[Development] export gobal enums to QML

Bo Thorsen bo at vikingsoft.eu
Tue Sep 2 08:36:52 CEST 2014


Den 02-09-2014 07:48, Salomon, Florian skrev:
> Hi,
> i’d like to know, if there is any possibility to export global enums
> (defined in a separate header file) to QML?
> #include “errcodes.h”
> Class A : QObject
> {
>          Q_OBJECT
>          Q_ENUMS(eErrorIDs)
> public:
>          enum globalErrCodes eErrorIDs;
> }

Hi Florian,

No, you have to declare the enums directly in the QObject derived class. 
The generated moc code won't work if you don't.

Side note: If someone on this list is looking for a pet project, this 
might be a good candidate. I think it's the third time someone has asked 
this on devel or interest in the last couple of months.

Bo Thorsen,
Director, Viking Software.

-- 
Viking Software
Qt and C++ developers for hire
http://www.vikingsoft.eu



More information about the Development mailing list