Search code examples
qtqlistwidget

Adjust height of QListWidget when window is resized


I have based a settings dialog on the Qt config dialog example found here:

http://doc.qt.io/qt-5/qtwidgets-dialogs-configdialog-example.html

I would like the QListWidget to fill the left of the window (except for the button bar at the bottom) regardless of the vertical size of the window. In Delphi there was a simple property to set. I can't find a similar thing in Qt.

Is this possible? If so, how?

--- edit --- The example I linked to has the same behaviour. My code is virtually a copy of that example.

Here is a screen shot showing the problem:

screen shot of config dialog


Solution

  • This can be fixed by removing mainLayout->addStretch(1); from configdialog.cpp. This line adds empty space that stretches instead of other content when extra space is available.