I have a public signal called UpdateScreenshots in the workspacemanager class that takes screenshots of some widgets. It then returns these screenshots in a struct I've defined. This call is made from a thread as taking screenshots can apparently only be done on the main thread. However, this invokemethod call is not working and the updatescreenshots slot is not being called. What could I be doing wrong? Is there a better way to do this?
invokeMethod call
VmsWorkspaceManager::InfoStruct info;
QMetaObject::invokeMethod(m_Manager, "UpdateScreenshots", Qt::BlockingQueuedConnection,
Q_RETURN_ARG(Vms::GuiWidgets::VmsWorkspaceManager::InfoStruct, info));
The definition of the slot;
public slots:
/**
* \brief Updates the current screenshots to be sent to a remote client
*/
InfoStruct UpdateScreenshots() const;
First, make sure you have this declaration at the bottom of the
InfoStruct
header:Then, on top of your
main
function, have this call:Since you're using namespaces, you must be very consistent with them, so be sure the slot signature is like this: