Build Environment: QT 4.7
, OS X 10.6
Run Environment: OS X 10.6
through OS X 10.13
, Windows XP
and later
I'm working in a very large, highly graphics-intensive QT app. I need to find out what version of OS X
/ MacOS
I am running on - 10.6... 10.10... 10.12 etc.
I am looking for a c or c++ function in OS X I can call live; this is a runtime issue. It needs to work from 10.6 onwards. I am writing in c++ so I can use a c solution as conveniently as c++.
I have this:
#ifdef Q_OS_WIN
QApplication::setGraphicsSystem("raster");
#else
QApplication::setGraphicsSystem("native");
#endif
The above works to determine if it's windows or OS X I am building for. Inside the else
in the above fragment I need to do some further checking; I don't need the "native" graphics system except in OS X 10.12
, where the QT "raster" system has problems. I prefer the "raster" system because it is much faster, but later machines are faster too and so if I can only call for the "native" system on a modern machine running recent OS's, that should work out.
I have users - large numbers of them - running under earlier versions of OS X, consequently whatever is used here has to be general enough to work on all versions of the OS 10.6 and up. QT 4.7 itself seems to be clueless about OS versions it doesn't explicitly know about; using QSysInfo::MacVersion
, it just reports "Unknown OS version."
Ideally, I imagine something of the following form:
int v = majorOSRevision();
int r = minorOSRevision();
int s = stepOSRevision();
Are there such direct, simple calls within the OS X API?