Moc: Propagate flags from aliases (Q_FLAG)

When creating the list of 'enums' to print into the moc file we
go through enums that have been defined and then we consult
aliases pointing to those names. If an alias is known we also
add this to the list. But we don't copy over the flags for the alias so
they have the exact same flags as the original enum.
In practice this is not a problem, the only flag it carries is
'EnumIsFlag' and we independently deduce this using the fact that it's
an alias.
It only really reveals itself in moc-output since we cannot
differentiate it from enum, so we print them all prefixed with an 'enum'
comment.

Change-Id: Iad055e69549ec1e854e1b5ac9992b035a4c343b4
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This commit is contained in:
Mårten Nordheim 2025-03-24 18:37:14 +01:00
parent 4cd66686e4
commit 2e61a7fc60

View File

@ -233,6 +233,7 @@ void Generator::generateCode()
QByteArray alias = cdef->flagAliases.value(def.name);
if (cdef->enumDeclarations.contains(alias)) {
def.name = alias;
def.flags |= cdef->enumDeclarations[alias];
enumList += def;
}
}