信号qt来自非qt线程,QueuedConnection [英] signal qt from a non-qt thread, QueuedConnection
问题描述
我通过boost ::线程发信号通知我的Qt GUI线程,我使用一个Qt :: QueuedConnection,
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.
编辑:我发现了问题,似乎我连接信号后,然后我的调用,但我确定否则,因为断点首先停止在GUI线程在连接调用,然后在发出
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每个人的分派线程的帮助和想法:D
ty everybody for the help and ideas :D
推荐答案
检查插槽名称和信号名称是否正确。通常,如果有问题(不正确的名称),则会在控制台中发出信号(错误消息)。此外,您可以检查connect函数调用的结果。如果连接失败,则应返回false。
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.
这篇关于信号qt来自非qt线程,QueuedConnection的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!