I do need to invoke a method from my MainWindow class, that inherit from QMainWindow
class from a class outside MainWindow, something like this:
Q_ASSERT(QMetaObject::invokeMethod(mainWindow, "attachmentDownloadComplete"));
mainWindow
is of class MainWindow : public QMainWindow
type
the error is:
no matching function for call to 'QMetaObject::invokeMethod(MainWindow*&, const char [27])'
Q_ASSERT(QMetaObject::invokeMethod(mainWindow, "attachmentDownloadComplete"));
My question is how can I manage to call invoke this method?
The problem is, the slot you are trying to invoke has an input argument.
When you have an input argument you need to specify the argument with
Q_ARG.
ex:
In my main window I have a slot, as shown below.
In some other file when invoking it, should do as said below. Tested and working as expected.
First parameter - Your main window object.
Second parameter - The slot name.
From third on all your input parameters with types.
If you have any return type use