Searching bar in tree widget
-
@suslucoder Why do you call setCurrentItem?
-
@suslucoder said in Searching bar in tree widget:
But when i delete it, it doesnt work
In what way it doesn't work? setBackground should work without setCurrentItem, they are unrelated.
-
@suslucoder I debug and, it finds the items but doesnt show me on tree widget
-
Hi,
Why don't you just modify the background of each item of the list and nothing else ?
-
@suslucoder said in Searching bar in tree widget:
When i only wrote
item->setBackground(0, Qt::cyan);search doesnt work
I think arguement for setBackground is QBrush not the color
void QTreeWidgetItem::setBackground(int column, const QBrush &brush) -
@nagesh said in Searching bar in tree widget:
I think arguement for setBackground is QBrush not the color
Can you please elaborate this?
https://doc.qt.io/qt-5/qbrush.html#QBrush-3 -
@SGaist when i modify the background, for highligting the searching items,
even the text was changed, it keep the oldest item.I search for a and highligh its background.
Then i delete a, search for bIt shows me the both a and b
-
@Christian-Ehrlicher thanks for the correction.
@suslucoder it's showing old search items with different color because you have set it's background color in last search..
It's better to set all with default color and matched items in highlight colour for each search