2

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

lj8888
  • 51
  • 1
  • 4
  • We'd need more code to be able to answer. What you're trying to do is possible, and that is the correct syntax for `connect()` – Brian Roach Apr 22 '10 at 19:53

2 Answers2

2

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ș
  • 14,123
  • 2
  • 39
  • 62
  • connect returns true, connection is succesfull, slot and signal names are correct, I am calling the signal from a non-Qt thread – lj8888 Apr 22 '10 at 11:20
0

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

guruz
  • 1,604
  • 14
  • 21
  • 1
    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 Apr 22 '10 at 19:47
  • not true. I can update Qt GUI from Posix thread, using signal-slot mechanism – 4pie0 Jun 18 '13 at 13:24