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