diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-07-25 18:02:09 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-07-26 22:14:56 +0000 |
commit | 9ce4006565c4fd4420f01e4c2d767b67b89698da (patch) | |
tree | 9198d896d746575dd804f6aed9d7dd531d01569e /src/tools | |
parent | 89f784757e81c7df540ce757eccb8af4da1c8e22 (diff) |
Fix moc'ing of enum class flags
Keep the original class name around for a little longer so we can
generate the correct scoped enum in the moc output.
Task-number: QTBUG-47652
Change-Id: Ib5934316fa786cc475335b03c86b8ec2dc239055
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'src/tools')
-rw-r--r-- | src/tools/moc/generator.cpp | 3 | ||||
-rw-r--r-- | src/tools/moc/moc.h | 1 |
2 files changed, 3 insertions, 1 deletions
diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp index aa02fc0af5..3dddbe907d 100644 --- a/src/tools/moc/generator.cpp +++ b/src/tools/moc/generator.cpp @@ -202,6 +202,7 @@ void Generator::generateCode() } QByteArray alias = cdef->flagAliases.value(def.name); if (cdef->enumDeclarations.contains(alias)) { + def.className = def.name; def.name = alias; enumList += def; } @@ -922,7 +923,7 @@ void Generator::generateEnums(int index) const QByteArray &val = e.values.at(j); QByteArray code = cdef->qualified.constData(); if (e.isEnumClass) - code += "::" + e.name; + code += "::" + (e.className.isNull() ? e.name : e.className); code += "::" + val; fprintf(out, " %4d, uint(%s),\n", stridx(val), code.constData()); diff --git a/src/tools/moc/moc.h b/src/tools/moc/moc.h index 5f8cdfcf2c..190fdfb733 100644 --- a/src/tools/moc/moc.h +++ b/src/tools/moc/moc.h @@ -64,6 +64,7 @@ Q_DECLARE_TYPEINFO(Type, Q_MOVABLE_TYPE); struct EnumDef { QByteArray name; + QByteArray className; QList<QByteArray> values; bool isEnumClass; // c++11 enum class EnumDef() : isEnumClass(false) {} |