summaryrefslogtreecommitdiffstats
path: root/src/tools/moc/generator.cpp
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>2015-01-12 15:55:13 +0100
committerGabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>2015-01-13 11:25:53 +0100
commite18f4bca288804cf13c87b06c6dfe21291ca274a (patch)
treedb6d26dcdc68b6215f5f2dac4a12301bb4c19371 /src/tools/moc/generator.cpp
parentdf6d2290e6399471431811160a0c0ff2eb16cb62 (diff)
moc: Don't link to inexistent parent staticMetaObject
Contrarily to Q_OBJECTs, Q_GADGETs are not guaranteed to descend from a Q_GADGET. Here, we ensure that if the first superclass is a Q_GADGET, then the derived class will be treated as one. This allows gaps in the Q_GADGET hierarchy while preventing from trying to link to the inexistent staticMetaObject if there's no such ancestor. Change-Id: If10fb952e23655102a425bb18fe8babaf447a47f Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
Diffstat (limited to 'src/tools/moc/generator.cpp')
-rw-r--r--src/tools/moc/generator.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp
index 2c41b17b68..f27c155da5 100644
--- a/src/tools/moc/generator.cpp
+++ b/src/tools/moc/generator.cpp
@@ -530,7 +530,7 @@ void Generator::generateCode()
if (isQObject)
fprintf(out, " { Q_NULLPTR, ");
- else if (cdef->superclassList.size())
+ else if (cdef->superclassList.size() && (!cdef->hasQGadget || knownGadgets.contains(purestSuperClass)))
fprintf(out, " { &%s::staticMetaObject, ", purestSuperClass.constData());
else
fprintf(out, " { Q_NULLPTR, ");