I have created an application with a screen resolution of 640 x 360 for the nokia n8. It includes a lot of flickables, labels, etc. I want it to run on the nokia e6 with a resolution of 640 x 480.
Up to now I have simply copied the the QML file and modified it for the new resolution but it’s getting a little tiresome to do it for each update. I want to know if there is any simple way I can get it to automatically fit the output to any screen resolution? Or if there is something else I can do to simplify my task. I would prefer not to use anchors because it makes it too complicated to design the QML file.
How about using
QApplication::desktop()->availableGeometry()to set the geometry of your application window?From the docs:
Addressing your comment below:
The
constinQDesktopWidget::availableGeometry() consttells you that you can be pretty sure that the function doesn’t alter anything. You’ll need to do the resizing yourself.Edit: The QML docs should give you the information you need to automatically change your application geometry. You could either change the geometry of the QML object from C++ or define your available screen geometry as a
Q_PROPERTYand access it from QML. I’d recommend the former, as hooking up to thesignalQDesktopWidget::workAreaResizedmight help you on mobile devices where your available geometery may change.