[Solved] How can i call two slot using timer alternately?
General and Desktop
5
Posts
4
Posters
2.6k
Views
1
Watching
-
//put this at the bottom of the mousepress slot
@QTimer::singleshot(1000,this,SLOT(mouserelease()));@//and this at the bottom of the mouserelease slot
@QTimer::singleshot(1000,this,SLOT(mousepress()));@and then call one of the slots.
This should make a call to the mousepress() slot trigger a call to the mouserelease() slot 1 second later and vice versa.
-
I think that a faster way maybe a single function with a flag. You should only set the negation of the flag inside the slot and fire it every timer trigger. Then the flag indicate the way the slot function should follow.