PDA

View Full Version : QListWidget shrink to fit size of items



woodtluk
28th September 2010, 15:54
Hi there

I've got a problem with QListWidget. I'd like to have the widget to shrink to the smallest size vertically. It shoud show all contained items.

I tried to achieve this with the sizePolicy and spacers. But I didn't get what i
I want.

5247

I the picture you see what I have on the first list and what I'd like to have on the second list.

Thanks for your help!

Luke

codebehind
28th September 2010, 22:42
you could use
while (verticalScrollBar()->pageStep() <= count() ) resize(w,h+X);

or

resize(w,itemHeight*count()+offset)