|
|
On Friday 05 August 2005 15:57, Nick Arini wrote:
> Hi,
>
> can anyone tell me how to add an icon to a QTreeView using the
> model/view architecture.
>
> I have tried using model->setData(index, QIcon("image.png"),
> Qt::DecorationRole) and while this does not cause compiler errors it
> does not display the icon.
>
> I have modified the simpletreemodel example. so model here is a subclass
> of QAbstractItemModel.
>
> Thanks for any pointers.
>
> Nick
Have you reimplemented QAbstractItemModel::setData() as the documentation
suggests and also adapted TreeModel::data() to return the icon? (The
original implementation in the SimpleTreeModel example does only return
QVariant() for Qt::DecorationRole).
Bernd
|
|