I have method. This method have static QTime but I want to reset this value if something is happened.
static QTime time(QTime::currentTime());
// calculate two new data points:
double key = time.elapsed()/1000;
static double lastPointKey = 0;
if(newPlot == true){
// like tihs key = 0 ;
// lastPointKey = 0 ;
}
Use the
QTime::restart()
method to reset your timer.Also, take a look at
QElapsedTimer
class. It has a similar API (elapsed()
,restart()
, etc.), however you may find it more suitable for your situation. From the docs: