timer = new Timer(this);改成 timer = new Timer();就可以了。

因为你timer是属于主线程的,尽量不要在非主线程里创建新的对象并指定其对象为主线程内的对象,否则QApplication.exec会warning.
this->exec(); 这样会显示的调用消息循环进而触发slot

 

相关文章:

  • 2021-08-15
  • 2022-12-23
  • 2021-07-16
  • 2022-12-23
  • 2021-05-09
  • 2021-12-22
猜你喜欢
  • 2022-12-23
  • 2021-11-20
  • 2022-12-23
  • 2021-09-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-13
相关资源
相似解决方案