其他分享
首页 > 其他分享> > QObject: Cannot create children for a parent that is in a different thread

QObject: Cannot create children for a parent that is in a different thread

作者:互联网

当使用movetothread时,注意对象的构造函数,因为对象的实例化是在A线程构造的,使用movetothread后,是在B线程调用,所以容易出现该问题。可以尝试在对象构造函数中初始化一些非new的变量,采用一次性定时器触发实际的初始化

标签:movetothread,初始化,different,thread,parent,对象,线程,children,构造函数
来源: https://www.cnblogs.com/clive-ccc/p/16575763.html