Replace Q_WS_WIN with appropriate guards to account for Qt5.

This commit replaces almost all occurrences of Q_WS_WIN to comply
with Qt5. The remaining occurrences should *not* be replaced,
because the guarded code won't compile on Qt5.