Hi, No namespaces and no forgotten import. It is really strange. The class in which I defined the enums is a QAbstractTableModel, which I use as model in QML. As I wrote, everything works perfectly, except for the enums. So the code cannot be that wrong. In another project I managed to use my C++ enums in QML. Now I did the same and it works. So far my problem is solved.
BUT... I don't understand the difference. The solution which works is that I put the enums in a class of their own. The only differences in the code is that the enum class inherits QObject and not QAbstractTableModel and the enum class is registered with qmlRegisterUncreatableType not with qmlRegisterType. The QObject instead of QAbstractTableModel should not make a difference, since QAbstractTableModel is also a QObject. And qmlRegisterUncreatableType/qmlRegisterType should not make a difference either. Guido On Fri, 15 Nov 2013 09:51:11 +0100 Ola Røer Thorsen <o...@silentwings.no> wrote: > Did you remember to import your registered type in your qml code? If you > register something like this, > > qmlRegisterType<MyClass>("MyClass",1,0,"MyClass"); > > where you have your enums then in qml you need to import that type on the > top of your code, > > import MyClass 1.0 > > Cheers, > Ola > > > > > 2013/11/14 Guido Seifert <warg...@gmx.de> > > > Hi, > > I have a little problem with my enums in QtQuick 2. > > > > Im a C++ class I created an enum and used Q_ENUMS to make the enums known > > to the property system. > > I registered my class with qmlRegisterType. > > So far so good. Works. I can invoke methods, which I marked with > > Q_INVOKABLE. Get signals from C++. > > Everythings works as expected. What I don't expect is that all my C++ > > enums are 'undefined'. > > The QtCreator completion finds all enum names, so some of the export must > > have worked. > > However, I don't get any values. > > > > Any ideas? > > > > Guido > > _______________________________________________ > > Interest mailing list > > Interest@qt-project.org > > http://lists.qt-project.org/mailman/listinfo/interest > > _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest