PDA

View Full Version : Highlight a part of QTreeWidgetItem name



Alundra
4th August 2013, 17:52
Hi all,
I have a widget who is a QTreeWidget with a search box.
I only show items who contains the text in the search box.
I would highlight the part of the QTreeWidgetItem name who is the search box value.
I would a simple background color on the part of the name found.
Is it possible with Qt ? How can I got it working ?
Thanks for the help

Santosh Reddy
5th August 2013, 13:15
Is it possible with Qt ?
Yes it is possible in Qt.


How can I got it working ?
It is not trival to do this QTreeWidget and QTreeWidgetItem. You can set costom widgets in place of the QTreeWidgetItems, and connect the search widget to the custom widgets. Text highlighting (partial/full) should be done in the custom widgets. These custom widgets could be QLabels, and can use html tags to hightlight the matched text.

spirit
5th August 2013, 16:45
See QItemDelegate.