Question

I have a class which inherits from QTreeWidgetItem and I intercept the click event.

I need to get another object from inside MY QTreeWidgetItem when I click the tree row, how can I do that??

Was it helpful?

Solution

You create and add the item:

newItem = new QTreeWidgetItem(myExplorer);

set the data:

newItem->setData(myListWidgetItem::idType, 1234);

And have a slot that accepts the item clicked (on the tree), which you can read the data from:

connect( myExplorer, SIGNAL( itemClicked (QTreeWidgetItem *, int) ), this, SLOT( slotFillListWidget(QTreeWidgetItem *, int) ) );
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top