I just discovered an interesting queue behavior in Qt 4.6:
The first connection in the queue is completed:
connect(someSender, SIGNAL(completed()), this, SLOT(handleCompletion()), Qt::QueuedConnection)
Then someSender sends a signal:
emit completed()
Before receiving a signal (as in a queue), I disconnect from the signal:
disconnect(someSender, SIGNAL(completed()), this, SLOT(handleCompletion())
However, the handleCompletion slot is called on the next iteration of the eventloop. I can prevent this by using someSender-> blockSignals (true) at the right point, but it feels awful, not to mention the presence of some logical flag to disable the functionality of the slot.
In particular, I am surprised that this behavior is not mentioned in the Qt documentation (at least I have not found).
Finally, the question is: is there any reasonable way to avoid this?
source share