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. How to tilt the window by 90 degree?
Forum Updated to NodeBB v4.3 + New Features

How to tilt the window by 90 degree?

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
13 Posts 3 Posters 3.2k 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.
  • sierdzioS sierdzio

    Yes Qt will automatically rotate the apps together with the screen. This can be controlled through content orientation and other similar properties.

    S Offline
    S Offline
    Sriu1
    wrote on last edited by
    #3

    @sierdzio Hi ,Thanks for the reply.Can you send me a code snippet?I did not find any examples for it.

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #4

      You don't need to code anything. Qt will rotate together with your device by default.

      If you want to force rotation, then this may work (untested):

      QWindow window; // your application's window
      window.reportContentOrientationChange(Qt::LandscapeOrientation);
      

      Although quite frankly I suspect this will fail. Most probably some platform-specific calls are necessary here, to force the rotation of the whole screen.

      (Z(:^

      S 1 Reply Last reply
      0
      • sierdzioS sierdzio

        You don't need to code anything. Qt will rotate together with your device by default.

        If you want to force rotation, then this may work (untested):

        QWindow window; // your application's window
        window.reportContentOrientationChange(Qt::LandscapeOrientation);
        

        Although quite frankly I suspect this will fail. Most probably some platform-specific calls are necessary here, to force the rotation of the whole screen.

        S Offline
        S Offline
        Sriu1
        wrote on last edited by
        #5

        @sierdzio what is the header file to be included?

        1 Reply Last reply
        0
        • S Sriu1

          I am creating a QComboBox object in the ui for "Landscape" and "Portrait" mode.How to tilt the ui window?Does Qt support this?

          J.HilkJ Online
          J.HilkJ Online
          J.Hilk
          Moderators
          wrote on last edited by
          #6

          @Sriu1
          I'm still not quite clear, on what you want to do.

          • First of, do you do this in QWidgets or in QML?
          • Do you want to detect the current orientation so you can load the different objects?
          • Do you want to force the orientation of your device?
          • Do you simply want to rotate your object around

          Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


          Q: What's that?
          A: It's blue light.
          Q: What does it do?
          A: It turns blue.

          S 1 Reply Last reply
          1
          • J.HilkJ J.Hilk

            @Sriu1
            I'm still not quite clear, on what you want to do.

            • First of, do you do this in QWidgets or in QML?
            • Do you want to detect the current orientation so you can load the different objects?
            • Do you want to force the orientation of your device?
            • Do you simply want to rotate your object around
            S Offline
            S Offline
            Sriu1
            wrote on last edited by
            #7

            @J.Hilk
            Hi,I am using QWidgets.I want to force the orientation of the application (when I come out of my application I should be in normal mode which is landscape).My screen resolution is 3840x2160.I want to Tilt the application of the qt gui by 90degree so that it can be in portrait mode.So that application works fine on a screen of resolution 2160x3840

            sierdzioS J.HilkJ 2 Replies Last reply
            0
            • S Sriu1

              @J.Hilk
              Hi,I am using QWidgets.I want to force the orientation of the application (when I come out of my application I should be in normal mode which is landscape).My screen resolution is 3840x2160.I want to Tilt the application of the qt gui by 90degree so that it can be in portrait mode.So that application works fine on a screen of resolution 2160x3840

              sierdzioS Offline
              sierdzioS Offline
              sierdzio
              Moderators
              wrote on last edited by
              #8

              @Sriu1 said in How to tilt the window by 90 degree?:

              So that application works fine on a screen of resolution 2160x3840

              I'm sorry but that just sounds like you want to resize the app window, not tilt it. Just open your app maximized/ fullscreen and it should work ok.

              (Z(:^

              1 Reply Last reply
              0
              • S Sriu1

                @J.Hilk
                Hi,I am using QWidgets.I want to force the orientation of the application (when I come out of my application I should be in normal mode which is landscape).My screen resolution is 3840x2160.I want to Tilt the application of the qt gui by 90degree so that it can be in portrait mode.So that application works fine on a screen of resolution 2160x3840

                J.HilkJ Online
                J.HilkJ Online
                J.Hilk
                Moderators
                wrote on last edited by J.Hilk
                #9

                @Sriu1 ok, that makes it a bit clearer,

                two more followup question than,

                • is your app to be supposed to stay in one orientation, or do you want to be able to change that by tilding your phone.
                • do you want something like the youtube up, where when you press full screen the orientation is locked to landscape and outside of that its lockied to portrait ?

                Forcing one orientation throughout the apps lifetime is very easy, making it change due to the gyro of the phone is the default behaviour forcing orientations during specific times of your app is dificult and requieres native code.


                Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                Q: What's that?
                A: It's blue light.
                Q: What does it do?
                A: It turns blue.

                S 1 Reply Last reply
                1
                • J.HilkJ J.Hilk

                  @Sriu1 ok, that makes it a bit clearer,

                  two more followup question than,

                  • is your app to be supposed to stay in one orientation, or do you want to be able to change that by tilding your phone.
                  • do you want something like the youtube up, where when you press full screen the orientation is locked to landscape and outside of that its lockied to portrait ?

                  Forcing one orientation throughout the apps lifetime is very easy, making it change due to the gyro of the phone is the default behaviour forcing orientations during specific times of your app is dificult and requieres native code.

                  S Offline
                  S Offline
                  Sriu1
                  wrote on last edited by
                  #10

                  @J.Hilk Hi,I want it to dynamic.User should be able to switch from portrait to landscape.

                  J.HilkJ 1 Reply Last reply
                  0
                  • S Sriu1

                    @J.Hilk Hi,I want it to dynamic.User should be able to switch from portrait to landscape.

                    J.HilkJ Online
                    J.HilkJ Online
                    J.Hilk
                    Moderators
                    wrote on last edited by
                    #11

                    @Sriu1
                    well thats the default behaviour.

                    • mkae sure your device can detect orientation changes
                    • make sure the orientation is not locked on your device
                    • make sure your ui is in a layout, that manages resizing automatically (very important or your ui will stay as it is)

                    and just rotate your device around


                    Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                    Q: What's that?
                    A: It's blue light.
                    Q: What does it do?
                    A: It turns blue.

                    S 1 Reply Last reply
                    1
                    • J.HilkJ J.Hilk

                      @Sriu1
                      well thats the default behaviour.

                      • mkae sure your device can detect orientation changes
                      • make sure the orientation is not locked on your device
                      • make sure your ui is in a layout, that manages resizing automatically (very important or your ui will stay as it is)

                      and just rotate your device around

                      S Offline
                      S Offline
                      Sriu1
                      wrote on last edited by
                      #12

                      @J.Hilk
                      I do not want my complete device(Desktop) to be changed.Only the ui should tilt.I have made sure that all ui objects are in layouts for automatic resizing.Can you send me a code snippet which will only tilt the ui not the complete device?

                      J.HilkJ 1 Reply Last reply
                      0
                      • S Sriu1

                        @J.Hilk
                        I do not want my complete device(Desktop) to be changed.Only the ui should tilt.I have made sure that all ui objects are in layouts for automatic resizing.Can you send me a code snippet which will only tilt the ui not the complete device?

                        J.HilkJ Online
                        J.HilkJ Online
                        J.Hilk
                        Moderators
                        wrote on last edited by
                        #13

                        @Sriu1 said in How to tilt the window by 90 degree?:

                        @J.Hilk
                        I do not want my complete device(Desktop) to be changed.Only the ui should tilt.I have made sure that all ui objects are in layouts for automatic resizing.Can you send me a code snippet which will only tilt the ui not the complete device?

                        Well this than has very little to to with the orientation of the device.

                        Take a look at the official QWidget-Transformation-Example
                        It should give you everything you need to transform your UI the way you want it to.


                        Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                        Q: What's that?
                        A: It's blue light.
                        Q: What does it do?
                        A: It turns blue.

                        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