[Qt-jambi-interest] BackgroundRole
Vincent Lebreil
vincent.lebreil at gmail.com
Thu Feb 5 18:52:54 CET 2009
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<-----------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt.nokia.com/pipermail/qt-jambi-interest/attachments/20090205/0f68232e/attachment.html
More information about the Qt-jambi-interest
mailing list