aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/generator/shiboken/cppgenerator.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2021-10-04 16:38:36 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2021-10-05 17:02:34 +0200
commit292a8e2426b14f98f4863dc58b5bf363ca97e748 (patch)
tree49447957883237e6881c568b889b6f5a45ce42b1 /sources/shiboken6/generator/shiboken/cppgenerator.cpp
parent2bdb0154c9409169f1b1d143cb328b741fe09568 (diff)
PySide6: Fix QObject.property() for QFlag types
QObject::property() returns a QVariant for whose type a shiboken converter is retrieved by name (QVariant::typeName()). This fails for QFlags types since QVariant::typeName() returns the fully expanded name QFlag<Enum>. Register the flags converter under that name, too, to fix this. Pick-to: 6.2 Fixes: PYSIDE-1673 Change-Id: I23e83da34b82196d76b78fa44f67647da65737c8 Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources/shiboken6/generator/shiboken/cppgenerator.cpp')
-rw-r--r--sources/shiboken6/generator/shiboken/cppgenerator.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/sources/shiboken6/generator/shiboken/cppgenerator.cpp b/sources/shiboken6/generator/shiboken/cppgenerator.cpp
index 5db3d82e3..4af72beda 100644
--- a/sources/shiboken6/generator/shiboken/cppgenerator.cpp
+++ b/sources/shiboken6/generator/shiboken/cppgenerator.cpp
@@ -4108,6 +4108,14 @@ void CppGenerator::writeEnumConverterInitialization(TextStream &s, const TypeEnt
else
break;
}
+ if (flags) {
+ // PYSIDE-1673: Also register "QFlags<Class::Option>" purely for
+ // the purpose of finding the converter by QVariant::typeName()
+ // in the QVariant conversion code.
+ s << "Shiboken::Conversions::registerConverterName(converter, \""
+ << flags->name() << "\");\n";
+ }
+
}
s << "}\n";