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. [Solved] Basic and Dumb Question but I couldn't find an answer
Forum Updated to NodeBB v4.3 + New Features

[Solved] Basic and Dumb Question but I couldn't find an answer

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 1.4k Views 1 Watching
  • 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.
  • VRoninV Offline
    VRoninV Offline
    VRonin
    wrote on last edited by
    #1

    Brief Question: Does the deletelater() method also disconnects signal and slots related to the destroyed item?

    More detailed explanation:
    I'm developing a small program that would work both as server and as client so based on the use I create and connect to the main window a QObject-based item that works as the server or the client. Since a user may potnetially switch to server to client and vice versa many times during a session, and when he does I schedule the client or server that he was using for deletion, I'd like to know if the deletelater() method also disconnects signal and slots related to the destroyed item or I should do it manually.

    "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
    ~Napoleon Bonaparte

    On a crusade to banish setIndexWidget() from the holy land of Qt

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      You don't need to worry about that :) And if you do, you can easily disconnect manually all the connections with just a single line of code (see QObject documentation).

      (Z(:^

      1 Reply Last reply
      1
      • A Offline
        A Offline
        andre
        wrote on last edited by
        #3

        Well, actually, it is a good question.

        Normally, when an object is destroyed, all signal-slot connections it is involved in are disconnected. However, this happens on the actual desctruction of the object, so not when you call deleteLater(). So yes, even after calling deleteLater(), the object may still emit signals or respond to signals.

        1 Reply Last reply
        1

        • Login

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