3

我有具有 QTimer 的线程,我希望它能够在不重新启动应用程序的情况下动态更改其执行间隔:这是 QThread 运行方法中的代码:

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();;
}
4

1 回答 1

9

有一种setInterval方法。

于 2011-05-29T09:18:19.177 回答