aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6/PySide6/templates/core_common.xml
diff options
context:
space:
mode:
Diffstat (limited to 'sources/pyside6/PySide6/templates/core_common.xml')
-rw-r--r--sources/pyside6/PySide6/templates/core_common.xml177
1 files changed, 40 insertions, 137 deletions
diff --git a/sources/pyside6/PySide6/templates/core_common.xml b/sources/pyside6/PySide6/templates/core_common.xml
index b173684ba..07bafc6ff 100644
--- a/sources/pyside6/PySide6/templates/core_common.xml
+++ b/sources/pyside6/PySide6/templates/core_common.xml
@@ -1,43 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
-->
<typesystem>
@@ -114,35 +78,52 @@
<insert-template name="tuple_retval_ok"/>
</template>
+ <!-- QInputDialog: these should allow threads -->
<template name="fix_arg,arg,arg,arg,arg,arg,arg,bool*,arg">
bool ok_;
- %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(%1, %2, %3, %4, %5, %6, %7, &amp;ok_, %9);
+ %RETURN_TYPE retval_;
+ Py_BEGIN_ALLOW_THREADS
+ retval_ = %CPPSELF.%FUNCTION_NAME(%1, %2, %3, %4, %5, %6, %7, &amp;ok_, %9);
+ Py_END_ALLOW_THREADS
<insert-template name="tuple_retval_ok"/>
</template>
<template name="fix_arg,arg,arg,arg,arg,arg,arg,bool*,arg,arg">
bool ok_;
- %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(%1, %2, %3, %4, %5, %6, %7, &amp;ok_, %9, %10);
+ %RETURN_TYPE retval_;
+ Py_BEGIN_ALLOW_THREADS
+ retval_ = %CPPSELF.%FUNCTION_NAME(%1, %2, %3, %4, %5, %6, %7, &amp;ok_, %9, %10);
+ Py_END_ALLOW_THREADS
<insert-template name="tuple_retval_ok"/>
</template>
<template name="fix_arg,arg,arg,arg,arg,arg,bool*,arg">
bool ok_;
- %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(%1, %2, %3, %4, %5, %6, &amp;ok_, %8);
+ %RETURN_TYPE retval_;
+ Py_BEGIN_ALLOW_THREADS
+ retval_ = %CPPSELF.%FUNCTION_NAME(%1, %2, %3, %4, %5, %6, &amp;ok_, %8);
+ Py_END_ALLOW_THREADS
<insert-template name="tuple_retval_ok"/>
</template>
<template name="fix_arg,arg,arg,arg,arg,bool*,arg">
bool ok_;
- %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(%1, %2, %3, %4, %5, &amp;ok_, %7);
+ %RETURN_TYPE retval_;
+ Py_BEGIN_ALLOW_THREADS
+ retval_ = %CPPSELF.%FUNCTION_NAME(%1, %2, %3, %4, %5, &amp;ok_, %7);
+ Py_END_ALLOW_THREADS
<insert-template name="tuple_retval_ok"/>
</template>
<template name="fix_arg,arg,arg,arg,bool*,arg,arg">
bool ok_;
- %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(%1, %2, %3, %4, &amp;ok_, %6, %7);
+ %RETURN_TYPE retval_;
+ Py_BEGIN_ALLOW_THREADS
+ retval_ = %CPPSELF.%FUNCTION_NAME(%1, %2, %3, %4, &amp;ok_, %6, %7);
+ Py_END_ALLOW_THREADS
<insert-template name="tuple_retval_ok"/>
</template>
+ <!-- End of QInputDialog templates -->
<template name="fix_char*">
char val_{};
@@ -176,10 +157,10 @@
PyObject* _obj = %PYARG_0.object();
if (!PySequence_Check(_obj)
|| PySequence_Fast_GET_SIZE(_obj) != 4
- || !SbkNumber_Check(PySequence_Fast_GET_ITEM(_obj, 0))
- || !SbkNumber_Check(PySequence_Fast_GET_ITEM(_obj, 1))
- || !SbkNumber_Check(PySequence_Fast_GET_ITEM(_obj, 2))
- || !SbkNumber_Check(PySequence_Fast_GET_ITEM(_obj, 3))) {
+ || !PyNumber_Check(PySequence_Fast_GET_ITEM(_obj, 0))
+ || !PyNumber_Check(PySequence_Fast_GET_ITEM(_obj, 1))
+ || !PyNumber_Check(PySequence_Fast_GET_ITEM(_obj, 2))
+ || !PyNumber_Check(PySequence_Fast_GET_ITEM(_obj, 3))) {
PyErr_SetString(PyExc_TypeError, "Sequence of 4 numbers expected");
} else {
*%1 = %CONVERTTOCPP[$TYPE](PySequence_Fast_GET_ITEM(_obj, 0));
@@ -232,6 +213,18 @@
%PYARG_0 = Shiboken::String::fromCString(qPrintable(format));
</template>
+ <template name="repr_qdebug">
+ QString result;
+ QDebug(&amp;result).nospace() &lt;&lt; "&lt;PySide6.MODULE." &lt;&lt; %CPPSELF &lt;&lt; '>';
+ %PYARG_0 = Shiboken::String::fromCString(qPrintable(result));
+ </template>
+
+ <template name="repr_qdebug_gui">
+ <insert-template name="repr_qdebug">
+ <replace from="MODULE" to="QtGui"/>
+ </insert-template>
+ </template>
+
<template name="return_internal_pointer">
%PYARG_0 = reinterpret_cast&lt;PyObject*>(%CPPSELF.%FUNCTION_NAME());
if (!%PYARG_0)
@@ -284,62 +277,6 @@
%PYARG_0 = Py_BuildValue("%TT_FORMAT", %TT_ARGS);
</template>
- <template name="cpplist_to_pylist_conversion">
- PyObject *%out = PyList_New(Py_ssize_t(%in.size()));
- Py_ssize_t idx = 0;
- for (auto it = %in.cbegin(), end = %in.cend(); it != end; ++it, ++idx) {
- %INTYPE_0 cppItem(*it);
- PyList_SET_ITEM(%out, idx, %CONVERTTOPYTHON[%INTYPE_0](cppItem));
- }
- return %out;
- </template>
-
- <template name="pyseq_to_cpplist_conversion">
- // PYSIDE-795: Turn all sequences into iterables.
- Shiboken::AutoDecRef it(PyObject_GetIter(%in));
- PyObject *(*iternext)(PyObject *) = *Py_TYPE(it)->tp_iternext;
- for (;;) {
- Shiboken::AutoDecRef pyItem(iternext(it));
- if (pyItem.isNull()) {
- if (PyErr_Occurred() &amp;&amp; PyErr_ExceptionMatches(PyExc_StopIteration))
- PyErr_Clear();
- break;
- }
- %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(Py_ssize_t(vectorSize));
- for (%INTYPE::size_type idx = 0; idx &lt; vectorSize; ++idx) {
- %INTYPE_0 cppItem(%in.at(idx));
- PyList_SET_ITEM(%out, idx, %CONVERTTOPYTHON[%INTYPE_0](cppItem));
- }
- return %out;
- </template>
-
- <template name="pyseq_to_cppvector_conversion">
- // PYSIDE-795: Turn all sequences into iterables.
- if (PySequence_Check(%in)) {
- int vectorSize = PySequence_Size(%in);
- %out.reserve(vectorSize);
- }
- Shiboken::AutoDecRef it(PyObject_GetIter(%in));
- PyObject *(*iternext)(PyObject *) = *Py_TYPE(it)->tp_iternext;
- for (;;) {
- Shiboken::AutoDecRef pyItem(iternext(it));
- if (pyItem.isNull()) {
- if (PyErr_Occurred() &amp;&amp; PyErr_ExceptionMatches(PyExc_StopIteration))
- PyErr_Clear();
- break;
- }
- %OUTTYPE_0 cppItem = %CONVERTTOCPP[%OUTTYPE_0](pyItem);
- %out.push_back(cppItem);
- }
- </template>
-
<template name="checkPyCapsuleOrPyCObject_func">
static bool checkPyCapsuleOrPyCObject(PyObject* pyObj)
{
@@ -347,38 +284,4 @@
}
</template>
- <template name="cppmap_to_pymap_conversion">
- PyObject *%out = PyDict_New();
- for (auto it = %in.cbegin(), end = %in.cend(); 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">
- static bool PyDateTime_ImportAndCheck(PyObject *pyIn)
- {
- if (!PyDateTimeAPI)
- PyDateTime_IMPORT;
- return $DATETIMETYPE_Check(pyIn);
- }
- </template>
-
</typesystem>