Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. disconnect happens automatically?
QtWS25 Last Chance

disconnect happens automatically?

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 726 Views
  • 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.
  • P Offline
    P Offline
    Publicnamer
    wrote on last edited by
    #1

    I have an object that needs to send signals to the GUI, so I connect it to a slot.
    However later I delete that object.
    I noticed I can always say when I'm done with the object:

    disconnect(myObject);
    

    However does this also happen automatically when its deallocator is called?

    JonBJ 1 Reply Last reply
    0
    • P Publicnamer

      I have an object that needs to send signals to the GUI, so I connect it to a slot.
      However later I delete that object.
      I noticed I can always say when I'm done with the object:

      disconnect(myObject);
      

      However does this also happen automatically when its deallocator is called?

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #2

      @Publicnamer
      Yep :)

      In general you don't need to worry about explicitly calling disconnect().

      1 Reply Last reply
      3
      • Christian EhrlicherC Online
        Christian EhrlicherC Online
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Properly explained in the documentation to QObject::disconnect(): 'A signal-slot connection is removed when either of the objects involved are destroyed.'

        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
        Visit the Qt Academy at https://academy.qt.io/catalog

        1 Reply Last reply
        3

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved