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. Newbie: Canonical way for getting this layout (screenshot)
Forum Updated to NodeBB v4.3 + New Features

Newbie: Canonical way for getting this layout (screenshot)

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 256 Views 2 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.
  • C Offline
    C Offline
    cdvo
    wrote on last edited by cdvo
    #1

    Hi all,

    what is the canonical way in Qt for getting the following layout without trick or workarounds?

    • Table A can shrink and grow, horizontally and vertically
    • Table B can grow and shrink horizontally only while the height is fixed (no vertical resizing allowed)
    • Buttons must be aligned as in the picture: the top one must be aligned with table b on the top. And obv., they must not resize.

    Could you please share your ui file?

    Thank you!

    Edited

    ss5.png

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

      Hi,

      I can't share any Ui file as I don't use Designer.

      However, you can do it using code.

      You already know the widgets you need.

      From the top of my head:

      Set a fixed height on B.

      Your two buttons should go in their own vertical layout to which you add a stretch after adding the second button so they are pushed up. B and the buttons layout go into a horizontal layout and finally, A and the horizontal layout go into a vertical layout that you set on you main widget.

      When adding A to the vertical layout, use a stretch factor of 1 so it will get more space than what is below. Do the same for B when you add it to the horizontal layout so it should also take more space that the buttons.

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

      C 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        I can't share any Ui file as I don't use Designer.

        However, you can do it using code.

        You already know the widgets you need.

        From the top of my head:

        Set a fixed height on B.

        Your two buttons should go in their own vertical layout to which you add a stretch after adding the second button so they are pushed up. B and the buttons layout go into a horizontal layout and finally, A and the horizontal layout go into a vertical layout that you set on you main widget.

        When adding A to the vertical layout, use a stretch factor of 1 so it will get more space than what is below. Do the same for B when you add it to the horizontal layout so it should also take more space that the buttons.

        C Offline
        C Offline
        cdvo
        wrote on last edited by
        #3

        @SGaist

        Your two buttons should go in their own vertical layout to which you add a stretch after adding the second button so
        they are pushed up. B and the buttons layout go into a horizontal layout and finally, A and the horizontal layout go into a
        vertical layout that you set on you main widget.

        Already done. What you get at the end is that the vertical spacer grows, which in turn the vertical layout grows, which in turn the horizontal layout grows up to the half of the main window. The top half is take by table A.

        When adding A to the vertical layout, use a stretch factor of 1 so it will get more space than what is below. Do the same >for B when you add it to the horizontal layout so it should also take more space that the buttons.

        As far as I've understood, with stretch you set a different factor of growing than what is the default. But I don't care
        about table A, it can grow or shrink, table B must grow or shrink only horizontally and not vertically.
        Do you talk about vertically stretch in you comment I guess, right?

        Thanks

        1 Reply Last reply
        0
        • C cdvo has marked this topic as solved on

        • Login

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