Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Application Portrait and Landscape mode (Horizontal/Vertical rotation)
QtWS25 Last Chance

Application Portrait and Landscape mode (Horizontal/Vertical rotation)

Scheduled Pinned Locked Moved Solved QML and Qt Quick
8 Posts 3 Posters 1.8k 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.
  • S Offline
    S Offline
    SebastianM
    wrote on 17 Nov 2021, 14:20 last edited by
    #1

    Hi,
    I would like to add option to rotate my application between Portait and Landscape mode. (Linux handheld device).
    I tried nesting Item inside main ApplicationWindow, with custom rotate flag swap width/height and set item rotation 0/90.
    Problem is - that lots of internal components rely on anchors and are placed in app corner. After above rotation, component from bottomLeft is now in bottomRight and is on side.
    I would like to avoid tedious process of exposing flag to all components and usage of condition expressions to decide how to place them.

    R 1 Reply Last reply 17 Nov 2021, 14:51
    0
    • S SebastianM
      17 Nov 2021, 14:20

      Hi,
      I would like to add option to rotate my application between Portait and Landscape mode. (Linux handheld device).
      I tried nesting Item inside main ApplicationWindow, with custom rotate flag swap width/height and set item rotation 0/90.
      Problem is - that lots of internal components rely on anchors and are placed in app corner. After above rotation, component from bottomLeft is now in bottomRight and is on side.
      I would like to avoid tedious process of exposing flag to all components and usage of condition expressions to decide how to place them.

      R Offline
      R Offline
      raven-worx
      Moderators
      wrote on 17 Nov 2021, 14:51 last edited by
      #2

      @SebastianM
      The "default" provided QML components listen to Window.contentOrientation property - like Popups on the Overlay

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      1
      • S Offline
        S Offline
        SebastianM
        wrote on 18 Nov 2021, 13:16 last edited by SebastianM
        #3

        Help me understand.
        Screen.orientation is OS information about current display orientation (if HW uses accelerometer or user manual change orientation).
        Window.contentOrientation applicaton changes to notify OS display server/windows manager how it describe it's own orientation.

        In both situation, if my App placed Rectangle in bottomLeft and device has been rotated. Rectangle will be rotated (lying on side) on and in new corner.
        Is is possible for app to treat anchors.top the same despite orientation change? I mean - in Vertical Top is this what Right was in Horizontal?

        I don't like idea to use rotation/orientation flag in all places where position is set. Or create two separate layouts changed with orientation.

        1 Reply Last reply
        0
        • M Offline
          M Offline
          Markkyboy
          wrote on 18 Nov 2021, 15:45 last edited by
          #4

          Out of pure curiosity, what is your Linux device?, I'm using Sony Xperia 10ii with SailfishOS, screen orientation is more or less handled by the device. Perhaps they way orientation is done in Sailfish, could be applied to your device...?.

          1 Reply Last reply
          0
          • S Offline
            S Offline
            SebastianM
            wrote on 19 Nov 2021, 11:47 last edited by
            #5

            It's commercial project on EGLFS without built-in orientation. Yocto will handle system setup.
            For now I'm starting to getting used to idea of two separate layouts.

            R 1 Reply Last reply 19 Nov 2021, 12:48
            0
            • S SebastianM
              19 Nov 2021, 11:47

              It's commercial project on EGLFS without built-in orientation. Yocto will handle system setup.
              For now I'm starting to getting used to idea of two separate layouts.

              R Offline
              R Offline
              raven-worx
              Moderators
              wrote on 19 Nov 2021, 12:48 last edited by
              #6

              @SebastianM
              i think i dont understand your problem.

              I tried nesting Item inside main ApplicationWindow, with custom rotate flag swap width/height and set item rotation 0/90.

              when you do this, all anchors are also translated. means bottom-left of horizontal will also be bottom-left in vertical when the device is rotated.

              Problem is - that lots of internal components rely on anchors and are placed in app corner. After above rotation, component from bottomLeft is now in bottomRight and is on side.

              can you please show how you are placing those elements

              --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
              If you have a question please use the forum so others can benefit from the solution in the future

              1 Reply Last reply
              0
              • S Offline
                S Offline
                SebastianM
                wrote on 24 Nov 2021, 15:10 last edited by
                #7

                I didn't add anchors.centerIn: parent in content Item (which is rotated and is changing size). In result, after rotation Item was placed in completely crazy place.

                1 Reply Last reply
                0
                • M Offline
                  M Offline
                  Markkyboy
                  wrote on 24 Nov 2021, 16:24 last edited by
                  #8
                  This post is deleted!
                  1 Reply Last reply
                  0

                  3/8

                  18 Nov 2021, 13:16

                  topic:navigator.unread, 5
                  • Login

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