Andrew
Andrew

Reputation: 376

Setting QListWidget Minimum Height

I've got a widget with a vertical layout. That widget is vertically split and its children are another QWidget and a QListWidget. The splitter is not set to collapse its children and the list widget has a minimum height of 0. Even with no items in the list widget, I can't use the splitter to make the list widget get any smaller than around 70px, vertically. I can manually set the maximum height to under 70px and it will obey.

I figured out that least that it's not my program specifically because I tried a fresh layout in Qt Designer and the same thing happens even in preview mode (bottom area is the QListWidget):

Qt Designer preview

I've also tried manually setting the sizeHint for the items to under that imaginary limit. The width is respected but the height stays the same.

Upvotes: 0

Views: 2353

Answers (1)

Andrew
Andrew

Reputation: 376

I solved the problem by setting the QListWidget's vertical size policy to "Ignored". I can't say I understand why having a minimum width of zero isn't respected.

Upvotes: 5

Related Questions