View Full Version : signal & slot
Ashkan_s
11th October 2012, 09:51
Is there a way to stop execution of a slot/function when a signal is emitted?
Zlatomir
11th October 2012, 10:15
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.
Ashkan_s
11th October 2012, 12:44
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:
int max = QScrollBar::maximum();
while (max == QScrollBar::maximum())
{
do something;
}
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.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.