Is the QListWidget supposed to be a child of verticalLayout in ObjectInspector? If it's not a child the layout doesn't seem to do anything. If the QListWidget is a child, it doesn't fill the layout. It's like 1/4 of the layout, only in the center.
Is the QListWidget supposed to be a child of verticalLayout in ObjectInspector? If it's not a child the layout doesn't seem to do anything. If the QListWidget is a child, it doesn't fill the layout. It's like 1/4 of the layout, only in the center.
Just follow this procedure:
- Create a QMainWindow in Qt Designer.
- Add a dock widget.
- Add a QListWidget inside of the dock widget.
- Select the dock widget by clicking on it.
- Click the Form menu - Layout vertically.
Voièla!
Now you can resize the dock widget. The list widget will take the whole space.
rakkar (28th August 2009)
Thanks. If I want to put a label above the list widget, the label takes up half of the vertical area of the dock widget. How do I get the label to only take up the necessary size to show it? I tried changing size policy to minimum but it doesn't do anything.
Make sure the vertical size policy of the label is Preferred and the vertical size policy of the QListWidget is Expanding or MinimumExpanding.
Bookmarks