I know that this has been posted before. I would like to know whether my argument is correct or not. I am presenting a new argument, so this question shouldn't be marked as duplicate.
Suppose that $Q \cong H \times K$ such that neither H or K is trivial. This is achieved through isomorphism $\psi : H \times K \rightarrow \mathbb{Q}$. I claim that kernel $\psi = H\times \{0\}$. That is, if we assume that H is non-trivial.
Proof
$$\small\frac{p_{(h,k)}}{q_{(h,k)}} = \psi((h,k) = \psi( (h,0) + (0,k) ) = \psi((h,0)) + \psi((0,k)) = \frac{p_{(h,0)}}{q_{(h,0)}} + \frac{p_{(0,k)}}{q_{(0,k)}} = \frac{p_{(h,0)}q_{(0,k)} + p_{(0,k)}q_{(h,0)}} {q_{(h,0)}q_{(0,k)}} = 0$$
$p_{(h,k)} = p_{(h,0)}q_{(0,k)} + p_{(0,k)}q_{(h,0)} = 0$. This gives us $p_{(h,0)}q_{(0,k)} = -p_{(0,k)}q_{(h,0)}$. We can choose k such that $p_{(0,k)} = 0$. Therefore $p_{(h,0)}q_{(0,k)} = 0$ implies that $p_{(h,0)} = 0$. Therefore $H\times \{0\} \subset \operatorname{ker}(\psi)$ giving us a contradiction that $\psi$ is an isomorphism.