Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. LayoutDirection weirdly affects the XY coordinates
Forum Updated to NodeBB v4.3 + New Features

LayoutDirection weirdly affects the XY coordinates

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 309 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.
  • DorosD Offline
    DorosD Offline
    Doros
    wrote on last edited by
    #1

    Hi,

    I used setLayoutDirection(Qt::RightToLeft) to my application. Some widgets change direction while other doesn't.
    I noticed that the XY Coordinate begins always from top left whatever the direction is, and wrongly affect my application. That is weird in my point of view.
    I created some projects with JavaFX. With LTR mode, the XY Coordinate starts from top left corner, while with RTL mode it starts from top right corner. So, that's logic.

    Is there a way to auto mirror all widgets, or at least reverse the XY system to start from top right.

    This images can explain what i mean:

    LeftToRight (Good result)
    Frame - LTR Good.png

    RighToLeft (Failed result)
    Frame - RTL Result.png

    RighToLeft (Expected result)
    Frame - RTL Expected.png

    Thanks.

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      How do you place your labels? When there is a spacer after '1' and all is in a proper layout then the mirroring works as expected. No need to change to coordinate system though.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      1
      • Chris KawaC Offline
        Chris KawaC Offline
        Chris Kawa
        Lifetime Qt Champion
        wrote on last edited by Chris Kawa
        #3

        The RTL mode does not change coordinate system. It would not be desirable for things like images, text or painting in general. What it does is change the order of elements in layouts. To get the result you want you would have a horizontal layout 100% wide with a spacer item as the last element. RTL layout would then reverse the order of elements in it and put the spacer on the left side.

        DorosD 1 Reply Last reply
        1
        • Chris KawaC Chris Kawa

          The RTL mode does not change coordinate system. It would not be desirable for things like images, text or painting in general. What it does is change the order of elements in layouts. To get the result you want you would have a horizontal layout 100% wide with a spacer item as the last element. RTL layout would then reverse the order of elements in it and put the spacer on the left side.

          DorosD Offline
          DorosD Offline
          Doros
          wrote on last edited by
          #4

          @Chris-Kawa
          @Christian-Ehrlicher

          I expected that the RTL mode reverse also coordinate frame.
          There is no spacer item in my Hboxlayout.
          I will try your advices.
          Thanks.

          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