A generalization of the stated problem from $Q$ a subfield of $C$ to arbitrary fields $F \subset E$ is resolved by means of the following
Proposition: Let $E$ and $F$ be fields with $F$ a subfield of $E$. Let $f(x), m(x) \in F[x]$ with $f(x) = q(x)m(x)$ in $E[x]$. Then in fact $q(x) \in F[x]$.
Proof: Let $f(x) = \sum_0^{\deg f} f_i x^i$, $m(x) = \sum_0^{\deg m} m_i x^i$, and $q(x) = \sum_0^{\deg q} q_i x^i$ with the $f_i, m_i \in F$ and the $q_i \in E$. Then since $f(x) = q(x)m(x)$, we have
$f_i = \sum_{j + k = i}q_j m_k \tag{7}$
with $j, k \ge 0$; this if you will is the definition of $q(x)m(x)$. Since $\deg f = \deg q + \deg m$, it follows that $f_{\deg f}$, the coefficient of the leading term of $f(x)$, satisfies
$f_{\deg f} = q_{\deg q} m_{\deg m}; \tag{8}$
this shows that the leading coefficient of $q(x)$, $q_{\deg q} = m_{\deg m}^{-1} f_{\deg f} \in F$. Next, we have that
$f_{\deg f - 1} = q_{\deg q - 1} m_{\deg m} + q_{\deg q} m_{\deg m - 1}, \tag{9}$
yielding
$q_{\deg q - 1} = m_{\deg m}^{-1}(f_{\deg f - 1} - q_{\deg q} m_{\deg m - 1}) \in F \tag{10}$
as well. Now (7) shows that
$f_{\deg f - l} = \sum_{j + k = \deg f - l}q_j m_k = m_{\deg m} q_{\deg f -l - \deg m} + \sum_{j + k = \deg f - l, k < \deg m} q_j m_k$
$= m_{\deg m} q_{\deg q -l} + \sum_{j + k = \deg f - l, k < \deg m} q_j m_k, \tag{11}$
for $0 \le l \le \deg q$, since $\deg q = \deg f - \deg m$. Scrutiny of (11) shows that (8) and (9) are respectively the $l = 0$ and $l = 1$ cases of this equation. Now suppose that $q_{\deg q}, q_{\deg q - 1}, . . ., q_{\deg q - r} \in F$ for some $r$ with $0 \le r < \deg q - 1$. Then by (11),
$f_{\deg f - r - 1} = m_{\deg m} q_{\deg q - r - 1} + \sum_{j + k = \deg f - r - 1, k < \deg m} q_j m_k, \tag{12}$
and since $k < \deg m$ in the summation on the right, it follows that $j > \deg f - \deg m -r - 1 = \deg q -r - 1$ for every coefficient $q_j$ appearing in this expression. If we now assume that each such $q_j \in F$, we may conclude that
$q_{\deg q - r - 1} \in F$ as well, since (12) yields
$q_{\deg q - r - 1} = m_{\deg m}^{-1}(f_{\deg f - r - 1} - \sum_{j + k = \deg f - r - 1, k < \deg m} q_j m_k), \tag{13}$
and every coefficient appearing on the right of (13) is in $F$. Thus we have completed an inductive demonstration that $q(x) \in F[x]$. END: Proof of Proposition.
If we apply this proposition to the problem at hand, taking $E = C$, $F = Q$, $m(x) = g(x)$ and $q(x) = h(x)$, it follows immediately that $h(x) \in Q[x]$. QED!!!
Hope this helps! Happy New Year,
and as always,
Fiat Lux!!!