QTreeWidget highlight item without mouse click
Solved
General and Desktop
-
Hello fellow QT'ers, hope you're all doing well. I have a weird question: I have a QTreeWidget that works well when I mouse click on an item. Is it possible to emulate this click with code? I tried this
foreach(QTreeWidgetItem * object, ui.listTree->selectedItems()) { ui.listTree->setCurrentItem(object); ui.listTree->currentItem()->setSelected(true); }
and it doesn't select the item at all. I looked at the SelectionMode and it's set to ExtendedSelection.
Thanks
-
@BoGut said in QTreeWidget highlight item without mouse click:
ui.listTree->selectedItems()
You're aware what this function does?
-
@Christian-Ehrlicher guess I need more sleep, good catch!