[Interest] Destroy all queued events on QObject::disconnect?

Thiago Macieira thiago.macieira at intel.com
Fri Jan 18 17:16:19 CET 2019

On Friday, 18 January 2019 01:06:58 PST Alexander Dyagilev wrote:
> Hello again,
> The previous problem I recently wrote about was caused by me thinking
> that QObject::disconnect also destroys all queued events caused by this
> connection. This was obviously wrong.
> But, I still want Qt to behave so. Is there a way to achieve such behavior?

No, and I question your design if you want this. If a signal was emitted and 
it was connected at that time, the slot should be called, even if you 
disconnect later.

The fact that your situation is threaded is not relevant. The functionality 
should be the same. The only important difference is that in a direct 
connection, a slot is called while the signal is still being emitted, so it 
can remove further receivers from that connection, while in the case of queued 
connection, all receivers are (usually) already queued by the time the first 
slot gets run.

Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center

More information about the Interest mailing list