[Qt-interest] QListView and item size

Anthony Serdyukov uksus70 at gmail.com
Thu Dec 25 06:16:52 CET 2008


Good day.

Having QListView and a custom model.
Model responds on Qt::DisplayRole and Qt::DecorationRole.
View is in QListView::IconMode and the layout mode is QListView::Batched.

First, view tries to get Qt::SizeHintRole. Since my model returns
QVariant() for this role, view calculates the size itself, taking into
account item's text and icon.

During program flow the icons for items are changed, and new icon has
different size (larger, for example). Model emits dataChanged() signal
and new icons are displayed by the view.
But the size of item does not change until user resize view. So, the
layout is broken at this moment.

Why does not the view recalculate the size of the item when the icon
changes? And how to solve the problem?

-- 
Regards,
Anthony



More information about the Qt-interest-old mailing list