Unsolved Mouse click event on children of qt tree item widget
-
I want to create a mouse click event on children items of a certain qt tree widget item. Is there a simple way i can do that with a qt tree widget item?
I would like to click on one of the children such that when I click on it I can retrieve the text data of that selected child.
-
Look at the signals for QTreeWidget. One already exists for clicking on an item.
-
Hi and welcome to the forums.
You can easily do that with
https://doc.qt.io/qt-5/qtreewidget.html#itemClicked
and use item->Text() -
I have added a checkbox to each tree widget item, how can i catch the event when one checkbox has been checked or unchecked?
-
@cymric97
Hi
You mean like a real qcombobox ?
With setCellWidget ?
If yes, you need to hook it up to a slot, like you normally.You could also do ( when you create item)
item->setFlags(item->flags() | Qt::ItemIsUserCheckable |Qt::ItemIsSelectable);and then you can directly check with
https://doc.qt.io/qt-5/qtreewidgetitem.html#checkState
or hook up to
https://doc.qt.io/qt-5/qtreewidget.html#itemChanged
to be notified when checked state changes for an item.