views:

294

answers:

2

hello,

I am signaling my Qt GUI thread from a boost::thread, and I am using a Qt::QueuedConnection,

 connect(src, SIGNAL(signal-signature), dest, SLOT(slot-signature), Qt::QueuedConnection);

and still, when I emit the signal my slot does not get called.

edit: I found the problem, it seems that I was connecting the signal later then my call, but I was sure of the otherwise since breakpoints stopped first on the GUI thread at the connect call and then on the dispatch thread that does the emit

ty everybody for the help and ideas :D

+2  A: 

Check whether the slot name and signal name are correct. Usually, if there is a problem (incorrect name), this is signaled in the console (an error message). Also, you could check the result of the connect function call. It should return false in case of connection unsuccessful.

Cătălin Pitiș
connect returns true, connection is succesfull, slot and signal names are correct, I am calling the signal from a non-Qt thread
lj8888
A: 

I would assume both threads need to be QThread with a QEventLoop to have that work.

guruz
my emit is done from a non-Qt thread
lj8888
That's why you use a Qt::QueuedConnection - it causes the slot to be executed by the receiving object's event loop. What he's trying to do will work fine, he's just got something wrong that we're not able to see.
Brian Roach