View Full Version : Is it possible to cancel the call to QTimer::singleShot?
TorAn
3rd April 2016, 19:49
Suppose, after I made a call to QTimer::singleShort, application logic requires cancellation of this operation. I don' see a way to cancel it, is it possible to do?
Thanks!
ChrisW67
3rd April 2016, 21:39
No, you have no access to the actual timer created by the static call.
You can create a single shot (zero time) timer explicitly and you should be able to stop() or delete that object before it fires.
Alternatively, track whether a single-shot timer is needed separately in a bool variable. Then, just before returning control to the event loop, create the single shot timer if required.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.