[Qt-interest] QListView SizeHintRole dataChanged
Anthony Serdyukov
uksus70 at gmail.com
Wed Dec 10 08:58:16 CET 2008
Excuse me for the reminder, but thу question is still of vital importance.
Could somebody give an advice?
2008/9/1 Anthony Serdyukov <uksus70 at gmail.com>:
> Hi.
>
>
>
> I have a custom model derived from QAbstractListModel. And I use QListView
> in IconMode to display data. Each item has its own icon (image), that is
> obtained from some external source (network). I want to realize lazy
> population for it. That is, I want to request only those images, which are
> to be displayed.
>
>
>
> I suppose the right way to achieve my goal is to request images in
> data(DecorationRole). Since my images have different sizes, I cannot set
> UniformItemSizes=true, so the list view queries DecorationRole for all items
> at once, not only visible ones. I understand that list view need them to
> calculate size of each item. That is why my model overrides SizeHintRole to
> prevent this behavior. It returns some "stub" size for item while it doesn't
> have real image to calculate real size. In data(DecorationRole) model
> requests an image asynchronously and emits dataChanged() when image is
> received. But! List view doesn't query SizeHintRole anymore till I resize it
> using GUI!
>
>
>
> Is this a normal behavior of QListView (not to query SizeHintRole after
> dataChanged)?
>
> Have someone solved such a problem already?
>
> Maybe my approach for lazy populating is ugly and somebody can offer
> something better?
>
>
>
> Thanks forward.
--
Regards,
Anthony
More information about the Qt-interest-old
mailing list