4. Let $a, b$ be two perpendicular unit vectors. Given $\overrightarrow{O P}=a, \overrightarrow{O Q}=b, \overrightarrow{O R}=r a+k b$. If $\triangle P Q R$ is an equilateral triangle, then the values of $k, r$ are ( ).
(A) $k=r=\frac{-1 \pm \sqrt{3}}{2}$
(B) $k=\frac{-1 \pm \sqrt{3}}{2}, r=\frac{1 \pm \sqrt{3}}{2}$
(C) $k=r=\frac{1 \pm \sqrt{3}}{2}$
(D) $k=\frac{1 \pm \sqrt{3}}{2}, r=\frac{-1 \pm \sqrt{3}}{2}$
4. C.

Notice
$$
\begin{array}{l}
|P Q|=|Q R|=|P R| \\
\Rightarrow \sqrt{r^{2}+(k-1)^{2}}=\sqrt{(r-1)^{2}+k^{2}}=\sqrt{2} \\
\Rightarrow r=k=\frac{1 \pm \sqrt{3}}{2} .
\end{array}
$$