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. Asymmetrical layout?
QtWS25 Last Chance

Asymmetrical layout?

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 484 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.
  • D Offline
    D Offline
    Dan203
    wrote on last edited by
    #1

    Is there any way to do an asymmetrical layout? Like if I wanted a single horizontal layout with just two controls in it to be split 70/30 instead of 50/50 is there a way to do that? Or is the only way to set a fixed size on one of the two controls and let the other fill the difference?

    And to be clear I'm talking about using the automatic layout properties not manually overriding sizeEvent and doing it programmatically. I'll do that if I have to, but I want to make sure I'm not overlooking some automatic option that does this.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Use the stretch parameter when adding your widget to match the ratio you want.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • D Offline
        D Offline
        Dan203
        wrote on last edited by
        #3

        Thanks, that does work. But I'm curious what that number means? Is it a percentage? I looked at the docs and it's just called a "stretch factor" but it doesn't explain exactly what the value means.

        1 Reply Last reply
        0
        • D Offline
          D Offline
          Dan203
          wrote on last edited by
          #4

          Answering my own question.... It's not a percentage. It seems to be some sort of relative scale where higher numbers get more scaling than lower numbers, but the numbers do not directly correlated to the percentage the widget scales. Kind of a weird system but with some trial and error I was able to get the results I wanted.

          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