QObject::startTimer: QTimer can only be used with threads started with QThread

解决:

我的原因main函数之中没有QCoreApplication::exec()函数的执行,这样我的定时器启动后main函数就退出了

 

如果是正常Qt cretor创建的工程,main函数中会有return a.exec(),而这会让程序进程不结束,也就是可以接收到timer的timeout信号了。

posted @ 2020-03-18 14:14  一只羊JAS  阅读(3014)  评论(0编辑  收藏  举报