Some QThread * worker has created QObject *tmp = new QObject(). How can another thread identify the worker given tmp? Is there something like:

QThread *answer = tmp->getThreadThatCreatedThisObject();

有帮助吗?

解决方案

You are probably looking for QObject::thread():

QThread* answer = tmp->thread();
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top