How to declare New-Signal-Slot syntax in Qt 5 as a parameter to function
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: How can I pass signal or slot (member-function, new syntax in Qt 5) as a parameter to function and then call connect ? e.g. I want to write a function that waits for a signal. Note : It is not compile - PointerToMemberFunction is my question. bool waitForSignal(const QObject* sender, PointerToMemberFunction??? signal, int timeOut = 5000/*ms*/) { if (sender == nullptr) return true; bool isTimeOut = false; QEventLoop loop; QTimer timer; timer.setSingleShot(true); QObject::connect(&timer, &QTimer::timeout, [&loop, &isTimeOut]() { loop.quit();