[SOLVED]Finding out CPU architecture programmatically using Qt?
-
Take a look at "Q_PROCESSOR_*":http://qt-project.org/doc/qt-5.0/qtcore/qtglobal.html#Q_PROCESSOR_X86
-
Class QSysInfo is what you need.
Note this can be tricky since not all members are defined in all platforms (a design error I think; they should return some kind of null value for all cases). In Python I used it this way:
@
from PyQt4.QtCore import QSysInfo
try:
junk = QSysInfo.WindowsVersion
self.osType = 'Win'
except: # that static var does not exist, so,
try:
junk = QSysInfo.MacintoshVersion
self.osType = 'Mac'
except: # that doesn't exist either, ergo:
self.osType = 'Linux'@
-
I'm actually afraid they aren't, but you should be able to simply add "qcompilerdetection.h":http://qt.gitorious.org/qt/qtbase/blobs/stable/src/corelib/global/qprocessordetection.h to your project, which will set Q_PROCESSOR_* (or just pick the required definitions from there).