[Qt-interest] How Can I use ListView to show QIcons ?
Kermit Mei
kermit.mei at gmail.com
Wed Jun 24 11:19:10 CEST 2009
On Wed, 2009-06-24 at 10:36 +0200, Alessandro Portale wrote:
> Kermit Mei schrieb:
> > QVariant ListModel::data(const QModelIndex &index, int role) const {
> > if(index.isValid())
> > return QVariant(icons.at(index.column()));
> > else
> > return QVariant();
> > }
>
> You need to consider the data role. Only return an icon, when role ==
> Qt::DecorationRole.
>
> Alessandro
Yes,I see. Thanks you all to help me.
But, I always can't understand the thinking of the keyword 'role' here.
And I can't understand it in the other model.
Can you give me some link about it?
Thank you, very much!
Kermit
More information about the Qt-interest-old
mailing list