Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to detect when a delegate is destroyed?



  • Is there a way to detect when a delegate is being (or has been) destroyed?
    I need to do some cleaning up on my own (deleting the pixmap used by the delegate, which comes from C++) when a delegate is no longer shown, but I'm not sure how to do it. The best way would be to somehow detect the destruction of the delegate, but how can I do that?



  • Hello,

    You can use Component.onDestruction.

    dmcr



  • Thanks! For some reason I got the impression that this would not work for individual delegates, but it does. I'm not sure how I was thinking really... so thanks for pointing me in the right direction.


Log in to reply