Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-48549

Screen's orientation not updated when rotating by 180° (in one movement) on Android

XMLWordPrintable

    • Android
    • d69e226e3 (dev), 954f2f5b3 (6.10), 37926c5d4 (6.9), ffc292ca7 (tqtc/lts-6.8)
    • 2025wk34s2QtforAndroid

      The screen orientation is correctly updated when the device is rotated by steps of 90°, but when it's rotated by 180° in one movement, the orientation is not updated.

      Here is a code that reproduce the issue :

      import QtQuick 2.5
      import QtQuick.Controls 1.4
      import QtQuick.Window 2.2
      
      ApplicationWindow {
          visible: true
          width: 640
          height: 480
      
          Component.onCompleted: {
              Screen.orientationUpdateMask = Qt.PrimaryOrientation |
                                             Qt.LandscapeOrientation |
                                             Qt.PortraitOrientation |
                                             Qt.InvertedLandscapeOrientation |
                                             Qt.InvertedPortraitOrientation;
          }
      
          Text {
              text: "orientation : " + orientationString(Screen.orientation)
              font.pointSize: 30
              anchors.centerIn: parent
          }
      
          function orientationString(orientation) {
              switch (orientation) {
              case Qt.PrimaryOrientation:
                  return "Primary";
              case Qt.LandscapeOrientation:
                  return "Landscape";
              case Qt.PortraitOrientation:
                  return "Portrait";
              case Qt.InvertedLandscapeOrientation:
                  return "Inverted Landscape";
              case Qt.InvertedPortraitOrientation:
                  return "Inverted Portrait";
              default:
                  return "Unknown";
              }
          }
      }
      

      Tested on Nexus 9 (Android 5) and Nexus 5 (Android 6 dev preview)

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            assam Assam Boudjelthia
            grecko Pierre-Yves Siret
            Veli-Pekka Heinonen Veli-Pekka Heinonen
            Votes:
            4 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes