Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个类,它有一个由主线程和其他 3 个线程调用的方法(2 个 QThreads 和 1 个使用 QtConcurrent::run())。在这种方法中,我有时会发出一个信号。这是可以的还是会导致问题,因为我没有发出属于调用线程的信号。
是的,这完全没问题。QT 透明地为您进行线程间通信。如果需要触发的插槽位于另一个线程中,则信号将排队并在目标线程进入其事件循环时被目标线程接收。
您可以尝试一下,看看在调试器中会发生什么。