Hi,

I've come across another issue when using QMetaObjectBuilder specifically related to creating properties that have a flags type.

When Q_PROPERTY is used to define a property with type (for example) Qt::Alignment the name of the type stored in the meta-object is "Qt::Alignment".

When QMetaObjectBuilder.addProperty() is used it will instead use the name of the meta-type (ie. "QFlags<Qt::AlignmentFlag>") which it has obtained from QMetaType::fromName("Qt::Alignment").name().

In the QMetaProperty ctor it tries to resolve the QMetaEnum for the property and uses the internal parse_scope() to extract the scope and qualified key from the name. However it does not handle template names and so fails with dynamically created properties.

One solution would be for addProperty() to always use the type name it was given rather than use QMetaType::fromName(). That has the advantage that the layout of the dynamic meta-object would match that generated by moc.

Another solution would be to change parse_scope() to first strip out any "QFlags<" and ">".

Thanks,
Phil
--
Development mailing list
Development@qt-project.org
https://lists.qt-project.org/listinfo/development

Reply via email to