summaryrefslogtreecommitdiffstats
path: root/src/tools/moc/generator.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2013-12-23 15:16:08 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-12-24 08:10:16 +0100
commit2b287c7c210ac708c0f8872e51517e0d46380ad3 (patch)
tree42a127faabe1318db2ef18cfdd7dc1ffc6ab58e5 /src/tools/moc/generator.cpp
parentd776937df91e46536f404c6868d64016b6038d7b (diff)
Fix regression in property handling with enums from gadgets
When declaring a Q_PROPERTY(SomeType::SomeEnum foo ...) and SomeType is not a QObject but a gadget, then we must still include SomeType's meta object in the list of related meta objects. Task-number: QTBUG-35657 Change-Id: I46195140cb5d180c4f03bb1fe06a876e3fe11267 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Diffstat (limited to 'src/tools/moc/generator.cpp')
-rw-r--r--src/tools/moc/generator.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp
index 0740a860ba..8c1a2f0354 100644
--- a/src/tools/moc/generator.cpp
+++ b/src/tools/moc/generator.cpp
@@ -87,8 +87,9 @@ QT_FOR_EACH_STATIC_TYPE(RETURN_METATYPENAME_STRING)
return 0;
}
-Generator::Generator(ClassDef *classDef, const QList<QByteArray> &metaTypes, const QHash<QByteArray, QByteArray> &knownQObjectClasses, FILE *outfile)
+Generator::Generator(ClassDef *classDef, const QList<QByteArray> &metaTypes, const QHash<QByteArray, QByteArray> &knownQObjectClasses, const QHash<QByteArray, QByteArray> &knownGadgets, FILE *outfile)
: out(outfile), cdef(classDef), metaTypes(metaTypes), knownQObjectClasses(knownQObjectClasses)
+ , knownGadgets(knownGadgets)
{
if (cdef->superclassList.size())
purestSuperClass = cdef->superclassList.first().first;
@@ -452,8 +453,11 @@ void Generator::generateCode()
// The scope may be a namespace for example, so it's only safe to include scopes that are known QObjects (QTBUG-2151)
QHash<QByteArray, QByteArray>::ConstIterator scopeIt = knownQObjectClasses.find(unqualifiedScope);
- if (scopeIt == knownQObjectClasses.constEnd())
- continue;
+ if (scopeIt == knownQObjectClasses.constEnd()) {
+ scopeIt = knownGadgets.find(unqualifiedScope);
+ if (scopeIt == knownGadgets.constEnd())
+ continue;
+ }
const QByteArray &scope = *scopeIt;
if (scope == "Qt")