Resize mobile QML app

192 views Asked by At

I'm working on a program to run Harmattan (N9) apps on Fremantle (N900). One of the problems is the resolution difference.

N900 has 800x480 screen and N9 854x480. Because of this part of the screen is cut off.

Can I fool (something) so that it thinks that the 800px screen contains 854px and paints all the elements (all the elements are painted as if 854px were availabe). I know that the shapes will be unnatural due to resizing one dimension, but it's better than a cut-off layout.

This has to be done without recompilation, as I can't access source code of every application for N9. I can't edit the qml files as they're built-in into qrc

Thanks in advance

marmistrz

1

There are 1 answers

1
air-dex On

If you code for different sizes of screens, you had better not use the raw values of screen dimensions. What you can do is saying that "this item with fill pw% of the width and ph% of the height". It will be automatically resized with the property binding. In your QML code, you can write something like this :

MyItem {
    id: my_item
    width: (pw / 100) * screen_width
    height: (ph / 100) * screen_height
    // ...
}