[Qt-interest] How Can I use ListView to show QIcons ?

Alessandro Portale Alessandro.Portale at trolltech.com
Wed Jun 24 10:36:48 CEST 2009


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



More information about the Qt-interest-old mailing list