Details
-
User Story
-
Resolution: Unresolved
-
P3: Somewhat important
-
6.2.0
-
None
Description
I was following a few discussions on dev forums and had to realize that is apparently not possible to lock orientation programmatically with Qt API. People developer they own "utils" for this. Do they or I miss something?
https://forum.qt.io/topic/126130/set-ios-device-orientation-programmatically-how/4
Another user posted this code:
#ifdef Q_OS_ANDROID // see https://falsinsoft.blogspot.com/2018/02/qml-change-android-screen-orientation.html // https://developer.android.com/reference/android/content/pm/ActivityInfo.html#SCREEN_ORIENTATION_SENSOR_LANDSCAPE == 6 // CREEN_ORIENTATION_SENSOR_LANDSCAPE == 0 bool ApplicationUI::setScreenOrientationLandscape() { QAndroidJniObject activity = QtAndroid::androidActivity(); if(activity.isValid()) { activity.callMethod<void>("setRequestedOrientation", "(I)V", 0); return true; } return false; } #endif #ifdef Q_OS_IOS void ApplicationUI::setLandscape() { // setLandscapeLeft IosUtil* mIosUtil = nullptr; mIosUtil = new IosUtil(this); mIosUtil->setLandscape(); } #endif
As a PM of iOS, I wish this simple feature should be available as API. Other takes?
Attachments
Issue Links
- relates to
-
QTBUG-83055 Simplify orientation APIs in Qt 6
- Reported