Qt5: How to wait for a signal in a thread?

后端 未结 4 1876
一个人的身影
一个人的身影 2021-01-31 04:46

Probably the title question is not very explicit. I am using Qt5 on Windows7.

In a thread (QThread) at some point, in the \"process()\" function/method, I m

4条回答
  •  梦谈多话
    2021-01-31 05:32

    Starting in Qt 5.0, QSignalSpy offers a wait method. You hook it up to a signal and wait() will block until the signal fires.

    QSignalSpy spy(SIGNAL(encrypted()));
    spy.wait(5000);  //wait until signal fires or 5 second timeout expires
    

提交回复
热议问题