PDA

View Full Version : Resizing instead of scrolling of a QListWidget: is it possible?



dave
8th May 2010, 22:40
I have a couple of QListWidgets in a QScrollArea.

Their behavior right now is that if the user add more items than there is space the QListWidget will show scroll bars for scrolling around. What I want the QListWidget to do is to resize itself to fit since the QScrollArea will already take care of the scroll bars. My question is: is it possible?


Thanks
Dave

dave
9th May 2010, 21:45
Anything? Surely somebody somewhere must have some idea.

wysota
10th May 2010, 08:57
Yes, this is possible but you have to calculate the new size yourself and set it manually on the widget.

dave
10th May 2010, 20:57
Yes, this is possible but you have to calculate the new size yourself and set it manually on the widget.

yes. but in reply to what. What signal/???? should I catch to know I have to recalculate the size?

wysota
10th May 2010, 22:12
QListWidget doesn't seem to have an appropriate signal but there is no chance items are added to it behind your back so you should know yourself when items are added. If you were using the model-based approach you could have used signals from the model.