Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Screen.orientation does not update on Android



  • The follow code to output screen orientation changes works on iOs but does not work on Android. I'm using Qt 5.12.4. I've tested on a number of different android tablets with the same result. The Screen.orientation value never changes from the original value. All works fine on iOs. Not sure if I'm doing something wrong or it's a Qt bug or something else.

    mport QtQuick 2.12
    import QtQuick.Window 2.12
    
    Window {
        visible: true
        width: 640
        height: 480
        color: "green"
        title: qsTr("Hello World")
        Screen.orientationUpdateMask: Qt.LandscapeOrientation | Qt.PortraitOrientation | Qt.InvertedLandscapeOrientation | Qt.InvertedPortraitOrientation
    
        Timer {
            interval: 1000
            repeat: true
            running: true
            onTriggered:  console.log(Screen.orientationUpdateMask, Screen.orientation)
        }
    }
    

Log in to reply