Getting data from the inherited QTreeWidgetItem class

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

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

+1


source to share


1 answer


You create and add an element:

newItem = new QTreeWidgetItem(myExplorer);

      

set data:



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

      

And you have a slot that accepts the clicked item (in the tree) that you can read the data:

connect( myExplorer, SIGNAL( itemClicked (QTreeWidgetItem *, int) ), this, SLOT( slotFillListWidget(QTreeWidgetItem *, int) ) );

      

+1


source







All Articles