Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
6.4
-
None
Description
Consider
class TestTest : public QObject { Q_OBJECT Q_ENUMS(MyEnum) Q_FLAGS(MyEnumFlag) Q_PROPERTY(MyEnumFlag fprop READ fprop) public: enum MyEnum { A = 0x01, B = 0x02 }; Q_DECLARE_FLAGS(MyEnumFlag, MyEnum); MyEnumFlag fprop() const { return A; } }; Q_DECLARE_OPERATORS_FOR_FLAGS(TestTest::MyEnumFlag)
Now if one clones its metaobject via something like
QMetaObjectBuilder builder(&TestTest::staticMetaObject); QMetaObject *meta = builder.toMetaObject();
then the staticMetaObject and the new one have different property flags for the MyEnumFlag property.
auto i = m->indexOfProperty("fprop");
QMetaProperty p = m->property(i);
qDebug() << i << p.name() << p.typeName() << p.isEnumType() << p.isFlagType();
on the true metaobject and on the clone says:
1 fprop QFlags<TestTest::MyEnum> true true 1 fprop QFlags<TestTest::MyEnum> false false
It seems it boils down to the QMetaEnum inside QMetaProperty not being initialized correctly in the second case, but I have no idea how to go in there.
Attachments
Issue Links
- relates to
-
QTBUG-83664 QMetaType::typename() doesn't return the registered typedef for a QFlag
- Reported
- mentioned in
-
Page Loading...
Gerrit Reviews
For Gerrit Dashboard: QTBUG-101426 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
399035,6 | QMetaType: use flag name as name in metatype (for Q_FLAG without s) | dev | qt/qtbase | Status: NEW | 0 | 0 |
399036,1 | WIP: QMetaObjectBuider: test case | dev | qt/qtbase | Status: ABANDONED | -2 | 0 |