Set orientation on embedded device
-
I have a C++ application that uses QML for user interface on an embedded device. The embedded device has a 320x240 screen but it's rotated (so it's in portrait mode). I developer and run the application on a normal pc. All the images I made in portrait mode.
I have defined my main qml as follows:
@
Item {
width: 240
height: 320BorderImage { source: "someimage.png" }
}
@When I run this on a pc, no problem. When I run this on my embedded device the picture is shown rotated on the up right side of my display.
To get the picture shown correctly on my embedded device I use the transform option:
@
transform: Rotation { id: windowOri; origin.x: 100; origin.y: 140; angle: 270}
@This works for the main page but other (non-fullscreen) windows that are shown on top of the main window are not shown correctly and I need to set the positions "manually":
@
PropertyChanges { target: messageWindow; x: 15; y: 70 }
@I am not convinced this is the correct way to set the orientation. I have found many examples but all of them are symbian / meegoo related. I am also not sure if the Rotation option is causing a performance issue...
Anyone have some suggestions?
-
The flickr and calculator demos in Qt 4.7 give an example of handling rotation purely from QML; if you haven't seen them already they might be worth a look.
Rotating the entire QML scene will generally have some performance impact. If possible, you may want to look at handling the rotation lower in the stack (e.g. so Qt sees a 240x320 screen geometry).
Regards,
Michael -
Thanks mbrasser. I have looked at the calculator example and I see that they also use the transform option. The difference is that they "draw" all there qml user interface components while I use images (png files) to show my components. I am not sure if the transform option is efficient for rotating pictures.
Can you please explain what you mean by this:
If possible, you may want to look at handling the rotation lower in the stack (e.g. so Qt sees a 240×320 screen geometry).
-
hi bkamps,
Can you get it's(the device) orientation?I think mbrasser means you can try to handle the rotation in a lower API, which may not the Qt staff. But meanwhile, if you can get the orientation, you can try rotate QML scene to see it's performance.
Br,
Chuck -
You mean rotate the pictures myself (using a imageeditor) instead of using Rotation? I notice that when I don't rotate on the target the drawing of windows is a lot quicker. Ofcourse I only see a part of the window (because the display is landscape and all my windows/pictures are portrait).
-
[quote author="bkamps" date="1340865823"]Can you please explain what you mean by this:
If possible, you may want to look at handling the rotation lower in the stack (e.g. so Qt sees a 240×320 screen geometry).
[/quote]Sure, I was thinking of, for example, the transformed display driver available for QWS ( http://doc.qt.nokia.com/4.7-snapshot/qt-embedded-displaymanagement.html ).
In terms of your QML scene, are you saying the entire UI is a single Image? Or just that it is composed of many Images (rather than Rectangles, Text, etc)?
Regards,
Michael -
[quote author="mbrasser" date="1340930133"][quote author="bkamps" date="1340865823"]Can you please explain what you mean by this: > If possible, you may want to look at handling the rotation lower in the stack (e.g. so Qt sees a 240×320 screen geometry). [/quote] Sure, I was thinking of, for example, the transformed display driver available for QWS ( http://doc.qt.nokia.com/4.7-snapshot/qt-embedded-displaymanagement.html ). In terms of your QML scene, are you saying the entire UI is a single Image? Or just that it is composed of many Images (rather than Rectangles, Text, etc)? Regards, Michael [/quote]
The applications consists of multiple images, but also Rectangles and Text..
-
[quote author="bkamps" date="1340947047"]The applications consists of multiple images, but also Rectangles and Text..[/quote]
I would expect the QML transform to have a performance impact -- from memory QPainter has a number of optimizations that can't be applied when more complex transforms are present. You could try running with the QML_SHOW_FRAMERATE environment variable set to see what sort of performance you get for rotated vs. non-rotated.
Regards,
Michael