Solved Timer Cannot Stop..?
-
Im using two different timer on Start button like below
and In STOP button im doing
timer->Stop();
timer->Stop();But timer not Stop .
How to stop timer here?
Thank You.
-
It should. Show us the complete code. You must be doing some mistake the objects of timer.
-
@PrAnit said in Timer Cannot Stop..?:
timer->Stop();
timer->Stop();Hi
I see twice "timer", maybe second is "timer2", if only "timer2" doesn't stop -
Hi
timer is a single shot so should not be running.
and you should call
timer2->Stop();in STOP button.
-
@mrjj said in Timer Cannot Stop..?:
should not be running.
But it will timeout once ? (As doc says set a timer to time out only once by calling setSingleShot(true) )
what if he tries to stops the timer before timeout?
-
@Ratzz
hi
Good thinking.
calling stop() will remove/cancel the one-shot if not triggered yet. -
@mrjj said in Timer Cannot Stop..?:
calling stop() will remove the one-shot if not triggered yet.
May be OP also failed to stop the timer set with setSingleShot ?
-
@Ratzz
hi
it's unclear what the real issue is.
The code shown would not stop timer2
but could be copy paste error. -
-
until the op actually shows the function where he calls stop(), it may just as well be variable shadowing.