Signal or event when QTreeWidgetItem is deleted?



  • Hello,

    I'm looking for a way to get a signal or event triggered whenever a QTreeWidgetItem is deleted, and then perform an action based on the QVariant data held within that item. Is there a way to do this? Looking through the manual it does not look like it emits any signals except for dataChanged.

    For example, I am hoping to simply call delete on a QTreeWidgetItem* that has many, many nested child objects. Qt will automatically delete all of the QTreeWidgetItem children, but I'd like to perform an action on each based on the QVariant data it holds. As it stands now I have to recursively loop over all items and all children and when call delete when there is no more children.

    Does anyone have any suggestions?

    Cheers,

    Bob


  • Moderators

    Hi,

    You can subclass QTreeWidgetItem and do your custom processing in its destructor.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.