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

解决:

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

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

原文地址:https://www.cnblogs.com/jieliujas/p/12517137.html