Application Portrait and Landscape mode (Horizontal/Vertical rotation)
-
Hi,
I would like to add option to rotate my application between Portait and Landscape mode. (Linux handheld device).
I tried nesting Item inside main ApplicationWindow, with custom rotate flag swap width/height and set item rotation 0/90.
Problem is - that lots of internal components rely on anchors and are placed in app corner. After above rotation, component from bottomLeft is now in bottomRight and is on side.
I would like to avoid tedious process of exposing flag to all components and usage of condition expressions to decide how to place them. -
Hi,
I would like to add option to rotate my application between Portait and Landscape mode. (Linux handheld device).
I tried nesting Item inside main ApplicationWindow, with custom rotate flag swap width/height and set item rotation 0/90.
Problem is - that lots of internal components rely on anchors and are placed in app corner. After above rotation, component from bottomLeft is now in bottomRight and is on side.
I would like to avoid tedious process of exposing flag to all components and usage of condition expressions to decide how to place them.@SebastianM
The "default" provided QML components listen to Window.contentOrientation property - like Popups on the Overlay -
Help me understand.
Screen.orientation is OS information about current display orientation (if HW uses accelerometer or user manual change orientation).
Window.contentOrientation applicaton changes to notify OS display server/windows manager how it describe it's own orientation.In both situation, if my App placed Rectangle in bottomLeft and device has been rotated. Rectangle will be rotated (lying on side) on and in new corner.
Is is possible for app to treat anchors.top the same despite orientation change? I mean - in Vertical Top is this what Right was in Horizontal?I don't like idea to use rotation/orientation flag in all places where position is set. Or create two separate layouts changed with orientation.
-
It's commercial project on EGLFS without built-in orientation. Yocto will handle system setup.
For now I'm starting to getting used to idea of two separate layouts. -
It's commercial project on EGLFS without built-in orientation. Yocto will handle system setup.
For now I'm starting to getting used to idea of two separate layouts.@SebastianM
i think i dont understand your problem.I tried nesting Item inside main ApplicationWindow, with custom rotate flag swap width/height and set item rotation 0/90.
when you do this, all anchors are also translated. means bottom-left of horizontal will also be bottom-left in vertical when the device is rotated.
Problem is - that lots of internal components rely on anchors and are placed in app corner. After above rotation, component from bottomLeft is now in bottomRight and is on side.
can you please show how you are placing those elements
-
I didn't add
anchors.centerIn: parent
in content Item (which is rotated and is changing size). In result, after rotation Item was placed in completely crazy place.