aboutsummaryrefslogtreecommitdiffstats
path: root/sources
diff options
context:
space:
mode:
authorCristian Maureira-Fredes <cristian.maureira-fredes@qt.io>2018-08-31 14:27:02 +0200
committerCristian Maureira-Fredes <cristian.maureira-fredes@qt.io>2018-11-28 16:11:36 +0000
commit0363a0986e19bfb97ed1b899fc1431a0e1b14dcb (patch)
tree9c5b67a91e61033b415f8d6b8d62c6ec86fd5dac /sources
parentaddfdfb1ff195e36d412dc7aa3dde2f2d474c0ed (diff)
Place templates per module
There is a main template file that hosts most of the code-templates we use in the typesystems, but there were still several templates written in each module-typesystem file. The templates that are used on different typesystem are now placed in: sources/pyside2/PySide2/templates/core_common.xml Additionally, the templates used only by a certain module, are placed next to it, e.g.: sources/pyside2/PySide2/templates/widgets_common.xml Some simple templates were moved to the snippets files too. Task-number: PYSIDE-799 Change-Id: I4f355cf2ae983aba9e85414e910550189cd18dcb Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'sources')
-rw-r--r--sources/pyside2/PySide2/CMakeLists.txt14
-rw-r--r--sources/pyside2/PySide2/QtCore/typesystem_core_common.xml210
-rw-r--r--sources/pyside2/PySide2/QtDataVisualization/typesystem_datavisualization.xml35
-rw-r--r--sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml136
-rw-r--r--sources/pyside2/PySide2/QtOpenGL/typesystem_opengl.xml21
-rw-r--r--sources/pyside2/PySide2/QtWebKitWidgets/typesystem_webkitwidgets.xml23
-rw-r--r--sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml53
-rw-r--r--sources/pyside2/PySide2/QtXml/typesystem_xml.xml56
-rw-r--r--sources/pyside2/PySide2/glue/qtcore.cpp26
-rw-r--r--sources/pyside2/PySide2/glue/qtwebkitwidgets.cpp15
-rw-r--r--sources/pyside2/PySide2/glue/qtwidgets.cpp20
-rw-r--r--sources/pyside2/PySide2/glue/qtxml.cpp15
-rw-r--r--sources/pyside2/PySide2/templates/core_common.xml (renamed from sources/pyside2/PySide2/typesystem_templates.xml)334
-rw-r--r--sources/pyside2/PySide2/templates/datavisualization_common.xml76
-rw-r--r--sources/pyside2/PySide2/templates/gui_common.xml291
-rw-r--r--sources/pyside2/PySide2/templates/opengl_common.xml61
-rw-r--r--sources/pyside2/PySide2/templates/webkitwidgets_common.xml55
-rw-r--r--sources/pyside2/PySide2/templates/widgets_common.xml54
-rw-r--r--sources/pyside2/PySide2/templates/xml_common.xml58
19 files changed, 868 insertions, 685 deletions
diff --git a/sources/pyside2/PySide2/CMakeLists.txt b/sources/pyside2/PySide2/CMakeLists.txt
index f4c2ae9d4..ea1a7de16 100644
--- a/sources/pyside2/PySide2/CMakeLists.txt
+++ b/sources/pyside2/PySide2/CMakeLists.txt
@@ -93,7 +93,19 @@ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/_config.py"
DESTINATION "${PYTHON_SITE_PACKAGES}/${BINDING_NAME}${pyside2_SUFFIX}")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/_git_pyside_version.py"
DESTINATION "${PYTHON_SITE_PACKAGES}/${BINDING_NAME}${pyside2_SUFFIX}")
-install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/typesystem_templates.xml
+install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/templates/core_common.xml
+ DESTINATION share/PySide2${pyside_SUFFIX}/typesystems)
+install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/templates/gui_common.xml
+ DESTINATION share/PySide2${pyside_SUFFIX}/typesystems)
+install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/templates/widgets_common.xml
+ DESTINATION share/PySide2${pyside_SUFFIX}/typesystems)
+install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/templates/datavisualization_common.xml
+ DESTINATION share/PySide2${pyside_SUFFIX}/typesystems)
+install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/templates/opengl_common.xml
+ DESTINATION share/PySide2${pyside_SUFFIX}/typesystems)
+install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/templates/webkitwidgets_common.xml
+ DESTINATION share/PySide2${pyside_SUFFIX}/typesystems)
+install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/templates/xml_common.xml
DESTINATION share/PySide2${pyside_SUFFIX}/typesystems)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/pyside2_global.h
DESTINATION include/${BINDING_NAME}${pyside2_SUFFIX})
diff --git a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml
index 7f4cb19b1..8aade34af 100644
--- a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml
+++ b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml
@@ -40,7 +40,7 @@
****************************************************************************/
-->
<typesystem package="PySide2.QtCore">
- <load-typesystem name="typesystem_templates.xml" generate="no"/>
+ <load-typesystem name="templates/core_common.xml" generate="no"/>
<custom-type name="str"/>
<custom-type name="PyBytes"/>
@@ -81,29 +81,18 @@
<inject-code class="native" position="beginning" file="../glue/qtcore.cpp" snippet="include-pyside"/>
- <template name="use_stream_for_format_security">
- // Uses the stream version for security reasons
- // see gcc man page at -Wformat-security
- %FUNCTION_NAME() &lt;&lt; %1;
- </template>
<add-function signature="qDebug(const char*)">
- <inject-code>
- <insert-template name="use_stream_for_format_security"/>
- </inject-code>
+ <inject-code file="../glue/qtcore.cpp" snippet="use-stream-for-format-security"/>
</add-function>
<add-function signature="qCritical(const char*)">
- <inject-code>
- <insert-template name="use_stream_for_format_security"/>
- </inject-code>
+ <inject-code file="../glue/qtcore.cpp" snippet="use-stream-for-format-security"/>
</add-function>
<add-function signature="qFatal(const char*)">
<inject-code file="../glue/qtcore.cpp" snippet="qfatal"/>
</add-function>
<add-function signature="qWarning(const char*)">
- <inject-code>
- <insert-template name="use_stream_for_format_security"/>
- </inject-code>
+ <inject-code file="../glue/qtcore.cpp" snippet="use-stream-for-format-security"/>
</add-function>
<!-- TODO: We do not support void* or const void* as arg -->
@@ -649,30 +638,6 @@
</conversion-rule>
</container-type>
- <template name="cppmap_to_pymap_conversion">
- PyObject *%out = PyDict_New();
- for (%INTYPE::const_iterator it = %in.begin(), end = %in.end(); it != end; ++it) {
- %INTYPE_0 key = it.key();
- %INTYPE_1 value = it.value();
- PyObject *pyKey = %CONVERTTOPYTHON[%INTYPE_0](key);
- PyObject *pyValue = %CONVERTTOPYTHON[%INTYPE_1](value);
- PyDict_SetItem(%out, pyKey, pyValue);
- Py_DECREF(pyKey);
- Py_DECREF(pyValue);
- }
- return %out;
- </template>
- <template name="pydict_to_cppmap_conversion">
- PyObject *key;
- PyObject *value;
- Py_ssize_t pos = 0;
- while (PyDict_Next(%in, &amp;pos, &amp;key, &amp;value)) {
- %OUTTYPE_0 cppKey = %CONVERTTOCPP[%OUTTYPE_0](key);
- %OUTTYPE_1 cppValue = %CONVERTTOCPP[%OUTTYPE_1](value);
- %out.insert(cppKey, cppValue);
- }
- </template>
-
<container-type name="QHash" type="hash">
<include file-name="QHash" location="global"/>
<!-- Include to make enum flags work. -->
@@ -1005,46 +970,24 @@
</modify-argument>
<inject-code file="../glue/qtcore.cpp" snippet="qresource-data"/>
</modify-function>
- <template name="QResource_registerResource">
- uchar *ptr = reinterpret_cast&lt;uchar*&gt;(Shiboken::Buffer::getPointer(%PYARG_1));
- %RETURN_TYPE %0 = %CPPSELF.%FUNCTION_NAME(const_cast&lt;const uchar*&gt;(ptr), %2);
- %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%0);
- </template>
<modify-function signature="unregisterResource(const uchar*,const QString&amp;)" rename="unregisterResourceData">
<modify-argument index="1">
<replace-type modified-type="PyBuffer"/>
</modify-argument>
- <inject-code>
- <insert-template name="QResource_registerResource"/>
- </inject-code>
+ <inject-code file="../glue/qtcore.cpp" snippet="qresource-registerResource"/>
</modify-function>
<modify-function signature="registerResource(const uchar*,const QString&amp;)" rename="registerResourceData">
<modify-argument index="1">
<replace-type modified-type="PyBuffer"/>
</modify-argument>
- <inject-code>
- <insert-template name="QResource_registerResource"/>
- </inject-code>
+ <inject-code file="../glue/qtcore.cpp" snippet="qresource-registerResource"/>
</modify-function>
</object-type>
<value-type name="QBasicTimer"/>
<value-type name="QByteArrayMatcher"/>
<value-type name="QDate" hash-function="PySide::hash" >
- <template name="pydatetime_importandcheck_function">
- #ifdef IS_PY3K
- #define PySideDateTime_IMPORT PyDateTime_IMPORT
- #else
- #define PySideDateTime_IMPORT \
- (PyDateTimeAPI = (PyDateTime_CAPI*) PyCObject_Import((char*)"datetime", \
- (char*)"datetime_CAPI"))
- #endif
- static bool PyDateTime_ImportAndCheck(PyObject *pyIn) {
- if (!PyDateTimeAPI) PySideDateTime_IMPORT;
- return $DATETIMETYPE_Check(pyIn);
- }
- </template>
<inject-code class="native" position="beginning">
<insert-template name="pydatetime_importandcheck_function">
<replace from="$DATETIMETYPE" to="PyDate"/>
@@ -2829,15 +2772,6 @@
<object-type name="QTimerEvent" polymorphic-id-expression="%1-&gt;type() == QEvent::Timer"/>
<object-type name="QDynamicPropertyChangeEvent" polymorphic-id-expression="%1-&gt;type() == QEvent::DynamicPropertyChange"/>
- <template name="stream_read_method">
- %RETURN_TYPE _cpp_result;
- (*%CPPSELF) &gt;&gt; _cpp_result;
- %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](_cpp_result);
- </template>
-
- <template name="stream_write_method">
- (*%CPPSELF) &lt;&lt; %1;
- </template>
<object-type name="QDataStream" stream="yes">
<enum-type name="FloatingPointPrecision" since="4.6"/>
@@ -2884,49 +2818,31 @@
<modify-function signature="operator&lt;&lt;(const char*)" remove="all"/>
<!-- ### -->
<add-function signature="operator&lt;&lt;(const QString&amp;)">
- <inject-code class="target" position="end">
- <insert-template name="stream_write_method"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="stream-write-method"/>
</add-function>
<add-function signature="writeQString(const QString&amp;)">
- <inject-code class="target" position="end">
- <insert-template name="stream_write_method"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="stream-write-method"/>
</add-function>
<add-function signature="readQString()" return-type="QString">
- <inject-code class="target" position="end">
- <insert-template name="stream_read_method"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="stream-read-method"/>
</add-function>
<add-function signature="writeQChar(const QChar&amp;)">
- <inject-code class="target" position="end">
- <insert-template name="stream_write_method"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="stream-write-method"/>
</add-function>
<add-function signature="readQChar()" return-type="QChar">
- <inject-code class="target" position="end">
- <insert-template name="stream_read_method"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="stream-read-method"/>
</add-function>
<add-function signature="writeQStringList(const QStringList&amp;)">
- <inject-code class="target" position="end">
- <insert-template name="stream_write_method"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="stream-write-method"/>
</add-function>
<add-function signature="readQStringList()" return-type="QStringList">
- <inject-code class="target" position="end">
- <insert-template name="stream_read_method"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="stream-read-method"/>
</add-function>
<add-function signature="writeQVariant(const QVariant&amp;)">
- <inject-code class="target" position="end">
- <insert-template name="stream_write_method"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="stream-write-method"/>
</add-function>
<add-function signature="readQVariant()" return-type="QVariant">
- <inject-code class="target" position="end">
- <insert-template name="stream_read_method"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="stream-read-method"/>
</add-function>
<modify-function signature="readRawData(char*,int)">
<modify-argument index="1">
@@ -2943,125 +2859,77 @@
<!-- Extra functions for primitive type handling -->
<add-function signature="readBool()" return-type="bool">
- <inject-code class="target" position="end">
- <insert-template name="stream_read_method"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="stream-read-method"/>
</add-function>
<add-function signature="readInt8()" return-type="qint8">
- <inject-code class="target" position="end">
- <insert-template name="stream_read_method"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="stream-read-method"/>
</add-function>
<add-function signature="readUInt8()" return-type="quint8">
- <inject-code class="target" position="end">
- <insert-template name="stream_read_method"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="stream-read-method"/>
</add-function>
<add-function signature="readUInt16()" return-type="quint16">
- <inject-code class="target" position="end">
- <insert-template name="stream_read_method"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="stream-read-method"/>
</add-function>
<add-function signature="readInt16()" return-type="qint16">
- <inject-code class="target" position="end">
- <insert-template name="stream_read_method"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="stream-read-method"/>
</add-function>
<add-function signature="readInt32()" return-type="qint32">
- <inject-code class="target" position="end">
- <insert-template name="stream_read_method"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="stream-read-method"/>
</add-function>
<add-function signature="readUInt32()" return-type="quint32">
- <inject-code class="target" position="end">
- <insert-template name="stream_read_method"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="stream-read-method"/>
</add-function>
<add-function signature="readInt64()" return-type="qint64">
- <inject-code class="target" position="end">
- <insert-template name="stream_read_method"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="stream-read-method"/>
</add-function>
<add-function signature="readUInt64()" return-type="quint64">
- <inject-code class="target" position="end">
- <insert-template name="stream_read_method"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="stream-read-method"/>
</add-function>
<add-function signature="readFloat()" return-type="float">
- <inject-code class="target" position="end">
- <insert-template name="stream_read_method"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="stream-read-method"/>
</add-function>
<add-function signature="readDouble()" return-type="qreal">
- <inject-code class="target" position="end">
- <insert-template name="stream_read_method"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="stream-read-method"/>
</add-function>
<add-function signature="readString()" return-type="QString">
- <inject-code class="target" position="end">
- <insert-template name="stream_read_method"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="stream-read-method"/>
</add-function>
<add-function signature="writeBool(bool)">
- <inject-code class="target" position="end">
- <insert-template name="stream_write_method"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="stream-write-method"/>
</add-function>
<add-function signature="writeInt8(qint8)">
- <inject-code class="target" position="end">
- <insert-template name="stream_write_method"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="stream-write-method"/>
</add-function>
<add-function signature="writeUInt8(quint8)">
- <inject-code class="target" position="end">
- <insert-template name="stream_write_method"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="stream-write-method"/>
</add-function>
<add-function signature="writeUInt16(quint16)">
- <inject-code class="target" position="end">
- <insert-template name="stream_write_method"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="stream-write-method"/>
</add-function>
<add-function signature="writeInt16(qint16)">
- <inject-code class="target" position="end">
- <insert-template name="stream_write_method"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="stream-write-method"/>
</add-function>
<add-function signature="writeInt32(qint32)">
- <inject-code class="target" position="end">
- <insert-template name="stream_write_method"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="stream-write-method"/>
</add-function>
<add-function signature="writeUInt32(quint32)">
- <inject-code class="target" position="end">
- <insert-template name="stream_write_method"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="stream-write-method"/>
</add-function>
<add-function signature="writeInt64(qint64)">
- <inject-code class="target" position="end">
- <insert-template name="stream_write_method"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="stream-write-method"/>
</add-function>
<add-function signature="writeUInt64(quint64)">
- <inject-code class="target" position="end">
- <insert-template name="stream_write_method"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="stream-write-method"/>
</add-function>
<add-function signature="writeFloat(float)">
- <inject-code class="target" position="end">
- <insert-template name="stream_write_method"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="stream-write-method"/>
</add-function>
<add-function signature="writeDouble(qreal)">
- <inject-code class="target" position="end">
- <insert-template name="stream_write_method"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="stream-write-method"/>
</add-function>
<add-function signature="writeString(QString)">
- <inject-code class="target" position="end">
- <insert-template name="stream_write_method"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="stream-write-method"/>
</add-function>
<!-- ### deprecated method -->
diff --git a/sources/pyside2/PySide2/QtDataVisualization/typesystem_datavisualization.xml b/sources/pyside2/PySide2/QtDataVisualization/typesystem_datavisualization.xml
index 2777f5519..94e6f4b88 100644
--- a/sources/pyside2/PySide2/QtDataVisualization/typesystem_datavisualization.xml
+++ b/sources/pyside2/PySide2/QtDataVisualization/typesystem_datavisualization.xml
@@ -41,39 +41,8 @@
-->
<typesystem package="PySide2.QtDataVisualization">
- <template name="cppqlistofptrtoqvectors_to_py_conversion">
- const int rowCount = %in.size();
- PyObject* %out = PyList_New(rowCount);
- for (int r = 0; r &lt; rowCount; ++r) {
- const QVector&lt;%INTYPE_0&gt; *row = %in.at(r);
- const int columnCount = row->size();
- PyObject *pyRow = PyList_New(columnCount);
- for (int c = 0; c &lt; columnCount; ++c) {
- const %INTYPE_0 &amp;cppItem = row->at(c);
- PyList_SET_ITEM(pyRow, c, %CONVERTTOPYTHON[%INTYPE_0](cppItem));
- }
- PyList_SET_ITEM(%out, r, pyRow);
- }
- return %out;
- </template>
- <template name="py_to_cppqlistofptrtoqvectors_conversion">
- const int rowCount = int(PySequence_Size(%in));
- %OUTTYPE &amp;result = %out;
- result.reserve(rowCount);
- for (int r = 0; r &lt; rowCount; ++r) {
- Shiboken::AutoDecRef rowItem(PySequence_GetItem(%in, r));
- const int columnCount = int(PySequence_Size(rowItem));
- QVector&lt;%OUTTYPE_0&gt; *row = new QVector&lt;%OUTTYPE_0&gt;;
- row->reserve(columnCount);
- for (int c = 0; c &lt; columnCount; ++c) {
- Shiboken::AutoDecRef pyItem(PySequence_GetItem(rowItem, c));
- %OUTTYPE_0 v = %CONVERTTOCPP[%OUTTYPE_0](pyItem);
- row->append(v);
- }
- result.append(row);
- }
- </template>
- <load-typesystem name="QtGui/typesystem_gui.xml" generate="no"/>
+ <load-typesystem name="templates/datavisualization_common.xml" generate="no" />
+ <load-typesystem name="QtGui/typesystem_gui.xml" generate="no" />
<namespace-type name="QtDataVisualization">
<primitive-type name="QBarDataArray">
<include file-name="qbardataproxy.h" location="global"/>
diff --git a/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml b/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml
index e7d1fc76d..090b7a4ec 100644
--- a/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml
+++ b/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml
@@ -41,18 +41,9 @@
-->
<typesystem package="PySide2.QtGui">
<load-typesystem name="QtCore/typesystem_core.xml" generate="no"/>
+ <load-typesystem name="templates/core_common.xml" generate="no"/>
+ <load-typesystem name="templates/gui_common.xml" generate="no"/>
- <template name="QFontCharFix">
- int size = Shiboken::String::len(%PYARG_1);
- if (size == 1) {
- const char *str = Shiboken::String::toCString(%PYARG_1);
- QChar ch(str[0]);
- %RETURN_TYPE %0 = %CPPSELF.%FUNCTION_NAME(ch);
- %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%0);
- } else {
- PyErr_SetString(PyExc_TypeError, "String must have only one character");
- }
- </template>
<rejection class="^Q.*$" argument-type="^QPlatform.*$"/>
<function signature="qAlpha(uint)"/>
@@ -554,26 +545,6 @@
</modify-function>
</value-type>
- <template name="load_xpm">
- Shiboken::AutoDecRef strList(PySequence_Fast(%PYARG_1, "Invalid sequence."));
- int lineCount = PySequence_Fast_GET_SIZE(strList.object());
- for (int line = 0; line &lt; lineCount; ++line) {
- if (!Shiboken::String::check(PySequence_Fast_GET_ITEM(strList.object(), line))) {
- PyErr_SetString(PyExc_TypeError, "The argument must be a sequence of strings.");
- break;
- }
- }
-
- const char **xpm = reinterpret_cast&lt;const char**&gt;(malloc(lineCount * sizeof(const char**)));
- for (int line = 0; line &lt; lineCount; ++line)
- xpm[line] = Shiboken::String::toCString(PySequence_Fast_GET_ITEM(strList.object(), line));
-
- %BEGIN_ALLOW_THREADS
- %0 = new %TYPE(xpm);
- %END_ALLOW_THREADS
-
- free(xpm);
- </template>
<value-type name="QPixmap" >
<!--<conversion-rule>-->
<!--<target-to-native replace="no">-->
@@ -703,13 +674,6 @@
</insert-template>
</inject-code>
</add-function>
- <template name="qmatrix_map">
- %ARG1_TYPE a, b;
- %CPPSELF.%FUNCTION_NAME(%1, %2, &amp;a, &amp;b);
- %PYARG_0 = PyTuple_New(2);
- PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[%ARG1_TYPE](a));
- PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[%ARG1_TYPE](b));
- </template>
<modify-function signature="map(int,int,int*,int*)const">
<modify-argument index="3">
<remove-argument />
@@ -791,10 +755,6 @@
<include file-name="QMatrix" location="global"/>
</extra-includes>
- <template name="qimage_buffer_constructor">
- uchar *ptr = reinterpret_cast&lt;uchar*&gt;(Shiboken::Buffer::getPointer(%PYARG_1));
- %0 = new %TYPE(ptr, %ARGS);
- </template>
<modify-function signature="QImage(uchar*,int,int,int,QImage::Format,QImageCleanupFunction,void*)">
<modify-argument index="1">
<replace-type modified-type="PyBuffer"/>
@@ -905,48 +865,6 @@
</extra-includes>
</value-type>
- <template name="qcolor_repr">
- switch(%CPPSELF.spec()) {
- case QColor::Rgb:
- {
- qreal r, g, b, a;
- %CPPSELF.getRgbF(&amp;r, &amp;g, &amp;b, &amp;a);
- QString repr = QString().sprintf("PySide2.QtGui.QColor.fromRgbF(%.6f, %.6f, %.6f, %.6f)", r, g, b, a);
- %PYARG_0 = Shiboken::String::fromCString(qPrintable(repr));
- break;
- }
- case QColor::Hsv:
- {
- qreal h, s, v, a;
- %CPPSELF.getHsvF(&amp;h, &amp;s, &amp;v, &amp;a);
- QString repr = QString().sprintf("PySide2.QtGui.QColor.fromHsvF(%.6f, %.6f, %.6f, %.6f)", h, s, v, a);
- %PYARG_0 = Shiboken::String::fromCString(qPrintable(repr));
- break;
- }
- case QColor::Cmyk:
- {
- qreal c, m, y, k, a;
- %CPPSELF.getCmykF(&amp;c, &amp;m, &amp;y, &amp;k, &amp;a);
- QString repr = QString().sprintf("PySide2.QtGui.QColor.fromCmykF(%.6f, %.6f, %.6f, %.6f, %.6f)", c, m, y, k, a);
- %PYARG_0 = Shiboken::String::fromCString(qPrintable(repr));
- break;
- }
- #if QT_VERSION >= 0x040600
- case QColor::Hsl:
- {
- qreal h, s, l, a;
- %CPPSELF.getHslF(&amp;h, &amp;s, &amp;l, &amp;a);
- QString repr = QString().sprintf("PySide2.QtGui.QColor.fromHslF(%.6f, %.6f, %.6f, %.6f)", h, s, l, a);
- %PYARG_0 = Shiboken::String::fromCString(qPrintable(repr));
- break;
- }
- #endif
- default:
- {
- %PYARG_0 = Shiboken::String::fromCString("PySide2.QtGui.QColor()");
- }
- }
- </template>
<value-type name="QColor">
<enum-type name="NameFormat"/>
<enum-type name="Spec"/>
@@ -1443,42 +1361,6 @@
</modify-function>
</object-type>
- <template name="validator_conversionrule">
- QValidator::State %out;
-
- if (PySequence_Check(%PYARG_0)) {
- Shiboken::AutoDecRef seq(PySequence_Fast(%PYARG_0, 0));
- int size = PySequence_Fast_GET_SIZE(seq.object());
-
- if (size > 1) {
- if (%ISCONVERTIBLE[QString](PySequence_Fast_GET_ITEM(seq.object(), 1)))
- %1 = %CONVERTTOCPP[QString](PySequence_Fast_GET_ITEM(seq.object(), 1));
- else
- qWarning("%TYPE::%FUNCTION_NAME: Second tuple element is not convertible to unicode.");
- }
-
- if (size > 2) {
- if (%ISCONVERTIBLE[int](PySequence_Fast_GET_ITEM(seq.object(), 2)))
- %2 = %CONVERTTOCPP[int](PySequence_Fast_GET_ITEM(seq.object(), 2));
- else
- qWarning("%TYPE::%FUNCTION_NAME: Second tuple element is not convertible to int.");
- }
- %PYARG_0.reset(PySequence_Fast_GET_ITEM(seq.object(), 0));
- Py_INCREF(%PYARG_0); // we need to incref, because "%PYARG_0 = ..." will decref the tuple and the tuple will be decrefed again at the end of this scope.
- }
-
- // check retrun value
- if (%ISCONVERTIBLE[QValidator::State](%PYARG_0)) {
- %out = %CONVERTTOCPP[QValidator::State](%PYARG_0);
- } else {
- PyErr_Format(PyExc_TypeError, "Invalid return value in function %s, expected %s, got %s.",
- "QValidator.validate",
- "PySide2.QtGui.QValidator.State, (PySide2.QtGui.QValidator.State,), (PySide2.QtGui.QValidator.State, unicode) or (PySide2.QtGui.QValidator.State, unicode, int)",
- Py_TYPE(pyResult)->tp_name);
- return QValidator::State();
- }
- </template>
-
<object-type name="QValidator">
<enum-type name="State"/>
<modify-function signature="fixup(QString &amp;)const">
@@ -1488,9 +1370,7 @@
<inject-code class="native" position="end">
<insert-template name="return_QString_native"/>
</inject-code>
- <inject-code class="target" position="end">
- <insert-template name="return_QString"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="qstring-return"/>
</modify-function>
<modify-function signature="validate(QString &amp;,int &amp;)const">
<modify-argument index="return">
@@ -1510,6 +1390,7 @@
<object-type name="QContextMenuEvent" polymorphic-id-expression="%1-&gt;type() == QEvent::ContextMenu">
<enum-type name="Reason"/>
</object-type>
+
<object-type name="QDragEnterEvent" polymorphic-id-expression="%1-&gt;type() == QEvent::DragEnter"/>
<object-type name="QDragLeaveEvent" polymorphic-id-expression="%1-&gt;type() == QEvent::DragLeave"/>
<object-type name="QDragMoveEvent" polymorphic-id-expression="%1-&gt;type() == QEvent::DragMove"/>
@@ -1928,11 +1809,6 @@
<!-- ### "drawText(...)" is an internal method. -->
<modify-function signature="drawText(const QPointF&amp;,const QString&amp;,int,int)" remove="all"/>
- <template name="qpainter_drawlist">
- %BEGIN_ALLOW_THREADS
- %CPPSELF.%FUNCTION_NAME(%1.data(), %1.size());
- %END_ALLOW_THREADS
- </template>
<modify-function signature="drawConvexPolygon(const QPoint*,int)" remove="all"/>
<add-function signature="drawConvexPolygon(QVector&lt;QPoint>)">
@@ -2905,9 +2781,7 @@
<modify-argument index="return">
<replace-type modified-type="QString"/>
</modify-argument>
- <inject-code class="target" position="beginning">
- <insert-template name="glGetString_return_QString"/>
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qstring-return"/>
</modify-function>
</object-type>
<object-type name="QOpenGLFunctions" since="5.0">
diff --git a/sources/pyside2/PySide2/QtOpenGL/typesystem_opengl.xml b/sources/pyside2/PySide2/QtOpenGL/typesystem_opengl.xml
index 59019faa1..a234e95d6 100644
--- a/sources/pyside2/PySide2/QtOpenGL/typesystem_opengl.xml
+++ b/sources/pyside2/PySide2/QtOpenGL/typesystem_opengl.xml
@@ -40,7 +40,8 @@
****************************************************************************/
-->
<typesystem package="PySide2.QtOpenGL">
- <load-typesystem name="QtWidgets/typesystem_widgets.xml" generate="no"/>
+ <load-typesystem name="QtWidgets/typesystem_widgets.xml" generate="no" />
+ <load-typesystem name="templates/opengl_common.xml" generate="no" />
<primitive-type name="GLbitfield"/>
<primitive-type name="GLboolean"/>
@@ -136,24 +137,6 @@
<enum-type name="ShaderTypeBit" flags="ShaderType"/>
</object-type>
- <template name="callArrayFunction">
- int _size = PySequence_Size(%PYARG_2);
- if (_size) {
- $ATTR_TYPE *_list = new $ATTR_TYPE[_size];
- if (_size) {
- Shiboken::AutoDecRef fast(PySequence_Fast(%PYARG_2, "Failed to parse sequence with type %VECTOR_TYPE."));
- for(int i=0; i &lt; _size; i++) {
- PyObject* pv = PySequence_Fast_GET_ITEM(fast.object(), i);
- _list[i] = %CONVERTTOCPP[$ATTR_TYPE](pv);
- }
- }
- %CPPSELF.%FUNCTION_NAME(%1, _list, $ARG0);
- delete[] _list;
- } else {
- %CPPSELF.%FUNCTION_NAME(%1, ($ATTR_TYPE*)NULL, $ARG1);
- }
- </template>
-
<object-type name="QGLShaderProgram" since="4.6">
<!-- setAttributeArray -->
<modify-function signature="setAttributeArray(int,const QVector2D*,int)" rename="setAttributeArray2D">
diff --git a/sources/pyside2/PySide2/QtWebKitWidgets/typesystem_webkitwidgets.xml b/sources/pyside2/PySide2/QtWebKitWidgets/typesystem_webkitwidgets.xml
index fa54703c3..27a4835e2 100644
--- a/sources/pyside2/PySide2/QtWebKitWidgets/typesystem_webkitwidgets.xml
+++ b/sources/pyside2/PySide2/QtWebKitWidgets/typesystem_webkitwidgets.xml
@@ -46,6 +46,7 @@
<load-typesystem name="QtWebKit/typesystem_webkit.xml" generate="no"/>
<load-typesystem name="QtNetwork/typesystem_network.xml" generate="no"/>
<load-typesystem name="QtPrintSupport/typesystem_printsupport.xml" generate="no"/>
+ <load-typesystem name="templates/webkitwidgets_common.xml" generate="no"/>
<value-type name="QWebDatabase"/>
@@ -118,14 +119,7 @@
<modify-argument index="return">
<replace-type modified-type="PyObject"/>
</modify-argument>
- <inject-code position="end">
- <insert-template name="convertFromMultiMap">
- <replace from="%MAP_NAME" to="%0"/>
- <replace from="%RETURN_NAME" to="%PYARG_0"/>
- <replace from="%KEY_TYPE" to="QString"/>
- <replace from="%VALUE_TYPE" to="QString"/>
- </insert-template>
- </inject-code>
+ <inject-code position="end" file="../glue/qtwebkitwidgets.cpp" snippet="qwebframe-metadata" />
</modify-function>
</object-type>
@@ -150,19 +144,6 @@
<value-type name="ViewportAttributes"/>
<modify-function signature="extension(QWebPage::Extension,const QWebPage::ExtensionOption*,QWebPage::ExtensionReturn*)">
- <template name="qwebpage_extension_argument_conversion">
- PyObject* %out = 0;
- // Cast the parameters according to the extension type
- if (extension == QWebPage::ChooseMultipleFilesExtension) {
- const ChooseMultipleFilesExtension$TYPE_SUFFIX* _in = reinterpret_cast&lt;const ChooseMultipleFilesExtension$TYPE_SUFFIX*>(%in);
- %out = %CONVERTTOPYTHON[const QWebPage::ChooseMultipleFilesExtension$TYPE_SUFFIX*](_in);
- #if QT_VERSION >= 0x040600
- } else if (extension == QWebPage::ErrorPageExtension) {
- const ErrorPageExtension$TYPE_SUFFIX* _in = reinterpret_cast&lt;const ErrorPageExtension$TYPE_SUFFIX*>(%in);
- %out = %CONVERTTOPYTHON[const QWebPage::ErrorPageExtension$TYPE_SUFFIX*](_in);
- #endif
- }
- </template>
<modify-argument index="2" invalidate-after-use="yes">
<conversion-rule class="target">
<insert-template name="qwebpage_extension_argument_conversion">
diff --git a/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml b/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml
index c7fae8d7f..d22d694cc 100644
--- a/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml
+++ b/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml
@@ -40,7 +40,8 @@
****************************************************************************/
-->
<typesystem package="PySide2.QtWidgets">
- <load-typesystem name="QtGui/typesystem_gui.xml" generate="no"/>
+ <load-typesystem name="templates/core_common.xml" generate="no"/>
+ <load-typesystem name="templates/widgets_common.xml" generate="no"/>
@@ -2297,9 +2298,7 @@
<modify-argument index="return">
<replace-type modified-type="QString"/>
</modify-argument>
- <inject-code class="target" position="end">
- <insert-template name="return_QString"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="qstring-return"/>
</modify-function>
<modify-function signature="validate(QString &amp;,int &amp;)const">
<modify-argument index="return">
@@ -2436,9 +2435,7 @@
<replace-type modified-type="QString"/>
<replace-default-expression with="QString()"/>
</modify-argument>
- <inject-code class="target" position="end">
- <insert-template name="return_for_QFileDialog"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtwidgets.cpp" snippet="qfiledialog-return" />
</modify-function>
<modify-function signature="getOpenFileNames(QWidget*,const QString&amp;,const QString&amp;,const QString&amp;,QString*,QFlags&lt;QFileDialog::Option&gt;)" allow-thread="yes">
<modify-argument index="return">
@@ -2448,9 +2445,7 @@
<replace-type modified-type="QString"/>
<replace-default-expression with="QString()"/>
</modify-argument>
- <inject-code class="target" position="end">
- <insert-template name="return_for_QFileDialog"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtwidgets.cpp" snippet="qfiledialog-return" />
</modify-function>
<modify-function signature="getOpenFileUrl(QWidget*,const QString&amp;,const QUrl&amp;,const QString&amp;,QString*,QFlags&lt;QFileDialog::Option&gt;,const QStringList&amp;)" allow-thread="yes">
@@ -2461,9 +2456,7 @@
<replace-type modified-type="QString"/>
<replace-default-expression with="QString()"/>
</modify-argument>
- <inject-code class="target" position="end">
- <insert-template name="return_for_QFileDialog"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtwidgets.cpp" snippet="qfiledialog-return" />
</modify-function>
<modify-function signature="getOpenFileUrls(QWidget*,const QString&amp;,const QUrl&amp;,const QString&amp;,QString*,QFlags&lt;QFileDialog::Option&gt;,const QStringList&amp;)" allow-thread="yes">
@@ -2474,9 +2467,7 @@
<replace-type modified-type="QString"/>
<replace-default-expression with="QString()"/>
</modify-argument>
- <inject-code class="target" position="end">
- <insert-template name="return_for_QFileDialog"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtwidgets.cpp" snippet="qfiledialog-return" />
</modify-function>
<modify-function signature="getSaveFileName(QWidget*,const QString&amp;,const QString&amp;,const QString&amp;,QString*,QFlags&lt;QFileDialog::Option&gt;)" allow-thread="yes">
@@ -2487,9 +2478,7 @@
<replace-type modified-type="QString"/>
<replace-default-expression with="QString()"/>
</modify-argument>
- <inject-code class="target" position="end">
- <insert-template name="return_for_QFileDialog"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtwidgets.cpp" snippet="qfiledialog-return" />
</modify-function>
<modify-function signature="getSaveFileUrl(QWidget*,const QString&amp;,const QUrl&amp;,const QString&amp;,QString*,QFlags&lt;QFileDialog::Option&gt;,const QStringList&amp;)" allow-thread="yes">
@@ -2500,9 +2489,7 @@
<replace-type modified-type="QString"/>
<replace-default-expression with="QString()"/>
</modify-argument>
- <inject-code class="target" position="end">
- <insert-template name="return_for_QFileDialog"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtwidgets.cpp" snippet="qfiledialog-return" />
</modify-function>
</object-type>
@@ -2979,16 +2966,6 @@
<enum-type name="ItemRole"/>
<enum-type name="RowWrapPolicy"/>
- <template name="fix_args,int*,ItemRole*">
- int _row;
- QFormLayout::ItemRole _role;
- %BEGIN_ALLOW_THREADS
- %CPPSELF->%FUNCTION_NAME(%ARGUMENT_NAMES, &amp;_row, &amp;_role);
- %END_ALLOW_THREADS
- %PYARG_0 = PyTuple_New(2);
- PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[int](_row));
- PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[QFormLayout::ItemRole](_role));
- </template>
<modify-function signature="getLayoutPosition(QLayout*,int*,QFormLayout::ItemRole*)const">
<modify-argument index="0">
@@ -3000,9 +2977,7 @@
<modify-argument index="3">
<remove-argument/>
</modify-argument>
- <inject-code class="target" position="beginning">
- <insert-template name="fix_args,int*,ItemRole*"/>
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtwidgets.cpp" snippet="qformlayout-fix-args" />
</modify-function>
<modify-function signature="getWidgetPosition(QWidget*,int*,QFormLayout::ItemRole*)const">
<modify-argument index="0">
@@ -3014,9 +2989,7 @@
<modify-argument index="3">
<remove-argument/>
</modify-argument>
- <inject-code class="target" position="beginning">
- <insert-template name="fix_args,int*,ItemRole*"/>
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtwidgets.cpp" snippet="qformlayout-fix-args" />
</modify-function>
<modify-function signature="getItemPosition(int,int*,QFormLayout::ItemRole*)const">
<modify-argument index="0">
@@ -3028,9 +3001,7 @@
<modify-argument index="3">
<remove-argument/>
</modify-argument>
- <inject-code class="target" position="beginning">
- <insert-template name="fix_args,int*,ItemRole*"/>
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtwidgets.cpp" snippet="qformlayout-fix-args" />
</modify-function>
<modify-function signature="addRow(QWidget*,QWidget*)">
diff --git a/sources/pyside2/PySide2/QtXml/typesystem_xml.xml b/sources/pyside2/PySide2/QtXml/typesystem_xml.xml
index 4f7839ccf..59343543a 100644
--- a/sources/pyside2/PySide2/QtXml/typesystem_xml.xml
+++ b/sources/pyside2/PySide2/QtXml/typesystem_xml.xml
@@ -40,8 +40,9 @@
****************************************************************************/
-->
<typesystem package="PySide2.QtXml">
- <load-typesystem name="typesystem_templates.xml" generate="no"/>
- <load-typesystem name="QtCore/typesystem_core.xml" generate="no"/>
+ <load-typesystem name="QtCore/typesystem_core.xml" generate="no" />
+ <load-typesystem name="templates/core_common.xml" generate="no" />
+ <load-typesystem name="templates/xml_common.xml" generate="no" />
<rejection class="QXmlAttributes::Attribute"/>
<rejection class="QDomNode" field-name="impl"/>
@@ -53,19 +54,6 @@
<value-type name="QDomCharacterData"/>
<value-type name="QDomComment"/>
- <template name="qdomdocument_setcontent">
- QString _errorMsg_;
- int _errorLine_ = 0;
- int _errorColumn_ = 0;
- %BEGIN_ALLOW_THREADS
- bool _ret_ = %CPPSELF.%FUNCTION_NAME(%ARGUMENT_NAMES, &amp;_errorMsg_, &amp;_errorLine_, &amp;_errorColumn_);
- %END_ALLOW_THREADS
- %PYARG_0 = PyTuple_New(4);
- PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[bool](_ret_));
- PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[QString](_errorMsg_));
- PyTuple_SET_ITEM(%PYARG_0, 2, %CONVERTTOPYTHON[int](_errorLine_));
- PyTuple_SET_ITEM(%PYARG_0, 3, %CONVERTTOPYTHON[int](_errorColumn_));
- </template>
<value-type name="QDomDocument">
<!-- will be replaced in inject code -->
@@ -85,9 +73,7 @@
<modify-argument index="return">
<replace-type modified-type="(retval, errorMsg, errorLine, errorColumn)"/>
</modify-argument>
- <inject-code class="target" position="beginning">
- <insert-template name="qdomdocument_setcontent"/>
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtxml.cpp" snippet="qdomdocument-setcontent" />
</modify-function>
<modify-function signature="setContent(const QString&amp;,bool,QString*,int*,int*)">
<modify-argument index="3">
@@ -105,9 +91,7 @@
<modify-argument index="return">
<replace-type modified-type="(retval, errorMsg, errorLine, errorColumn)"/>
</modify-argument>
- <inject-code class="target" position="beginning">
- <insert-template name="qdomdocument_setcontent"/>
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtxml.cpp" snippet="qdomdocument-setcontent" />
</modify-function>
<modify-function signature="setContent(QIODevice*,bool,QString*,int*,int*)">
<modify-argument index="3">
@@ -125,9 +109,7 @@
<modify-argument index="return">
<replace-type modified-type="(retval, errorMsg, errorLine, errorColumn)"/>
</modify-argument>
- <inject-code class="target" position="beginning">
- <insert-template name="qdomdocument_setcontent"/>
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtxml.cpp" snippet="qdomdocument-setcontent" />
</modify-function>
<modify-function signature="setContent(const QByteArray&amp;,QString*,int*,int*)">
<modify-argument index="2">
@@ -145,9 +127,7 @@
<modify-argument index="return">
<replace-type modified-type="(retval, errorMsg, errorLine, errorColumn)"/>
</modify-argument>
- <inject-code class="target" position="beginning">
- <insert-template name="qdomdocument_setcontent"/>
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtxml.cpp" snippet="qdomdocument-setcontent" />
</modify-function>
<modify-function signature="setContent(QIODevice*,QString*,int*,int*)">
<modify-argument index="2">
@@ -165,9 +145,7 @@
<modify-argument index="return">
<replace-type modified-type="(retval, errorMsg, errorLine, errorColumn)"/>
</modify-argument>
- <inject-code class="target" position="beginning">
- <insert-template name="qdomdocument_setcontent"/>
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtxml.cpp" snippet="qdomdocument-setcontent" />
</modify-function>
<modify-function signature="setContent(QXmlInputSource*,bool,QString*,int*,int*)">
<modify-argument index="3">
@@ -185,9 +163,7 @@
<modify-argument index="return">
<replace-type modified-type="(retval, errorMsg, errorLine, errorColumn)"/>
</modify-argument>
- <inject-code class="target" position="beginning">
- <insert-template name="qdomdocument_setcontent"/>
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtxml.cpp" snippet="qdomdocument-setcontent" />
</modify-function>
<modify-function signature="setContent(QXmlInputSource*,QXmlReader*,QString*,int*,int*)">
<modify-argument index="3">
@@ -205,9 +181,7 @@
<modify-argument index="return">
<replace-type modified-type="(retval, errorMsg, errorLine, errorColumn)"/>
</modify-argument>
- <inject-code class="target" position="beginning">
- <insert-template name="qdomdocument_setcontent"/>
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtxml.cpp" snippet="qdomdocument-setcontent" />
</modify-function>
<modify-function signature="setContent(const QString&amp;,QString*,int*,int*)">
<modify-argument index="2">
@@ -225,9 +199,7 @@
<modify-argument index="return">
<replace-type modified-type="(retval, errorMsg, errorLine, errorColumn)"/>
</modify-argument>
- <inject-code class="target" position="beginning">
- <insert-template name="qdomdocument_setcontent"/>
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtxml.cpp" snippet="qdomdocument-setcontent" />
</modify-function>
</value-type>
@@ -273,12 +245,6 @@
<object-type name="QXmlErrorHandler"/>
<object-type name="QXmlLexicalHandler"/>
- <template name="QXmlEntityResolver_resolveEntity_return_conversion_native">
- Shiboken::AutoDecRef _py_ok_(PySequence_GetItem(%PYARG_0, 0));
- Shiboken::AutoDecRef _py_ret_(PySequence_GetItem(%PYARG_0, 1));
- %RETURN_TYPE %out = %CONVERTTOCPP[%RETURN_TYPE](_py_ok_);
- %3 = %CONVERTTOCPP[QXmlInputSource*](_py_ret_);
- </template>
<object-type name="QXmlEntityResolver">
<modify-function signature="resolveEntity(const QString&amp;,const QString&amp;,QXmlInputSource*&amp;)">
diff --git a/sources/pyside2/PySide2/glue/qtcore.cpp b/sources/pyside2/PySide2/glue/qtcore.cpp
index f4114db3f..084004ceb 100644
--- a/sources/pyside2/PySide2/glue/qtcore.cpp
+++ b/sources/pyside2/PySide2/glue/qtcore.cpp
@@ -1008,3 +1008,29 @@ QT_END_NAMESPACE
reinterpret_cast<uchar*>(PyBytes_AS_STRING(%PYARG_4)));
%PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%0);
// @snippet qt-qunregisterresourcedata
+
+// @snippet use-stream-for-format-security
+// Uses the stream version for security reasons
+// see gcc man page at -Wformat-security
+%FUNCTION_NAME() << %1;
+// @snippet use-stream-for-format-security
+
+// @snippet qresource-registerResource
+ auto ptr = reinterpret_cast<uchar*>(Shiboken::Buffer::getPointer(%PYARG_1));
+ %RETURN_TYPE %0 = %CPPSELF.%FUNCTION_NAME(const_cast<const uchar*>(ptr), %2);
+ %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%0);
+// @snippet qresource-registerResource
+
+// @snippet qstring-return
+%PYARG_0 = %CONVERTTOPYTHON[QString](%1);
+// @snippet qstring-return
+
+// @snippet stream-write-method
+(*%CPPSELF) << %1;
+// @snippet stream-write-method
+
+// @snippet stream-read-method
+%RETURN_TYPE _cpp_result;
+(*%CPPSELF) >> _cpp_result;
+%PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](_cpp_result);
+// @snippet stream-read-method
diff --git a/sources/pyside2/PySide2/glue/qtwebkitwidgets.cpp b/sources/pyside2/PySide2/glue/qtwebkitwidgets.cpp
index 6744c4be2..086ee3b85 100644
--- a/sources/pyside2/PySide2/glue/qtwebkitwidgets.cpp
+++ b/sources/pyside2/PySide2/glue/qtwebkitwidgets.cpp
@@ -75,3 +75,18 @@ if (_signalIndex == id) {
}
}
// @snippet qwebpage-qt-metacall
+
+// @snippet qwebframe-metadata
+%PYARG_0 = PyDict_New();
+const auto &keys = %0.keys();
+for (const auto &_key : keys) {
+ Shiboken::AutoDecRef _pyValueList(PyList_New(0));
+ for (auto it = %0.lowerBound(key), end = %0.upperBound(key); it ! = end; ++it) {
+ Shiboken::AutoDecRef _pyValue(%CONVERTTOPYTHON[QString](it.value));
+ PyList_Append(_pyValueList, _pyValue);
+ }
+
+ Shiboken::AutoDecRef _pyKey(%CONVERTTOPYTHON[QString](_key));
+ PyDict_SetItem(%PYARG_0, _pyKey, _pyValueList);
+}
+// @snippet qwebframe-metadata
diff --git a/sources/pyside2/PySide2/glue/qtwidgets.cpp b/sources/pyside2/PySide2/glue/qtwidgets.cpp
index 02e74c997..2a8a8af0f 100644
--- a/sources/pyside2/PySide2/glue/qtwidgets.cpp
+++ b/sources/pyside2/PySide2/glue/qtwidgets.cpp
@@ -86,6 +86,26 @@ if (_defaultValue)
_defaultValue = %PYARG_1;
// @snippet qitemeditorfactory-setdefaultfactory
+// @snippet qformlayout-fix-args
+int _row;
+QFormLayout::ItemRole _role;
+%BEGIN_ALLOW_THREADS
+%CPPSELF->%FUNCTION_NAME(%ARGUMENT_NAMES, &_row, &_role);
+%END_ALLOW_THREADS
+%PYARG_0 = PyTuple_New(2);
+PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[int](_row));
+PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[QFormLayout::ItemRole](_role));
+// @snippet qformlayout-fix-args
+
+// @snippet qfiledialog-return
+%BEGIN_ALLOW_THREADS
+%RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(%1, %2, %3, %4, &%5, %6);
+%END_ALLOW_THREADS
+%PYARG_0 = PyTuple_New(2);
+PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[%RETURN_TYPE](retval_));
+PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[%ARG5_TYPE](%5));
+// @snippet qfiledialog-return
+
// @snippet qmenu-addaction-1
%PYARG_0 = addActionWithPyObject(%CPPSELF, QIcon(), %1, %2, %3);
// @snippet qmenu-addaction-1
diff --git a/sources/pyside2/PySide2/glue/qtxml.cpp b/sources/pyside2/PySide2/glue/qtxml.cpp
index 4c24c0c53..ff8be58e2 100644
--- a/sources/pyside2/PySide2/glue/qtxml.cpp
+++ b/sources/pyside2/PySide2/glue/qtxml.cpp
@@ -46,3 +46,18 @@ QXmlInputSource* _qxmlinputsource_arg_ = nullptr;
PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[%RETURN_TYPE](%0));
PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[QXmlInputSource*](_qxmlinputsource_arg_));
// @snippet qxmlentityresolver-resolveentity
+
+// @snippet qdomdocument-setcontent
+QString _errorMsg_;
+int _errorLine_ = 0;
+int _errorColumn_ = 0;
+%BEGIN_ALLOW_THREADS
+bool _ret_ = %CPPSELF.%FUNCTION_NAME(%ARGUMENT_NAMES, &_errorMsg_, &_errorLine_,
+ &_errorColumn_);
+%END_ALLOW_THREADS
+%PYARG_0 = PyTuple_New(4);
+PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[bool](_ret_));
+PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[QString](_errorMsg_));
+PyTuple_SET_ITEM(%PYARG_0, 2, %CONVERTTOPYTHON[int](_errorLine_));
+PyTuple_SET_ITEM(%PYARG_0, 3, %CONVERTTOPYTHON[int](_errorColumn_));
+// @snippet qdomdocument-setcontent
diff --git a/sources/pyside2/PySide2/typesystem_templates.xml b/sources/pyside2/PySide2/templates/core_common.xml
index f0e4a2bf8..0fe19273b 100644
--- a/sources/pyside2/PySide2/typesystem_templates.xml
+++ b/sources/pyside2/PySide2/templates/core_common.xml
@@ -2,7 +2,7 @@
<!--
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2018 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt for Python.
@@ -40,21 +40,13 @@
****************************************************************************/
-->
<typesystem>
- <template name="replace_child">
- $CHILD_TYPE* oldChild = %CPPSELF.$FUNCTION_GET_OLD();
- if (oldChild &amp;&amp; (oldChild != $CPPARG)) {
- Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[$CHILD_TYPE*](oldChild));
- Shiboken::Object::setParent(0, pyChild);
- Shiboken::Object::releaseOwnership(pyChild);
- }
- Shiboken::Object::setParent(%PYSELF, $PYARG);
- </template>
<template name="tuple_ok_retval">
- %PYARG_0 = PyTuple_New(2);
- PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[bool](ok_));
- PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[%RETURN_TYPE](retval_));
+ %PYARG_0 = PyTuple_New(2);
+ PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[bool](ok_));
+ PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[%RETURN_TYPE](retval_));
</template>
+
<template name="bool*_fix,arg">
bool ok_;
%BEGIN_ALLOW_THREADS
@@ -62,6 +54,7 @@
%END_ALLOW_THREADS
<insert-template name="tuple_ok_retval"/>
</template>
+
<template name="bool*_fix,arg,arg,arg,arg">
bool ok_;
%BEGIN_ALLOW_THREADS
@@ -69,12 +62,14 @@
%END_ALLOW_THREADS
<insert-template name="tuple_ok_retval"/>
</template>
+
<!-- Templates to fix bool* parameters -->
<template name="tuple_retval_ok">
- %PYARG_0 = PyTuple_New(2);
- PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[%RETURN_TYPE](retval_));
- PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[bool](ok_));
+ %PYARG_0 = PyTuple_New(2);
+ PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[%RETURN_TYPE](retval_));
+ PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[bool](ok_));
</template>
+
<template name="fix_bool*">
bool ok_;
%BEGIN_ALLOW_THREADS
@@ -82,6 +77,7 @@
%END_ALLOW_THREADS
<insert-template name="tuple_retval_ok"/>
</template>
+
<template name="fix_args,bool*">
bool ok_;
%BEGIN_ALLOW_THREADS
@@ -89,6 +85,7 @@
%END_ALLOW_THREADS
<insert-template name="tuple_retval_ok"/>
</template>
+
<template name="fix_arg,bool*,arg">
bool ok_;
%BEGIN_ALLOW_THREADS
@@ -96,6 +93,7 @@
%END_ALLOW_THREADS
<insert-template name="tuple_retval_ok"/>
</template>
+
<template name="fix_bool*,arg">
bool ok_;
%BEGIN_ALLOW_THREADS
@@ -103,6 +101,7 @@
%END_ALLOW_THREADS
<insert-template name="tuple_retval_ok"/>
</template>
+
<template name="fix_bool*,arg,arg">
bool ok_;
%BEGIN_ALLOW_THREADS
@@ -110,6 +109,7 @@
%END_ALLOW_THREADS
<insert-template name="tuple_retval_ok"/>
</template>
+
<template name="fix_bool*,arg,arg,arg">
bool ok_;
%BEGIN_ALLOW_THREADS
@@ -117,6 +117,7 @@
%END_ALLOW_THREADS
<insert-template name="tuple_retval_ok"/>
</template>
+
<template name="fix_bool*,arg,arg,arg,arg">
bool ok_;
%BEGIN_ALLOW_THREADS
@@ -124,6 +125,7 @@
%END_ALLOW_THREADS
<insert-template name="tuple_retval_ok"/>
</template>
+
<template name="fix_arg,arg,arg,arg,arg,arg,arg,bool*,arg">
bool ok_;
%BEGIN_ALLOW_THREADS
@@ -131,6 +133,7 @@
%END_ALLOW_THREADS
<insert-template name="tuple_retval_ok"/>
</template>
+
<template name="fix_arg,arg,arg,arg,arg,arg,bool*,arg">
bool ok_;
%BEGIN_ALLOW_THREADS
@@ -138,6 +141,7 @@
%END_ALLOW_THREADS
<insert-template name="tuple_retval_ok"/>
</template>
+
<template name="fix_arg,arg,arg,arg,arg,bool*,arg">
bool ok_;
%BEGIN_ALLOW_THREADS
@@ -145,6 +149,7 @@
%END_ALLOW_THREADS
<insert-template name="tuple_retval_ok"/>
</template>
+
<template name="fix_arg,arg,arg,arg,bool*,arg,arg">
bool ok_;
%BEGIN_ALLOW_THREADS
@@ -152,86 +157,39 @@
%END_ALLOW_THREADS
<insert-template name="tuple_retval_ok"/>
</template>
- <template name="get_slice">
- %TYPE* sequence;
- Py_ssize_t start, end;
- Py_ssize_t len = %CPPSELF->count();
-
- if (_i1 &gt; len)
- start = len;
- else if (_i1 &lt; 0)
- start = 0;
- else
- start = _i1;
-
- if (_i2 &gt; len)
- end = len;
- else if (_i2 &lt; 0)
- end = 0;
- else
- end = _i2;
-
- sequence = new %TYPE();
- for (Py_ssize_t i = start; i &lt; end; i++)
- sequence->append(%CPPSELF->at(i));
-
- return %CONVERTTOPYTHON[%TYPE](*sequence);
- </template>
- <template name="fix_args,QRectF*">
- QRectF rect_;
+ <template name="fix_char*">
+ char val_{};
%BEGIN_ALLOW_THREADS
- %CPPSELF.%FUNCTION_NAME(%ARGUMENT_NAMES, &amp;rect_);
+ %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(&amp;val_);
%END_ALLOW_THREADS
- %PYARG_0 = %CONVERTTOPYTHON[QRectF](rect_);
+ %PYARG_0 = PyTuple_New(2);
+ PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[%RETURN_TYPE](retval_));
+ PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[char](val_));
</template>
- <template name="glGetString_return_QString">
- %BEGIN_ALLOW_THREADS
- const GLubyte *us = %CPPSELF.%FUNCTION_NAME(%ARGUMENT_NAMES);
- const QString s = QString::fromLocal8Bit(reinterpret_cast&lt;const char *&gt;(us));
- %END_ALLOW_THREADS
- %PYARG_0 = %CONVERTTOPYTHON[QString](s);
+ <template name="tuple_abcd_same_type">
+ %PYARG_0 = PyTuple_New(4);
+ PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[$TYPE](a));
+ PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[$TYPE](b));
+ PyTuple_SET_ITEM(%PYARG_0, 2, %CONVERTTOPYTHON[$TYPE](c));
+ PyTuple_SET_ITEM(%PYARG_0, 3, %CONVERTTOPYTHON[$TYPE](d));
</template>
- <template name="fix_args,QRect*">
- QRect rect_;
+ <template name="fix_number*,number*,number*,number*">
+ $TYPE a, b, c, d;
%BEGIN_ALLOW_THREADS
- %CPPSELF.%FUNCTION_NAME(%ARGUMENT_NAMES, &amp;rect_);
+ %CPPSELF->::%TYPE::%FUNCTION_NAME(&amp;a, &amp;b, &amp;c, &amp;d);
%END_ALLOW_THREADS
- %PYARG_0 = %CONVERTTOPYTHON[QRect](rect_);
- </template>
-
- <template name="fix_char*">
- char val_{};
- %BEGIN_ALLOW_THREADS
- %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(&amp;val_);
- %END_ALLOW_THREADS
- %PYARG_0 = PyTuple_New(2);
- PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[%RETURN_TYPE](retval_));
- PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[char](val_));
+ <insert-template name="tuple_abcd_same_type"/>
</template>
- <template name="tuple_abcd_same_type">
- %PYARG_0 = PyTuple_New(4);
- PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[$TYPE](a));
- PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[$TYPE](b));
- PyTuple_SET_ITEM(%PYARG_0, 2, %CONVERTTOPYTHON[$TYPE](c));
- PyTuple_SET_ITEM(%PYARG_0, 3, %CONVERTTOPYTHON[$TYPE](d));
- </template>
- <template name="fix_number*,number*,number*,number*">
- $TYPE a, b, c, d;
- %BEGIN_ALLOW_THREADS
- %CPPSELF->::%TYPE::%FUNCTION_NAME(&amp;a, &amp;b, &amp;c, &amp;d);
- %END_ALLOW_THREADS
- <insert-template name="tuple_abcd_same_type"/>
- </template>
<template name="fix_number*,number*,number*,number*,args">
- $TYPE a, b, c, d;
- %BEGIN_ALLOW_THREADS
- %CPPSELF->::%TYPE::%FUNCTION_NAME(&amp;a, &amp;b, &amp;c, &amp;d, %ARGUMENT_NAMES);
- %END_ALLOW_THREADS
- <insert-template name="tuple_abcd_same_type"/>
+ $TYPE a, b, c, d;
+ %BEGIN_ALLOW_THREADS
+ %CPPSELF->::%TYPE::%FUNCTION_NAME(&amp;a, &amp;b, &amp;c, &amp;d, %ARGUMENT_NAMES);
+ %END_ALLOW_THREADS
+ <insert-template name="tuple_abcd_same_type"/>
</template>
<template name="fix_native_return_number*,number*,number*,number*">
@@ -252,42 +210,26 @@
</template>
<template name="fix_number*,number*,number*,number*,number*">
- $TYPE a, b, c, d, e;
- %BEGIN_ALLOW_THREADS
- %CPPSELF.%FUNCTION_NAME(&amp;a, &amp;b, &amp;c, &amp;d, &amp;e);
- %END_ALLOW_THREADS
- %PYARG_0 = PyTuple_New(5);
- PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[$TYPE](a));
- PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[$TYPE](b));
- PyTuple_SET_ITEM(%PYARG_0, 2, %CONVERTTOPYTHON[$TYPE](c));
- PyTuple_SET_ITEM(%PYARG_0, 3, %CONVERTTOPYTHON[$TYPE](d));
- PyTuple_SET_ITEM(%PYARG_0, 4, %CONVERTTOPYTHON[$TYPE](e));
- </template>
-
- <template name="read_wrapper">
- Shiboken::AutoArrayPointer&lt;char&gt; _data(%2);
- qint64 _size = %CPPSELF.%FUNCTION_NAME(_data, %2);
- QByteArray ba;
- if (_size > 0)
- ba = QByteArray(_data, _size);
- %PYARG_0 = %CONVERTTOPYTHON[QByteArray](ba);
+ $TYPE a, b, c, d, e;
+ %BEGIN_ALLOW_THREADS
+ %CPPSELF.%FUNCTION_NAME(&amp;a, &amp;b, &amp;c, &amp;d, &amp;e);
+ %END_ALLOW_THREADS
+ %PYARG_0 = PyTuple_New(5);
+ PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[$TYPE](a));
+ PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[$TYPE](b));
+ PyTuple_SET_ITEM(%PYARG_0, 2, %CONVERTTOPYTHON[$TYPE](c));
+ PyTuple_SET_ITEM(%PYARG_0, 3, %CONVERTTOPYTHON[$TYPE](d));
+ PyTuple_SET_ITEM(%PYARG_0, 4, %CONVERTTOPYTHON[$TYPE](e));
</template>
<template name="fix_args,number*,number*">
- $TYPE a, b;
- %BEGIN_ALLOW_THREADS
- %CPPSELF.%FUNCTION_NAME(%ARGUMENT_NAMES, &amp;a, &amp;b);
- %END_ALLOW_THREADS
- %PYARG_0 = PyTuple_New(2);
- PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[$TYPE](a));
- PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[$TYPE](b));
- </template>
-
- <template name="fix_virtual_method_return_value_and_bool*">
- Shiboken::AutoDecRef _py_ret_(PySequence_GetItem(%PYARG_0, 0));
- Shiboken::AutoDecRef _py_ok_(PySequence_GetItem(%PYARG_0, 1));
- %RETURN_TYPE %out = %CONVERTTOCPP[%RETURN_TYPE](_py_ret_);
- *%2 = %CONVERTTOCPP[bool](_py_ok_);
+ $TYPE a, b;
+ %BEGIN_ALLOW_THREADS
+ %CPPSELF.%FUNCTION_NAME(%ARGUMENT_NAMES, &amp;a, &amp;b);
+ %END_ALLOW_THREADS
+ %PYARG_0 = PyTuple_New(2);
+ PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[$TYPE](a));
+ PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[$TYPE](b));
</template>
<template name="fix_arg,int*,int*">
@@ -302,57 +244,21 @@
PyTuple_SET_ITEM(%PYARG_0, 2, %CONVERTTOPYTHON[int](b));
</template>
- <template name="return_QString">
- %PYARG_0 = %CONVERTTOPYTHON[QString](%1);
- </template>
- <template name="return_QString_native">
- if (%ISCONVERTIBLE[QString](%PYARG_0))
- %1 = %CONVERTTOCPP[QString](%PYARG_0);
- else
- qWarning("%TYPE::%FUNCTION_NAME: Argument is not convertible to unicode.");
- </template>
-
<template name="return_tuple_QValidator_QString_int">
- %BEGIN_ALLOW_THREADS
- %RETURN_TYPE retval_ = %RETURN_TYPE(%CPPSELF.%FUNCTION_NAME(%1, %2));
- %END_ALLOW_THREADS
- %PYARG_0 = PyTuple_New(3);
- PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[%RETURN_TYPE](retval_));
- PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[%ARG1_TYPE](%1));
- PyTuple_SET_ITEM(%PYARG_0, 2, %CONVERTTOPYTHON[%ARG2_TYPE](%2));
- </template>
-
- <template name="return_for_QFileDialog">
- %BEGIN_ALLOW_THREADS
- %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(%1, %2, %3, %4, &amp;%5, %6);
- %END_ALLOW_THREADS
- %PYARG_0 = PyTuple_New(2);
- PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[%RETURN_TYPE](retval_));
- PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[%ARG5_TYPE](%5));
+ %BEGIN_ALLOW_THREADS
+ %RETURN_TYPE retval_ = %RETURN_TYPE(%CPPSELF.%FUNCTION_NAME(%1, %2));
+ %END_ALLOW_THREADS
+ %PYARG_0 = PyTuple_New(3);
+ PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[%RETURN_TYPE](retval_));
+ PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[%ARG1_TYPE](%1));
+ PyTuple_SET_ITEM(%PYARG_0, 2, %CONVERTTOPYTHON[%ARG2_TYPE](%2));
</template>
- <!-- templates for __repr__ -->
<template name="repr_code">
- QString format = QString().sprintf("%s(%REPR_FORMAT)",
+ QString format = QString::asprintf("%s(%REPR_FORMAT)",
Py_TYPE(%PYSELF)->tp_name, %REPR_ARGS);
%PYARG_0 = Shiboken::String::fromCString(qPrintable(format));
</template>
- <template name="repr_code_matrix">
- QString format= QString("%1((").arg(Py_TYPE(%PYSELF)->tp_name);
-
- QList&lt; %MATRIX_TYPE &gt; cppArgs;
- %MATRIX_TYPE data[%MATRIX_SIZE];
- %CPPSELF.copyDataTo(data);
- int matrixSize = %MATRIX_SIZE;
- for(int size=0; size &lt; matrixSize; size++) {
- if (size > 0)
- format += ", ";
- format += QString::number(data[size]);
- }
- format += "))";
-
- %PYARG_0 = Shiboken::String::fromCString(qPrintable(format));
- </template>
<!-- Helpers for modifying "bool nativeEventFilter(QByteArray, void*, long *result)"
to return a tuple of bool,long -->
@@ -380,41 +286,6 @@
<template name="reduce_code">
%PYARG_0 = Py_BuildValue("(N(%REDUCE_FORMAT))", PyObject_Type(%PYSELF), %REDUCE_ARGS);
</template>
- <template name="reduce_code_matrix">
- QList&lt; %MATRIX_TYPE &gt; cppArgs;
- %MATRIX_TYPE data[%MATRIX_SIZE];
- %CPPSELF.copyDataTo(data);
- int matrixSize = %MATRIX_SIZE;
- for(int size=0; size &lt; matrixSize; size++)
- cppArgs.append(data[size]);
-
- PyObject *type = PyObject_Type(%PYSELF);
- PyObject *args = Py_BuildValue("(N)", %CONVERTTOPYTHON[QList&lt;%MATRIX_TYPE&gt; ](cppArgs));
- %PYARG_0 = Py_BuildValue("(NN)", type, args);
- </template>
-
- <!-- Matrix Aux functions -->
- <template name="matrix_constructor">
- if (PySequence_Size(%PYARG_1) == %SIZE) {
- Shiboken::AutoDecRef fast(PySequence_Fast(%PYARG_1, "Failed to parse sequence on %TYPE constructor."));
- float values[%SIZE];
- for(int i=0; i &lt; %SIZE; i++) {
- PyObject *pv = PySequence_Fast_GET_ITEM(fast.object(), i);
- values[i] = %CONVERTTOCPP[float](pv);
- }
- %0 = new %TYPE(values);
- }
- </template>
-
- <template name="matrix_data_function">
- const float* data = %CPPSELF.constData();
- PyObject *pyData = PyTuple_New(%MATRIX_SIZE);
- if (data) {
- for(int i=0; i &lt; %MATRIX_SIZE; i++)
- PyTuple_SET_ITEM(pyData, i, %CONVERTTOPYTHON[float](data[i]));
- }
- return pyData;
- </template>
<!-- Replace '#' for the argument number you want. -->
<template name="return_argument">
@@ -428,32 +299,6 @@
%PYARG_0 = %PYSELF;
</template>
- <template name="__iter_parent__">
- %CPPSELF_TYPE _tmp = %CPPSELF.begin();
- %PYARG_0 = %CONVERTTOPYTHON[%CPPSELF_TYPE](_tmp);
- </template>
-
- <template name="__next__">
- if (!%CPPSELF.atEnd()) {
- %PYARG_0 = %CONVERTTOPYTHON[%CPPSELF_TYPE](*%CPPSELF);
- ++(*%CPPSELF);
- }
- </template>
-
- <template name="convertFromMultiMap">
- %RETURN_NAME = PyDict_New();
- foreach(%KEY_TYPE _key, %MAP_NAME.keys()) {
- Shiboken::AutoDecRef _pyValueList(PyList_New(0));
- foreach(%VALUE_TYPE _value, %MAP_NAME.values(_key)) {
- Shiboken::AutoDecRef _pyValue(%CONVERTTOPYTHON[%VALUE_TYPE](_value));
- PyList_Append(_pyValueList, _pyValue);
- }
-
- Shiboken::AutoDecRef _pyKey(%CONVERTTOPYTHON[%KEY_TYPE](_key));
- PyDict_SetItem(%RETURN_NAME, _pyKey, _pyValueList);
- }
- </template>
-
<template name="to_tuple">
%PYARG_0 = Py_BuildValue("%TT_FORMAT", %TT_ARGS);
</template>
@@ -467,13 +312,16 @@
}
return %out;
</template>
+
<template name="pyseq_to_cpplist_conversion">
- for (int i = 0; i &lt; PySequence_Size(%in); i++) {
+ for (int i = 0, size = PySequence_Size(%in); i &lt; size; i++) {
+
Shiboken::AutoDecRef pyItem(PySequence_GetItem(%in, i));
%OUTTYPE_0 cppItem = %CONVERTTOCPP[%OUTTYPE_0](pyItem);
%out &lt;&lt; cppItem;
}
</template>
+
<template name="cppvector_to_pylist_conversion">
%INTYPE::size_type vectorSize = %in.size();
PyObject* %out = PyList_New((int) vectorSize);
@@ -483,6 +331,7 @@
}
return %out;
</template>
+
<template name="pyseq_to_cppvector_conversion">
int vectorSize = PySequence_Size(%in);
%out.reserve(vectorSize);
@@ -504,4 +353,43 @@
}
</template>
+ <template name="cppmap_to_pymap_conversion">
+ PyObject *%out = PyDict_New();
+ for (%INTYPE::const_iterator it = %in.begin(), end = %in.end(); it != end; ++it) {
+ %INTYPE_0 key = it.key();
+ %INTYPE_1 value = it.value();
+ PyObject *pyKey = %CONVERTTOPYTHON[%INTYPE_0](key);
+ PyObject *pyValue = %CONVERTTOPYTHON[%INTYPE_1](value);
+ PyDict_SetItem(%out, pyKey, pyValue);
+ Py_DECREF(pyKey);
+ Py_DECREF(pyValue);
+ }
+ return %out;
+ </template>
+
+ <template name="pydict_to_cppmap_conversion">
+ PyObject *key;
+ PyObject *value;
+ Py_ssize_t pos = 0;
+ while (PyDict_Next(%in, &amp;pos, &amp;key, &amp;value)) {
+ %OUTTYPE_0 cppKey = %CONVERTTOCPP[%OUTTYPE_0](key);
+ %OUTTYPE_1 cppValue = %CONVERTTOCPP[%OUTTYPE_1](value);
+ %out.insert(cppKey, cppValue);
+ }
+ </template>
+
+ <template name="pydatetime_importandcheck_function">
+ #ifdef IS_PY3K
+ #define PySideDateTime_IMPORT PyDateTime_IMPORT
+ #else
+ #define PySideDateTime_IMPORT \
+ (PyDateTimeAPI = (PyDateTime_CAPI*) PyCObject_Import((char*)"datetime", \
+ (char*)"datetime_CAPI"))
+ #endif
+ static bool PyDateTime_ImportAndCheck(PyObject *pyIn) {
+ if (!PyDateTimeAPI) PySideDateTime_IMPORT;
+ return $DATETIMETYPE_Check(pyIn);
+ }
+ </template>
+
</typesystem>
diff --git a/sources/pyside2/PySide2/templates/datavisualization_common.xml b/sources/pyside2/PySide2/templates/datavisualization_common.xml
new file mode 100644
index 000000000..ee040c977
--- /dev/null
+++ b/sources/pyside2/PySide2/templates/datavisualization_common.xml
@@ -0,0 +1,76 @@
+<?xml version="1.0"?>
+<!--
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt for Python.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+-->
+<typesystem>
+ <template name="cppqlistofptrtoqvectors_to_py_conversion">
+ const int rowCount = %in.size();
+ PyObject* %out = PyList_New(rowCount);
+ for (int r = 0; r &lt; rowCount; ++r) {
+ const QVector&lt;%INTYPE_0&gt; *row = %in.at(r);
+ const int columnCount = row->size();
+ PyObject *pyRow = PyList_New(columnCount);
+ for (int c = 0; c &lt; columnCount; ++c) {
+ const %INTYPE_0 &amp;cppItem = row->at(c);
+ PyList_SET_ITEM(pyRow, c, %CONVERTTOPYTHON[%INTYPE_0](cppItem));
+ }
+ PyList_SET_ITEM(%out, r, pyRow);
+ }
+ return %out;
+ </template>
+
+ <template name="py_to_cppqlistofptrtoqvectors_conversion">
+ const int rowCount = int(PySequence_Size(%in));
+ %OUTTYPE &amp;result = %out;
+ result.reserve(rowCount);
+ for (int r = 0; r &lt; rowCount; ++r) {
+ Shiboken::AutoDecRef rowItem(PySequence_GetItem(%in, r));
+ const int columnCount = int(PySequence_Size(rowItem));
+ QVector&lt;%OUTTYPE_0&gt; *row = new QVector&lt;%OUTTYPE_0&gt;;
+ row->reserve(columnCount);
+ for (int c = 0; c &lt; columnCount; ++c) {
+ Shiboken::AutoDecRef pyItem(PySequence_GetItem(rowItem, c));
+ %OUTTYPE_0 v = %CONVERTTOCPP[%OUTTYPE_0](pyItem);
+ row->append(v);
+ }
+ result.append(row);
+ }
+ </template>
+</typesystem>
diff --git a/sources/pyside2/PySide2/templates/gui_common.xml b/sources/pyside2/PySide2/templates/gui_common.xml
new file mode 100644
index 000000000..227d0a460
--- /dev/null
+++ b/sources/pyside2/PySide2/templates/gui_common.xml
@@ -0,0 +1,291 @@
+<?xml version="1.0"?>
+<!--
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt for Python.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+-->
+<typesystem>
+ <template name="QFontCharFix">
+ int size = Shiboken::String::len(%PYARG_1);
+ if (size == 1) {
+ const char *str = Shiboken::String::toCString(%PYARG_1);
+ QChar ch(str[0]);
+ %RETURN_TYPE %0 = %CPPSELF.%FUNCTION_NAME(ch);
+ %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%0);
+ } else {
+ PyErr_SetString(PyExc_TypeError, "String must have only one character");
+ }
+ </template>
+
+ <template name="load_xpm">
+ Shiboken::AutoDecRef strList(PySequence_Fast(%PYARG_1, "Invalid sequence."));
+ int lineCount = PySequence_Fast_GET_SIZE(strList.object());
+ for (int line = 0; line &lt; lineCount; ++line) {
+ if (!Shiboken::String::check(PySequence_Fast_GET_ITEM(strList.object(), line))) {
+ PyErr_SetString(PyExc_TypeError, "The argument must be a sequence of strings.");
+ break;
+ }
+ }
+
+ const char **xpm = reinterpret_cast&lt;const char**&gt;(malloc(lineCount * sizeof(const char**)));
+ for (int line = 0; line &lt; lineCount; ++line)
+ xpm[line] = Shiboken::String::toCString(PySequence_Fast_GET_ITEM(strList.object(), line));
+
+ %BEGIN_ALLOW_THREADS
+ %0 = new %TYPE(xpm);
+ %END_ALLOW_THREADS
+
+ free(xpm);
+ </template>
+
+ <template name="qmatrix_map">
+ %ARG1_TYPE a, b;
+ %CPPSELF.%FUNCTION_NAME(%1, %2, &amp;a, &amp;b);
+ %PYARG_0 = PyTuple_New(2);
+ PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[%ARG1_TYPE](a));
+ PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[%ARG1_TYPE](b));
+ </template>
+
+ <template name="qimage_buffer_constructor">
+ auto ptr = reinterpret_cast&lt;uchar*&gt;(Shiboken::Buffer::getPointer(%PYARG_1));
+ %0 = new %TYPE(ptr, %ARGS);
+ </template>
+
+ <template name="qcolor_repr">
+ switch(%CPPSELF.spec()) {
+ case QColor::Rgb:
+ {
+ qreal r, g, b, a;
+ %CPPSELF.getRgbF(&amp;r, &amp;g, &amp;b, &amp;a);
+ QString repr = QString::asprintf("PySide2.QtGui.QColor.fromRgbF(%.6f, %.6f, %.6f, %.6f)", r, g, b, a);
+ %PYARG_0 = Shiboken::String::fromCString(qPrintable(repr));
+ break;
+ }
+ case QColor::Hsv:
+ {
+ qreal h, s, v, a;
+ %CPPSELF.getHsvF(&amp;h, &amp;s, &amp;v, &amp;a);
+ QString repr = QString::asprintf("PySide2.QtGui.QColor.fromHsvF(%.6f, %.6f, %.6f, %.6f)", h, s, v, a);
+ %PYARG_0 = Shiboken::String::fromCString(qPrintable(repr));
+ break;
+ }
+ case QColor::Cmyk:
+ {
+ qreal c, m, y, k, a;
+ %CPPSELF.getCmykF(&amp;c, &amp;m, &amp;y, &amp;k, &amp;a);
+ QString repr = QString::asprintf("PySide2.QtGui.QColor.fromCmykF(%.6f, %.6f, %.6f, %.6f, %.6f)", c, m, y, k, a);
+ %PYARG_0 = Shiboken::String::fromCString(qPrintable(repr));
+ break;
+ }
+ case QColor::Hsl:
+ {
+ qreal h, s, l, a;
+ %CPPSELF.getHslF(&amp;h, &amp;s, &amp;l, &amp;a);
+ QString repr = QString::asprintf("PySide2.QtGui.QColor.fromHslF(%.6f, %.6f, %.6f, %.6f)", h, s, l, a);
+ %PYARG_0 = Shiboken::String::fromCString(qPrintable(repr));
+ break;
+ }
+ default:
+ {
+ %PYARG_0 = Shiboken::String::fromCString("PySide2.QtGui.QColor()");
+ }
+ }
+ </template>
+
+ <template name="validator_conversionrule">
+ QValidator::State %out;
+
+ if (PySequence_Check(%PYARG_0)) {
+ Shiboken::AutoDecRef seq(PySequence_Fast(%PYARG_0, 0));
+ int size = PySequence_Fast_GET_SIZE(seq.object());
+
+ if (size > 1) {
+ if (%ISCONVERTIBLE[QString](PySequence_Fast_GET_ITEM(seq.object(), 1)))
+ %1 = %CONVERTTOCPP[QString](PySequence_Fast_GET_ITEM(seq.object(), 1));
+ else
+ qWarning("%TYPE::%FUNCTION_NAME: Second tuple element is not convertible to unicode.");
+ }
+
+ if (size > 2) {
+ if (%ISCONVERTIBLE[int](PySequence_Fast_GET_ITEM(seq.object(), 2)))
+ %2 = %CONVERTTOCPP[int](PySequence_Fast_GET_ITEM(seq.object(), 2));
+ else
+ qWarning("%TYPE::%FUNCTION_NAME: Second tuple element is not convertible to int.");
+ }
+ %PYARG_0.reset(PySequence_Fast_GET_ITEM(seq.object(), 0));
+ Py_INCREF(%PYARG_0); // we need to incref, because "%PYARG_0 = ..." will decref the tuple and the tuple will be decrefed again at the end of this scope.
+ }
+
+ // check retrun value
+ if (%ISCONVERTIBLE[QValidator::State](%PYARG_0)) {
+ %out = %CONVERTTOCPP[QValidator::State](%PYARG_0);
+ } else {
+ PyErr_Format(PyExc_TypeError, "Invalid return value in function %s, expected %s, got %s.",
+ "QValidator.validate",
+ "PySide2.QtGui.QValidator.State, (PySide2.QtGui.QValidator.State,), (PySide2.QtGui.QValidator.State, unicode) or (PySide2.QtGui.QValidator.State, unicode, int)",
+ Py_TYPE(pyResult)->tp_name);
+ return QValidator::State();
+ }
+ </template>
+
+ <template name="qpainter_drawlist">
+ %BEGIN_ALLOW_THREADS
+ %CPPSELF.%FUNCTION_NAME(%1.data(), %1.size());
+ %END_ALLOW_THREADS
+ </template>
+
+ <template name="inplace_add">
+ *%CPPSELF += %1;
+ return %CONVERTTOPYTHON[%RETURN_TYPE](*%CPPSELF);
+ </template>
+
+ <template name="inplace_sub">
+ *%CPPSELF -= %1;
+ return %CONVERTTOPYTHON[%RETURN_TYPE](*%CPPSELF);
+ </template>
+
+ <template name="inplace_mult">
+ *%CPPSELF *= %1;
+ return %CONVERTTOPYTHON[%RETURN_TYPE](*%CPPSELF);
+ </template>
+
+ <template name="inplace_div">
+ *%CPPSELF /= %1;
+ return %CONVERTTOPYTHON[%RETURN_TYPE](*%CPPSELF);
+ </template>
+
+ <template name="return_QString_native">
+ if (%ISCONVERTIBLE[QString](%PYARG_0))
+ %1 = %CONVERTTOCPP[QString](%PYARG_0);
+ else
+ qWarning("%TYPE::%FUNCTION_NAME: Argument is not convertible to unicode.");
+ </template>
+
+ <template name="repr_code_matrix">
+ QByteArray format(Py_TYPE(%PYSELF)->tp_name);
+ format += QByteArray("((");
+
+ QList&lt; %MATRIX_TYPE &gt; cppArgs;
+ %MATRIX_TYPE data[%MATRIX_SIZE];
+ %CPPSELF.copyDataTo(data);
+ int matrixSize = %MATRIX_SIZE;
+ for(int size=0; size &lt; matrixSize; size++) {
+ if (size > 0)
+ format += ", ";
+ format += QByteArray::number(data[size]);
+ }
+ format += "))";
+
+ %PYARG_0 = Shiboken::String::fromStringAndSize(format, format.size());
+ </template>
+
+ <template name="reduce_code_matrix">
+ QList&lt; %MATRIX_TYPE &gt; cppArgs;
+ %MATRIX_TYPE data[%MATRIX_SIZE];
+ %CPPSELF.copyDataTo(data);
+ int matrixSize = %MATRIX_SIZE;
+ for(int size=0; size &lt; matrixSize; size++)
+ cppArgs.append(data[size]);
+
+ PyObject *type = PyObject_Type(%PYSELF);
+ PyObject *args = Py_BuildValue("(N)",
+ %CONVERTTOPYTHON[QList&lt;%MATRIX_TYPE&gt; ](cppArgs));
+ %PYARG_0 = Py_BuildValue("(NN)", type, args);
+ </template>
+
+ <template name="matrix_data_function">
+ const float* data = %CPPSELF.constData();
+ PyObject *pyData = PyTuple_New(%MATRIX_SIZE);
+ if (data) {
+ for(int i=0; i &lt; %MATRIX_SIZE; i++)
+ PyTuple_SET_ITEM(pyData, i, %CONVERTTOPYTHON[float](data[i]));
+ }
+ return pyData;
+ </template>
+
+ <template name="matrix_constructor">
+ if (PySequence_Size(%PYARG_1) == %SIZE) {
+ Shiboken::AutoDecRef fast(PySequence_Fast(%PYARG_1,
+ "Failed to parse sequence on %TYPE constructor."));
+ float values[%SIZE];
+ for(int i=0; i &lt; %SIZE; i++) {
+ PyObject *pv = PySequence_Fast_GET_ITEM(fast.object(), i);
+ values[i] = %CONVERTTOCPP[float](pv);
+ }
+ %0 = new %TYPE(values);
+ }
+ </template>
+
+ <template name="glGetString_return_QString">
+ %BEGIN_ALLOW_THREADS
+ const GLubyte *us = %CPPSELF.%FUNCTION_NAME(%ARGUMENT_NAMES);
+ const QString s = QString::fromLocal8Bit(reinterpret_cast&lt;const char *&gt;(us));
+ %END_ALLOW_THREADS
+ %PYARG_0 = %CONVERTTOPYTHON[QString](s);
+ </template>
+
+ <template name="fix_args,QRectF*">
+ QRectF rect_;
+ %BEGIN_ALLOW_THREADS
+ %CPPSELF.%FUNCTION_NAME(%ARGUMENT_NAMES, &amp;rect_);
+ %END_ALLOW_THREADS
+ %PYARG_0 = %CONVERTTOPYTHON[QRectF](rect_);
+ </template>
+
+ <template name="fix_args,QRect*">
+ QRect rect_;
+ %BEGIN_ALLOW_THREADS
+ %CPPSELF.%FUNCTION_NAME(%ARGUMENT_NAMES, &amp;rect_);
+ %END_ALLOW_THREADS
+ %PYARG_0 = %CONVERTTOPYTHON[QRect](rect_);
+ </template>
+
+ <template name="__next__">
+ if (!%CPPSELF.atEnd()) {
+ %PYARG_0 = %CONVERTTOPYTHON[%CPPSELF_TYPE](*%CPPSELF);
+ ++(*%CPPSELF);
+ }
+ </template>
+
+ <template name="__iter_parent__">
+ %CPPSELF_TYPE _tmp = %CPPSELF.begin();
+ %PYARG_0 = %CONVERTTOPYTHON[%CPPSELF_TYPE](_tmp);
+ </template>
+
+
+</typesystem>
diff --git a/sources/pyside2/PySide2/templates/opengl_common.xml b/sources/pyside2/PySide2/templates/opengl_common.xml
new file mode 100644
index 000000000..46299d8d7
--- /dev/null
+++ b/sources/pyside2/PySide2/templates/opengl_common.xml
@@ -0,0 +1,61 @@
+<?xml version="1.0"?>
+<!--
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt for Python.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+-->
+<typesystem>
+ <template name="callArrayFunction">
+ Py_ssize_t _size = PySequence_Size(%PYARG_2);
+ if (_size) {
+ $ATTR_TYPE *_list = new $ATTR_TYPE[_size];
+ if (_size) {
+ Shiboken::AutoDecRef fast(PySequence_Fast(%PYARG_2,
+ "Failed to parse sequence with type %VECTOR_TYPE."));
+ for(Py_ssize_t i=0; i &lt; _size; i++) {
+ PyObject* pv = PySequence_Fast_GET_ITEM(fast.object(), i);
+ _list[i] = %CONVERTTOCPP[$ATTR_TYPE](pv);
+ }
+ }
+ %CPPSELF.%FUNCTION_NAME(%1, _list, $ARG0);
+ delete[] _list;
+ } else {
+ %CPPSELF.%FUNCTION_NAME(%1, ($ATTR_TYPE*)nullptr, $ARG1);
+ }
+ </template>
+</typesystem>
diff --git a/sources/pyside2/PySide2/templates/webkitwidgets_common.xml b/sources/pyside2/PySide2/templates/webkitwidgets_common.xml
new file mode 100644
index 000000000..fa70c8de7
--- /dev/null
+++ b/sources/pyside2/PySide2/templates/webkitwidgets_common.xml
@@ -0,0 +1,55 @@
+<?xml version="1.0"?>
+<!--
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt for Python.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+-->
+<typesystem>
+ <template name="qwebpage_extension_argument_conversion">
+ PyObject* %out = 0;
+ // Cast the parameters according to the extension type
+ if (extension == QWebPage::ChooseMultipleFilesExtension) {
+ const ChooseMultipleFilesExtension$TYPE_SUFFIX* _in = reinterpret_cast&lt;const ChooseMultipleFilesExtension$TYPE_SUFFIX*>(%in);
+ %out = %CONVERTTOPYTHON[const QWebPage::ChooseMultipleFilesExtension$TYPE_SUFFIX*](_in);
+ } else if (extension == QWebPage::ErrorPageExtension) {
+ const auto _in = reinterpret_cast&lt;const ErrorPageExtension$TYPE_SUFFIX*>(%in);
+ %out = %CONVERTTOPYTHON[const QWebPage::ErrorPageExtension$TYPE_SUFFIX*](_in);
+ }
+ </template>
+
+</typesystem>
diff --git a/sources/pyside2/PySide2/templates/widgets_common.xml b/sources/pyside2/PySide2/templates/widgets_common.xml
new file mode 100644
index 000000000..b68739533
--- /dev/null
+++ b/sources/pyside2/PySide2/templates/widgets_common.xml
@@ -0,0 +1,54 @@
+<?xml version="1.0"?>
+<!--
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt for Python.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+-->
+<typesystem>
+
+ <template name="replace_child">
+ $CHILD_TYPE* oldChild = %CPPSELF.$FUNCTION_GET_OLD();
+ if (oldChild &amp;&amp; (oldChild != $CPPARG)) {
+ Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[$CHILD_TYPE*](oldChild));
+ Shiboken::Object::setParent(0, pyChild);
+ Shiboken::Object::releaseOwnership(pyChild);
+ }
+ Shiboken::Object::setParent(%PYSELF, $PYARG);
+ </template>
+
+</typesystem>
diff --git a/sources/pyside2/PySide2/templates/xml_common.xml b/sources/pyside2/PySide2/templates/xml_common.xml
new file mode 100644
index 000000000..b13a10c25
--- /dev/null
+++ b/sources/pyside2/PySide2/templates/xml_common.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0"?>
+<!--
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt for Python.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+-->
+<typesystem>
+
+ <template name="QXmlEntityResolver_resolveEntity_return_conversion_native">
+ Shiboken::AutoDecRef _py_ok_(PySequence_GetItem(%PYARG_0, 0));
+ Shiboken::AutoDecRef _py_ret_(PySequence_GetItem(%PYARG_0, 1));
+ %RETURN_TYPE %out = %CONVERTTOCPP[%RETURN_TYPE](_py_ok_);
+ %3 = %CONVERTTOCPP[QXmlInputSource*](_py_ret_);
+ </template>
+
+ <template name="fix_virtual_method_return_value_and_bool*">
+ Shiboken::AutoDecRef _py_ret_(PySequence_GetItem(%PYARG_0, 0));
+ Shiboken::AutoDecRef _py_ok_(PySequence_GetItem(%PYARG_0, 1));
+ %RETURN_TYPE %out = %CONVERTTOCPP[%RETURN_TYPE](_py_ret_);
+ *%2 = %CONVERTTOCPP[bool](_py_ok_);
+ </template>
+
+</typesystem>