PDA

View Full Version : Gui and non-Gui thread problem



AviMittal
21st September 2009, 11:43
Hi

I am working on QtC++ (version 4.4.). I am trying to post an event from non-gui thread to gui thread. For most of cases it works fine but don't know why for one particular case its generating error saying:


QObject::connect: Cannot queue arguments of type 'QItemSelection'
(Make sure 'QItemSelection' is registered using qRegisterMetaType().)
QCoreApplication::sendPostedEvents: Cannot send posted events for objects in another thread
QCoreApplication::sendPostedEvents: Cannot send posted events for objects in another thread


Please suggest.

andy.fillebrown
21st September 2009, 14:03
Connecting objects in different threads is a little different than what you're expecting (slots are queued and executed via the event system when signalled, and parameters in the signals/slots get copied instead of passed directly). Check out the following links for more info...

http://doc.trolltech.com/4.4/threads.html#accessing-qobject-subclasses-from-other-threads
http://doc.trolltech.com/4.4/threads.html#signals-and-slots-across-threads

and most importantly make sure you understand the design of the Mandlebrot example...
http://doc.trolltech.com/4.4/threads-mandelbrot.html

Hope that helps
~ andy.f