Details
-
Bug
-
Resolution: Invalid
-
P2: Important
-
None
-
5.12.0
-
Qt Creator 4.8.1
Description
The following code causes the enum UserType does not work in QML:
namespace Model { Q_NAMESPACE enum class UserProperty { UserType, UserId, }; Q_ENUM_NS(UserProperty) enum class UserType { Normal, Super, }; Q_ENUM_NS(UserType) } // namespace model
You can check it attached application.
I think the code generated by MOC is incorrect (It does not distinguish between Model::UserProperty::UserType and Model::UserType):
#define QT_MOC_LITERAL(idx, ofs, len) \ Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \ qptrdiff(offsetof(qt_meta_stringdata_Model_t, stringdata0) + ofs \ - idx * sizeof(QByteArrayData)) \ ) static const qt_meta_stringdata_Model_t qt_meta_stringdata_Model = { { QT_MOC_LITERAL(0, 0, 5), // "Model" QT_MOC_LITERAL(1, 6, 12), // "UserProperty" QT_MOC_LITERAL(2, 19, 8), // "UserType" QT_MOC_LITERAL(3, 28, 6), // "UserId" QT_MOC_LITERAL(4, 35, 6), // "Normal" QT_MOC_LITERAL(5, 42, 5) // "Super" }, "Model\0UserProperty\0UserType\0UserId\0" "Normal\0Super" }; #undef QT_MOC_LITERAL
Attachments
Issue Links
- relates to
-
QTBUG-73402 Problem with enum class from namespace used as QObject property
- Closed