Get screen orientation before any form created
-
Hi All
Is there any way to get current screen orientation before any form or widget created (i.e. in main.cpp after the "QApplication a(argc, argv);" line)? This is required because of the application behaves in a strange manner durring the start-up in this case: if a user clicked application icon in the portrait mode and turned the device into landscape mode, the application will still run in a portrait mode (I mean the widget sizes would be as in the portrait mode but the screen is in landscape mode, and as a result of incorrect application visualization, and this is until next orientation change).
Thanks ahead
-
One idea: you can get the "desktopWidget":http://doc.trolltech.com/4.7//qapplication.html#desktop for the application and check it's size....
-
Just thinking out loud:
The orientation sensor will give you the physical orientation of the device. Depending on the device you may want to take other sensors into consideration. For example the auto-rotation on the n900 is disabled when the keyboard is open.
I can't wait to experiment with it. I have used the dbus signals on the n900 to detect the device changing orientation but this would be The Qt way.