removing parent is essential http://doc.qt.io/qt-5/qobject.html#moveToThread
"The object cannot be moved if it has a parent."
The children will follow to the new thread.
For the reparenting, maybe you can shed some light on it. From what I
understand, moveToThread, make that thread responsible to delete the object
and own him now (the object have the thread affinity to that thread from
now on), why can't you use a parent into that thread then?
Thread#1:
- ObjA
- ObjB as child of A
Thread#2:
- ObjC
Code:
ObjB->setParent(nullptr);
ObjB->moveToThread(Thread2);
Now you have:
Thread#1:
- ObjA
Thread#2:
- ObjC
- ObjB
why inside thread2 set parent of ObjB to ObjC is bad? to get the following:
Thread#2:
- ObjC
- ObjB as child of C
On Wed, May 27, 2015 at 10:23 AM, Thiago Macieira <[email protected]
> wrote:
> On Wednesday 27 May 2015 09:49:06 Jérôme Godbout wrote:
> > Before making the moveToThread(), remove the parent of the object,
> > ->setParent(nullptr);
> > Once moved, you can reparent with object into that Thread.
>
> No, you cannot. The parent must be another object that lives in the current
> thread.
> --
> Thiago Macieira - thiago.macieira (AT) intel.com
> Software Architect - Intel Open Source Technology Center
>
> _______________________________________________
> Interest mailing list
> [email protected]
> http://lists.qt-project.org/mailman/listinfo/interest
>
_______________________________________________
Interest mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/interest