Hi, I encountered something that bothers me for a few days. I would be thankful if someone can point nice workaround for such case:
class MyClass { Q_OBJECT Q_PROPERTY(MyEnum myEnumProperty ...) Q_PROPERTY(QVariantList availableValuesOfMyEnum ...) public: enum MyEnum { MyEnumValue1, MyEnumValue1 } Q_ENUM(MyEnum) } >From Qt Quick everything works ok except indexOf: objectOfMyClass.availaleValuesOfMyEnum.indexOf(objectOfMyClass.myEnumProperty) gives -1 And it is reasonable because availaleValuesOfMyEnum is list of QVariant not list of MyEnum. If I change type of myEnumProperty to QVariant, indexOf works ok, but javascript switch doesn't (QVariant is not int). Additionally myEnumProperty is printed nicely in logs from Qt Quick(not raw integer value). Question: Does anyone has better idea how to expose list of enums to QtQuick so that searching for enum in such list will work out of the box? Cheers, Tomek
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest