aboutsummaryrefslogtreecommitdiffstats
path: root/sources
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2019-02-06 14:46:44 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2019-02-06 14:46:46 +0100
commit243f5ed3c79e6ac831f5e46b2f2b029ccfe5ea6b (patch)
tree6c66387e76eb6aef40ef51fc9b84109be3f253f2 /sources
parent9ef7df3e333177c7d71b5e7bb725f9f5ceb6cd9f (diff)
parentbc254363c36bee262f7e0477f5e3d0b5987fb3ba (diff)
Merge remote-tracking branch 'origin/5.12' into dev
Diffstat (limited to 'sources')
-rw-r--r--sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml39
-rw-r--r--sources/pyside2/PySide2/QtScxml/typesystem_scxml.xml9
-rw-r--r--sources/pyside2/PySide2/support/signature/mapping.py26
-rw-r--r--sources/pyside2/PySide2/templates/core_common.xml8
-rw-r--r--sources/pyside2/libpyside/pysidesignal.cpp3
-rw-r--r--sources/pyside2/tests/registry/exists_darwin_5_12_0_ci.py17
-rw-r--r--sources/pyside2/tests/registry/exists_opensuse423_5_12_0_ci.py17
-rw-r--r--sources/pyside2/tests/registry/exists_redhatenterpriselinuxworkstation74_5_12_0_ci.py17
-rw-r--r--sources/pyside2/tests/registry/exists_win32_5_12_0_ci.py17
-rw-r--r--sources/shiboken2/ApiExtractor/abstractmetalang.cpp8
-rw-r--r--sources/shiboken2/ApiExtractor/tests/testtemplates.cpp6
-rw-r--r--sources/shiboken2/generator/main.cpp2
-rw-r--r--sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp12
-rw-r--r--sources/shiboken2/generator/shiboken2/cppgenerator.cpp22
-rw-r--r--sources/shiboken2/generator/shiboken2/shibokengenerator.cpp8
-rw-r--r--sources/shiboken2/libshiboken/pep384impl.cpp2
-rw-r--r--sources/shiboken2/shibokenmodule/support/signature/loader.py9
-rw-r--r--sources/shiboken2/shibokenmodule/support/signature/mapping.py87
-rw-r--r--sources/shiboken2/shibokenmodule/support/signature/parser.py31
19 files changed, 222 insertions, 118 deletions
diff --git a/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml b/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml
index e61e1b6e7..eaff93345 100644
--- a/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml
+++ b/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml
@@ -1927,9 +1927,7 @@
<value-type name="QGenericMatrix" generate="no"/>
<value-type name="QMatrix2x2" since="4.6">
- <modify-function signature="QMatrix2x2(const float*)">
- <modify-argument index="1"><array/></modify-argument>
- </modify-function>
+ <modify-function signature="QMatrix2x2(const float*)" remove="all"/>
<modify-function signature="copyDataTo(float*) const" remove="all"/>
<add-function signature="__repr__" return-type="PyObject*">
<inject-code class="target" position="beginning">
@@ -1965,9 +1963,7 @@
</value-type>
<value-type name="QMatrix2x3" since="4.6">
- <modify-function signature="QMatrix2x3(const float*)">
- <modify-argument index="1"><array/></modify-argument>
- </modify-function>
+ <modify-function signature="QMatrix2x3(const float*)" remove="all"/>
<modify-function signature="copyDataTo(float*) const" remove="all"/>
<add-function signature="__repr__" return-type="PyObject*">
<inject-code class="target" position="beginning">
@@ -2003,9 +1999,7 @@
</value-type>
<value-type name="QMatrix2x4" since="4.6">
- <modify-function signature="QMatrix2x4(const float*)">
- <modify-argument index="1"><array/></modify-argument>
- </modify-function>
+ <modify-function signature="QMatrix2x4(const float*)" remove="all"/>
<modify-function signature="copyDataTo(float*) const" remove="all"/>
<add-function signature="__repr__" return-type="PyObject*">
<inject-code class="target" position="beginning">
@@ -2041,9 +2035,7 @@
</value-type>
<value-type name="QMatrix3x2" since="4.6">
- <modify-function signature="QMatrix3x2(const float*)">
- <modify-argument index="1"><array/></modify-argument>
- </modify-function>
+ <modify-function signature="QMatrix3x2(const float*)" remove="all"/>
<modify-function signature="copyDataTo(float*) const" remove="all"/>
<add-function signature="__repr__" return-type="PyObject*">
<inject-code class="target" position="beginning">
@@ -2079,9 +2071,7 @@
</value-type>
<value-type name="QMatrix3x3" since="4.6">
- <modify-function signature="QMatrix3x3(const float*)">
- <modify-argument index="1"><array/></modify-argument>
- </modify-function>
+ <modify-function signature="QMatrix3x3(const float*)" remove="all"/>
<modify-function signature="copyDataTo(float*) const" remove="all"/>
<add-function signature="__repr__" return-type="PyObject*">
<inject-code class="target" position="beginning">
@@ -2117,9 +2107,7 @@
</value-type>
<value-type name="QMatrix3x4" since="4.6">
- <modify-function signature="QMatrix3x4(const float*)">
- <modify-argument index="1"><array/></modify-argument>
- </modify-function>
+ <modify-function signature="QMatrix3x4(const float*)" remove="all"/>
<modify-function signature="copyDataTo(float*) const" remove="all"/>
<add-function signature="__repr__" return-type="PyObject*">
<inject-code class="target" position="beginning">
@@ -2155,9 +2143,8 @@
</value-type>
<value-type name="QMatrix4x2" since="4.6">
- <modify-function signature="QMatrix4x2(const float*)">
- <modify-argument index="1"><array/></modify-argument>
- </modify-function>
+ <modify-function signature="QMatrix4x2(const float*)" remove="all"/>
+ <modify-function signature="copyDataTo(float*) const" remove="all"/>
<add-function signature="__repr__" return-type="PyObject*">
<inject-code class="target" position="beginning">
<insert-template name="repr_code_matrix">
@@ -2192,9 +2179,7 @@
</value-type>
<value-type name="QMatrix4x3" since="4.6">
- <modify-function signature="QMatrix4x3(const float*)">
- <modify-argument index="1"><array/></modify-argument>
- </modify-function>
+ <modify-function signature="QMatrix4x3(const float*)" remove="all"/>
<modify-function signature="copyDataTo(float*) const" remove="all"/>
<add-function signature="__repr__" return-type="PyObject*">
<inject-code class="target" position="beginning">
@@ -2739,12 +2724,6 @@
<modify-function signature="glProgramUniformMatrix4x3fv(unsigned int,int,int,unsigned char,const float*)">
<modify-argument index="5"><array/></modify-argument>
</modify-function>
- <modify-function signature="glSamplerParameterfv(unsigned int,unsigned int,const float*)">
- <modify-argument index="3"><array/></modify-argument>
- </modify-function>
- <modify-function signature="glSamplerParameteriv(unsigned int,unsigned int,const int*)">
- <modify-argument index="3"><array/></modify-argument>
- </modify-function>
<modify-function signature="^glSamplerParameterI?u?[fi]v\(.*$">
<modify-argument index="3"><array/></modify-argument>
</modify-function>
diff --git a/sources/pyside2/PySide2/QtScxml/typesystem_scxml.xml b/sources/pyside2/PySide2/QtScxml/typesystem_scxml.xml
index 616a5a782..f6402f7e8 100644
--- a/sources/pyside2/PySide2/QtScxml/typesystem_scxml.xml
+++ b/sources/pyside2/PySide2/QtScxml/typesystem_scxml.xml
@@ -63,6 +63,15 @@
<object-type name="QScxmlDataModel" since="5.12">
<!-- Needs to have exports fixed -->
<interface-type name="ForeachLoopBody" since="5.12"/>
+ <modify-function signature="^evaluateTo(String|Bool|Variant)\(.*bool ?\*.*$">
+ <modify-argument index="2">
+ <remove-default-expression/>
+ <remove-argument/>
+ </modify-argument>
+ <inject-code class="target" position="beginning">
+ <insert-template name="fix_args,arg,bool*"/>
+ </inject-code>
+ </modify-function>
</object-type>
<object-type name="QScxmlEcmaScriptDataModel" since="5.12"/>
<value-type name="QScxmlError"/>
diff --git a/sources/pyside2/PySide2/support/signature/mapping.py b/sources/pyside2/PySide2/support/signature/mapping.py
index 96afd3c7a..d56d97454 100644
--- a/sources/pyside2/PySide2/support/signature/mapping.py
+++ b/sources/pyside2/PySide2/support/signature/mapping.py
@@ -98,7 +98,6 @@ def init_QtCore():
"unsigned long long": int,
"unsigned short": int,
"QStringList": StringList,
- "QList": list,
"QChar": Char,
"signed char": Char,
"QVariant": Variant,
@@ -106,11 +105,8 @@ def init_QtCore():
"QStringRef": str,
"QString()": "",
"QModelIndexList": ModelIndexList,
- "QPair": Pair,
"unsigned char": Char,
- "QSet": set, # seems _not_ to work
- "QVector": list,
- "QJsonObject": dict, # seems to work
+ "QJsonObject": typing.Dict[str, PySide2.QtCore.QJsonValue],
"QStringList()": [],
"ULONG_MAX": ulong_max,
"quintptr": int,
@@ -120,12 +116,12 @@ def init_QtCore():
"qptrdiff": int,
"true": True,
"Qt.HANDLE": int, # be more explicit with some consts?
- "list of QAbstractState": list, # how to use typing.List when we don't have QAbstractState?
- "list of QAbstractAnimation": list, # dto.
+ "list of QAbstractState": typing.List[PySide2.QtCore.QAbstractState],
+ "list of QAbstractAnimation": typing.List[PySide2.QtCore.QAbstractAnimation],
"QVariant()": Invalid(Variant),
- "QMap": dict,
+ "QMap": typing.Dict,
"PySide2.QtCore.bool": bool,
- "QHash": dict,
+ "QHash": typing.Dict,
"PySide2.QtCore.QChar": Char,
"PySide2.QtCore.qreal": float,
"PySide2.QtCore.float": float,
@@ -159,7 +155,6 @@ def init_QtCore():
"signed long": int,
"PySide2.QtCore.int": int,
"PySide2.QtCore.char": StringList, # A 'char **' is a list of strings.
- "char[]": StringList, # 5.9
"unsigned long int": int, # 5.6, RHEL 6.6
"unsigned short int": int, # 5.6, RHEL 6.6
"4294967295UL": 4294967295, # 5.6, RHEL 6.6
@@ -169,7 +164,6 @@ def init_QtCore():
"nullptr": None, # 5.9
"uint64_t": int, # 5.9
"PySide2.QtCore.uint32_t": int, # 5.9
- "float[][]": FloatMatrix, # 5.9
"PySide2.QtCore.unsigned int": int, # 5.9 Ubuntu
"PySide2.QtCore.long long": int, # 5.9, MSVC 15
"QGenericArgument(nullptr)": ellipsis, # 5.10
@@ -202,7 +196,7 @@ def init_QtCore():
"zero(PySide2.QtCore.QEvent.Type)": None,
"CheckIndexOption.NoOption": Instance(
"PySide2.QtCore.QAbstractItemModel.CheckIndexOptions.NoOption"), # 5.11
- "QVariantMap": dict,
+ "QVariantMap": typing.Dict[str, Variant],
"PySide2.QtCore.QCborStreamReader.StringResult": typing.AnyStr,
"PySide2.QtCore.double": float,
})
@@ -249,8 +243,6 @@ def init_QtGui():
def init_QtWidgets():
from PySide2.QtWidgets import QWidget, QMessageBox, QStyleOption, QStyleHintReturn, QStyleOptionComplex
from PySide2.QtWidgets import QGraphicsItem, QStyleOptionGraphicsItem # 5.9
- GraphicsItemList = typing.List[QGraphicsItem]
- StyleOptionGraphicsItemList = typing.List[QStyleOptionGraphicsItem]
type_map.update({
"QMessageBox.StandardButtons(Yes | No)": Instance(
"QMessageBox.StandardButtons(QMessageBox.Yes | QMessageBox.No)"),
@@ -265,8 +257,6 @@ def init_QtWidgets():
"SO_Default": QStyleOption.SO_Default,
"SH_Default": QStyleHintReturn.SH_Default,
"SO_Complex": QStyleOptionComplex.SO_Complex,
- "QGraphicsItem[]": GraphicsItemList,
- "QStyleOptionGraphicsItem[]": StyleOptionGraphicsItemList,
"zero(PySide2.QtWidgets.QWidget)": None,
"zero(PySide2.QtWidgets.QGraphicsItem)": None,
"zero(PySide2.QtCore.QEvent)": None,
@@ -286,7 +276,7 @@ def init_QtSql():
from PySide2.QtSql import QSqlDatabase
type_map.update({
"QLatin1String(defaultConnection)": QSqlDatabase.defaultConnection,
- "QVariant.Invalid": Invalid("PySide2.QtCore.QVariant"), # not sure what I should create, here...
+ "QVariant.Invalid": Invalid("Variant"), # not sure what I should create, here...
})
return locals()
@@ -342,7 +332,7 @@ def init_QtQml():
"QJSValueList()": [],
"PySide2.QtQml.bool volatile": bool,
# from 5.9
- "QVariantHash()": {},
+ "QVariantHash()": typing.Dict[str, Variant], # XXX sorted?
"zero(PySide2.QtQml.QQmlContext)": None,
"zero(PySide2.QtQml.QQmlEngine)": None,
})
diff --git a/sources/pyside2/PySide2/templates/core_common.xml b/sources/pyside2/PySide2/templates/core_common.xml
index 96a9be620..7c2ae3a77 100644
--- a/sources/pyside2/PySide2/templates/core_common.xml
+++ b/sources/pyside2/PySide2/templates/core_common.xml
@@ -86,6 +86,14 @@
<insert-template name="tuple_retval_ok"/>
</template>
+ <template name="fix_args,arg,bool*">
+ bool ok_;
+ %BEGIN_ALLOW_THREADS
+ %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(%1, &amp;ok_);
+ %END_ALLOW_THREADS
+ <insert-template name="tuple_retval_ok"/>
+ </template>
+
<template name="fix_arg,bool*,arg">
bool ok_;
%BEGIN_ALLOW_THREADS
diff --git a/sources/pyside2/libpyside/pysidesignal.cpp b/sources/pyside2/libpyside/pysidesignal.cpp
index e7fd389a8..cf99de785 100644
--- a/sources/pyside2/libpyside/pysidesignal.cpp
+++ b/sources/pyside2/libpyside/pysidesignal.cpp
@@ -48,6 +48,7 @@
#include <QtCore/QMetaMethod>
#include <QtCore/QMetaObject>
+#include <algorithm>
#include <utility>
#define SIGNAL_CLASS_NAME "Signal"
@@ -904,7 +905,7 @@ void registerSignals(SbkObjectType* pyObj, const QMetaObject* metaObject)
self->homonymousMethod = 0;
// Empty signatures comes first! So they will be the default signal signature
- qStableSort(it.value().begin(), it.value().end(), &compareSignals);
+ std::stable_sort(it.value().begin(), it.value().end(), &compareSignals);
SignalSigMap::mapped_type::const_iterator j = it.value().begin();
SignalSigMap::mapped_type::const_iterator endJ = it.value().end();
for (; j != endJ; ++j) {
diff --git a/sources/pyside2/tests/registry/exists_darwin_5_12_0_ci.py b/sources/pyside2/tests/registry/exists_darwin_5_12_0_ci.py
index 7a070abfe..a1fd624d9 100644
--- a/sources/pyside2/tests/registry/exists_darwin_5_12_0_ci.py
+++ b/sources/pyside2/tests/registry/exists_darwin_5_12_0_ci.py
@@ -4421,7 +4421,7 @@ if "PySide2.QtGui" in sys.modules:
"QMatrix.translate": ('float', 'float'),
# class PySide2.QtGui.QMatrix2x2:
- "QMatrix2x2.__init__": [(), ('PySide2.QtGui.QMatrix2x2',), ('float',), ('typing.Iterable',)],
+ "QMatrix2x2.__init__": [(), ('PySide2.QtGui.QMatrix2x2',), ('typing.Iterable',)],
"QMatrix2x2.__call__": ('int', 'int'),
"QMatrix2x2.__copy__": (),
"QMatrix2x2.__iadd__": ('Missing("PySide2.QtGui.QGenericMatrix")',),
@@ -4437,7 +4437,7 @@ if "PySide2.QtGui" in sys.modules:
"QMatrix2x2.transposed": (),
# class PySide2.QtGui.QMatrix2x3:
- "QMatrix2x3.__init__": [(), ('PySide2.QtGui.QMatrix2x3',), ('float',), ('typing.Iterable',)],
+ "QMatrix2x3.__init__": [(), ('PySide2.QtGui.QMatrix2x3',), ('typing.Iterable',)],
"QMatrix2x3.__call__": ('int', 'int'),
"QMatrix2x3.__copy__": (),
"QMatrix2x3.__iadd__": ('Missing("PySide2.QtGui.QGenericMatrix")',),
@@ -4453,7 +4453,7 @@ if "PySide2.QtGui" in sys.modules:
"QMatrix2x3.transposed": (),
# class PySide2.QtGui.QMatrix2x4:
- "QMatrix2x4.__init__": [(), ('PySide2.QtGui.QMatrix2x4',), ('float',), ('typing.Iterable',)],
+ "QMatrix2x4.__init__": [(), ('PySide2.QtGui.QMatrix2x4',), ('typing.Iterable',)],
"QMatrix2x4.__call__": ('int', 'int'),
"QMatrix2x4.__copy__": (),
"QMatrix2x4.__iadd__": ('Missing("PySide2.QtGui.QGenericMatrix")',),
@@ -4469,7 +4469,7 @@ if "PySide2.QtGui" in sys.modules:
"QMatrix2x4.transposed": (),
# class PySide2.QtGui.QMatrix3x2:
- "QMatrix3x2.__init__": [(), ('PySide2.QtGui.QMatrix3x2',), ('float',), ('typing.Iterable',)],
+ "QMatrix3x2.__init__": [(), ('PySide2.QtGui.QMatrix3x2',), ('typing.Iterable',)],
"QMatrix3x2.__call__": ('int', 'int'),
"QMatrix3x2.__copy__": (),
"QMatrix3x2.__iadd__": ('Missing("PySide2.QtGui.QGenericMatrix")',),
@@ -4485,7 +4485,7 @@ if "PySide2.QtGui" in sys.modules:
"QMatrix3x2.transposed": (),
# class PySide2.QtGui.QMatrix3x3:
- "QMatrix3x3.__init__": [(), ('PySide2.QtGui.QMatrix3x3',), ('float',), ('typing.Iterable',)],
+ "QMatrix3x3.__init__": [(), ('PySide2.QtGui.QMatrix3x3',), ('typing.Iterable',)],
"QMatrix3x3.__call__": ('int', 'int'),
"QMatrix3x3.__copy__": (),
"QMatrix3x3.__iadd__": ('Missing("PySide2.QtGui.QGenericMatrix")',),
@@ -4501,7 +4501,7 @@ if "PySide2.QtGui" in sys.modules:
"QMatrix3x3.transposed": (),
# class PySide2.QtGui.QMatrix3x4:
- "QMatrix3x4.__init__": [(), ('PySide2.QtGui.QMatrix3x4',), ('float',), ('typing.Iterable',)],
+ "QMatrix3x4.__init__": [(), ('PySide2.QtGui.QMatrix3x4',), ('typing.Iterable',)],
"QMatrix3x4.__call__": ('int', 'int'),
"QMatrix3x4.__copy__": (),
"QMatrix3x4.__iadd__": ('Missing("PySide2.QtGui.QGenericMatrix")',),
@@ -4517,7 +4517,7 @@ if "PySide2.QtGui" in sys.modules:
"QMatrix3x4.transposed": (),
# class PySide2.QtGui.QMatrix4x2:
- "QMatrix4x2.__init__": [(), ('PySide2.QtGui.QMatrix4x2',), ('float',), ('typing.Iterable',)],
+ "QMatrix4x2.__init__": [(), ('PySide2.QtGui.QMatrix4x2',), ('typing.Iterable',)],
"QMatrix4x2.__call__": ('int', 'int'),
"QMatrix4x2.__copy__": (),
"QMatrix4x2.__iadd__": ('Missing("PySide2.QtGui.QGenericMatrix")',),
@@ -4526,7 +4526,6 @@ if "PySide2.QtGui" in sys.modules:
"QMatrix4x2.__reduce__": (),
"QMatrix4x2.__repr__": (),
"QMatrix4x2.constData": (),
- "QMatrix4x2.copyDataTo": ('float',),
"QMatrix4x2.data": (),
"QMatrix4x2.fill": ('float',),
"QMatrix4x2.isIdentity": (),
@@ -4534,7 +4533,7 @@ if "PySide2.QtGui" in sys.modules:
"QMatrix4x2.transposed": (),
# class PySide2.QtGui.QMatrix4x3:
- "QMatrix4x3.__init__": [(), ('PySide2.QtGui.QMatrix4x3',), ('float',), ('typing.Iterable',)],
+ "QMatrix4x3.__init__": [(), ('PySide2.QtGui.QMatrix4x3',), ('typing.Iterable',)],
"QMatrix4x3.__call__": ('int', 'int'),
"QMatrix4x3.__copy__": (),
"QMatrix4x3.__iadd__": ('Missing("PySide2.QtGui.QGenericMatrix")',),
diff --git a/sources/pyside2/tests/registry/exists_opensuse423_5_12_0_ci.py b/sources/pyside2/tests/registry/exists_opensuse423_5_12_0_ci.py
index 6caa0947d..4b753386f 100644
--- a/sources/pyside2/tests/registry/exists_opensuse423_5_12_0_ci.py
+++ b/sources/pyside2/tests/registry/exists_opensuse423_5_12_0_ci.py
@@ -4420,7 +4420,7 @@ if "PySide2.QtGui" in sys.modules:
"QMatrix.translate": ('float', 'float'),
# class PySide2.QtGui.QMatrix2x2:
- "QMatrix2x2.__init__": [(), ('PySide2.QtGui.QMatrix2x2',), ('float',), ('typing.Iterable',)],
+ "QMatrix2x2.__init__": [(), ('PySide2.QtGui.QMatrix2x2',), ('typing.Iterable',)],
"QMatrix2x2.__call__": ('int', 'int'),
"QMatrix2x2.__copy__": (),
"QMatrix2x2.__iadd__": ('Missing("PySide2.QtGui.QGenericMatrix")',),
@@ -4436,7 +4436,7 @@ if "PySide2.QtGui" in sys.modules:
"QMatrix2x2.transposed": (),
# class PySide2.QtGui.QMatrix2x3:
- "QMatrix2x3.__init__": [(), ('PySide2.QtGui.QMatrix2x3',), ('float',), ('typing.Iterable',)],
+ "QMatrix2x3.__init__": [(), ('PySide2.QtGui.QMatrix2x3',), ('typing.Iterable',)],
"QMatrix2x3.__call__": ('int', 'int'),
"QMatrix2x3.__copy__": (),
"QMatrix2x3.__iadd__": ('Missing("PySide2.QtGui.QGenericMatrix")',),
@@ -4452,7 +4452,7 @@ if "PySide2.QtGui" in sys.modules:
"QMatrix2x3.transposed": (),
# class PySide2.QtGui.QMatrix2x4:
- "QMatrix2x4.__init__": [(), ('PySide2.QtGui.QMatrix2x4',), ('float',), ('typing.Iterable',)],
+ "QMatrix2x4.__init__": [(), ('PySide2.QtGui.QMatrix2x4',), ('typing.Iterable',)],
"QMatrix2x4.__call__": ('int', 'int'),
"QMatrix2x4.__copy__": (),
"QMatrix2x4.__iadd__": ('Missing("PySide2.QtGui.QGenericMatrix")',),
@@ -4468,7 +4468,7 @@ if "PySide2.QtGui" in sys.modules:
"QMatrix2x4.transposed": (),
# class PySide2.QtGui.QMatrix3x2:
- "QMatrix3x2.__init__": [(), ('PySide2.QtGui.QMatrix3x2',), ('float',), ('typing.Iterable',)],
+ "QMatrix3x2.__init__": [(), ('PySide2.QtGui.QMatrix3x2',), ('typing.Iterable',)],
"QMatrix3x2.__call__": ('int', 'int'),
"QMatrix3x2.__copy__": (),
"QMatrix3x2.__iadd__": ('Missing("PySide2.QtGui.QGenericMatrix")',),
@@ -4484,7 +4484,7 @@ if "PySide2.QtGui" in sys.modules:
"QMatrix3x2.transposed": (),
# class PySide2.QtGui.QMatrix3x3:
- "QMatrix3x3.__init__": [(), ('PySide2.QtGui.QMatrix3x3',), ('float',), ('typing.Iterable',)],
+ "QMatrix3x3.__init__": [(), ('PySide2.QtGui.QMatrix3x3',), ('typing.Iterable',)],
"QMatrix3x3.__call__": ('int', 'int'),
"QMatrix3x3.__copy__": (),
"QMatrix3x3.__iadd__": ('Missing("PySide2.QtGui.QGenericMatrix")',),
@@ -4500,7 +4500,7 @@ if "PySide2.QtGui" in sys.modules:
"QMatrix3x3.transposed": (),
# class PySide2.QtGui.QMatrix3x4:
- "QMatrix3x4.__init__": [(), ('PySide2.QtGui.QMatrix3x4',), ('float',), ('typing.Iterable',)],
+ "QMatrix3x4.__init__": [(), ('PySide2.QtGui.QMatrix3x4',), ('typing.Iterable',)],
"QMatrix3x4.__call__": ('int', 'int'),
"QMatrix3x4.__copy__": (),
"QMatrix3x4.__iadd__": ('Missing("PySide2.QtGui.QGenericMatrix")',),
@@ -4516,7 +4516,7 @@ if "PySide2.QtGui" in sys.modules:
"QMatrix3x4.transposed": (),
# class PySide2.QtGui.QMatrix4x2:
- "QMatrix4x2.__init__": [(), ('PySide2.QtGui.QMatrix4x2',), ('float',), ('typing.Iterable',)],
+ "QMatrix4x2.__init__": [(), ('PySide2.QtGui.QMatrix4x2',), ('typing.Iterable',)],
"QMatrix4x2.__call__": ('int', 'int'),
"QMatrix4x2.__copy__": (),
"QMatrix4x2.__iadd__": ('Missing("PySide2.QtGui.QGenericMatrix")',),
@@ -4525,7 +4525,6 @@ if "PySide2.QtGui" in sys.modules:
"QMatrix4x2.__reduce__": (),
"QMatrix4x2.__repr__": (),
"QMatrix4x2.constData": (),
- "QMatrix4x2.copyDataTo": ('float',),
"QMatrix4x2.data": (),
"QMatrix4x2.fill": ('float',),
"QMatrix4x2.isIdentity": (),
@@ -4533,7 +4532,7 @@ if "PySide2.QtGui" in sys.modules:
"QMatrix4x2.transposed": (),
# class PySide2.QtGui.QMatrix4x3:
- "QMatrix4x3.__init__": [(), ('PySide2.QtGui.QMatrix4x3',), ('float',), ('typing.Iterable',)],
+ "QMatrix4x3.__init__": [(), ('PySide2.QtGui.QMatrix4x3',), ('typing.Iterable',)],
"QMatrix4x3.__call__": ('int', 'int'),
"QMatrix4x3.__copy__": (),
"QMatrix4x3.__iadd__": ('Missing("PySide2.QtGui.QGenericMatrix")',),
diff --git a/sources/pyside2/tests/registry/exists_redhatenterpriselinuxworkstation74_5_12_0_ci.py b/sources/pyside2/tests/registry/exists_redhatenterpriselinuxworkstation74_5_12_0_ci.py
index c7b58c3fb..1a68c8c85 100644
--- a/sources/pyside2/tests/registry/exists_redhatenterpriselinuxworkstation74_5_12_0_ci.py
+++ b/sources/pyside2/tests/registry/exists_redhatenterpriselinuxworkstation74_5_12_0_ci.py
@@ -4420,7 +4420,7 @@ if "PySide2.QtGui" in sys.modules:
"QMatrix.translate": ('float', 'float'),
# class PySide2.QtGui.QMatrix2x2:
- "QMatrix2x2.__init__": [(), ('PySide2.QtGui.QMatrix2x2',), ('float',), ('typing.Iterable',)],
+ "QMatrix2x2.__init__": [(), ('PySide2.QtGui.QMatrix2x2',), ('typing.Iterable',)],
"QMatrix2x2.__call__": ('int', 'int'),
"QMatrix2x2.__copy__": (),
"QMatrix2x2.__iadd__": ('Missing("PySide2.QtGui.QGenericMatrix")',),
@@ -4436,7 +4436,7 @@ if "PySide2.QtGui" in sys.modules:
"QMatrix2x2.transposed": (),
# class PySide2.QtGui.QMatrix2x3:
- "QMatrix2x3.__init__": [(), ('PySide2.QtGui.QMatrix2x3',), ('float',), ('typing.Iterable',)],
+ "QMatrix2x3.__init__": [(), ('PySide2.QtGui.QMatrix2x3',), ('typing.Iterable',)],
"QMatrix2x3.__call__": ('int', 'int'),
"QMatrix2x3.__copy__": (),
"QMatrix2x3.__iadd__": ('Missing("PySide2.QtGui.QGenericMatrix")',),
@@ -4452,7 +4452,7 @@ if "PySide2.QtGui" in sys.modules:
"QMatrix2x3.transposed": (),
# class PySide2.QtGui.QMatrix2x4:
- "QMatrix2x4.__init__": [(), ('PySide2.QtGui.QMatrix2x4',), ('float',), ('typing.Iterable',)],
+ "QMatrix2x4.__init__": [(), ('PySide2.QtGui.QMatrix2x4',), ('typing.Iterable',)],
"QMatrix2x4.__call__": ('int', 'int'),
"QMatrix2x4.__copy__": (),
"QMatrix2x4.__iadd__": ('Missing("PySide2.QtGui.QGenericMatrix")',),
@@ -4468,7 +4468,7 @@ if "PySide2.QtGui" in sys.modules:
"QMatrix2x4.transposed": (),
# class PySide2.QtGui.QMatrix3x2:
- "QMatrix3x2.__init__": [(), ('PySide2.QtGui.QMatrix3x2',), ('float',), ('typing.Iterable',)],
+ "QMatrix3x2.__init__": [(), ('PySide2.QtGui.QMatrix3x2',), ('typing.Iterable',)],
"QMatrix3x2.__call__": ('int', 'int'),
"QMatrix3x2.__copy__": (),
"QMatrix3x2.__iadd__": ('Missing("PySide2.QtGui.QGenericMatrix")',),
@@ -4484,7 +4484,7 @@ if "PySide2.QtGui" in sys.modules:
"QMatrix3x2.transposed": (),
# class PySide2.QtGui.QMatrix3x3:
- "QMatrix3x3.__init__": [(), ('PySide2.QtGui.QMatrix3x3',), ('float',), ('typing.Iterable',)],
+ "QMatrix3x3.__init__": [(), ('PySide2.QtGui.QMatrix3x3',), ('typing.Iterable',)],
"QMatrix3x3.__call__": ('int', 'int'),
"QMatrix3x3.__copy__": (),
"QMatrix3x3.__iadd__": ('Missing("PySide2.QtGui.QGenericMatrix")',),
@@ -4500,7 +4500,7 @@ if "PySide2.QtGui" in sys.modules:
"QMatrix3x3.transposed": (),
# class PySide2.QtGui.QMatrix3x4:
- "QMatrix3x4.__init__": [(), ('PySide2.QtGui.QMatrix3x4',), ('float',), ('typing.Iterable',)],
+ "QMatrix3x4.__init__": [(), ('PySide2.QtGui.QMatrix3x4',), ('typing.Iterable',)],
"QMatrix3x4.__call__": ('int', 'int'),
"QMatrix3x4.__copy__": (),
"QMatrix3x4.__iadd__": ('Missing("PySide2.QtGui.QGenericMatrix")',),
@@ -4516,7 +4516,7 @@ if "PySide2.QtGui" in sys.modules:
"QMatrix3x4.transposed": (),
# class PySide2.QtGui.QMatrix4x2:
- "QMatrix4x2.__init__": [(), ('PySide2.QtGui.QMatrix4x2',), ('float',), ('typing.Iterable',)],
+ "QMatrix4x2.__init__": [(), ('PySide2.QtGui.QMatrix4x2',), ('typing.Iterable',)],
"QMatrix4x2.__call__": ('int', 'int'),
"QMatrix4x2.__copy__": (),
"QMatrix4x2.__iadd__": ('Missing("PySide2.QtGui.QGenericMatrix")',),
@@ -4525,7 +4525,6 @@ if "PySide2.QtGui" in sys.modules:
"QMatrix4x2.__reduce__": (),
"QMatrix4x2.__repr__": (),
"QMatrix4x2.constData": (),
- "QMatrix4x2.copyDataTo": ('float',),
"QMatrix4x2.data": (),
"QMatrix4x2.fill": ('float',),
"QMatrix4x2.isIdentity": (),
@@ -4533,7 +4532,7 @@ if "PySide2.QtGui" in sys.modules:
"QMatrix4x2.transposed": (),
# class PySide2.QtGui.QMatrix4x3:
- "QMatrix4x3.__init__": [(), ('PySide2.QtGui.QMatrix4x3',), ('float',), ('typing.Iterable',)],
+ "QMatrix4x3.__init__": [(), ('PySide2.QtGui.QMatrix4x3',), ('typing.Iterable',)],
"QMatrix4x3.__call__": ('int', 'int'),
"QMatrix4x3.__copy__": (),
"QMatrix4x3.__iadd__": ('Missing("PySide2.QtGui.QGenericMatrix")',),
diff --git a/sources/pyside2/tests/registry/exists_win32_5_12_0_ci.py b/sources/pyside2/tests/registry/exists_win32_5_12_0_ci.py
index 0a3f587f3..10b2acf4c 100644
--- a/sources/pyside2/tests/registry/exists_win32_5_12_0_ci.py
+++ b/sources/pyside2/tests/registry/exists_win32_5_12_0_ci.py
@@ -4433,7 +4433,7 @@ if "PySide2.QtGui" in sys.modules:
"QMatrix.translate": ('float', 'float'),
# class PySide2.QtGui.QMatrix2x2:
- "QMatrix2x2.__init__": [(), ('PySide2.QtGui.QMatrix2x2',), ('float',), ('typing.Iterable',)],
+ "QMatrix2x2.__init__": [(), ('PySide2.QtGui.QMatrix2x2',), ('typing.Iterable',)],
"QMatrix2x2.__call__": ('int', 'int'),
"QMatrix2x2.__copy__": (),
"QMatrix2x2.__iadd__": ('Missing("PySide2.QtGui.QGenericMatrix")',),
@@ -4449,7 +4449,7 @@ if "PySide2.QtGui" in sys.modules:
"QMatrix2x2.transposed": (),
# class PySide2.QtGui.QMatrix2x3:
- "QMatrix2x3.__init__": [(), ('PySide2.QtGui.QMatrix2x3',), ('float',), ('typing.Iterable',)],
+ "QMatrix2x3.__init__": [(), ('PySide2.QtGui.QMatrix2x3',), ('typing.Iterable',)],
"QMatrix2x3.__call__": ('int', 'int'),
"QMatrix2x3.__copy__": (),
"QMatrix2x3.__iadd__": ('Missing("PySide2.QtGui.QGenericMatrix")',),
@@ -4465,7 +4465,7 @@ if "PySide2.QtGui" in sys.modules:
"QMatrix2x3.transposed": (),
# class PySide2.QtGui.QMatrix2x4:
- "QMatrix2x4.__init__": [(), ('PySide2.QtGui.QMatrix2x4',), ('float',), ('typing.Iterable',)],
+ "QMatrix2x4.__init__": [(), ('PySide2.QtGui.QMatrix2x4',), ('typing.Iterable',)],
"QMatrix2x4.__call__": ('int', 'int'),
"QMatrix2x4.__copy__": (),
"QMatrix2x4.__iadd__": ('Missing("PySide2.QtGui.QGenericMatrix")',),
@@ -4481,7 +4481,7 @@ if "PySide2.QtGui" in sys.modules:
"QMatrix2x4.transposed": (),
# class PySide2.QtGui.QMatrix3x2:
- "QMatrix3x2.__init__": [(), ('PySide2.QtGui.QMatrix3x2',), ('float',), ('typing.Iterable',)],
+ "QMatrix3x2.__init__": [(), ('PySide2.QtGui.QMatrix3x2',), ('typing.Iterable',)],
"QMatrix3x2.__call__": ('int', 'int'),
"QMatrix3x2.__copy__": (),
"QMatrix3x2.__iadd__": ('Missing("PySide2.QtGui.QGenericMatrix")',),
@@ -4497,7 +4497,7 @@ if "PySide2.QtGui" in sys.modules:
"QMatrix3x2.transposed": (),
# class PySide2.QtGui.QMatrix3x3:
- "QMatrix3x3.__init__": [(), ('PySide2.QtGui.QMatrix3x3',), ('float',), ('typing.Iterable',)],
+ "QMatrix3x3.__init__": [(), ('PySide2.QtGui.QMatrix3x3',), ('typing.Iterable',)],
"QMatrix3x3.__call__": ('int', 'int'),
"QMatrix3x3.__copy__": (),
"QMatrix3x3.__iadd__": ('Missing("PySide2.QtGui.QGenericMatrix")',),
@@ -4513,7 +4513,7 @@ if "PySide2.QtGui" in sys.modules:
"QMatrix3x3.transposed": (),
# class PySide2.QtGui.QMatrix3x4:
- "QMatrix3x4.__init__": [(), ('PySide2.QtGui.QMatrix3x4',), ('float',), ('typing.Iterable',)],
+ "QMatrix3x4.__init__": [(), ('PySide2.QtGui.QMatrix3x4',), ('typing.Iterable',)],
"QMatrix3x4.__call__": ('int', 'int'),
"QMatrix3x4.__copy__": (),
"QMatrix3x4.__iadd__": ('Missing("PySide2.QtGui.QGenericMatrix")',),
@@ -4529,7 +4529,7 @@ if "PySide2.QtGui" in sys.modules:
"QMatrix3x4.transposed": (),
# class PySide2.QtGui.QMatrix4x2:
- "QMatrix4x2.__init__": [(), ('PySide2.QtGui.QMatrix4x2',), ('float',), ('typing.Iterable',)],
+ "QMatrix4x2.__init__": [(), ('PySide2.QtGui.QMatrix4x2',), ('typing.Iterable',)],
"QMatrix4x2.__call__": ('int', 'int'),
"QMatrix4x2.__copy__": (),
"QMatrix4x2.__iadd__": ('Missing("PySide2.QtGui.QGenericMatrix")',),
@@ -4538,7 +4538,6 @@ if "PySide2.QtGui" in sys.modules:
"QMatrix4x2.__reduce__": (),
"QMatrix4x2.__repr__": (),
"QMatrix4x2.constData": (),
- "QMatrix4x2.copyDataTo": ('float',),
"QMatrix4x2.data": (),
"QMatrix4x2.fill": ('float',),
"QMatrix4x2.isIdentity": (),
@@ -4546,7 +4545,7 @@ if "PySide2.QtGui" in sys.modules:
"QMatrix4x2.transposed": (),
# class PySide2.QtGui.QMatrix4x3:
- "QMatrix4x3.__init__": [(), ('PySide2.QtGui.QMatrix4x3',), ('float',), ('typing.Iterable',)],
+ "QMatrix4x3.__init__": [(), ('PySide2.QtGui.QMatrix4x3',), ('typing.Iterable',)],
"QMatrix4x3.__call__": ('int', 'int'),
"QMatrix4x3.__copy__": (),
"QMatrix4x3.__iadd__": ('Missing("PySide2.QtGui.QGenericMatrix")',),
diff --git a/sources/shiboken2/ApiExtractor/abstractmetalang.cpp b/sources/shiboken2/ApiExtractor/abstractmetalang.cpp
index c65d7e0bd..73f1bf621 100644
--- a/sources/shiboken2/ApiExtractor/abstractmetalang.cpp
+++ b/sources/shiboken2/ApiExtractor/abstractmetalang.cpp
@@ -42,6 +42,10 @@
#include <QtCore/QRegularExpression>
#include <QtCore/QStack>
+#include <algorithm>
+
+#include <algorithm>
+
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug d, const AbstractMetaAttributes *aa)
{
@@ -152,7 +156,7 @@ static QString lastNameSegment(QString name)
QString AbstractMetaType::name() const
{
- if (m_name.isNull())
+ if (m_name.isEmpty())
m_name = lastNameSegment(m_typeEntry->targetLangName());
return m_name;
}
@@ -1428,7 +1432,7 @@ bool AbstractMetaClass::hasLogicalOperatorOverload() const
void AbstractMetaClass::sortFunctions()
{
- qSort(m_functions.begin(), m_functions.end(), function_sorter);
+ std::sort(m_functions.begin(), m_functions.end(), function_sorter);
}
void AbstractMetaClass::setFunctions(const AbstractMetaFunctionList &functions)
diff --git a/sources/shiboken2/ApiExtractor/tests/testtemplates.cpp b/sources/shiboken2/ApiExtractor/tests/testtemplates.cpp
index b1b171bae..59b601f3b 100644
--- a/sources/shiboken2/ApiExtractor/tests/testtemplates.cpp
+++ b/sources/shiboken2/ApiExtractor/tests/testtemplates.cpp
@@ -111,7 +111,7 @@ namespace Namespace {
AbstractMetaClass* classB = AbstractMetaClass::findClass(classes, QLatin1String("B"));
QVERIFY(classB);
QVERIFY(!classB->baseClass());
- QVERIFY(classB->baseClassName().isNull());
+ QVERIFY(classB->baseClassName().isEmpty());
const AbstractMetaFunction* func = classB->findFunction(QLatin1String("foo"));
AbstractMetaType* argType = func->arguments().first()->type();
QCOMPARE(argType->instantiations().count(), 1);
@@ -300,7 +300,7 @@ template<SomeEnum type> struct Future {};
AbstractMetaClass* classB = AbstractMetaClass::findClass(classes, QLatin1String("B"));
QVERIFY(classB);
QVERIFY(!classB->baseClass());
- QVERIFY(classB->baseClassName().isNull());
+ QVERIFY(classB->baseClassName().isEmpty());
// 3 functions: simple constructor, copy constructor and "method()".
QCOMPARE(classB->functions().count(), 3);
}
@@ -338,7 +338,7 @@ template<SomeEnum type> struct Future {};
AbstractMetaClass* classB = AbstractMetaClass::findClass(classes, QLatin1String("Namespace::B"));
QVERIFY(classB);
QVERIFY(!classB->baseClass());
- QVERIFY(classB->baseClassName().isNull());
+ QVERIFY(classB->baseClassName().isEmpty());
// 3 functions: simple constructor, copy constructor and "method()".
QCOMPARE(classB->functions().count(), 3);
}
diff --git a/sources/shiboken2/generator/main.cpp b/sources/shiboken2/generator/main.cpp
index c5bcb766d..9cdc77ca7 100644
--- a/sources/shiboken2/generator/main.cpp
+++ b/sources/shiboken2/generator/main.cpp
@@ -171,7 +171,7 @@ static CommandArgumentMap getInitializedArguments()
}
}
- if (projectFileName.isNull())
+ if (projectFileName.isEmpty())
return args;
if (!QFile::exists(projectFileName)) {
diff --git a/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp b/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp
index ea971287a..c194c0ea4 100644
--- a/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp
+++ b/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp
@@ -756,11 +756,11 @@ void QtXmlToSphinx::handleSnippetTag(QXmlStreamReader& reader)
// Fall back to C++ snippet when "path" attribute is present.
// Also read fallback snippet when comparison is desired.
QString fallbackCode;
- if ((pythonCode.isNull() || snippetComparison())
+ if ((pythonCode.isEmpty() || snippetComparison())
&& reader.attributes().hasAttribute(fallbackPathAttribute())) {
const QString fallback = reader.attributes().value(fallbackPathAttribute()).toString();
if (QFileInfo::exists(fallback)) {
- if (pythonCode.isNull())
+ if (pythonCode.isEmpty())
qCWarning(lcShiboken, "%s", qPrintable(msgFallbackWarning(reader, m_context, m_lastTagName, location, identifier, fallback)));
fallbackCode = readFromLocation(fallback, identifier, &errorMessage);
if (!errorMessage.isEmpty())
@@ -775,7 +775,7 @@ void QtXmlToSphinx::handleSnippetTag(QXmlStreamReader& reader)
m_output << INDENT << "::\n\n";
Indentation indentation(INDENT);
- const QString code = pythonCode.isNull() ? fallbackCode : pythonCode;
+ const QString code = pythonCode.isEmpty() ? fallbackCode : pythonCode;
if (code.isEmpty())
m_output << INDENT << "<Code snippet \"" << location << ':' << identifier << "\" not found>" << endl;
else
@@ -1582,7 +1582,7 @@ void QtDocGenerator::generateClass(QTextStream &s, GeneratorContext &classContex
//Function list
AbstractMetaFunctionList functionList = metaClass->functions();
- qSort(functionList.begin(), functionList.end(), functionSort);
+ std::sort(functionList.begin(), functionList.end(), functionSort);
s << endl
<< "Detailed Description\n"
@@ -1678,7 +1678,7 @@ void QtDocGenerator::writeFunctionBlock(QTextStream& s, const QString& title, QS
s << title << endl
<< QString(title.size(), QLatin1Char('^')) << endl;
- qSort(functions);
+ std::sort(functions.begin(), functions.end());
s << ".. container:: function_list" << endl << endl;
Indentation indentation(INDENT);
@@ -2051,7 +2051,7 @@ static void writeFancyToc(QTextStream& s, const QStringList& items, int cols = 4
QMutableMapIterator<QChar, QStringList> it(tocMap);
while (it.hasNext()) {
it.next();
- qSort(it.value());
+ std::sort(it.value().begin(), it.value().end());
if (i)
ss << endl;
diff --git a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
index d15f3a951..20030bcdf 100644
--- a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
+++ b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
@@ -43,6 +43,10 @@
#include <QtCore/QDebug>
#include <QMetaType>
+#include <algorithm>
+
+#include <algorithm>
+
static const char CPP_ARG0[] = "cppArg0";
QHash<QString, QString> CppGenerator::m_nbFuncs = QHash<QString, QString>();
@@ -355,7 +359,7 @@ void CppGenerator::generateClass(QTextStream &s, GeneratorContext &classContext)
QVector<Include> includes = metaClass->typeEntry()->extraIncludes();
for (AbstractMetaEnum *cppEnum : qAsConst(classEnums))
includes.append(cppEnum->typeEntry()->extraIncludes());
- qSort(includes.begin(), includes.end());
+ std::sort(includes.begin(), includes.end());
for (const Include &inc : qAsConst(includes))
s << inc.toString() << endl;
s << endl;
@@ -1680,7 +1684,7 @@ void CppGenerator::writeConstructorWrapper(QTextStream &s, const AbstractMetaFun
}
}
QStringList argNamesList = argNamesSet.toList();
- qSort(argNamesList.begin(), argNamesList.end());
+ std::sort(argNamesList.begin(), argNamesList.end());
if (argNamesList.isEmpty()) {
s << INDENT << "const char** argNames{};" << endl;
} else {
@@ -4573,7 +4577,11 @@ void CppGenerator::writeSignatureInfo(QTextStream &s, const AbstractMetaFunction
QStringList args;
const AbstractMetaArgumentList &arguments = f->arguments();
for (const AbstractMetaArgument *arg : arguments) {
+ AbstractMetaType *argType = getTypeWithoutContainer(arg->type());
QString strArg = resolveRetOrArgType(arg->type());
+ // PYSIDE-921: Handle container returntypes correctly.
+ if (argType != arg->type())
+ strArg += QLatin1Char('[') + resolveRetOrArgType(argType) + QLatin1Char(']');
if (!arg->defaultValueExpression().isEmpty()) {
strArg += QLatin1Char('=');
QString e = arg->defaultValueExpression();
@@ -4587,10 +4595,12 @@ void CppGenerator::writeSignatureInfo(QTextStream &s, const AbstractMetaFunction
// mark the multiple signatures as such, to make it easier to generate different code
if (multiple)
s << idx-- << ':';
- // now calculate the return type.
s << funcName << '(' << args.join(QLatin1Char(',')) << ')';
AbstractMetaType *returnType = getTypeWithoutContainer(f->type());
- if (returnType)
+ // PYSIDE-921: Handle container returntypes correctly.
+ if (returnType != f->type())
+ s << "->" << resolveRetOrArgType(f->type()) << '[' << resolveRetOrArgType(returnType) << ']';
+ else if (returnType)
s << "->" << resolveRetOrArgType(returnType);
s << endl;
}
@@ -5057,7 +5067,7 @@ void CppGenerator::writeClassRegister(QTextStream &s,
for (AbstractMetaClass *innerClass : innerClasses)
lookForEnumsInClassesNotToBeGenerated(classEnums, innerClass);
- ErrorCode errorCode(QString::null);
+ ErrorCode errorCode(QString::fromLatin1(""));
writeEnumsInitialization(s, classEnums);
if (metaClass->hasSignals())
@@ -5497,7 +5507,7 @@ bool CppGenerator::finishGeneration()
QVector<Include> extraIncludes = moduleEntry->extraIncludes();
for (AbstractMetaEnum *cppEnum : qAsConst(globalEnums))
extraIncludes.append(cppEnum->typeEntry()->extraIncludes());
- qSort(extraIncludes.begin(), extraIncludes.end());
+ std::sort(extraIncludes.begin(), extraIncludes.end());
for (const Include &inc : qAsConst(extraIncludes))
s << inc;
s << endl;
diff --git a/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp b/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp
index a226f2c00..ca5dab54e 100644
--- a/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp
+++ b/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp
@@ -870,14 +870,14 @@ QString ShibokenGenerator::converterObject(const TypeEntry* type)
if (type->isArray()) {
qDebug() << "Warning: no idea how to handle the Qt5 type " << type->qualifiedCppName();
- return QString::null;
+ return QString();
}
/* the typedef'd primitive types case */
const PrimitiveTypeEntry* pte = dynamic_cast<const PrimitiveTypeEntry*>(type);
if (!pte) {
qDebug() << "Warning: the Qt5 primitive type is unknown" << type->qualifiedCppName();
- return QString::null;
+ return QString();
}
if (pte->basicReferencedTypeEntry())
pte = pte->basicReferencedTypeEntry();
@@ -1457,7 +1457,7 @@ void ShibokenGenerator::writeFunctionArguments(QTextStream &s,
QString ShibokenGenerator::functionReturnType(const AbstractMetaFunction* func, Options options) const
{
QString modifiedReturnType = QString(func->typeReplaced(0));
- if (!modifiedReturnType.isNull() && !(options & OriginalTypeDescription))
+ if (!modifiedReturnType.isEmpty() && !(options & OriginalTypeDescription))
return modifiedReturnType;
return translateType(func->type(), func->implementingClass(), options);
}
@@ -1821,7 +1821,7 @@ void ShibokenGenerator::writeCodeSnips(QTextStream& s,
if (func->isVirtual() && !func->isAbstract() && (!avoidProtectedHack() || !func->isProtected())) {
QString methodCallArgs = getArgumentsFromMethodCall(code);
- if (!methodCallArgs.isNull()) {
+ if (!methodCallArgs.isEmpty()) {
const QString pattern = QStringLiteral("%CPPSELF.%FUNCTION_NAME(%1)").arg(methodCallArgs);
if (func->name() == QLatin1String("metaObject")) {
QString wrapperClassName = wrapperName(func->ownerClass());
diff --git a/sources/shiboken2/libshiboken/pep384impl.cpp b/sources/shiboken2/libshiboken/pep384impl.cpp
index 7b333f4ff..9a52603dc 100644
--- a/sources/shiboken2/libshiboken/pep384impl.cpp
+++ b/sources/shiboken2/libshiboken/pep384impl.cpp
@@ -409,6 +409,7 @@ PyRun_String(const char *str, int start, PyObject *globals, PyObject *locals)
// This is only a simple local helper that returns a computed variable.
// Used also in Python 2.
+#if defined(Py_LIMITED_API) || PY_VERSION_HEX < 0x03000000
static PyObject *
PepRun_GetResult(const char *command, const char *resvar)
{
@@ -424,6 +425,7 @@ PepRun_GetResult(const char *command, const char *resvar)
Py_DECREF(d);
return res;
}
+#endif // Py_LIMITED_API || Python 2
#ifdef Py_LIMITED_API
diff --git a/sources/shiboken2/shibokenmodule/support/signature/loader.py b/sources/shiboken2/shibokenmodule/support/signature/loader.py
index 8c7739d9a..40ad95bdd 100644
--- a/sources/shiboken2/shibokenmodule/support/signature/loader.py
+++ b/sources/shiboken2/shibokenmodule/support/signature/loader.py
@@ -148,6 +148,15 @@ with ensure_import_support():
namespace = inspect.__dict__
from support.signature import typing27 as typing
typing.__name__ = "typing"
+ # Fix the module names in typing if possible. This is important since
+ # the typing names should be I/O compatible, so that typing.Dict
+ # shows itself as "typing.Dict".
+ for name, obj in typing.__dict__.items():
+ if hasattr(obj, "__module__"):
+ try:
+ obj.__module__ = "typing"
+ except (TypeError, AttributeError):
+ pass
from support.signature import backport_inspect as inspect
_doc = inspect.__doc__
inspect.__dict__.update(namespace)
diff --git a/sources/shiboken2/shibokenmodule/support/signature/mapping.py b/sources/shiboken2/shibokenmodule/support/signature/mapping.py
index 40db43729..d4c630aca 100644
--- a/sources/shiboken2/shibokenmodule/support/signature/mapping.py
+++ b/sources/shiboken2/shibokenmodule/support/signature/mapping.py
@@ -55,12 +55,13 @@ import os
import pkgutil
from signature_loader import typing
+from signature_loader.typing import TypeVar, Generic
class ellipsis(object):
def __repr__(self):
return "..."
+
ellipsis = ellipsis()
-Char = typing.Union[str, int] # how do I model the limitation to 1 char?
StringList = typing.List[str]
IntList = typing.List[int]
Point = typing.Tuple[float, float]
@@ -69,10 +70,72 @@ IntMatrix = typing.List[IntList]
Variant = typing.Any
ModelIndexList = typing.List[int]
QImageCleanupFunction = typing.Callable
-FloatList = typing.List[float]
-FloatMatrix = typing.List[FloatList]
-# Pair could be more specific, but we loose the info in the generator.
-Pair = typing.Tuple[typing.Any, typing.Any]
+
+# First time installing our own Pair type into typing.
+T = TypeVar('T')
+S = TypeVar('S')
+
+class Pair(Generic[T, S]):
+ __module__ = "typing"
+
+typing.Pair = Pair
+
+
+# Building our own Char type, which is much nicer than
+# Char = typing.Union[str, int] # how do I model the limitation to 1 char?
+
+# Copied from the six module:
+def with_metaclass(meta, *bases):
+ """Create a base class with a metaclass."""
+ # This requires a bit of explanation: the basic idea is to make a dummy
+ # metaclass for one level of class instantiation that replaces itself with
+ # the actual metaclass.
+ class metaclass(type):
+
+ def __new__(cls, name, this_bases, d):
+ return meta(name, bases, d)
+
+ @classmethod
+ def __prepare__(cls, name, this_bases):
+ return meta.__prepare__(name, bases)
+ return type.__new__(metaclass, 'temporary_class', (), {})
+
+class _CharMeta(type):
+ def __repr__(self):
+ return '%s.%s' % (self.__module__, self.__name__)
+
+
+class Char(with_metaclass(_CharMeta)):
+ """
+ From http://doc.qt.io/qt-5/qchar.html :
+
+ In Qt, Unicode characters are 16-bit entities without any markup or
+ structure. This class represents such an entity. It is lightweight,
+ so it can be used everywhere. Most compilers treat it like an
+ unsigned short.
+
+ Here, we provide a simple implementation just to avoid long aliases.
+ """
+ __module__ = "typing"
+
+ def __init__(self, code):
+ if isinstance(code, int):
+ self.code = code & 0xffff
+ else:
+ self.code = ord(code)
+
+ def __add__(self, other):
+ return chr(self.code) + other
+
+ def __radd__(self, other):
+ return other + chr(self.code)
+
+ def __repr__(self):
+ return "typing.Char({})".format(self.code)
+
+typing.Char = Char
+
+
MultiMap = typing.DefaultDict[str, typing.List[str]]
# ulong_max is only 32 bit on windows.
@@ -205,6 +268,13 @@ update_mapping = Reloader().update
type_map = {}
namespace = globals() # our module's __dict__
+type_map.update({
+ "QList": typing.List,
+ "QVector": typing.List,
+ "QSet": typing.Set,
+ "QPair": Pair,
+ })
+
def init_Shiboken():
type_map.update({
@@ -225,18 +295,16 @@ def init_minimal():
def init_sample():
import datetime
type_map.update({
+ "double": float,
"sample.int": int,
"Complex": complex,
"sample.OddBool": bool,
"sample.bool": bool,
"sample.PStr": str,
- "double[]": FloatList,
"OddBool": bool,
"PStr": str,
+ "char": Char,
"sample.char": Char,
- "double[][]": FloatMatrix,
- "int[]": IntList,
- "int[][]": IntMatrix,
"sample.Point": Point,
"sample.ObjectType": object,
"std.string": str,
@@ -257,7 +325,6 @@ def init_sample():
"zero(sample.bool)": False,
"PyDate": datetime.date,
"ZeroIn": 0,
- "Point[]": PointList,
})
return locals()
diff --git a/sources/shiboken2/shibokenmodule/support/signature/parser.py b/sources/shiboken2/shibokenmodule/support/signature/parser.py
index 2f6e6e3f5..3b09dd4f7 100644
--- a/sources/shiboken2/shibokenmodule/support/signature/parser.py
+++ b/sources/shiboken2/shibokenmodule/support/signature/parser.py
@@ -45,7 +45,8 @@ import warnings
import types
import keyword
import functools
-from signature_loader.mapping import type_map, update_mapping, namespace
+from signature_loader.mapping import (type_map, update_mapping, namespace,
+ typing, Missing)
_DEBUG = False
LIST_KEYWORDS = False
@@ -191,7 +192,35 @@ def _resolve_value(thing, valtype, line):
""".format(thing, line), RuntimeWarning)
return thing
+def _resolve_arraytype(thing, line):
+ thing = thing[:-2]
+ if thing.endswith("[]"):
+ thing = _resolve_arraytype(thing, line)
+ # this mapping is in shiboken
+ thing = "QList[" + thing + "]"
+ return thing
+
+def to_string(thing):
+ if isinstance(thing, str):
+ return thing
+ if hasattr(thing, "__name__"):
+ dot = "." in str(type(thing))
+ return thing.__module__ + "." + thing.__name__ if dot else thing.__name__
+ # Note: This captures things from the typing module:
+ return str(thing)
+
def _resolve_type(thing, line):
+ if thing.endswith("[]"):
+ thing = _resolve_arraytype(thing, line)
+ if "[" in thing:
+ # Handle a container return type. (see PYSIDE-921 in cppgenerator.cpp)
+ contr, thing = re.match(r"(.*?)\[(.*?)\]$", thing).groups()
+ contr = to_string(_resolve_type(contr, line))
+ thing = to_string(_resolve_type(thing, line))
+ result = "{contr}[{thing}]".format(**locals())
+ if not isinstance(thing, Missing):
+ result = eval(result, namespace)
+ return result
return _resolve_value(thing, None, line)
def calculate_props(line):