QML + QEnums
-
Greetings Qt community,
I'm calling this function from QML:
@Q_INVOKABLE OtherClass::Type Class::getType() const;@
In the QML:
@property int type: -1type = class.getType();@
I get the following message:
@'Cannot assign [undefined] to int'@The enum is declared with Q_ENUM in the OtherClass. And I declared OtherClass with qmlRegisterType.
Am I missing something ?
Thanks.
-
Hi SteveKing,
That sounds like a bug. Can you confirm that it's still the case in QtQuick2? If so, please file a bug report.
Cheers,
Chris./edit: I should add - there is some special considerations with enums (and the QMetaObject extension stuff) which I'm not too familiar, so perhaps the fact that the source of the type information is a separate QMetaObject, is the issue in this particular case. I don't know. Either way, it should work - whether or not it's technically feasible to fix is another question...
-
Hi Chris,
I'm not using Qt5 (QtQuick2) yet so I don't know if it's there. I think this might be related to existing bugs: "15983":https://bugreports.qt-project.org/browse/QTBUG-15983 and "27041":https://bugreports.qt-project.org/browse/QTBUG-27041
Regards,
Steve