ASSERT failure in QCoreApplication::sendEvent: “Cannot send events to objects owned by a different t
当前线程调用的东西,不能执行相应操作。需要转移到另外线程(主线程,GUI线程)。
·
- 具体错误
ASSERT failure in QCoreApplication::sendEvent: "Cannot send events to objects owned by a different thread. Current thread
- 原因
当前线程调用的东西,不能执行相应操作。需要转移到另外线程(主线程,GUI线程)。
- 解决办法
类:
class Worker
{
public slots:
void work(void* param);
}
调用:
void test()
{
Worker w;
QMetaObject::invokeMethod(&w, "work", Qt::QueuedConnection, nullptr);
}
更多推荐
已为社区贡献8条内容
所有评论(0)