All my QML applications won't get rotated properly on Android
-
Hi there,
I've been developing a lot of small applications lately in QML to learn it & get used to its syntax.
It's working properly on Desktop, but on Android I have a rotation-issue.
When the application is launched while the device is in landscape or portrait mode it's rendered perfectly! But when the device is rotated, it get's messed like if it isn't re-rendering. Check screenshots:
The 1st screenshot: ( When the application is launched while in landscape mode ).
The 2nd screenshot: ( When rotating the device while the app is up & running after it was launched in landscape mode ).
The 3rd screenshot: ( When the application is launched in portrait mode ).
The 4th screenshot: ( When device gets rotated & the app was launched in portrait mode from beginning ).
[ "Click here to view in full size":http://store1.up-00.com/2014-07/1406287874491.png ]
!http://www.up-00.com/thumbs/1406287874491.png(When the application is launched while in landscape mode)![ "Click here to view in full size":http://store1.up-00.com/2014-07/140628787482.png ]
!http://www.up-00.com/thumbs/140628787482.png(When rotating the device while the app is up & running after it was launched in landscape mode)![ "Click here to view in full size":http://store1.up-00.com/2014-07/1406287875033.png ]
!http://www.up-00.com/thumbs/1406287875033.png(When the application is launched in portrait mode)![ "Click here to view in full size":http://store1.up-00.com/2014-07/1406287875314.png ]
!http://www.up-00.com/thumbs/1406287875314.png(When device gets rotated & the app was launched in portrait mode from beginning)!I'm using an ApplicationWindow as my root item in my QML file ( if it matters ):
@ApplicationWindow {
visible: true
width: 640
height: 480
title: qsTr("Hello World")
}@.. So, what's the problem?
-
bq. width: 640
height: 480I think that is the hardcoded width/height.
-
[quote author="gabrieltb" date="1406299078"]bq. width: 640
height: 480I think that is the hardcoded width/height.[/quote]
It should be hardcoded or it won't appear at all.
But the weird thing is that it's rendered correctly at initial launch, problem occurs after rotation. -
I apologize for my lazy answer. What I meant is that you can try using relative values for width and height.
@width: Screen.width
height: Screen.height@Also, take a look "here":http://qt-project.org/doc/qt-5/scalability.html
You'll find a section talking about screen orientation. -
[quote author="gabrieltb" date="1406310520"]I apologize for my lazy answer. What I meant is that you can try using relative values for width and height.
@width: Screen.width
height: Screen.height@Also, take a look "here":http://qt-project.org/doc/qt-5/scalability.html
You'll find a section talking about screen orientation.[/quote]
Worked!Thank you so much budd :)