PDA

View Full Version : How know if Qt is running on a Desktop



hubbobubbo
28th April 2010, 14:38
Hi

I wonder if there is a compiler switch to know if Qt is Qt is running in a Desktop environment like Win32, OS-X etc. I am developing an app that should run on Win32 / Windows Mobile and Symbian and in some scenarios I want to do showMaximized on a QDialog when in Windows Mobile or Symbian but not when the application is running on Win32. The rest of the code will be the same for all platforms, only how my derived QDialog is shown

totem
28th April 2010, 14:48
If you compile your app for those systems you probably have environment variables like _WIN32 to make the difference at compile time. Now, you could use it like this :


QDialog myDialog ;

#ifndef _WIN32
myDialog.showMaximized() ;
#else
myDialog.show() ;
#endif

hubbobubbo
28th April 2010, 15:54
Thanks this is all great, I just wondered if there is a way to not limit it to Windows incase I want to move to Mac in the future this will not work all the way or do I have to use a combination of platform specific switches.

squidge
28th April 2010, 16:07
It'll be a combination of platform specific switches.