[Qt-interest] How to re-lay out items in QListView on dataChanged()

Dmitry Teslenko dteslenko at gmail.com
Fri Apr 23 15:17:42 CEST 2010


Hello!

I have QListView in ItemView mode that shows previews of windows and
window captions beneath.
Windows are of different sizes, so my QListView's model provide data
for Qt::DecorationRole and Qt::SizeHintRole.

In scenario 1 I have all previews ready and after model reset QListView
lays out all previews according its size hints.

In scenario 2 I have only list of windows ready and worker threads preparing
previews. After model reset QListView lays out previews stubs and waits.
Thren previews are finally ready, model emits dataChanged() signals to
notify QListView it's time to update previews. QListView re-reads previews
from model and shows them nicely. Bad thing QListView doesn't also
re-layout items and some of them looks cropped.

How to trigger QListView item re-layout?

-- 
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?



More information about the Qt-interest-old mailing list