PDA

View Full Version : qListWidget nad update problem



Talei
2nd April 2010, 08:48
Hello,
I'm having problem with "repainting" qListWidget. By "repainting" I mean updating and relayouting items inside, the same as it happens when I additem to list.
How can I "manually" update listWidget?

Any suggestion are more then welcome
Bets regards

EDIT. Sorry for commotion, right after posting I found answer by accident, so to sums it up using doItemsLayout do the trick.

wysota
2nd April 2010, 08:53
Call update() on the widget.

Talei
2nd April 2010, 09:37
I did that at the beginning, but nothing happens.
I use qListWidget and populate it with QListWidgetItem and I want to rearrange items (scaled Images displayed as QIcons, I know that I should use delegates but I want to keep it as simple as possible) on window resize.

wysota
2nd April 2010, 09:53
I did that at the beginning, but nothing happens.
What would you expect to happen?


I use qListWidget and populate it with QListWidgetItem and I want to rearrange items (scaled Images displayed as QIcons, I know that I should use delegates but I want to keep it as simple as possible) on window resize.
Please define "rearrange". How exactly do you do that in your code?

Talei
2nd April 2010, 10:05
After importing images and scaling them, items ( items == images + description) are arranged depending on the widget size, i.e. when widget width is smaller then (2x item width + spacing) they arrange in one column but when I resize window (previous statement is true ) then I want them to rearrange into two (or more depending on the widget size ) columns. And calling doItemsLayout () do the trick.
Sorry for confusion, it's probably due to my poor eng, or not properly stated question.
Best regards

EDIT: also listWidget->setResizeMode( QListView::Adjust ); do the trick ... seriously I need some sleep.