user63898
user63898

Reputation: 30885

How can i set QTimer interval to change dynamically without restarting the app

I have thread that has QTimer , i like it to be able to change its execution interval dynamclly without restarting the application : this is the code inside the QThread run method :

void myThread::run()
{
      QTimer timer1;
      connect(&timer1, SIGNAL(timeout()),
              this,SLOT(fire(),Qt::DirectConnection));

      qDebug() << "A::run() worker thread -- currentThread:" << currentThread();

      timer1.start(1000);

      QThread::exec();;
}

Upvotes: 3

Views: 7693

Answers (1)

cnicutar
cnicutar

Reputation: 182609

There is a setInterval method.

Upvotes: 9

Related Questions