Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QML screen rotation
Qt 6.11 is out! See what's new in the release blog

QML screen rotation

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 729 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    anderi1982
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    1

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved