diff options
| author | Phil Thompson <phil@riverbankcomputing.com> | 2024-10-23 16:28:27 +0100 |
|---|---|---|
| committer | Phil Thompson <phil@riverbankcomputing.com> | 2024-10-29 20:04:58 +0000 |
| commit | 5624060865e3ccd3c487f10355cb740b7322f93c (patch) | |
| tree | d97badaf1be663c7db65526546588ac8ba6b8133 /src/corelib/kernel/qmetaobjectbuilder.cpp | |
| parent | 1558811a8485f6dcc51a50a2bba0846091ca8bf6 (diff) | |
Fix QFlag properties built by QMetaObjectBuilder
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.
This change to parse_scope() removes the "QFlags<>" so that the
template type can then be parsed.
Another 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.
Pick-to: 6.8
Change-Id: Iac9e2db2f134029709158b4e500286922396501d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/kernel/qmetaobjectbuilder.cpp')
0 files changed, 0 insertions, 0 deletions
