Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    Signal or event when QTreeWidgetItem is deleted?

    General and Desktop
    2
    2
    1050
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • B
      bobEdwards last edited by

      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

      1 Reply Last reply Reply Quote 0
      • JKSH
        JKSH Moderators last edited by

        Hi,

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

        Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

        1 Reply Last reply Reply Quote 0
        • First post
          Last post