I have a single-thread gui application and I do not choose a type of connection, so according to documentation the connection will be a direct one. According to documentation then: "The slot is invoked immediately when the signal is emitted. The slot is executed in the signalling thread."
For my understanding, this obviously leads to the conclusion that if I disconnect such an auto-connection in a method, then there is a guarantee that there is no possibility that after completion of this method (in which I do the disconnection) I can get a slot (corresponding to the just-disconnected connection) still being called. The reason of that is, as far as I understand, the fact that no event queue is used for such an auto (here direct) connection.
Am I right? Or should I be careful and better keep a state
-variable and double check this state
and return from the slot if it's in a some (unclear to me) way still got called? I am especially worried for the situations where I have connections, in which signals are produced by Qt entities (e.g. signals QNetworkReply::finished()
, etc.), rather than by me, as I do not control them fully.
I have found related questions, like this one, but I have not found the exact question, and so I have inconfidence and decided to ask.
CodePudding user response:
If you use only direct connections then you can't "receive" any further signals after you disconnected from getting them. Direct connection is just a callback call, nothing more.