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. Get screen orientation before any form created
Qt 6.11 is out! See what's new in the release blog

Get screen orientation before any form created

Scheduled Pinned Locked Moved Mobile and Embedded
5 Posts 2 Posters 4.1k 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.
  • V Offline
    V Offline
    vlad2048
    wrote on last edited by
    #1

    Hi All

    Is there any way to get current screen orientation before any form or widget created (i.e. in main.cpp after the "QApplication a(argc, argv);" line)? This is required because of the application behaves in a strange manner durring the start-up in this case: if a user clicked application icon in the portrait mode and turned the device into landscape mode, the application will still run in a portrait mode (I mean the widget sizes would be as in the portrait mode but the screen is in landscape mode, and as a result of incorrect application visualization, and this is until next orientation change).

    Thanks ahead

    1 Reply Last reply
    0
    • V Offline
      V Offline
      vlad2048
      wrote on last edited by
      #2

      Please also note that my application is running in full screen mode (showFullScreen() is called).

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

        One idea: you can get the "desktopWidget":http://doc.trolltech.com/4.7//qapplication.html#desktop for the application and check it's size....

        Certified Specialist & Qt Ambassador <a href="http://www.crochik.com">Maemo, Meego, Symbian, Playbook, RaspberryPi, Desktop... Qt everywhere!</a>

        1 Reply Last reply
        0
        • ? This user is from outside of this forum
          ? This user is from outside of this forum
          Guest
          wrote on last edited by
          #4

          You could also check if QOrientationReading is useful, but haven't used it myself

          1 Reply Last reply
          0
          • F Offline
            F Offline
            fcrochik
            wrote on last edited by
            #5

            Just thinking out loud:

            The orientation sensor will give you the physical orientation of the device. Depending on the device you may want to take other sensors into consideration. For example the auto-rotation on the n900 is disabled when the keyboard is open.

            I can't wait to experiment with it. I have used the dbus signals on the n900 to detect the device changing orientation but this would be The Qt way.

            Certified Specialist & Qt Ambassador <a href="http://www.crochik.com">Maemo, Meego, Symbian, Playbook, RaspberryPi, Desktop... Qt everywhere!</a>

            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