Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-74691

add a disconnectAll function, to disconnect all signals from a sender, or a receiver

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • P4: Low
    • None
    • None
    • Core: Object Model
    • None

    Description

      Sometimes we make connections to a receiver and lost the trace of which is connected to a receiver, and we want to disconnect all signals to this receiver before doing some actions. 

      So I suggest a new function that disconnect all signals to a receiver slot. It will be like this

      QObject::disconnectAllToReceiver(const QObject *rec, const char *met = nullptr)
      This function disconnect all signals to the slot "met" of the receveiver "rec". And if the met=nullptr it will disconnect all signal to all slots to the receiver "rec". 

      And the same for the sender:
      QObject::disconnectAllFromSender(const QObject *sen, const char *met = nullptr)
      This function will disconnect all "met" signals sent from the sender sen. And if met = nullptr, it will disconnect every signal that are emitted by the sender "sen". 

      NB: Not to be confused with this function :
      bool QObject::disconnect(const QObject *receiver, const char *method = nullptr) which is equivalent to bool QObject::disconnect(this, nullptr, receiver, member);
      This function disconnect all signals to the receiver, but only signals from "this" pointer

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            Unassigned Unassigned
            navis-raven Dragoon Gryffoon
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes