我有具有 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();;
}