Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Deactivate then reactivate the orientation change
Qt 6.11 is out! See what's new in the release blog

Deactivate then reactivate the orientation change

Scheduled Pinned Locked Moved Solved Mobile and Embedded
3 Posts 1 Posters 411 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    Francky033
    wrote on last edited by
    #1

    Hi !

    I would like my app to be in portrait mode while loading on Android and, once loaded, to be able to choose the orientation by rotating the mobile...

    How do I do this?

    Thanx!

    1 Reply Last reply
    0
    • F Offline
      F Offline
      Francky033
      wrote on last edited by
      #2

      is it possible to freeze the orientation of the mobile during a phase of the execution of an application ?

      Thanks !

      1 Reply Last reply
      0
      • F Offline
        F Offline
        Francky033
        wrote on last edited by Francky033
        #3

        I was finally able to solve my problem by using this function:

        void Basique::setScreenOrientation(int orientation)
        {
            QAndroidJniObject activity = QAndroidJniObject::callStaticObjectMethod("org/qtproject/qt5/android/QtNative", "activity", "()Landroid/app/Activity;");
        
            if ( activity.isValid() )
            {
                activity.callMethod<void>
                        ("setRequestedOrientation" // method name
                         , "(I)V" // signature
                         , orientation);
            }
        }
        

        If it can be useful for other people in the forum...

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved