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

Android: Implement full orientation API



    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.4.0 Alpha
    • Sensors
    • Android


      Currently, on Android, we update Screen.primaryOrientation correctly, and we set Screen.orientation to match it if the update mask is set to report orientation changes. Which means they are both currently based on the ratio width/height of the window.

      However, this is not how that API is designed. The Screen.orientation property should give you an idea about how the device is oriented regardless of which way the window is oriented. The specific use case for this is if you want to do the transitions between landscape and portrait yourself. In that case, you have to lock to a specific orientation in the manifest but still have a way to detect which way the device is held. It's possible to achieve this using the more expressive APIs in Qt Sensors, but since Screen.orientation is supported on other platforms, we should have an implementation for Android as well.

      To support this use case, we also need to implement reportContentOrientationChange(), which the user can call to tell Qt that the contents have been rotated independently. The UIs of the OS should in this case also be adjusted to match the content orientation instead of the window orientation. This of course depends on whether Android has such an API. It is useful when the user wants to disable automatic orientation changes in the OS and do it manually based on the accelerometer instead, so that they can have their own transitions on the content when the orientation changes.


        Issue Links

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



              lpotter Lorn Potter
              esabraha Eskil Abrahamsen Blomfeldt
              Veli-Pekka Heinonen Veli-Pekka Heinonen
              2 Vote for this issue
              6 Start watching this issue



                Gerrit Reviews

                  There are no open Gerrit changes