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

Malyushytsky, Alex alex at wai.com
Fri Apr 23 22:55:52 CEST 2010


>> How to trigger QListView item re-layout?

I have not tried myself, but have you tried to call  doItemsLayout()?

Regards,
    Alex


-----Original Message-----
From: qt-interest-bounces at trolltech.com [mailto:qt-interest-bounces at trolltech.com] On Behalf Of Dmitry Teslenko
Sent: Friday, April 23, 2010 6:18 AM
To: qt-interest at trolltech.com
Subject: [Qt-interest] How to re-lay out items in QListView on dataChanged()

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?
_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest


---------------------------------------------------------------------------------------------------
Weidlinger Associates, Inc. made the following annotations.

“This message and any attachments are solely for the intended recipient and may contain confidential or privileged information. If you are not the intended recipient, any disclosure, copying, use, or distribution of the information included in this message and any attachments is prohibited. If you have received this communication in error, please notify us by reply e-mail and immediately and permanently delete this message and any attachments. Thank you.”

“Please consider our environment before printing this email.”




More information about the Qt-interest-old mailing list