Search code examples
qtqt4qt-designer

Make QListWidget fill QFormLayout


I am using QT4 Designer have a layout that looks basically like this:

QWidget
  QVBoxLayout
    QFormLayout
      QLineEdit
      QListWidget
      QPushButton

Each control is on a separate line.

I did the layout assignment trick to get everything to fit to the parent, and if I reduce the height the QListWidget shrinks as hoped, but if I increase the height the QWidget.geometry.Height never exceeds 192. The Vertical Policy is set to Expanding and the maximumSize.Height is 16777215, but no other policy seems to allow the QListWidget to grow. Width grows correctly, however.

What setting am I missing? Should I instead anchor the QPushButton to the bottom of the QFormLayout, and if so, how?


Solution

  • Well, I found my own answer - I selected the QFormLayout, right-clicked, and chose Lay out/Lay Out in a Grid and everything snapped into place! So, the new, working hierarchy is:

    QWidget
      QVBoxLayout
        QGridLayout  <<-- Changed from QFormLayout
          QLineEdit
          QListWidget
          QPushButton