How to create QML enumeration like those of Qt QML type?



  • How to create QML enumeration? As we know Qt type have so many enumeration such as Qt.Key_Left. I want to create a custom enumeration like that.

    @SomeClass
    {
    property enumeration type: SomeClass.EnumerationValue
    }@



  • For doing that:

    • create a subclass of QObject,
    • add an enum declaration,
    • declare it using Q_ENUM and
    • register the object with qmlRegisterType

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.