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. How to make widget use maximum height
Forum Updated to NodeBB v4.3 + New Features

How to make widget use maximum height

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 2 Posters 1.9k 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.
  • O Offline
    O Offline
    OpenGL
    wrote on last edited by OpenGL
    #1

    I'm using qt creator and designer to create an app, and so far I have in the MainWindow 4 things:

    1. a qtreeview
    2. a group box
    3. another group box
    4. a vertical spacer

    The treeview is to the left and first groupbox is in the upper right corner, and the other box below and the spacer below that group box.

    I selected each group box in turn and clicked "Lay out in a grid" and set "LayoutSizeConstraint" to "SetFixedSize" for them both, so they look very nice and keep their size when resizing the mainwindow.

    Then I selected the central widget and clicked "Lay out in a grid".

    Now the groupboxes are close to eachother and stay in the upper right corner when resizing the mainwindow, and the treeview changes size to fit as much as possible horrizontaly (great!) but how can I get it to scale vertically and use maximum height?

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

      You need to modify sizePolicy of your QTreeView widget and set it to expanding in both directions.

      (Z(:^

      1 Reply Last reply
      2
      • O Offline
        O Offline
        OpenGL
        wrote on last edited by
        #3

        Thanks for the suggestion, but it didn't help. It was already set to Expanding in both directions.

        1 Reply Last reply
        0
        • O Offline
          O Offline
          OpenGL
          wrote on last edited by
          #4

          I solved it by breaking up the layout of the central widget, and putting the widgets to the right (2. 3. and 4.) in a vertical layout, and then add a grid layout in the central widget.

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

            Nice, thanks for sharing the solution

            (Z(:^

            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