09-19-2012 01:51 PM
Sorry, another Blackberry/Qt issue...
Is there some way for a Qt application to get notified when the screen is rotated? At present, it seems that you have to create a QMainWindow (or whatever top-level widget) with a fixed size -- you can't (so far as I can tell) create a widget that snaps to the screen size. So presumably you have to deal with screen rotation in the application. But how?
Solved! Go to Solution.
09-19-2012 04:16 PM
09-20-2012 03:31 AM
Now I'm completely confused. If you set a fixed size of 1024x600, and the window still fills the screen when you rotate, then presumably Qt is overriding your size settings? I mean, in portrait orientation it's 600x1024, no?
When set a widget size of 1024x600 (i.e., widget.resize(1024,600)), then when I rotate into portrait my widget only fills the top part of the screen, but the bottom part is black and empty. That is, it's keeping the size of 1024x600, which no longer fits the screen.
I tried not calling resize() at all, hoping that the system would somehow scale the main window so that it fills the screen; but it doesn't -- it has a default size of about 5 cm square.
I wonder if different releases of Qt behave differently in this respect? Or is there something specific you have to have in the descriptor XML to get reorientation to work?
09-20-2012 03:40 AM - edited 09-20-2012 03:41 AM
In my bar descriptor I have
In mainwidget.ui (I use standard desktop oriented ui components)
<?xml version="1.0" encoding="UTF-8"?>
<widget class="QWidget" name="MainWidget">
09-20-2012 03:48 AM
You're a star !
It's the 'showMaximzed()' that does it. After that, the main widget will always fit the screen shape. I don't actually need to set an initial size (but from your code, clearly it doesn't hurt to).
Thanks. I can't tell you how much time you saved me