Reputation: 5335
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?
Upvotes: 3
Views: 1785
Reputation: 7017
You do not need to use QT_VERSION
, you can check both versions like this:
#if defined(Q_WS_WIN) || defined(Q_OS_WIN)
// Windows...
#elif defined(Q_WS_X11) || defined(Q_OS_LINUX)
// Linux...
#endif
Upvotes: 2