Solved Get current CPU architecture in Qt 4.7, and hide mouse cursor on ARM
-
Hello,
For my project i need two builds (one for x86 architecutre , one for ARM architecure) , i am using qt 4.7
and i need to hide cursor mouse on ARM architecture:
I added this part of code to my program:
QWSServer *server = QWSServer::instance(); if(server) { server->setCursorVisible(false); }
This seems to work normally without any problem on ARM, but in x86 the program won't build cause QWSServer is not built with my qt4 Desktop,
Is there anyway to getCpu Information in sourceFile?
I saw that this can be achieved in Qt 5 with this getter:
QSysInfo::currentCpuArchitecture()
but i don't know if there is an equivalent in qt4
if this will be possible i want to do this:
if(QSysInfo::currentCpuArchitecture() == "arm") #define armBuild #ifdef armBuild QWSServer *server = QWSServer::instance(); if(server) { server->setCursorVisible(false); } #endif
Or is there any other way to to hide cursor mouse only for ARM build?
Thank you for your help !
-
Solved:
with
#ifdef __arm__
i wrote this code :
#ifdef __arm__ QWSServer *server = QWSServer::instance(); if(server) { server->setCursorVisible(false); } #endif
Sorry for my question !
-
Hi,
You should rather use
#ifdef Q_WS_QWS
. This way you're not dependent on the architecture of the processor either.The fact that you are currently building for ARM is an implementation detail. You could be building your application for MIPS in a few months or even x86 and your current check would have to be modified. With
Q_WS_QWS
you're testing that you are building against an embedded build of Qt4 whatever the underlying platform is. -
@SGaist thank you for explanation but when i use #ifdef Q_WS_QWS_ , like this :
#ifdef Q_WS_QWS_
QWSServer *server = QWSServer::instance();
if(server) {
server->setCursorVisible(false);
}
#endifthe mouse cursor still appear in ARM
Is there something i am mading wrong?
-
Oh it was just a writing mistake
#ifdef Q_WS_QWS_ instead of #ifdef Q_WS_QWS , now it work
@SGaist Thank you again