Details
-
Suggestion
-
Resolution: Unresolved
-
P4: Low
-
None
-
None
-
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