Daniyar
Daniyar

Reputation: 1720

Get QThread that created QObject

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();

Upvotes: 0

Views: 188

Answers (1)

RA.
RA.

Reputation: 7777

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

QThread* answer = tmp->thread();

Upvotes: 2

Related Questions