Two object calls for Qt child threads
-
Hi community coders. I have a question about using QThread. There is a thread object
QThread* subThread = new QThread();
l Then there are two normal objects.
A* a = new A(); B* b = new B();
Then
a->moveToThread(subThread); b->moveToThread(subThread);
After completing the above steps, if the thread and the UI thread interact, you need to use the signal slot mechanism. So now that both a and b have moved to subThread thread, can a and b be called directly? For example, execute the b.say() method in a. In short, they all move to the same thread object through moveToThread, can they be called directly without signal slots?
-
Hi community coders. I have a question about using QThread. There is a thread object
QThread* subThread = new QThread();
l Then there are two normal objects.
A* a = new A(); B* b = new B();
Then
a->moveToThread(subThread); b->moveToThread(subThread);
After completing the above steps, if the thread and the UI thread interact, you need to use the signal slot mechanism. So now that both a and b have moved to subThread thread, can a and b be called directly? For example, execute the b.say() method in a. In short, they all move to the same thread object through moveToThread, can they be called directly without signal slots?
@Nan-Feng said in Two object calls for Qt child threads:
can they be called directly without signal slots?
yes
-
@Nan-Feng said in Two object calls for Qt child threads:
can they be called directly without signal slots?
yes
-
-