已找到原因,是因为退出时没有先关闭子线程。
threadTimer=new QThread(this);
QTimer *timerInStatusBar=new QTimer(0);
timerInStatusBar->setInterval(100);
timerInStatusBar->moveToThread(threadTimer);
connect(threadTimer,SIGNAL(started()),timerInStatusBar,SLOT(start()));
threadTimer->start();
在析构函数加上这行后问题消失。
threadTimer->quit();