您的位置:首页 > Web前端

QT出现 Cannot create children for a parent that is in a different thread 的解决方法:

2015-11-16 11:34 525 查看
timer = new Timer(this);改成 timer = new Timer();就可以了。

因为你timer是属于主线程的,尽量不要在非主线程里创建新的对象并指定其对象为主线程内的对象,否则QApplication.exec会warning.
this->exec(); 这样会显示的调用消息循环进而触发slot
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: