QTreeWidget: Set color text: specified column in specified row [Solved]
-
Hello,
I'm using QTreeWidget.
This widget contains 8 columns (first column contains the tree)
The items in some columns are updated every one second.
I want to set the color of a specified row,column according to the text.How can I do it ?
I managed to set the color of all the items in a column.
But this is not good enough.Thanks,
Zvika. -
Each QTreeWidgetItem (if this is what you are using) has it's own font. You can set it using "setFont()":http://qt-project.org/doc/qt-5.0/qtreewidgetitem.html#setFont method.
To be honest I don't really know what problem you have. Can you try to be more specific?
-
I would say, subclassing [[doc:QIdentityProxyModel]] is of help here. You can overwrite the data method and return the color value depending on the text (and/or other constraints).
-
Hi,
you can't use proxy models for the item based widgets :-)
proxy models are for model - view widgets. -
Switching to QTreeView + QTreeModel + Proxy model should be fairly easy in this case.
-
Hello,
I found a solution.
QTreeWidgetItem->setColor, did the job.
Thanks,
Zvika