diff options
Diffstat (limited to 'sources/pyside6/PySide6/templates')
9 files changed, 110 insertions, 503 deletions
diff --git a/sources/pyside6/PySide6/templates/common.xml b/sources/pyside6/PySide6/templates/common.xml new file mode 100644 index 000000000..44ed931e7 --- /dev/null +++ b/sources/pyside6/PySide6/templates/common.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +// Copyright (C) 2022 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> + <template name="const_char_pybuffer"> + PyObject *%out = Shiboken::Buffer::newObject(%in, size); + </template> + + <template name="pybuffer_const_char"> + Py_ssize_t bufferLen; + char *%out = reinterpret_cast<char*>(Shiboken::Buffer::getPointer(%PYARG_1, &bufferLen)); + </template> + + <template name="uint_remove"> + uint %out = bufferLen; + </template> + + <template name="pybytes_const_uchar"> + const uchar *%out = reinterpret_cast<const uchar*>(PyBytes_AS_STRING(%PYARG_1)); + </template> + + <template name="pybytes_uint"> + uint %out = static_cast<uint>(PyBytes_Size(%PYARG_1)); + </template> +</typesystem> 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, &ok_, %9); + %RETURN_TYPE retval_; + Py_BEGIN_ALLOW_THREADS + retval_ = %CPPSELF.%FUNCTION_NAME(%1, %2, %3, %4, %5, %6, %7, &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, &ok_, %9, %10); + %RETURN_TYPE retval_; + Py_BEGIN_ALLOW_THREADS + retval_ = %CPPSELF.%FUNCTION_NAME(%1, %2, %3, %4, %5, %6, %7, &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, &ok_, %8); + %RETURN_TYPE retval_; + Py_BEGIN_ALLOW_THREADS + retval_ = %CPPSELF.%FUNCTION_NAME(%1, %2, %3, %4, %5, %6, &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, &ok_, %7); + %RETURN_TYPE retval_; + Py_BEGIN_ALLOW_THREADS + retval_ = %CPPSELF.%FUNCTION_NAME(%1, %2, %3, %4, %5, &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, &ok_, %6, %7); + %RETURN_TYPE retval_; + Py_BEGIN_ALLOW_THREADS + retval_ = %CPPSELF.%FUNCTION_NAME(%1, %2, %3, %4, &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(&result).nospace() << "<PySide6.MODULE." << %CPPSELF << '>'; + %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<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() && PyErr_ExceptionMatches(PyExc_StopIteration)) - PyErr_Clear(); - break; - } - %OUTTYPE_0 cppItem = %CONVERTTOCPP[%OUTTYPE_0](pyItem); - %out << 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 < 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() && 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, &pos, &key, &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> diff --git a/sources/pyside6/PySide6/templates/datavisualization_common.xml b/sources/pyside6/PySide6/templates/datavisualization_common.xml index 9b2b7eadd..6d5861322 100644 --- a/sources/pyside6/PySide6/templates/datavisualization_common.xml +++ b/sources/pyside6/PySide6/templates/datavisualization_common.xml @@ -1,53 +1,17 @@ <?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> <template name="cppqlistofptrtoqlists_to_py_conversion"> - const int rowCount = %in.size(); + const Py_ssize_t rowCount = %in.size(); PyObject* %out = PyList_New(rowCount); - for (int r = 0; r < rowCount; ++r) { - const QVector<%INTYPE_0> *row = %in.at(r); - const int columnCount = row->size(); + for (Py_ssize_t r = 0; r < rowCount; ++r) { + const QList<%INTYPE_0> *row = %in.at(r); + const Py_ssize_t columnCount = row->size(); PyObject *pyRow = PyList_New(columnCount); - for (int c = 0; c < columnCount; ++c) { + for (Py_ssize_t c = 0; c < columnCount; ++c) { const %INTYPE_0 &cppItem = row->at(c); PyList_SET_ITEM(pyRow, c, %CONVERTTOPYTHON[%INTYPE_0](cppItem)); } @@ -57,15 +21,15 @@ </template> <template name="py_to_cppqlistofptrtoqlists_conversion"> - const int rowCount = int(PySequence_Size(%in)); + const Py_ssize_t rowCount = PySequence_Size(%in); %OUTTYPE &result = %out; result.reserve(rowCount); - for (int r = 0; r < rowCount; ++r) { + for (Py_ssize_t r = 0; r < rowCount; ++r) { Shiboken::AutoDecRef rowItem(PySequence_GetItem(%in, r)); - const int columnCount = int(PySequence_Size(rowItem)); - QVector<%OUTTYPE_0> *row = new QVector<%OUTTYPE_0>; + const Py_ssize_t columnCount = PySequence_Size(rowItem); + auto *row = new QList<%OUTTYPE_0>; row->reserve(columnCount); - for (int c = 0; c < columnCount; ++c) { + for (Py_ssize_t c = 0; c < columnCount; ++c) { Shiboken::AutoDecRef pyItem(PySequence_GetItem(rowItem, c)); %OUTTYPE_0 v = %CONVERTTOCPP[%OUTTYPE_0](pyItem); row->append(v); diff --git a/sources/pyside6/PySide6/templates/gui_common.xml b/sources/pyside6/PySide6/templates/gui_common.xml index 1869af8bb..6a7404507 100644 --- a/sources/pyside6/PySide6/templates/gui_common.xml +++ b/sources/pyside6/PySide6/templates/gui_common.xml @@ -1,50 +1,14 @@ <?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> <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]); + const QChar ch(static_cast<unsigned short>(str[0])); %RETURN_TYPE %0 = %CPPSELF.%FUNCTION_NAME(ch); %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%0); } else { @@ -54,21 +18,24 @@ <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 < lineCount; ++line) { + Py_ssize_t lineCount = PySequence_Fast_GET_SIZE(strList.object()); + for (Py_ssize_t line = 0; line < 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; } } + // PySIDE-1735: Enums are now implemented in Python, so we need to avoid asserts. + if (PyErr_Occurred()) + break; - const char **xpm = reinterpret_cast<const char**>(malloc(lineCount * sizeof(const char**))); - for (int line = 0; line < lineCount; ++line) + auto xpm = new const char*[lineCount]; + for (Py_ssize_t line = 0; line < lineCount; ++line) xpm[line] = Shiboken::String::toCString(PySequence_Fast_GET_ITEM(strList.object(), line)); %0 = new %TYPE(xpm); - free(xpm); + delete [] xpm; </template> <template name="qmatrix_map"> @@ -80,8 +47,9 @@ </template> <template name="qimage_buffer_constructor"> + Py_INCREF(%PYARG_1); auto ptr = reinterpret_cast<uchar*>(Shiboken::Buffer::getPointer(%PYARG_1)); - %0 = new %TYPE(ptr, %ARGS); + %0 = new %TYPE(ptr, %ARGS, imageDecrefDataHandler, %PYARG_1); </template> <template name="qcolor_repr"> @@ -125,21 +93,12 @@ } </template> - <template name="qkeysequence_repr"> - QString result; - QDebug debug(&result); - debug.noquote(); - debug.nospace(); - debug << (*%CPPSELF); - %PYARG_0 = Shiboken::String::fromCString(result.toUtf8().constData()); - </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()); + const Py_ssize_t size = PySequence_Fast_GET_SIZE(seq.object()); if (size > 1) { if (%ISCONVERTIBLE[QString](PySequence_Fast_GET_ITEM(seq.object(), 1))) @@ -171,7 +130,7 @@ </template> <template name="qpainter_drawlist"> - %CPPSELF.%FUNCTION_NAME(%1.data(), %1.size()); + %CPPSELF.%FUNCTION_NAME(%1.constData(), %1.size()); </template> <template name="inplace_add"> @@ -203,7 +162,7 @@ <template name="repr_code_matrix"> QByteArray format(Py_TYPE(%PYSELF)->tp_name); - format += QByteArray("(("); + format += QByteArrayLiteral("(("); QList< %MATRIX_TYPE > cppArgs; %MATRIX_TYPE data[%MATRIX_SIZE]; diff --git a/sources/pyside6/PySide6/templates/opengl_common.xml b/sources/pyside6/PySide6/templates/opengl_common.xml index ee7b021dd..566ebe6ee 100644 --- a/sources/pyside6/PySide6/templates/opengl_common.xml +++ b/sources/pyside6/PySide6/templates/opengl_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> <template name="callArrayFunction"> @@ -55,7 +19,12 @@ %CPPSELF.%FUNCTION_NAME(%1, _list, $ARG0); delete[] _list; } else { - %CPPSELF.%FUNCTION_NAME(%1, ($ATTR_TYPE*)nullptr, $ARG1); + %CPPSELF.%FUNCTION_NAME(%1, reinterpret_cast<$ATTR_TYPE*>(nullptr), $ARG1); } </template> + <template name="glGetString_return_QString"> + const GLubyte *us = %CPPSELF.%FUNCTION_NAME(%ARGUMENT_NAMES); + const QString s = QString::fromLocal8Bit(reinterpret_cast<const char *>(us)); + %PYARG_0 = %CONVERTTOPYTHON[QString](s); + </template> </typesystem> diff --git a/sources/pyside6/PySide6/templates/openglfunctions_common.xml b/sources/pyside6/PySide6/templates/openglfunctions_common.xml deleted file mode 100644 index 117229a29..000000000 --- a/sources/pyside6/PySide6/templates/openglfunctions_common.xml +++ /dev/null @@ -1,48 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- -/**************************************************************************** -** -** Copyright (C) 2019 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="glGetString_return_QString"> - const GLubyte *us = %CPPSELF.%FUNCTION_NAME(%ARGUMENT_NAMES); - const QString s = QString::fromLocal8Bit(reinterpret_cast<const char *>(us)); - %PYARG_0 = %CONVERTTOPYTHON[QString](s); - </template> -</typesystem> diff --git a/sources/pyside6/PySide6/templates/webkitwidgets_common.xml b/sources/pyside6/PySide6/templates/webkitwidgets_common.xml deleted file mode 100644 index 9d0c8e587..000000000 --- a/sources/pyside6/PySide6/templates/webkitwidgets_common.xml +++ /dev/null @@ -1,73 +0,0 @@ -<?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$ -** -****************************************************************************/ ---> -<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<const ChooseMultipleFilesExtension$TYPE_SUFFIX*>(%in); - %out = %CONVERTTOPYTHON[const QWebPage::ChooseMultipleFilesExtension$TYPE_SUFFIX*](_in); - } else if (extension == QWebPage::ErrorPageExtension) { - const auto _in = reinterpret_cast<const ErrorPageExtension$TYPE_SUFFIX*>(%in); - %out = %CONVERTTOPYTHON[const QWebPage::ErrorPageExtension$TYPE_SUFFIX*](_in); - } - </template> - - <template name="qstring_remove"> - QString _local; - QString* %4 = &_local; - </template> - - <template name="pysequence_qstring"> - Shiboken::AutoDecRef pyRes(PySequence_GetItem(%PYARG_0, 0)); - Shiboken::AutoDecRef pyStr(PySequence_GetItem(%PYARG_0, 1)); - %RETURN_TYPE %out = %CONVERTTOCPP[%RETURN_TYPE](pyRes); - *%4 = %CONVERTTOCPP[QString](pyStr); - </template> - - <template name="qstring_pytuple"> - %PYARG_0 = PyTuple_New(2); - PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[%RETURN_TYPE](%0)); - PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[QString](*%4)); - </template> - -</typesystem> diff --git a/sources/pyside6/PySide6/templates/widgets_common.xml b/sources/pyside6/PySide6/templates/widgets_common.xml index 9ce01e79a..b0dee43cd 100644 --- a/sources/pyside6/PySide6/templates/widgets_common.xml +++ b/sources/pyside6/PySide6/templates/widgets_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> @@ -45,16 +9,16 @@ $CHILD_TYPE* oldChild = %CPPSELF.$FUNCTION_GET_OLD(); if (oldChild && (oldChild != $CPPARG)) { Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[$CHILD_TYPE*](oldChild)); - Shiboken::Object::setParent(0, pyChild); + Shiboken::Object::setParent(nullptr, pyChild); Shiboken::Object::releaseOwnership(pyChild); } Shiboken::Object::setParent(%PYSELF, $PYARG); </template> <template name="qgraphicsitem_pysequence"> - int numItems = PySequence_Size(%PYARG_1); + const Py_ssize_t numItems = PySequence_Size(%PYARG_1); Shiboken::AutoArrayPointer<QGraphicsItem*> %out(numItems); - for (int i=0; i < numItems; i++) { + for (Py_ssize_t i = 0; i < numItems; ++i) { %out[i] = %CONVERTTOCPP[QGraphicsItem*](PySequence_Fast_GET_ITEM(%PYARG_1, i)); } </template> @@ -77,9 +41,9 @@ </template> <template name="pysequence_qstyleoptiongraphicsitem"> - int numOptions = PySequence_Size(%PYARG_2); + const Py_ssize_t numOptions = PySequence_Size(%PYARG_2); Shiboken::AutoArrayPointer<QStyleOptionGraphicsItem> %out(numOptions); - for (int i=0; i < numOptions; i++) { + for (Py_ssize_t i=0; i < numOptions; ++i) { %out[i] = %CONVERTTOCPP[QStyleOptionGraphicsItem](PySequence_Fast_GET_ITEM(%PYARG_1, i)); } </template> diff --git a/sources/pyside6/PySide6/templates/xml_common.xml b/sources/pyside6/PySide6/templates/xml_common.xml deleted file mode 100644 index 0a6ae4906..000000000 --- a/sources/pyside6/PySide6/templates/xml_common.xml +++ /dev/null @@ -1,58 +0,0 @@ -<?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$ -** -****************************************************************************/ ---> -<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> |