All eigenvalues of $Q$ must be either $i$ or $-i$. Furthermore, $Q$ must be diagonalizable (because the square of non-diagonalizable invertible matrices can be shown to be non-diagonalizable, but $A$ is diagonalizable). If we allow complex numbers, all matrices which are similar to a diagonal matrix $D$ with $i$ and $-i$ as diagonal elements (i.e. all matrices $RDR^{-1}$ with an invertible $R$) can be chosen as $Q$.
If we allow only real numbers in $Q$, then the eigenvalues of $Q$ must show up as conjugate pairs, i.e. $Q$ has the eigenvalue $i$ with multiplicity $2$ and the eigenvalue $-i$ with multiplicity $2$. Each real matrix, which is diagonalizable in $\mathbb{C}$ and has this configuration of eigenvalues, is similar to $$B = \left(\begin{array}{cccc} 0 & -1 & 0 & 0 \\ 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & -1 \\ 0 & 0 & 1 & 0 \end{array}\right)$$ which means that each real $Q$ can be written as $RBR^{-1}$ with an invertible matrix $R$.