aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2022-05-03 21:10:26 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-05-04 17:06:58 +0000
commitd355b044b589e20b1eafbf349836337287f20f14 (patch)
treed0eb1a8e4af15a43edd5d4c4ac7ef7c322ad5635
parentde1149bc259d942cc61cd8e7400572f9381c34c1 (diff)
Fix overriding QGraphicsItem::itemChange()
9ef3c0041c489bd9f939c45a571026c3e2227685 introduced meta type registration for pointers to value classes for signals and slots. Registering QGraphicsItemGroup* breaks QGraphicsItem::itemChange() which returns a QGraphicsItem* in ParentChange. When a QVariant<QGraphicsItemGroup*> is returned, Qt cannot recognize this. As a quick fix, disable for meta type registration for polymorphic classes. This needs to be made configureable. Fixes: PYSIDE-1887 Change-Id: I714236031c2011790cbba58da40af35d05d09d33 Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> (cherry picked from commit e0a24f5c43086049d491ce3d3daa10e225c52273) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--sources/shiboken6/generator/shiboken/cppgenerator.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/sources/shiboken6/generator/shiboken/cppgenerator.cpp b/sources/shiboken6/generator/shiboken/cppgenerator.cpp
index 6d28432db..bdd03845c 100644
--- a/sources/shiboken6/generator/shiboken/cppgenerator.cpp
+++ b/sources/shiboken6/generator/shiboken/cppgenerator.cpp
@@ -5800,7 +5800,10 @@ void CppGenerator::writeInitQtMetaTypeFunctionBody(TextStream &s, const Generato
// Qt metatypes are registered only on their first use, so we do this now.
bool canBeValue = false;
if (metaClass->isObjectType()) {
- if (!metaClass->isQObject())
+ // Generate meta types for slot usage, but not for polymorphic
+ // classes (see PYSIDE-1887, registering // QGraphicsItemGroup*
+ // breaks QGraphicsItem::itemChange()). FIXME: Make configureable.
+ if (!metaClass->isQObject() && !metaClass->isPolymorphic())
s << "qRegisterMetaType< ::" << className << " *>();\n";
} else {
// check if there's a empty ctor