Details
-
Suggestion
-
Resolution: Duplicate
-
Not Evaluated
-
4.7.1
-
None
Description
See attached example:
What works: if I have an enum declared by Q_ENUMS, then in qml I can use its values (by ClassName.ENUM_ID):
In TestClass declaration
Q_ENUMS(test_enum)
enum test_enum { ENUM1, ENUM2 };
In qml
console.log("TestClass.ENUM1 == " + TestClass.ENUM1);
returns:
TestClass.ENUM1 == 0
Similarly one can use enums for properties.
What does not work: if I have a public slot:
In TestClass declaration
QString testFunction(test_enum)
then
In qml
console.log(instance.testFunction(TestClass.ENUM1));
gives an error:
test.qml:12: Error: Unknown method parameter type: test_enum
So the request is: please enable the last structure: please enable calling from qml slots which arguments are declared enums of classes registered by qmlRegisterType.