Rotate coordinates of display?
-
I have an app I would like to test in full screen with a resolution of 1920x1080. I would also like to test the orientation of the display as if the display is 1080x1920. I tried using the Page component to rotate (rotation: -90), but it does not swap the underlying coordinates of the Components inside of it. It just rotates all the components, but the top level component inside the Page still sees the area as 1920x1080. Is there a way to rotate the entire app such that the width and height get swapped as well?
-
I tried virtualizing the width and height and it sorta works:
property int r_width: pagerot.rotation == 0 ? width : height property int r_height: pagerot.rotation == 0 ? height : width
But the origin of where it starts drawing does not seem to be the corner where I would expect it to be. It would also cause the mouse to be wrong when testing. I am just going to rely on the operating system to rotate my screen for testing. This trying to trick qml to do it is folly.
-
Hi @fcarney , just to add, i guess the simplest way you can do is to deploy a simple android app, with auto-rotate enabled on your phone. So when you rotate your phone the height and width get swapped.
I just tried a sample app with 2 Rectangles inside a ColumnLayout and Rectangles consisting of a text which prints the Screen.height and Screen.width
ColumnLayout { anchors.fill: parent Rectangle { Layout.fillHeight: true Layout.fillWidth: true color: "red" Text { text: Screen.height anchors.centerIn: parent } } Rectangle { Layout.fillHeight: true Layout.fillWidth: true color: "green" Text { text: Screen.width anchors.centerIn: parent } } }
Portrait Mode:-
Landscape Mode:-
Here the red rectangle prints the height and green rectangle prints the width, so you can see from the above images when rotate your phone the height and the width get swapped.