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. Fix orientation of mobile application
Qt 6.11 is out! See what's new in the release blog

Fix orientation of mobile application

Scheduled Pinned Locked Moved Mobile and Embedded
4 Posts 2 Posters 2.4k Views 1 Watching
  • 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.
  • T Offline
    T Offline
    Tsweti
    wrote on last edited by
    #1

    I want to lock the orientation of the mobile application ( android and ios ) that i'm developing in portrait mode for some of the pages that i'm showing even if the Screen Rotation option of the device is enabled. In other words - I want to rotate the device and the application to stay unchanged. I'm talking about qml application. I looked at the OrientationSensor from QtSensors but I couldn't find the right way to use it.

    Is what i'm trying to do possible? And how can I do it?

    1 Reply Last reply
    0
    • p3c0P Offline
      p3c0P Offline
      p3c0
      Moderators
      wrote on last edited by
      #2

      Hi,
      I have not done for ios app but for Android application you need to modify the AndriodManifest.xml and put this in the activity tag,
      @
      android:screenOrientation="landscape" //or portrait
      @
      also set the permission
      @
      <uses-permission android:name="android.permission.SET_ORIENTATION"/>
      @

      157

      1 Reply Last reply
      0
      • T Offline
        T Offline
        Tsweti
        wrote on last edited by
        #3

        If I do this it will affect the whole application, right? I want to affect only some pages from it.

        1 Reply Last reply
        0
        • p3c0P Offline
          p3c0P Offline
          p3c0
          Moderators
          wrote on last edited by
          #4

          Right. Well then i guess you need to set the orientation from the java api's.
          May be Qt's Android extras will provide an easier way to do it.

          157

          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