Solved How to register custom pointer so that signal/slot can use it?
-
I want to pass 2 custom pointers using signal/slot.
My signal is defined asvoid createTimerRequest(const timer::CreateTimerRequest* request, std::promise<timer::CreateTimerReply_Status> *promise);
I try to use
qRegisterMetaType<std::promise<timer::CreateTimerReply_Status>*>("std::promise<timer::CreateTimerReply_Status>*"); qRegisterMetaType<timer::CreateTimerRequest*>("timer::CreateTimerRequest*");
But it doesnot work. The slot function is no called.
Any ideas??Thank you.
-
You have to also declare these types using
Q_DECLARE_METATYPE
. When callingconnect
check if the return value istrue
. If not, look for warnings printed to terminal. If there are warnings, post them here. -
Oh, my fault. My eventloop is dead lock. No need to register pointer, in fact.