Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

[SOLVED] How to disable screen rotation on condition



  • For example there is few QML pages, how to enable/disable screen rotation on specific page?


  • Moderators

    Hi,

    How do you do screen rotation ?



  • Hi, i mean changing screen orientation on rotation of Android device, its changes automatically.


  • Moderators

    I think it will require using QAndroidJniObject and calling the native api as the screen rotation is handled by OS.



  • In AndroidManifest.xml you have option, on which all orientation does the app have to work on.

    When you check You can see similar like,

    <activity
    android:name="com.android"
    android:label="text"
    android:screenOrientation="portrait".
    ...
    </activity>



  • [quote author="p3c0" date="1416553159"]I think it will require using QAndroidJniObject and calling the native api as the screen rotation is handled by OS. [/quote]
    Yeah, thanks, i set it with JNI call of setRequestedOrientation.

    [quote author="mcm_qt" date="1416582887"] In AndroidManifest.xml you have option, on which all orientation does the app have to work on.

    When you check You can see similar like,

    <activity
    android:name="com.android"
    android:label="text"
    android:screenOrientation="portrait".
    ...
    </activity>[/quote]

    I know that orientation can be set in manifest, but that about how to change it at runtime.


Log in to reply