diff options
author | Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> | 2019-06-17 12:51:25 +0200 |
---|---|---|
committer | Cristián Maureira-Fredes <cristian.maureira-fredes@qt.io> | 2019-07-02 12:37:04 +0200 |
commit | 423f12bb6908667e34a477ccf515a2377fc7a596 (patch) | |
tree | 2987f0deb6b7d03db57b99d6d7058050cea66490 | |
parent | 19e316d71dce61a3aab86875f4ade3963ece1fad (diff) |
Leave QVariantMap as a name, not a type
The problem happened on the QtLocation module,
when the QVariantMap argument was being used in several functions,
and this type was declared as a primitive-type in QtCore.
An approach to change the type to a container-type failed,
because since QVariantMap is a typedef, is was already registered
as a name associated to the definition QMap<QString, QVariant>.
The solution was to register the name at the beginning of the
module (like QVariantList), and remove the type declaration,
leaving it only as a name.
Previously, the wrongly generated code looked like this:
Shiboken::Conversions::PrimitiveTypeConverter<QVariantList>()
but with this patch, it looks like:
SbkPySide2_QtLocationTypeConverters[SBK_QTLOCATION_QMAP_QSTRING_QVARIANT_IDX]
which is the proper name established by the code on glue/qtcore.cpp:
Shiboken::Conversions::registerConverterName(SbkPySide2_QtCoreTypeConverters[SBK_QTCORE_QMAP_QSTRING_QVARIANT_IDX], "QVariantMap");
Change-Id: Id172cf5b1e3ac784bc9497359279e81fcba1d8ec
Fixes: PYSIDE-1028
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Tismer <tismer@stackless.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
-rw-r--r-- | sources/pyside2/PySide2/QtCore/typesystem_core_common.xml | 2 | ||||
-rw-r--r-- | sources/pyside2/PySide2/glue/qtcore.cpp | 5 |
2 files changed, 1 insertions, 6 deletions
diff --git a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml index 9ba45b2e5..4f800cc90 100644 --- a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml +++ b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml @@ -303,8 +303,6 @@ </conversion-rule> </primitive-type> - <primitive-type name="QVariantMap" target-lang-api-name="PyDict"/> - <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="qvariantmap-register"/> <inject-code class="native" position="beginning" file="../glue/qtcore.cpp" snippet="qvariantmap-check"/> <primitive-type name="QStringList"> <include file-name="QStringList" location="global"/> diff --git a/sources/pyside2/PySide2/glue/qtcore.cpp b/sources/pyside2/PySide2/glue/qtcore.cpp index cb5cb4e68..930ad9349 100644 --- a/sources/pyside2/PySide2/glue/qtcore.cpp +++ b/sources/pyside2/PySide2/glue/qtcore.cpp @@ -190,10 +190,6 @@ static QVariant QVariant_convertToVariantList(PyObject *list) } // @snippet qvariant-conversion -// @snippet qvariantmap-register -Shiboken::Conversions::registerConverterName(SbkPySide2_QtCoreTypeConverters[SBK_QTCORE_QMAP_QSTRING_QVARIANT_IDX], "QVariantMap"); -// @snippet qvariantmap-register - // @snippet qvariantmap-check static bool QVariantType_isStringList(PyObject *list) { @@ -519,6 +515,7 @@ PySide::runCleanupFunctions(); Shiboken::Conversions::registerConverterName(SbkPySide2_QtCoreTypeConverters[SBK_QSTRING_IDX], "unicode"); Shiboken::Conversions::registerConverterName(SbkPySide2_QtCoreTypeConverters[SBK_QSTRING_IDX], "str"); Shiboken::Conversions::registerConverterName(SbkPySide2_QtCoreTypeConverters[SBK_QTCORE_QLIST_QVARIANT_IDX], "QVariantList"); +Shiboken::Conversions::registerConverterName(SbkPySide2_QtCoreTypeConverters[SBK_QTCORE_QMAP_QSTRING_QVARIANT_IDX], "QVariantMap"); PySide::registerInternalQtConf(); PySide::init(module); |