Hello,
i have several questions about the Qt MetaObject system, related to issues i have with an application i'm working on.
1) Namespace Enums.
i have a very wide namespace named "RE". To allow declaration of enums and types inside that namespace while still being covered by the Qt MetaObject processing system, i use such trick:
#ifdef Q_MOC_RUN
class RELibOpt RE {
Q_GADGET
Q_ENUMS (AnEnum, AnotherEnum)
public:
#else
namespace RE {
#endif
// My whole fake class / namespace comes here,
// including all my enums declarations... Is there another way to make an enum "global" but still part of the parsed meta-object system?...
}
Q_DECLARE_METATYPE(RE::AnEnum);
Q_DECLARE_METATYPE(RE::AnotherEnum);
#ifdef Q_MOC_RUN
class RELibOpt RE {
Q_GADGET
Q_ENUMS (AnEnum, AnotherEnum)
public:
#else
namespace RE {
#endif
// My whole fake class / namespace comes here,
// including all my enums declarations... Is there another way to make an enum "global" but still part of the parsed meta-object system?...
}
Q_DECLARE_METATYPE(RE::AnEnum);
Q_DECLARE_METATYPE(RE::AnotherEnum);
To copy to clipboard, switch view to plain text mode
Is that right to do that? What would be the other solution to have a namespace containing enums and registered typedefs? i would like to be able to have my enums part of my "RE" namespace exactly as the Qt enums are part of the "Qt" namespace... What is Qt in this case? A class? A namespace? How is it processed by MOC?
2) Properties and Enums.
Still in my "RE" namespace, i have classes. In those classes, i use the Q_PROPERTY macro. However, if in a class RE::A i use a Q_PROPERTY using RE::AnEnum as it's base type, i'm unable to enumerate it's content with QMetaEnum: the QMetaProperty exists but says it's not an enum type! What is the solution to do that?
Thanks a lot,
Pierre.
Bookmarks