Hello all!
I have the following problem: i declare enum in C++ and share it to QML context
class TestClass{
Q_OBJECT
Q_ENUMS(testEnum)
public:
enum testEnum{
Low = 0,
Mid = 1,
High = 2
};
}
qmlRegisterUncreatableType<TestClass>("CppImport", 1, 0, "TestClass", "NOT MAY CREATE");
In QML I’m trying to create property variant:
import QtQuick 1.1
import CppImport 1.0
QtObject{
property variant dict:{
TestClass.Low: "Low string",
TestClass.Mid: "Mid string",
TestClass.High: "High string",
}
}
I have this error:
Expected token `:' TestClass.Low: "Low string",
It is a bug? or I do not quite understand QML? Q_ENUMS should be represented as integers in QML. how to get around this error?
My Qt version: 4.8.4. Sory for bad english.
↧