IPad orientation changes in qml



  • Hi all,

    I am developing an iPad application with QML. I would like to detect the change of orientation of the iPad,
    so that I can do different things on Portrait and Landscape. Which is the best way?

    Until now I have a Rectangle item inside which I have used a sensor like this:

    @Sensors.OrientationSensor {
    id: sensor

    active: true
    
    onReadingChanged: {
        if ( reading.orientation == Sensors.OrientationReading.TopUp ) {
            orientation = "Portrait";      
        }
        else if ( reading.orientation == Sensors.OrientationReading.LeftUp ) {
            orientation = "Landscape";
        }
    }
    

    }@

    however the sensor reading changes before the screen-content orientation is complete.
    Is there a way to detect when orientation change is complete?

    Any help about the use of Screen.orientation?

    Any help?

    Thanx,
    Cochleas



  • Hmm, try out to handle change signals on width or height of your ApplicationWindow. I would think the orientation is finished if the width or height is changed.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.