09-28-2012 11:18 AM
I ran into another problem while porting a QtQuick app. It is a screen orientation lock and resize.
When the application start first after built, it runs normal as expected but for the after tries it will behave unexpectedly.
For example, when I tried to make the phone portrait and start the application, its view will open in portrait and stretched, and when I tried to make the phone landscape again and restarting the application, it stretched also to the
half screen, the view is messed up. several items put on the qml are messed also.
I observed the problem caused by these lines of code. I already commented the second line, which improves the result close to my expectation but I'm still unable lock the qml view orientation. Any suggestion?
view.setAttribute(Qt::WA_LockLandscapeOrientation,true);
view.setResizeMode(QDeclarativeView::SizeRootObjec tToView);view.showMaximized();
Solved! Go to Solution.
10-01-2012 02:41 AM
Qt::WA_LockLandScapeOrientation is not yet supported for Blackberry devices.
Instead, you can add something like the following to your bar-descriptor XML file:
<initialWindow>
<autoOrients>false</autoOrients>
<aspectRatio>landscape</aspectRatio>
</initialWindow>About the other problem: Could you post a minimal testcase of this, please? Then we (KDAB) can have a look.
10-01-2012 11:08 AM - edited 10-01-2012 11:10 AM
Yes, I had put this one before:
<initialWindow>
<autoOrients>false</autoOrients>
<aspectRatio>landscape</aspectRatio>
</initialWindow>
I haven't experienced the problem before b3 bb10 software.
Test case:
1. Create an image area contains of couple image area and component, for example:
https://gist.github.com/84889e651d3d2c91560c
2. Build it
3. Run it
4. Looks normal, looking good, no problem
5. Close it.
6. Stand the device vertically, screen front facing
7. run it again
8. It will stretched unexpectedly
9. Close it again, stand the device horizontally, screen front facing
10. run it again
11. It stretched vertically (it doesn't always happen, sometimes it will load the application just like (8), or stretched half screen with the half other is a white one (background color) )
11. Sometimes it gets normal again, and screwed up for next tries.
12. Expected result, it should be looks nice and crisp (this is the look that I get after build or when the application becomes normal again sometimes)
Thanks!
10-02-2012 02:42 AM
Thanks for the testcase, I'll have a look as soon as I get to it (have to work through a pile of other bugs in my backlog first)
10-04-2012 03:38 AM
While looking at https://gist.github.com/84889e651d3d2c91560c, I noticed some conflicting positioners. For example the "logo" image has both "x" and "anchors.left" set. These conflict, you can either use absolute positioning or anchor-based positioning, but noth both at the same time. Or rather, you can combine both, but they can not both define the same layouting attribute. In this case, "x" and "anchors.left" define the same layouting attribute, namely the leftmost position of the element. Combining "anchors.top" and "x" on the other hand would be fine, as they define different layouting attributes, the topmost and the leftmost position.
Same for the "menu" element btw, "anchors.fill" and "x", "y" conflict.
I don't know what QtQuick does in case of these conflicts, and it is probably unrelated to the bug you're seeing, but I thought I'd mention it so you can create cleaner and more bug-free QML code.
10-04-2012 04:14 AM
I can not reproduce the problem.
I created a simple QML file with 2 images, and then launched the application a few times, alternating between horizontal and vertical orientation of the device. I didn't see any stretching yet.
I've uploaded the testcase I used to http://www.kdab.com/~thomas/stuff/qtquick-stretch-
I need a minimal testcase that reproduces the bug to be able to do something about it.
10-04-2012 05:18 AM
10-04-2012 07:57 AM
@mcguire, i'll try it shortly..
@fbumberger, I already did, change to showFullScreen() didn't change the result..
10-04-2012 08:41 AM
Btw, we are fixing WA_LockLandscape at the moment, see https://codereview.qt-project.org/#change,36296.
10-04-2012 11:00 AM - edited 10-04-2012 01:41 PM
Hi I put the implementation on my main cpp like this:
#ifdef Q_OS_BLACKBERRY navigator_set_orientation_mode(NAVIGATOR_LANDSCAPE, 0); navigator_rotation_lock(true); #else view.setAttribute(Qt::WA_NoSystemBackground); view.setAttribute(Qt::WA_AutoOrientation, false); view.setAttribute(Qt::WA_LockLandscapeOrientation, true); #endif view.setResizeMode(QDeclarativeView::SizeRootObjec tToView); view.showFullScreen();
It is still not able to lock on landscape mode when it ran in which device held vertically or when it ran horizontally an then hold the device vertically (it rotated to portrait mode and all element fitted to the screen, all showed but skewed/slimmed).
However, I noticed an improvement when changing autoorients value in bar descriptor to true:
> It is more consistent. When the device held in landscape, all elements are in the normal position. It doesn't stretched unexpectedly like before (showed on picture above), when the device held in portrait (rotated counter clockwise), all elements rotated clockwise. The only thing left is to block its rotation to portrait.
nb: I'm using 'fillMode: Image.Stretch' which is not in your test case.