How to use own enum with Q_INVOKABLE and namespace
Unsolved
QML and Qt Quick
-
Hi,
i will use this function from qml.Q_INVOKABLE bool startBackUp(SomeEnum i);
The Enum is definied in *. h file:
namespace MyNamespace { Q_NAMESPACE enum class SomeEnum { Foo, Bar }; Q_ENUM_NS(SomeEnum) }
I did the registration (``` qmlRegisterUncreatableMetaObject(MyNamespace::staticMetaObject, ..."MyNamespace", ```)
Im write the ```
"import myImort 1.0"
Is use the function in qml:
Model.startBackUp( MyNamespace.Foo) // works not! console.log("MyEnums: " + MyNamespace.Foo + " " + MyNamespace.bar ) // works: MyEnums: 0 1
I get the Message: ```
Error: Unknown method parameter type: MyNamespace.Fooit works fine if i using an Integer datatype: ```
Q_INVOKABLE bool startBackUp(int i); // works Model.startBackUp( MyNamespace.Foo) // works
-
Hi,
Do you also call Q_DECLARE_METATYPE and qRegisterMetaType ?