which works fine. Then I wanted to clean the code up a little more, and removed the "public:", given that the above is a `struct`, so everything in it is public anyhow. And that's where it stopped working !

The Q_GADGET macro contains a "private:", just like the Q_OBJECT macro:

#define Q_GADGET_EXPORT(...) \
public: \
    static __VA_ARGS__ const QMetaObject staticMetaObject; \
    void qt_check_for_QGADGET_macro(); \
    typedef void QtGadgetHelper; \
private: \
    QT_WARNING_PUSH \
    Q_OBJECT_NO_ATTRIBUTES_WARNING \
Q_DECL_HIDDEN_STATIC_METACALL static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **); \
    QT_WARNING_POP \
    QT_ANNOTATE_CLASS(qt_qgadget, "") \
    /*end*/

/* qmake ignore Q_GADGET */
#define Q_GADGET Q_GADGET_EXPORT()

Why isn't the MOC using an actual compiler frontend to analyse these declarations ?

There have been some attempts to modernize moc, but so far the custom C++ parser has been the preferred choice. It has the upside of not requiring any dependencies and being fairly fast. I'm not an expert in that particular area, though.

best regards,
Ulf
_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

Reply via email to