[Interest] C++ enums undefined in QML
Bo Thorsen
bthorsen at ics.com
Fri Nov 15 09:40:17 CET 2013
Den 14-11-2013 21:36, Guido Seifert skrev:
> 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.
Only thing that comes to mind is if you use namespaces?
I have done exactly what you say here, and it works as expected.
class Foo : public QObject {
Q_OBJECT
Q_ENUMS(Bar)
public:
enum Bar { ... };
}
main() {
qmlRegisterType<Foo>(url, 1, 0, "Foo");
setQmlFile(...);
}
This should be all there is to it.
I hope this helps.
Bo.
--
Bo Thorsen, European Engineering Manager, ICS
Integrated Computer Solutions. Delivering World-Class Applications
http://ics.com/services
More information about the Interest
mailing list