It may help to call the matrix $X(X'X)^{-1}X'$ ,$\:$ "$H$" (for "hat", since it's usually called the 'hat-matrix', because it puts the hat on $y$): $\quad\hat{y}=Hy$.
Note that $H^2=H$ (expand it out, and cancel an adjacent pair of terms that is a matrix and its inverse).
Then $Q=I-H$ and $Q^2=(I-H)^2 = I^2 -HI - IH +H^2$. Using known results, simplify this down to $Q$.
Then note that in the page you copied, above the marked section it says "the rank of an idempotent matrix equals its trace (see below for a proof)" -- so look after that point for a proof of that fact. So now we know that rank(Q)=trace(Q).
Now you would want to relate X and Q. (If you don't see what to do there, you can always fall back on something like this)