Qt World Summit: Register Today!

Derived QTreeWidgetItem class painting

  • i have derived my own class subclassing from QTreeWidgetItem and i want to be able to draw some of these items in a QTreeWidget with colored boxes surrounding the items. for instance, i want to be be able to draw a red outline around some of the items to give feedback on critical items. is this possible?

  • Sure. However, you should probably look into using a delegate instead. One way would be to subclass [[doc:QStyledItemDelegate]] and reimplement its paint() method.

Log in to reply