Hi,
I am developing an application where in I am providing facilities like Import, Merge.
As Import, Merge are time consuming operation I perform these operations on a thread. I use QtConcurrent::run() method or QObject::moveToThread() method along with appropriate connects to perform the operation.
Firstly can you please specify which method is best suited and I should use ?
My problem is, I am creating new custom QGraphicsItem inside these function and adding some connects inside the constructor.
As these objects are created as a part of the thread that it is running I have to use moveToThread(QCoreApplication::instance()->thread());
Am I doing the right thing or is there any other way to solve this ?
Also after thread completion I move to the main application thread and add these custom QGraphicsItem to the scene.
I am facing problem when I interact with these QGraphicsItems giving problems such as "QObject: Cannot create children for a parent that is in a different thread." or sometimes "ASSERT failure in QCoreApplication::sendEvent: "Cannot send events to objects owned by a different thread."
What am I doing wrong ? Can you please solve the issue ?
Bookmarks