QML screen rotation
Unsolved
QML and Qt Quick
-
Can one show a simple example that would have the same behavior as QT_QPA_EGLFS_ROTATION=270 which works perfectly for me for widget based applications but instead in QML?
I'm running a Raspberry PI 4B with the 800x480 7 inch touchscreen.
I have this:
import QtQuick 2.7 import QtQuick.Controls 2.12 import QtQuick.Window 2.2 ApplicationWindow { visible: true Item { anchors.fill: parent transform: Rotation { angle: 270 origin.x: Screen.width/2 origin.y: Screen.height/2 } Rectangle { anchors.centerIn: parent width: 480 height: 800 Image { sourceSize.width: parent.width sourceSize.height: parent.height source: "./images/background.png" fillMode: Image.PreserveAspectCrop } Rectangle { anchors.fill: parent color: "transparent" Text { text: "Hello world" font.pixelSize: 48 color: "white" } } } }
Which seem to work, but I dont understand why I cant use anchors.fill: parent in the top Rectangle for example, and also why I need to set the size explicitly. This makes me feel it's not the optimal way since QT_QPA_EGLFS_ROTATION seem to do all the proper stuff (unless running qml...)
Best regards,
Andreas