Hi !

Do you have the same behaviour with my QTreeView/QAbstractItemModel ? and if
so, do you know why ?

Thx

On Thu, Feb 5, 2009 at 6:52 PM, Vincent Lebreil
<[email protected]>wrote:

> Hi,
>
> I'm trying to display a background color for all items of my model.
> I've tried to return a QColor in my data method for BackgroundRole. But
> this color is only displayed if the mouse is over one row of my view. This
> color is not displayed for all the rows of my view.
> I don't understand why, cause if I do the same thing but with
> DecorationRole, it works great (ie all the rows of my view have this
> decoration).
>
> Thanks for your help
>
> Vincent
>
> ---------------8< -------------------
> public Object data(QModelIndex index, int role) {
>         Object data = null;
>         if (index != null) {
>             if (role == Qt.ItemDataRole.DisplayRole }
>                     data = "data";
>             } else if (role == Qt.ItemDataRole.DecorationRole) {
>                 data = QColor.blue;
>             } else if (role == Qt.ItemDataRole.BackgroundRole) {
>                 data = QColor.blue;
>             }
>         }
>         return data;
>     }
> -------------8<-----------------------
>
_______________________________________________
Qt-jambi-interest mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt-jambi-interest

Reply via email to