$U^+$ denotes the Moore-Penrose inverse of $U$. Let $Y=XS$. Then Part 1: $QY=Z$; if $QQ^+Z\not= Z$, then no solutions. Otherwise $Y=Q^+Z+(I-Q^+Q)W$ where $W$ is an arbitrary $m\times n$ matrix.
Part 2. One has $Y=XS$. If $YS^+S\not= Y$, then no solutions. Otherwise $X=YS^++V(I-SS^+)$, where $V$ is an arbitrary $m\times n$ matrix.
EDIT. Answer to m0_as. We can also write the equation $(Q\otimes S^T)X=Z$ where we stack the matrix row by row. cf. https://en.wikipedia.org/wiki/Kronecker_product
In the same way as above, using $(Q\otimes S^T)^+$, we can solve the equation.
Remark 1. $rank(Q\otimes S^T)=rank(Q)rank(S)$.
Remark 2. If your matrices are parametric, then make this clear in your question. It is more difficult. Use a formal calculation.