You can use Q_ENUMS to export enum names to the QML typesystem. Internally, all enums are just treated as ints so if something doesn't work, change your property type to int and things should start working ;-)
@
class MyType : public QObject
{
Q_OBJECT
Q_PROPERTY(MyEnum enumProp READ enumPropAccessor CONSTANT)
Q_ENUMS(MyEnum)
public:
enum MyEnum {
FirstValue = 1,
SecondValue = 2
};
MyType(QObject *parent = 0) : QObject(parent) {}
~MyType() {}
MyEnum enumPropAccessor() const { return FirstValue; }
};
@
In QML, you should be able to do:
@
MyType {
property int someValue: MyType.SecondValue
}
@
Cheers,
Chris.