[Qt-interest] QGraphicsScene problem

Patric userqt at gmail.com
Sat Aug 29 12:11:33 CEST 2009


Guys, good news. I'v found my problem :

In my run() method I had

forever {
// move items
msleep(simulationSpeed);
emit simulateNextTurnClick();


}



instead of



forever {

// move items

emit simulateNextTurnClick();

msleep(simulationSpeed);



}



Now every turn they are moving.



Anyway, I think the question regarding the usage of QGraphicsScene from 
other than the main thread still exists.

As you saw, you can MOVE around items of type QGraphicsTextItem around from 
another thread, but you can't set it's text for example.

Following error occurs in the second situation :


ASSERT failure in QCoreApplication::sendEvent: "Cannot send events to
objects owned by a different thread. Current thread 8deda50. Receiver '' (of
type 'QTextDocument') was created in thread 3d4988", file
kernel\qcoreapplication.cpp, line 305





I'll be happy to know why the the moving works and the setting of text 
don't.


Regards,

Patric




More information about the Qt-interest-old mailing list