// check the constructor's parent thread argument
static bool check_parent_thread(QObject *parent,
QThreadData *parentThreadData,
QThreadData *currentThreadData)
{
if (parent && parentThreadData != currentThreadData) {
QThread *parentThread = parentThreadData->thread;
QThread *currentThread = currentThreadData->thread;
qWarning("QObject: Cannot create children for a parent that is in a different thread.\n"
"(Parent is %s(%p), parent's thread is %s(%p), current thread is %s(%p)",
parent->metaObject()->className(),
parent,
parentThread ? parentThread->metaObject()->className() : "QThread",
parentThread,
currentThread ? currentThread->metaObject()->className() : "QThread",
currentThread);
return false;
}
return true;
}
还没有评论,来说两句吧...