Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.4.0 Alpha
Description
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.
Attachments
Issue Links
- relates to
-
QTBUG-38699 With Android, when phone is rotated, Screen.primaryOrientation and screen geometry change but not Screen.orientation
- Closed