Deleting Objects and Connections



  • If I dynamically create a QWidget and connect it via the connect function. Later when the dynamic object is deleted, is the connection deleted too? Or do I need to remove the connection myself? I haven't read anything that says the connections are deleted when the objects get deleted.

    I understand that the delete object can't cause a signal, but that doesn't mean the connection isn't still connected halfway. I just don't want to waste memory if i don't have too. Also I don't want to program with a paranoia, ie doing stuff "just to make sure". Which is a waste my time.

    -Thanks



  • Hi,

    if an object is deleted, the connections from this object to others is deleted. And it emits a signal which leads to removing the signals connected to this object. This works.

    To achieve this, QObject has one signal:

    @
    void destroyed(QObject * = 0);
    @



  • Did not know that. Figured it did, but now I know for sure.

    Thanks!


Log in to reply
 

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