Is there a way to stop execution of a slot/function when a signal is emitted?
Is there a way to stop execution of a slot/function when a signal is emitted?
You have to tell more information about what are you trying to do, so generic answer is you can disconnect the signal-slot connection or use return/exceptions if the condition to "stop" the slot execution is true.
I needed to check for a condition in a loop, the condition was a change in the range of a QScrollBar. So I wrote something like this pseudo-code:Qt Code:
{ do something; }To copy to clipboard, switch view to plain text mode
Then it crossed my mind to use QAbstractSlider::rangeChanged signal to control the execution of the loop if it is possible. This signal reports what I am looking for.
By stopping execution of a slot/function I mean exiting from it in the middle of execution of the slot/function.
Bookmarks