One can compile different code depending on the current Qt version:
#if QT_VERSION < 0x050000
.....
#else
.....
#endif
However, Qt4 and Qt5 have different macros for checking the operating system: Q_WS_WIN -> Q_OS_WIN
and Q_WS_X11 -> Q_OS_LINUX
, respectively. How to add #ifdef
macro for certain operating system?