I want to put the timer in the serial data stream, and every time new data, the timer will restart, there is no data for a long time to come over, timer timing slot function called end,
F1timer=new QTimer; F1timer - & gt; stop(); The connect (F1timer, SIGNAL (timeout ()), and this, SLOT (F1timeout ())); F1timer - & gt; Start (5 * 1000);
Now is when the new data, the timer will not reset and count again, how should change? Seek help from a great god,
CodePudding user response:
Calls to start again
CodePudding user response:
Can say about it? I've tried, can't, such as I now set the start value to 5 seconds, if 1 second after the new data, I hope I can start timing QTimer, namely to 5 seconds countdown,
CodePudding user response:
With a global Int variables, divided exactly by 5 (cycle), the remainder is zero, run the processing function, if a new data is detected, the global Int=0
CodePudding user response:
A little leakage, in the operation of the timer, remember to set the global Int++, keep growing