I'm trying to pass a JS object (map) to a C++ member function with a signature
Q_INVOKABLE virtual bool generate(QObject* context);
by using
a.generate({foo: "bar"});
The method is called (detected via breakpoint), but the passed context parameter is NULL. Since the documentation mentions that JS objects will be passed as QVariantMap, I've tried using the signature
Q_INVOKABLE virtual bool generate(QVariantMap* context);
but this failed during MOC. Using
Q_INVOKABLE virtual bool generate(QVariantMap& context);
causes the method to not be found at runtime by QML (error message is "Unknown method parameter type: QVariantMap&").
The documentation only has an example of passing a QVariantMap from C++ to QML, not in the other direction.
Using a public slot instead of a Q_INVOKABLE shows exactly the same behavior and errors.