aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6/PySide6/glue
diff options
context:
space:
mode:
Diffstat (limited to 'sources/pyside6/PySide6/glue')
-rw-r--r--sources/pyside6/PySide6/glue/qtcharts.cpp42
-rw-r--r--sources/pyside6/PySide6/glue/qtcore.cpp1879
-rw-r--r--sources/pyside6/PySide6/glue/qtdatavisualization.cpp42
-rw-r--r--sources/pyside6/PySide6/glue/qtgui.cpp547
-rw-r--r--sources/pyside6/PySide6/glue/qtmultimedia.cpp53
-rw-r--r--sources/pyside6/PySide6/glue/qtnetwork.cpp80
-rw-r--r--sources/pyside6/PySide6/glue/qtopengl.cpp74
-rw-r--r--sources/pyside6/PySide6/glue/qtprintsupport.cpp43
-rw-r--r--sources/pyside6/PySide6/glue/qtqml.cpp76
-rw-r--r--sources/pyside6/PySide6/glue/qtquick.cpp42
-rw-r--r--sources/pyside6/PySide6/glue/qtscript.cpp74
-rw-r--r--sources/pyside6/PySide6/glue/qtuitools.cpp238
-rw-r--r--sources/pyside6/PySide6/glue/qtwebenginewidgets.cpp157
-rw-r--r--sources/pyside6/PySide6/glue/qtwebkitwidgets.cpp92
-rw-r--r--sources/pyside6/PySide6/glue/qtwidgets.cpp663
-rw-r--r--sources/pyside6/PySide6/glue/qtxml.cpp63
-rw-r--r--sources/pyside6/PySide6/glue/qtxmlpatterns.cpp43
17 files changed, 4208 insertions, 0 deletions
diff --git a/sources/pyside6/PySide6/glue/qtcharts.cpp b/sources/pyside6/PySide6/glue/qtcharts.cpp
new file mode 100644
index 000000000..1828fecc0
--- /dev/null
+++ b/sources/pyside6/PySide6/glue/qtcharts.cpp
@@ -0,0 +1,42 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+// @snippet qchart-releaseownership
+Shiboken::Object::releaseOwnership(%PYARG_1);
+// @snippet qchart-releaseownership
diff --git a/sources/pyside6/PySide6/glue/qtcore.cpp b/sources/pyside6/PySide6/glue/qtcore.cpp
new file mode 100644
index 000000000..1ce41d003
--- /dev/null
+++ b/sources/pyside6/PySide6/glue/qtcore.cpp
@@ -0,0 +1,1879 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+/*********************************************************************
+ * INJECT CODE
+ ********************************************************************/
+
+// @snippet include-pyside
+#include <pyside.h>
+#include <limits>
+// @snippet include-pyside
+
+// @snippet qsettings-value
+// If we enter the kwds, means that we have a defaultValue or
+// at least a type.
+// This avoids that we are passing '0' as defaultValue.
+// defaultValue can also be passed as positional argument,
+// not only as keyword.
+QVariant out;
+if (kwds || numArgs > 1) {
+ Py_BEGIN_ALLOW_THREADS
+ out = %CPPSELF.value(%1, %2);
+ Py_END_ALLOW_THREADS
+} else {
+ Py_BEGIN_ALLOW_THREADS
+ out = %CPPSELF.value(%1);
+ Py_END_ALLOW_THREADS
+}
+
+PyTypeObject *typeObj = reinterpret_cast<PyTypeObject*>(%PYARG_3);
+
+if (typeObj) {
+ if (typeObj == &PyList_Type) {
+ QByteArray out_ba = out.toByteArray();
+ if (!out_ba.isEmpty()) {
+ QByteArrayList valuesList = out_ba.split(',');
+ const int valuesSize = valuesList.size();
+ if (valuesSize > 0) {
+ PyObject *list = PyList_New(valuesSize);
+ for (int i = 0; i < valuesSize; i++) {
+ PyObject *item = PyUnicode_FromString(valuesList[i].data());
+ PyList_SET_ITEM(list, i, item);
+ }
+ %PYARG_0 = list;
+
+ } else {
+ %PYARG_0 = %CONVERTTOPYTHON[QVariant](out);
+ }
+ } else {
+ %PYARG_0 = PyList_New(0);
+ }
+ } else if (typeObj == &PyBytes_Type) {
+ QByteArray asByteArray = out.toByteArray();
+ %PYARG_0 = PyBytes_FromString(asByteArray.data());
+ } else if (typeObj == &PyUnicode_Type) {
+ QByteArray asByteArray = out.toByteArray();
+ %PYARG_0 = PyUnicode_FromString(asByteArray.data());
+ } else if (typeObj == &PyLong_Type) {
+ float asFloat = out.toFloat();
+ pyResult = PyLong_FromDouble(asFloat);
+ } else if (typeObj == &PyFloat_Type) {
+ float asFloat = out.toFloat();
+ %PYARG_0 = PyFloat_FromDouble(asFloat);
+ } else if (typeObj == &PyBool_Type) {
+ if (out.toBool()) {
+ Py_INCREF(Py_True);
+ %PYARG_0 = Py_True;
+ } else {
+ Py_INCREF(Py_False);
+ %PYARG_0 = Py_False;
+ }
+ }
+ // TODO: PyDict_Type and PyTuple_Type
+}
+else {
+ if (!out.isValid()) {
+ Py_INCREF(Py_None);
+ %PYARG_0 = Py_None;
+ } else {
+ %PYARG_0 = %CONVERTTOPYTHON[QVariant](out);
+ }
+}
+
+// @snippet qsettings-value
+
+// @snippet qvariant-conversion
+static QMetaType QVariant_resolveMetaType(PyTypeObject *type)
+{
+ if (PyObject_TypeCheck(type, SbkObjectType_TypeF())) {
+ auto sbkType = reinterpret_cast<SbkObjectType *>(type);
+ const char *typeName = Shiboken::ObjectType::getOriginalName(sbkType);
+ if (!typeName)
+ return {};
+ const bool valueType = '*' != typeName[qstrlen(typeName) - 1];
+ // Do not convert user type of value
+ if (valueType && Shiboken::ObjectType::isUserType(type))
+ return {};
+ QMetaType metaType = QMetaType::fromName(typeName);
+ if (metaType.isValid())
+ return metaType;
+ // Do not resolve types to value type
+ if (valueType)
+ return {};
+ // Find in base types. First check tp_bases, and only after check tp_base, because
+ // tp_base does not always point to the first base class, but rather to the first
+ // that has added any python fields or slots to its object layout.
+ // See https://mail.python.org/pipermail/python-list/2009-January/520733.html
+ if (type->tp_bases) {
+ for (int i = 0, size = PyTuple_GET_SIZE(type->tp_bases); i < size; ++i) {
+ auto baseType = reinterpret_cast<PyTypeObject *>(PyTuple_GET_ITEM(type->tp_bases, i));
+ const QMetaType derived = QVariant_resolveMetaType(baseType);
+ if (derived.isValid())
+ return derived;
+ }
+ } else if (type->tp_base) {
+ return QVariant_resolveMetaType(type->tp_base);
+ }
+ }
+ return {};
+}
+static QVariant QVariant_convertToValueList(PyObject *list)
+{
+ if (PySequence_Size(list) < 0) {
+ // clear the error if < 0 which means no length at all
+ PyErr_Clear();
+ return QVariant();
+ }
+
+ Shiboken::AutoDecRef element(PySequence_GetItem(list, 0));
+
+ const QMetaType metaType = QVariant_resolveMetaType(element.cast<PyTypeObject *>());
+ if (metaType.isValid()) {
+ QByteArray listTypeName("QList<");
+ listTypeName += metaType.name();
+ listTypeName += '>';
+ QMetaType metaType = QMetaType::fromName(listTypeName);
+ if (metaType.isValid()) {
+ Shiboken::Conversions::SpecificConverter converter(listTypeName);
+ if (converter) {
+ QVariant var(metaType);
+ converter.toCpp(list, &var);
+ return var;
+ }
+ qWarning() << "Type converter for :" << listTypeName << "not registered.";
+ }
+ }
+ return QVariant();
+}
+static bool QVariant_isStringList(PyObject *list)
+{
+ if (!PySequence_Check(list)) {
+ // If it is not a list or a derived list class
+ // we assume that will not be a String list neither.
+ return false;
+ }
+
+ if (PySequence_Size(list) < 0) {
+ // clear the error if < 0 which means no length at all
+ PyErr_Clear();
+ return false;
+ }
+
+ Shiboken::AutoDecRef fast(PySequence_Fast(list, "Failed to convert QVariantList"));
+ const Py_ssize_t size = PySequence_Fast_GET_SIZE(fast.object());
+ for (Py_ssize_t i = 0; i < size; ++i) {
+ PyObject *item = PySequence_Fast_GET_ITEM(fast.object(), i);
+ if (!%CHECKTYPE[QString](item))
+ return false;
+ }
+ return true;
+}
+static QVariant QVariant_convertToVariantMap(PyObject *map)
+{
+ Py_ssize_t pos = 0;
+ Shiboken::AutoDecRef keys(PyDict_Keys(map));
+ if (!QVariant_isStringList(keys))
+ return QVariant();
+ PyObject *key;
+ PyObject *value;
+ QMap<QString,QVariant> ret;
+ while (PyDict_Next(map, &pos, &key, &value)) {
+ QString cppKey = %CONVERTTOCPP[QString](key);
+ QVariant cppValue = %CONVERTTOCPP[QVariant](value);
+ ret.insert(cppKey, cppValue);
+ }
+ return QVariant(ret);
+}
+static QVariant QVariant_convertToVariantList(PyObject *list)
+{
+ if (QVariant_isStringList(list)) {
+ QList<QString > lst = %CONVERTTOCPP[QList<QString>](list);
+ return QVariant(QStringList(lst));
+ }
+ QVariant valueList = QVariant_convertToValueList(list);
+ if (valueList.isValid())
+ return valueList;
+
+ if (PySequence_Size(list) < 0) {
+ // clear the error if < 0 which means no length at all
+ PyErr_Clear();
+ return QVariant();
+ }
+
+ QList<QVariant> lst;
+ Shiboken::AutoDecRef fast(PySequence_Fast(list, "Failed to convert QVariantList"));
+ const Py_ssize_t size = PySequence_Fast_GET_SIZE(fast.object());
+ for (Py_ssize_t i = 0; i < size; ++i) {
+ PyObject *pyItem = PySequence_Fast_GET_ITEM(fast.object(), i);
+ QVariant item = %CONVERTTOCPP[QVariant](pyItem);
+ lst.append(item);
+ }
+ return QVariant(lst);
+}
+// @snippet qvariant-conversion
+
+// @snippet qvariantmap-check
+static bool QVariantType_isStringList(PyObject *list)
+{
+ Shiboken::AutoDecRef fast(PySequence_Fast(list, "Failed to convert QVariantList"));
+ const Py_ssize_t size = PySequence_Fast_GET_SIZE(fast.object());
+ for (Py_ssize_t i=0; i < size; i++) {
+ PyObject *item = PySequence_Fast_GET_ITEM(fast.object(), i);
+ if (!%CHECKTYPE[QString](item))
+ return false;
+ }
+ return true;
+}
+static bool QVariantType_checkAllStringKeys(PyObject *dict)
+{
+ Shiboken::AutoDecRef keys(PyDict_Keys(dict));
+ return QVariantType_isStringList(keys);
+}
+// @snippet qvariantmap-check
+
+// @snippet qt-qabs
+double _abs = qAbs(%1);
+%PYARG_0 = %CONVERTTOPYTHON[double](_abs);
+// @snippet qt-qabs
+
+// @snippet qt-postroutine
+namespace PySide {
+static QStack<PyObject *> globalPostRoutineFunctions;
+void globalPostRoutineCallback()
+{
+ Shiboken::GilState state;
+ for (auto *callback : globalPostRoutineFunctions) {
+ Shiboken::AutoDecRef result(PyObject_CallObject(callback, nullptr));
+ Py_DECREF(callback);
+ }
+ globalPostRoutineFunctions.clear();
+}
+void addPostRoutine(PyObject *callback)
+{
+ if (PyCallable_Check(callback)) {
+ globalPostRoutineFunctions << callback;
+ Py_INCREF(callback);
+ } else {
+ PyErr_SetString(PyExc_TypeError, "qAddPostRoutine: The argument must be a callable object.");
+ }
+}
+} // namespace
+// @snippet qt-postroutine
+
+// @snippet qt-addpostroutine
+PySide::addPostRoutine(%1);
+// @snippet qt-addpostroutine
+
+// @snippet qt-qaddpostroutine
+qAddPostRoutine(PySide::globalPostRoutineCallback);
+// @snippet qt-qaddpostroutine
+
+// @snippet qt-version
+QList<QByteArray> version = QByteArray(qVersion()).split('.');
+PyObject *pyQtVersion = PyTuple_New(3);
+for (int i = 0; i < 3; ++i)
+ PyTuple_SET_ITEM(pyQtVersion, i, PyInt_FromLong(version[i].toInt()));
+PyModule_AddObject(module, "__version_info__", pyQtVersion);
+PyModule_AddStringConstant(module, "__version__", qVersion());
+// @snippet qt-version
+
+// @snippet qobject-connect
+static bool isDecorator(PyObject *method, PyObject *self)
+{
+ Shiboken::AutoDecRef methodName(PyObject_GetAttr(method, Shiboken::PyMagicName::name()));
+ if (!PyObject_HasAttr(self, methodName))
+ return true;
+ Shiboken::AutoDecRef otherMethod(PyObject_GetAttr(self, methodName));
+ return PyMethod_GET_FUNCTION(otherMethod.object()) != PyMethod_GET_FUNCTION(method);
+}
+
+static bool getReceiver(QObject *source, const char *signal, PyObject *callback, QObject **receiver, PyObject **self, QByteArray *callbackSig)
+{
+ bool forceGlobalReceiver = false;
+ if (PyMethod_Check(callback)) {
+ *self = PyMethod_GET_SELF(callback);
+ if (%CHECKTYPE[QObject *](*self))
+ *receiver = %CONVERTTOCPP[QObject *](*self);
+ forceGlobalReceiver = isDecorator(callback, *self);
+ } else if (PyCFunction_Check(callback)) {
+ *self = PyCFunction_GET_SELF(callback);
+ if (*self && %CHECKTYPE[QObject *](*self))
+ *receiver = %CONVERTTOCPP[QObject *](*self);
+ } else if (PyCallable_Check(callback)) {
+ // Ok, just a callable object
+ *receiver = nullptr;
+ *self = nullptr;
+ }
+
+ bool usingGlobalReceiver = !*receiver || forceGlobalReceiver;
+
+ // Check if this callback is a overwrite of a non-virtual Qt slot.
+ if (!usingGlobalReceiver && receiver && self) {
+ *callbackSig = PySide::Signal::getCallbackSignature(signal, *receiver, callback, usingGlobalReceiver).toLatin1();
+ const QMetaObject *metaObject = (*receiver)->metaObject();
+ int slotIndex = metaObject->indexOfSlot(callbackSig->constData());
+ if (slotIndex != -1 && slotIndex < metaObject->methodOffset() && PyMethod_Check(callback))
+ usingGlobalReceiver = true;
+ }
+
+ const auto receiverThread = *receiver ? (*receiver)->thread() : nullptr;
+
+ if (usingGlobalReceiver) {
+ PySide::SignalManager &signalManager = PySide::SignalManager::instance();
+ *receiver = signalManager.globalReceiver(source, callback);
+ // PYSIDE-1354: Move the global receiver to the original receivers's thread
+ // so that autoconnections work correctly.
+ if (receiverThread && receiverThread != (*receiver)->thread())
+ (*receiver)->moveToThread(receiverThread);
+ *callbackSig = PySide::Signal::getCallbackSignature(signal, *receiver, callback, usingGlobalReceiver).toLatin1();
+ }
+
+ return usingGlobalReceiver;
+}
+
+static bool qobjectConnect(QObject *source, const char *signal, QObject *receiver, const char *slot, Qt::ConnectionType type)
+{
+ if (!signal || !slot)
+ return false;
+
+ if (!PySide::Signal::checkQtSignal(signal))
+ return false;
+ signal++;
+
+ if (!PySide::SignalManager::registerMetaMethod(source, signal, QMetaMethod::Signal))
+ return false;
+
+ bool isSignal = PySide::Signal::isQtSignal(slot);
+ slot++;
+ PySide::SignalManager::registerMetaMethod(receiver, slot, isSignal ? QMetaMethod::Signal : QMetaMethod::Slot);
+ bool connection;
+ connection = QObject::connect(source, signal - 1, receiver, slot - 1, type);
+ return connection;
+}
+
+static bool qobjectConnect(QObject *source, QMetaMethod signal, QObject *receiver, QMetaMethod slot, Qt::ConnectionType type)
+{
+ return qobjectConnect(source, signal.methodSignature(), receiver, slot.methodSignature(), type);
+}
+
+static bool qobjectConnectCallback(QObject *source, const char *signal, PyObject *callback, Qt::ConnectionType type)
+{
+ if (!signal || !PySide::Signal::checkQtSignal(signal))
+ return false;
+ signal++;
+
+ int signalIndex = PySide::SignalManager::registerMetaMethodGetIndex(source, signal, QMetaMethod::Signal);
+ if (signalIndex == -1)
+ return false;
+
+ PySide::SignalManager &signalManager = PySide::SignalManager::instance();
+
+ // Extract receiver from callback
+ QObject *receiver = nullptr;
+ PyObject *self = nullptr;
+ QByteArray callbackSig;
+ bool usingGlobalReceiver = getReceiver(source, signal, callback, &receiver, &self, &callbackSig);
+ if (receiver == nullptr && self == nullptr)
+ return false;
+
+ const QMetaObject *metaObject = receiver->metaObject();
+ const char *slot = callbackSig.constData();
+ int slotIndex = metaObject->indexOfSlot(slot);
+ QMetaMethod signalMethod = metaObject->method(signalIndex);
+
+ if (slotIndex == -1) {
+ if (!usingGlobalReceiver && self && !Shiboken::Object::hasCppWrapper(reinterpret_cast<SbkObject *>(self))) {
+ qWarning("You can't add dynamic slots on an object originated from C++.");
+ if (usingGlobalReceiver)
+ signalManager.releaseGlobalReceiver(source, receiver);
+
+ return false;
+ }
+
+ if (usingGlobalReceiver)
+ slotIndex = signalManager.globalReceiverSlotIndex(receiver, slot);
+ else
+ slotIndex = PySide::SignalManager::registerMetaMethodGetIndex(receiver, slot, QMetaMethod::Slot);
+
+ if (slotIndex == -1) {
+ if (usingGlobalReceiver)
+ signalManager.releaseGlobalReceiver(source, receiver);
+
+ return false;
+ }
+ }
+ bool connection;
+ connection = QMetaObject::connect(source, signalIndex, receiver, slotIndex, type);
+ if (connection) {
+ if (usingGlobalReceiver)
+ signalManager.notifyGlobalReceiver(receiver);
+ #ifndef AVOID_PROTECTED_HACK
+ source->connectNotify(signalMethod); //Qt5: QMetaMethod instead of char *
+ #else
+ // Need to cast to QObjectWrapper * and call the public version of
+ // connectNotify when avoiding the protected hack.
+ reinterpret_cast<QObjectWrapper *>(source)->connectNotify(signalMethod); //Qt5: QMetaMethod instead of char *
+ #endif
+
+ return connection;
+ }
+
+ if (usingGlobalReceiver)
+ signalManager.releaseGlobalReceiver(source, receiver);
+
+ return false;
+}
+
+
+static bool qobjectDisconnectCallback(QObject *source, const char *signal, PyObject *callback)
+{
+ if (!PySide::Signal::checkQtSignal(signal))
+ return false;
+
+ PySide::SignalManager &signalManager = PySide::SignalManager::instance();
+
+ // Extract receiver from callback
+ QObject *receiver = nullptr;
+ PyObject *self = nullptr;
+ QByteArray callbackSig;
+ QMetaMethod slotMethod;
+ bool usingGlobalReceiver = getReceiver(nullptr, signal, callback, &receiver, &self, &callbackSig);
+ if (receiver == nullptr && self == nullptr)
+ return false;
+
+ const QMetaObject *metaObject = receiver->metaObject();
+ int signalIndex = source->metaObject()->indexOfSignal(++signal);
+ int slotIndex = -1;
+
+ slotIndex = metaObject->indexOfSlot(callbackSig);
+ slotMethod = metaObject->method(slotIndex);
+
+ bool disconnected;
+ disconnected = QMetaObject::disconnectOne(source, signalIndex, receiver, slotIndex);
+
+ if (disconnected) {
+ if (usingGlobalReceiver)
+ signalManager.releaseGlobalReceiver(source, receiver);
+
+ #ifndef AVOID_PROTECTED_HACK
+ source->disconnectNotify(slotMethod); //Qt5: QMetaMethod instead of char *
+ #else
+ // Need to cast to QObjectWrapper * and call the public version of
+ // connectNotify when avoiding the protected hack.
+ reinterpret_cast<QObjectWrapper *>(source)->disconnectNotify(slotMethod); //Qt5: QMetaMethod instead of char *
+ #endif
+ return true;
+ }
+ return false;
+}
+// @snippet qobject-connect
+
+// @snippet qobject-connect-1
+// %FUNCTION_NAME() - disable generation of function call.
+bool %0 = qobjectConnect(%1, %2, %CPPSELF, %3, %4);
+%PYARG_0 = %CONVERTTOPYTHON[bool](%0);
+// @snippet qobject-connect-1
+
+// @snippet qobject-connect-2
+// %FUNCTION_NAME() - disable generation of function call.
+bool %0 = qobjectConnect(%1, %2, %3, %4, %5);
+%PYARG_0 = %CONVERTTOPYTHON[bool](%0);
+// @snippet qobject-connect-2
+
+// @snippet qobject-connect-3
+// %FUNCTION_NAME() - disable generation of function call.
+bool %0 = qobjectConnect(%1, %2, %3, %4, %5);
+%PYARG_0 = %CONVERTTOPYTHON[bool](%0);
+// @snippet qobject-connect-3
+
+// @snippet qobject-connect-4
+// %FUNCTION_NAME() - disable generation of function call.
+%RETURN_TYPE %0 = qobjectConnectCallback(%1, %2, %PYARG_3, %4);
+%PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%0);
+// @snippet qobject-connect-4
+
+// @snippet qobject-connect-5
+// %FUNCTION_NAME() - disable generation of function call.
+%RETURN_TYPE %0 = qobjectConnectCallback(%CPPSELF, %1, %PYARG_2, %3);
+%PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%0);
+// @snippet qobject-connect-5
+
+// @snippet qobject-connect-6
+// %FUNCTION_NAME() - disable generation of function call.
+%RETURN_TYPE %0 = qobjectConnect(%CPPSELF, %1, %2, %3, %4);
+%PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%0);
+// @snippet qobject-connect-6
+
+// @snippet qobject-emit
+%RETURN_TYPE %0 = PySide::SignalManager::instance().emitSignal(%CPPSELF, %1, %PYARG_2);
+%PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%0);
+// @snippet qobject-emit
+
+// @snippet qobject-disconnect-1
+// %FUNCTION_NAME() - disable generation of function call.
+%RETURN_TYPE %0 = qobjectDisconnectCallback(%CPPSELF, %1, %2);
+%PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%0);
+// @snippet qobject-disconnect-1
+
+// @snippet qobject-disconnect-2
+// %FUNCTION_NAME() - disable generation of function call.
+%RETURN_TYPE %0 = qobjectDisconnectCallback(%1, %2, %3);
+%PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%0);
+// @snippet qobject-disconnect-2
+
+// @snippet qfatal
+// qFatal doesn't have a stream version, so we do a
+// qWarning call followed by a qFatal() call using a
+// literal.
+Py_BEGIN_ALLOW_THREADS
+qWarning() << %1;
+qFatal("[A qFatal() call was made from Python code]");
+Py_END_ALLOW_THREADS
+// @snippet qfatal
+
+// @snippet moduleshutdown
+PySide::runCleanupFunctions();
+// @snippet moduleshutdown
+
+// @snippet qt-qenum
+%PYARG_0 = PySide::QEnum::QEnumMacro(%1, false);
+// @snippet qt-qenum
+
+// @snippet qt-qflag
+%PYARG_0 = PySide::QEnum::QEnumMacro(%1, true);
+// @snippet qt-qflag
+
+// @snippet qt-init-feature
+PySide::Feature::init();
+// @snippet qt-init-feature
+
+// @snippet qt-pysideinit
+Shiboken::Conversions::registerConverterName(SbkPySide6_QtCoreTypeConverters[SBK_QSTRING_IDX], "unicode");
+Shiboken::Conversions::registerConverterName(SbkPySide6_QtCoreTypeConverters[SBK_QSTRING_IDX], "str");
+Shiboken::Conversions::registerConverterName(SbkPySide6_QtCoreTypeConverters[SBK_QTCORE_QLIST_QVARIANT_IDX], "QVariantList");
+Shiboken::Conversions::registerConverterName(SbkPySide6_QtCoreTypeConverters[SBK_QTCORE_QMAP_QSTRING_QVARIANT_IDX], "QVariantMap");
+
+PySide::registerInternalQtConf();
+PySide::init(module);
+Py_AtExit(QtCoreModuleExit);
+// @snippet qt-pysideinit
+
+// @snippet qt-messagehandler
+// Define a global variable to handle qInstallMessageHandler callback
+static PyObject *qtmsghandler = nullptr;
+
+static void msgHandlerCallback(QtMsgType type, const QMessageLogContext &ctx, const QString &msg)
+{
+ Shiboken::GilState state;
+ Shiboken::AutoDecRef arglist(PyTuple_New(3));
+ PyTuple_SET_ITEM(arglist, 0, %CONVERTTOPYTHON[QtMsgType](type));
+ PyTuple_SET_ITEM(arglist, 1, %CONVERTTOPYTHON[QMessageLogContext &](ctx));
+ QByteArray array = msg.toUtf8(); // Python handler requires UTF-8
+ char *data = array.data();
+ PyTuple_SET_ITEM(arglist, 2, %CONVERTTOPYTHON[char *](data));
+ Shiboken::AutoDecRef ret(PyObject_CallObject(qtmsghandler, arglist));
+}
+static void QtCoreModuleExit()
+{
+ PySide::SignalManager::instance().clear();
+}
+// @snippet qt-messagehandler
+
+// @snippet qt-installmessagehandler
+if (%PYARG_1 == Py_None) {
+ qInstallMessageHandler(0);
+ %PYARG_0 = qtmsghandler ? qtmsghandler : Py_None;
+ qtmsghandler = 0;
+} else if (!PyCallable_Check(%PYARG_1)) {
+ PyErr_SetString(PyExc_TypeError, "parameter must be callable");
+} else {
+ %PYARG_0 = qtmsghandler ? qtmsghandler : Py_None;
+ Py_INCREF(%PYARG_1);
+ qtmsghandler = %PYARG_1;
+ qInstallMessageHandler(msgHandlerCallback);
+}
+
+if (%PYARG_0 == Py_None)
+ Py_INCREF(%PYARG_0);
+// @snippet qt-installmessagehandler
+
+// @snippet qline-hash
+namespace PySide {
+ template<> inline Py_ssize_t hash(const QLine &l)
+ {
+ const int v[4] = {l.x1(), l.y1(), l.x2(), l.y2()};
+ return qHashRange(v, v + 4);
+ }
+};
+// @snippet qline-hash
+
+// @snippet qlinef-intersect
+QPointF p;
+%RETURN_TYPE retval = %CPPSELF.%FUNCTION_NAME(%ARGUMENT_NAMES, &p);
+%PYARG_0 = PyTuple_New(2);
+PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[%RETURN_TYPE](retval));
+PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[QPointF](p));
+// @snippet qlinef-intersect
+
+// @snippet qresource-data
+const void *d = %CPPSELF.%FUNCTION_NAME();
+if (d) {
+ %PYARG_0 = Shiboken::Buffer::newObject(d, %CPPSELF.size());
+} else {
+ Py_INCREF(Py_None);
+ %PYARG_0 = Py_None;
+}
+// @snippet qresource-data
+
+// @snippet qdate-topython
+if (!PyDateTimeAPI)
+ PyDateTime_IMPORT;
+%PYARG_0 = PyDate_FromDate(%CPPSELF.year(), %CPPSELF.month(), %CPPSELF.day());
+// @snippet qdate-topython
+
+// @snippet qdate-getdate
+int year, month, day;
+%CPPSELF.%FUNCTION_NAME(&year, &month, &day);
+%PYARG_0 = PyTuple_New(3);
+PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[int](year));
+PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[int](month));
+PyTuple_SET_ITEM(%PYARG_0, 2, %CONVERTTOPYTHON[int](day));
+// @snippet qdate-getdate
+
+// @snippet qdate-weeknumber
+int yearNumber;
+int week = %CPPSELF.%FUNCTION_NAME(&yearNumber);
+%PYARG_0 = PyTuple_New(2);
+PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[int](week));
+PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[int](yearNumber));
+// @snippet qdate-weeknumber
+
+// @snippet qdatetime-1
+QDate date(%1, %2, %3);
+QTime time(%4, %5, %6, %7);
+%0 = new %TYPE(date, time, Qt::TimeSpec(%8));
+// @snippet qdatetime-1
+
+// @snippet qdatetime-2
+QDate date(%1, %2, %3);
+QTime time(%4, %5, %6);
+%0 = new %TYPE(date, time);
+// @snippet qdatetime-2
+
+// @snippet qdatetime-topython
+QDate date = %CPPSELF.date();
+QTime time = %CPPSELF.time();
+if (!PyDateTimeAPI)
+ PyDateTime_IMPORT;
+%PYARG_0 = PyDateTime_FromDateAndTime(date.year(), date.month(), date.day(), time.hour(), time.minute(), time.second(), time.msec()*1000);
+// @snippet qdatetime-topython
+
+// @snippet qpoint
+namespace PySide {
+ template<> inline Py_ssize_t hash(const QPoint &v) {
+ return qHash(qMakePair(v.x(), v.y()));
+ }
+};
+// @snippet qpoint
+
+// @snippet qrect
+namespace PySide {
+ template<> inline Py_ssize_t hash(const QRect &r) {
+ const int v[4] = {r.x(), r.y(), r.width(), r.height()};
+ return qHashRange(v, v + 4);
+ }
+};
+// @snippet qrect
+
+// @snippet qsize
+namespace PySide {
+ template<> inline Py_ssize_t hash(const QSize &v) {
+ return qHash(qMakePair(v.width(), v.height()));
+ }
+};
+// @snippet qsize
+
+// @snippet qtime-topython
+if (!PyDateTimeAPI)
+ PyDateTime_IMPORT;
+%PYARG_0 = PyTime_FromTime(%CPPSELF.hour(), %CPPSELF.minute(), %CPPSELF.second(), %CPPSELF.msec()*1000);
+// @snippet qtime-topython
+
+// @snippet qbitarray-len
+return %CPPSELF.size();
+// @snippet qbitarray-len
+
+// @snippet qbitarray-getitem
+if (_i < 0 || _i >= %CPPSELF.size()) {
+ PyErr_SetString(PyExc_IndexError, "index out of bounds");
+ return 0;
+}
+bool ret = %CPPSELF.at(_i);
+return %CONVERTTOPYTHON[bool](ret);
+// @snippet qbitarray-getitem
+
+// @snippet qbitarray-setitem
+PyObject *args = Py_BuildValue("(iiO)", _i, 1, _value);
+PyObject *result = Sbk_QBitArrayFunc_setBit(self, args);
+Py_DECREF(args);
+Py_XDECREF(result);
+return !result ? -1 : 0;
+// @snippet qbitarray-setitem
+
+// @snippet unlock
+%CPPSELF.unlock();
+// @snippet unlock
+
+// @snippet qabstractitemmodel-createindex
+%RETURN_TYPE %0 = %CPPSELF.%FUNCTION_NAME(%1, %2, %PYARG_3);
+%PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%0);
+// @snippet qabstractitemmodel-createindex
+
+// @snippet qabstractitemmodel
+qRegisterMetaType<QVector<int> >("QVector<int>");
+// @snippet qabstractitemmodel
+
+// @snippet qobject-metaobject
+%RETURN_TYPE %0 = %CPPSELF.%FUNCTION_NAME();
+%PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%0);
+// @snippet qobject-metaobject
+
+// @snippet qobject-findchild-1
+static QObject *_findChildHelper(const QObject *parent, const QString &name, PyTypeObject *desiredType)
+{
+ for (auto *child : parent->children()) {
+ Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QObject *](child));
+ if (PyType_IsSubtype(Py_TYPE(pyChild), desiredType)
+ && (name.isNull() || name == child->objectName())) {
+ return child;
+ }
+ }
+
+ for (auto *child : parent->children()) {
+ QObject *obj = _findChildHelper(child, name, desiredType);
+ if (obj)
+ return obj;
+ }
+ return nullptr;
+}
+
+static inline bool _findChildrenComparator(const QObject *&child, const QRegularExpression &name)
+{
+ return name.match(child->objectName()).hasMatch();
+}
+
+static inline bool _findChildrenComparator(const QObject *&child, const QString &name)
+{
+ return name.isNull() || name == child->objectName();
+}
+
+template<typename T>
+static void _findChildrenHelper(const QObject *parent, const T& name, PyTypeObject *desiredType, PyObject *result)
+{
+ for (const auto *child : parent->children()) {
+ Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QObject *](child));
+ if (PyType_IsSubtype(Py_TYPE(pyChild), desiredType) && _findChildrenComparator(child, name))
+ PyList_Append(result, pyChild);
+ _findChildrenHelper(child, name, desiredType, result);
+ }
+}
+// @snippet qobject-findchild-1
+
+// @snippet qobject-findchild-2
+QObject *child = _findChildHelper(%CPPSELF, %2, reinterpret_cast<PyTypeObject *>(%PYARG_1));
+%PYARG_0 = %CONVERTTOPYTHON[QObject *](child);
+// @snippet qobject-findchild-2
+
+// @snippet qobject-findchildren
+%PYARG_0 = PyList_New(0);
+_findChildrenHelper(%CPPSELF, %2, reinterpret_cast<PyTypeObject *>(%PYARG_1), %PYARG_0);
+// @snippet qobject-findchildren
+
+// @snippet qobject-tr
+QString result;
+if (QCoreApplication::instance()) {
+ PyObject *klass = PyObject_GetAttr(%PYSELF, Shiboken::PyMagicName::class_());
+ PyObject *cname = PyObject_GetAttr(klass, Shiboken::PyMagicName::name());
+ result = QString(QCoreApplication::instance()->translate(Shiboken::String::toCString(cname),
+ /* %1, %2, QCoreApplication::CodecForTr, %3)); */
+ %1, %2, %3));
+
+ Py_DECREF(klass);
+ Py_DECREF(cname);
+} else {
+ result = QString(QString::fromLatin1(%1));
+}
+%PYARG_0 = %CONVERTTOPYTHON[QString](result);
+// @snippet qobject-tr
+
+// @snippet qobject-receivers
+// Avoid return +1 because SignalManager connect to "destroyed()" signal to control object timelife
+int ret = %CPPSELF.%FUNCTION_NAME(%1);
+if (ret > 0 && ((strcmp(%1, SIGNAL(destroyed())) == 0) || (strcmp(%1, SIGNAL(destroyed(QObject*))) == 0)))
+ ret -= PySide::SignalManager::instance().countConnectionsWith(%CPPSELF);
+
+%PYARG_0 = %CONVERTTOPYTHON[int](ret);
+// @snippet qobject-receivers
+
+// @snippet qregexp-replace
+%1.replace(*%CPPSELF, %2);
+%PYARG_0 = %CONVERTTOPYTHON[QString](%1);
+// @snippet qregexp-replace
+
+// @snippet qbytearray-mgetitem
+if (PyIndex_Check(_key)) {
+ Py_ssize_t _i;
+ _i = PyNumber_AsSsize_t(_key, PyExc_IndexError);
+ if (_i < 0 || _i >= %CPPSELF.size()) {
+ PyErr_SetString(PyExc_IndexError, "index out of bounds");
+ return 0;
+ } else {
+ char res[2];
+ res[0] = %CPPSELF.at(_i);
+ res[1] = 0;
+ return PyBytes_FromStringAndSize(res, 1);
+ }
+} else if (PySlice_Check(_key)) {
+ Py_ssize_t start, stop, step, slicelength, cur;
+ if (PySlice_GetIndicesEx(_key, %CPPSELF.count(), &start, &stop, &step, &slicelength) < 0) {
+ return nullptr;
+ }
+
+ QByteArray ba;
+ if (slicelength <= 0) {
+ return %CONVERTTOPYTHON[QByteArray](ba);
+ } else if (step == 1) {
+ Py_ssize_t max = %CPPSELF.count();
+ start = qBound(Py_ssize_t(0), start, max);
+ stop = qBound(Py_ssize_t(0), stop, max);
+ QByteArray ba;
+ if (start < stop)
+ ba = %CPPSELF.mid(start, stop - start);
+ return %CONVERTTOPYTHON[QByteArray](ba);
+ } else {
+ QByteArray ba;
+ for (cur = start; slicelength > 0; cur += static_cast<size_t>(step), slicelength--) {
+ ba.append(%CPPSELF.at(cur));
+ }
+ return %CONVERTTOPYTHON[QByteArray](ba);
+ }
+} else {
+ PyErr_Format(PyExc_TypeError,
+ "list indices must be integers or slices, not %.200s",
+ Py_TYPE(_key)->tp_name);
+ return nullptr;
+}
+// @snippet qbytearray-mgetitem
+
+// @snippet qbytearray-msetitem
+if (PyIndex_Check(_key)) {
+ Py_ssize_t _i = PyNumber_AsSsize_t(_key, PyExc_IndexError);
+ if (_i == -1 && PyErr_Occurred())
+ return -1;
+
+ if (_i < 0)
+ _i += %CPPSELF.count();
+
+ if (_i < 0 || _i >= %CPPSELF.size()) {
+ PyErr_SetString(PyExc_IndexError, "QByteArray index out of range");
+ return -1;
+ }
+
+ // Provide more specific error message for bytes/str, bytearray, QByteArray respectively
+ if (PyBytes_Check(_value)) {
+ if (Py_SIZE(_value) != 1) {
+ PyErr_SetString(PyExc_ValueError, "bytes must be of size 1");
+ return -1;
+ }
+ } else if (PyByteArray_Check(_value)) {
+ if (Py_SIZE(_value) != 1) {
+ PyErr_SetString(PyExc_ValueError, "bytearray must be of size 1");
+ return -1;
+ }
+ } else if (reinterpret_cast<PyTypeObject *>(Py_TYPE(_value)) == reinterpret_cast<PyTypeObject *>(SbkPySide6_QtCoreTypes[SBK_QBYTEARRAY_IDX])) {
+ if (PyObject_Length(_value) != 1) {
+ PyErr_SetString(PyExc_ValueError, "QByteArray must be of size 1");
+ return -1;
+ }
+ } else {
+ PyErr_SetString(PyExc_ValueError, "a bytes, bytearray, QByteArray of size 1 is required");
+ return -1;
+ }
+
+ // Not support int or long.
+ %CPPSELF.remove(_i, 1);
+ PyObject *args = Py_BuildValue("(nO)", _i, _value);
+ PyObject *result = Sbk_QByteArrayFunc_insert(self, args);
+ Py_DECREF(args);
+ Py_XDECREF(result);
+ return !result ? -1 : 0;
+} else if (PySlice_Check(_key)) {
+ Py_ssize_t start, stop, step, slicelength, value_length;
+ if (PySlice_GetIndicesEx(_key, %CPPSELF.count(), &start, &stop, &step, &slicelength) < 0) {
+ return -1;
+ }
+ // The parameter candidates are: bytes/str, bytearray, QByteArray itself.
+ // Not support iterable which contains ints between 0~255
+
+ // case 1: value is nullpre, means delete the items within the range
+ // case 2: step is 1, means shrink or expanse
+ // case 3: step is not 1, then the number of slots have to equal the number of items in _value
+ QByteArray ba;
+ if (_value == nullptr || _value == Py_None) {
+ ba = QByteArray();
+ value_length = 0;
+ } else if (!(PyBytes_Check(_value) || PyByteArray_Check(_value) || reinterpret_cast<PyTypeObject *>(Py_TYPE(_value)) == reinterpret_cast<PyTypeObject *>(SbkPySide6_QtCoreTypes[SBK_QBYTEARRAY_IDX]))) {
+ PyErr_Format(PyExc_TypeError, "bytes, bytearray or QByteArray is required, not %.200s", Py_TYPE(_value)->tp_name);
+ return -1;
+ } else {
+ value_length = PyObject_Length(_value);
+ }
+
+ if (step != 1 && value_length != slicelength) {
+ PyErr_Format(PyExc_ValueError, "attempt to assign %s of size %d to extended slice of size %d",
+ Py_TYPE(_value)->tp_name, int(value_length), int(slicelength));
+ return -1;
+ }
+
+ if (step != 1) {
+ int i = start;
+ for (int j = 0; j < slicelength; j++) {
+ PyObject *item = PyObject_GetItem(_value, PyLong_FromLong(j));
+ QByteArray temp;
+ if (PyLong_Check(item)) {
+ int overflow;
+ long ival = PyLong_AsLongAndOverflow(item, &overflow);
+ // Not suppose to bigger than 255 because only bytes, bytearray, QByteArray were accept
+ temp = QByteArray(reinterpret_cast<const char *>(&ival));
+ } else {
+ temp = %CONVERTTOCPP[QByteArray](item);
+ }
+
+ %CPPSELF.replace(i, 1, temp);
+ i += step;
+ }
+ return 0;
+ } else {
+ ba = %CONVERTTOCPP[QByteArray](_value);
+ %CPPSELF.replace(start, slicelength, ba);
+ return 0;
+ }
+} else {
+ PyErr_Format(PyExc_TypeError, "QBytearray indices must be integers or slices, not %.200s",
+ Py_TYPE(_key)->tp_name);
+ return -1;
+}
+// @snippet qbytearray-msetitem
+
+// @snippet qbytearray-bufferprotocol
+extern "C" {
+// QByteArray buffer protocol functions
+// see: http://www.python.org/dev/peps/pep-3118/
+
+static int SbkQByteArray_getbufferproc(PyObject *obj, Py_buffer *view, int flags)
+{
+ if (!view || !Shiboken::Object::isValid(obj))
+ return -1;
+
+ QByteArray * cppSelf = %CONVERTTOCPP[QByteArray *](obj);
+ //XXX /|\ omitting this space crashes shiboken!
+ #ifdef Py_LIMITED_API
+ view->obj = obj;
+ view->buf = reinterpret_cast<void *>(cppSelf->data());
+ view->len = cppSelf->size();
+ view->readonly = 0;
+ view->itemsize = 1;
+ view->format = const_cast<char *>("c");
+ view->ndim = 1;
+ view->shape = (flags & PyBUF_ND) == PyBUF_ND ? &(view->len) : nullptr;
+ view->strides = &view->itemsize;
+ view->suboffsets = NULL;
+ view->internal = NULL;
+
+ Py_XINCREF(obj);
+ return 0;
+#else // Py_LIMITED_API
+ const int result = PyBuffer_FillInfo(view, obj, reinterpret_cast<void *>(cppSelf->data()),
+ cppSelf->size(), 0, flags);
+ if (result == 0)
+ Py_XINCREF(obj);
+ return result;
+#endif
+}
+
+static PyBufferProcs SbkQByteArrayBufferProc = {
+ /*bf_getbuffer*/ (getbufferproc)SbkQByteArray_getbufferproc,
+ /*bf_releasebuffer*/ (releasebufferproc)0,
+};
+
+}
+// @snippet qbytearray-bufferprotocol
+
+// @snippet qbytearray-operatorplus-1
+QByteArray ba = QByteArray(PyBytes_AS_STRING(%PYARG_1), PyBytes_GET_SIZE(%PYARG_1)) + *%CPPSELF;
+%PYARG_0 = %CONVERTTOPYTHON[QByteArray](ba);
+// @snippet qbytearray-operatorplus-1
+
+// @snippet qbytearray-operatorplus-2
+QByteArray ba = QByteArray(PyByteArray_AsString(%PYARG_1), PyByteArray_Size(%PYARG_1)) + *%CPPSELF;
+%PYARG_0 = %CONVERTTOPYTHON[QByteArray](ba);
+// @snippet qbytearray-operatorplus-2
+
+// @snippet qbytearray-operatorplus-3
+QByteArray ba = *%CPPSELF + QByteArray(PyByteArray_AsString(%PYARG_1), PyByteArray_Size(%PYARG_1));
+%PYARG_0 = %CONVERTTOPYTHON[QByteArray](ba);
+// @snippet qbytearray-operatorplus-3
+
+// @snippet qbytearray-operatorplusequal
+*%CPPSELF += QByteArray(PyByteArray_AsString(%PYARG_1), PyByteArray_Size(%PYARG_1));
+// @snippet qbytearray-operatorplusequal
+
+// @snippet qbytearray-operatorequalequal
+if (PyUnicode_CheckExact(%PYARG_1)) {
+ Shiboken::AutoDecRef data(PyUnicode_AsASCIIString(%PYARG_1));
+ QByteArray ba = QByteArray(PyBytes_AsString(data.object()), PyBytes_GET_SIZE(data.object()));
+ bool cppResult = %CPPSELF == ba;
+ %PYARG_0 = %CONVERTTOPYTHON[bool](cppResult);
+}
+// @snippet qbytearray-operatorequalequal
+
+// @snippet qbytearray-operatornotequal
+if (PyUnicode_CheckExact(%PYARG_1)) {
+ Shiboken::AutoDecRef data(PyUnicode_AsASCIIString(%PYARG_1));
+ QByteArray ba = QByteArray(PyBytes_AsString(data.object()), PyBytes_GET_SIZE(data.object()));
+ bool cppResult = %CPPSELF != ba;
+ %PYARG_0 = %CONVERTTOPYTHON[bool](cppResult);
+}
+// @snippet qbytearray-operatornotequal
+
+// @snippet qbytearray-operatorgreater
+if (PyUnicode_CheckExact(%PYARG_1)) {
+ Shiboken::AutoDecRef data(PyUnicode_AsASCIIString(%PYARG_1));
+ QByteArray ba = QByteArray(PyBytes_AsString(data.object()), PyBytes_GET_SIZE(data.object()));
+ bool cppResult = %CPPSELF > ba;
+ %PYARG_0 = %CONVERTTOPYTHON[bool](cppResult);
+}
+// @snippet qbytearray-operatorgreater
+
+// @snippet qbytearray-operatorgreaterequal
+if (PyUnicode_CheckExact(%PYARG_1)) {
+ Shiboken::AutoDecRef data(PyUnicode_AsASCIIString(%PYARG_1));
+ QByteArray ba = QByteArray(PyBytes_AsString(data.object()), PyBytes_GET_SIZE(data.object()));
+ bool cppResult = %CPPSELF >= ba;
+ %PYARG_0 = %CONVERTTOPYTHON[bool](cppResult);
+}
+// @snippet qbytearray-operatorgreaterequal
+
+// @snippet qbytearray-operatorlower
+if (PyUnicode_CheckExact(%PYARG_1)) {
+ Shiboken::AutoDecRef data(PyUnicode_AsASCIIString(%PYARG_1));
+ QByteArray ba = QByteArray(PyBytes_AsString(data.object()), PyBytes_GET_SIZE(data.object()));
+ bool cppResult = %CPPSELF < ba;
+ %PYARG_0 = %CONVERTTOPYTHON[bool](cppResult);
+}
+// @snippet qbytearray-operatorlower
+
+// @snippet qbytearray-operatorlowerequal
+if (PyUnicode_CheckExact(%PYARG_1)) {
+ Shiboken::AutoDecRef data(PyUnicode_AsASCIIString(%PYARG_1));
+ QByteArray ba = QByteArray(PyBytes_AsString(data.object()), PyBytes_GET_SIZE(data.object()));
+ bool cppResult = %CPPSELF <= ba;
+ %PYARG_0 = %CONVERTTOPYTHON[bool](cppResult);
+}
+// @snippet qbytearray-operatorlowerequal
+
+// @snippet qbytearray-repr
+PyObject *aux = PyBytes_FromStringAndSize(%CPPSELF.constData(), %CPPSELF.size());
+if (aux == nullptr) {
+ return nullptr;
+}
+QByteArray b(Py_TYPE(%PYSELF)->tp_name);
+%PYARG_0 = PyUnicode_FromFormat("%s(%R)", b.constData(), aux);
+Py_DECREF(aux);
+// @snippet qbytearray-repr
+
+// @snippet qbytearray-1
+if (PyBytes_Check(%PYARG_1)) {
+ %0 = new QByteArray(PyBytes_AsString(%PYARG_1), PyBytes_GET_SIZE(%PYARG_1));
+} else if (Shiboken::String::check(%PYARG_1)) {
+ %0 = new QByteArray(Shiboken::String::toCString(%PYARG_1), Shiboken::String::len(%PYARG_1));
+}
+// @snippet qbytearray-1
+
+// @snippet qbytearray-2
+%0 = new QByteArray(PyByteArray_AsString(%PYARG_1), PyByteArray_Size(%PYARG_1));
+// @snippet qbytearray-2
+
+// @snippet qbytearray-3
+%0 = new QByteArray(PyBytes_AS_STRING(%PYARG_1), PyBytes_GET_SIZE(%PYARG_1));
+// @snippet qbytearray-3
+
+// @snippet qbytearray-py3
+PepType_AS_BUFFER(Shiboken::SbkType<QByteArray>()) = &SbkQByteArrayBufferProc;
+// @snippet qbytearray-py3
+
+// @snippet qbytearray-data
+%PYARG_0 = PyBytes_FromStringAndSize(%CPPSELF.%FUNCTION_NAME(), %CPPSELF.size());
+// @snippet qbytearray-data
+
+// @snippet qbytearray-fromrawdata
+%RETURN_TYPE %0 = %CPPSELF.%FUNCTION_NAME(PyBytes_AsString(%PYARG_1), PyBytes_GET_SIZE(%PYARG_1));
+%PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%0);
+// @snippet qbytearray-fromrawdata
+
+// @snippet qbytearray-str
+PyObject *aux = PyBytes_FromStringAndSize(%CPPSELF.constData(), %CPPSELF.size());
+if (aux == nullptr) {
+ return nullptr;
+}
+%PYARG_0 = PyObject_Repr(aux);
+Py_DECREF(aux);
+// @snippet qbytearray-str
+
+// @snippet qbytearray-len
+return %CPPSELF.count();
+// @snippet qbytearray-len
+
+// @snippet qbytearray-getitem
+if (_i < 0 || _i >= %CPPSELF.size()) {
+ PyErr_SetString(PyExc_IndexError, "index out of bounds");
+ return 0;
+} else {
+ char res[2];
+ res[0] = %CPPSELF.at(_i);
+ res[1] = 0;
+ return PyBytes_FromStringAndSize(res, 1);
+}
+// @snippet qbytearray-getitem
+
+// @snippet qbytearray-setitem
+%CPPSELF.remove(_i, 1);
+PyObject *args = Py_BuildValue("(nO)", _i, _value);
+PyObject *result = Sbk_QByteArrayFunc_insert(self, args);
+Py_DECREF(args);
+Py_XDECREF(result);
+return !result ? -1 : 0;
+// @snippet qbytearray-setitem
+
+// @snippet qfiledevice-unmap
+uchar *ptr = reinterpret_cast<uchar *>(Shiboken::Buffer::getPointer(%PYARG_1));
+%RETURN_TYPE %0 = %CPPSELF.%FUNCTION_NAME(ptr);
+%PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%0);
+// @snippet qfiledevice-unmap
+
+// @snippet qfiledevice-map
+%PYARG_0 = Shiboken::Buffer::newObject(%CPPSELF.%FUNCTION_NAME(%1, %2, %3), %2, Shiboken::Buffer::ReadWrite);
+// @snippet qfiledevice-map
+
+// @snippet qiodevice-readdata
+QByteArray ba(1 + int(%2), char(0));
+%CPPSELF.%FUNCTION_NAME(ba.data(), int(%2));
+%PYARG_0 = Shiboken::String::fromCString(ba.constData());
+// @snippet qiodevice-readdata
+
+// @snippet qcryptographichash-adddata
+%CPPSELF.%FUNCTION_NAME(Shiboken::String::toCString(%PYARG_1), Shiboken::String::len(%PYARG_1));
+// @snippet qcryptographichash-adddata
+
+// @snippet qsocketdescriptor
+#ifdef WIN32
+using DescriptorType = Qt::HANDLE;
+#else
+using DescriptorType = int;
+#endif
+// @snippet qsocketdescriptor
+
+// @snippet qsocketnotifier
+PyObject *socket = %PYARG_1;
+if (socket != nullptr) {
+ // We use qintptr as PyLong, but we check for int
+ // since it is currently an alias to be Python2 compatible.
+ // Internally, ints are qlonglongs.
+ if (%CHECKTYPE[int](socket)) {
+ int cppSocket = %CONVERTTOCPP[int](socket);
+ qintptr socket = (qintptr)cppSocket;
+ %0 = new %TYPE(socket, %2, %3);
+ } else {
+ PyErr_SetString(PyExc_TypeError,
+ "QSocketNotifier: first argument (socket) must be an int.");
+ }
+}
+// @snippet qsocketnotifier
+
+// @snippet qtranslator-load
+Py_ssize_t size;
+uchar *ptr = reinterpret_cast<uchar *>(Shiboken::Buffer::getPointer(%PYARG_1, &size));
+%RETURN_TYPE %0 = %CPPSELF.%FUNCTION_NAME(const_cast<const uchar *>(ptr), size);
+%PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%0);
+// @snippet qtranslator-load
+
+// @snippet qtimer-singleshot-1
+// %FUNCTION_NAME() - disable generation of c++ function call
+(void) %2; // remove warning about unused variable
+Shiboken::AutoDecRef emptyTuple(PyTuple_New(0));
+PyObject *pyTimer = reinterpret_cast<PyTypeObject *>(Shiboken::SbkType<QTimer>())->tp_new(Shiboken::SbkType<QTimer>(), emptyTuple, 0);
+reinterpret_cast<PyTypeObject *>(Shiboken::SbkType<QTimer>())->tp_init(pyTimer, emptyTuple, 0);
+
+auto timer = %CONVERTTOCPP[QTimer *](pyTimer);
+//XXX /|\ omitting this space crashes shiboken!
+Shiboken::AutoDecRef result(
+ PyObject_CallMethod(pyTimer,
+ const_cast<char *>("connect"),
+ const_cast<char *>("OsOs"),
+ pyTimer,
+ SIGNAL(timeout()),
+ %PYARG_2,
+ %3)
+);
+Shiboken::Object::releaseOwnership((SbkObject *)pyTimer);
+Py_XDECREF(pyTimer);
+timer->setSingleShot(true);
+timer->connect(timer, SIGNAL(timeout()), timer, SLOT(deleteLater()));
+timer->start(%1);
+// @snippet qtimer-singleshot-1
+
+// @snippet qtimer-singleshot-2
+// %FUNCTION_NAME() - disable generation of c++ function call
+Shiboken::AutoDecRef emptyTuple(PyTuple_New(0));
+PyObject *pyTimer = reinterpret_cast<PyTypeObject *>(Shiboken::SbkType<QTimer>())->tp_new(Shiboken::SbkType<QTimer>(), emptyTuple, 0);
+reinterpret_cast<PyTypeObject *>(Shiboken::SbkType<QTimer>())->tp_init(pyTimer, emptyTuple, 0);
+QTimer * timer = %CONVERTTOCPP[QTimer *](pyTimer);
+timer->setSingleShot(true);
+
+if (PyObject_TypeCheck(%2, PySideSignalInstanceTypeF())) {
+ PySideSignalInstance *signalInstance = reinterpret_cast<PySideSignalInstance *>(%2);
+ Shiboken::AutoDecRef signalSignature(Shiboken::String::fromFormat("2%s", PySide::Signal::getSignature(signalInstance)));
+ Shiboken::AutoDecRef result(
+ PyObject_CallMethod(pyTimer,
+ const_cast<char *>("connect"),
+ const_cast<char *>("OsOO"),
+ pyTimer,
+ SIGNAL(timeout()),
+ PySide::Signal::getObject(signalInstance),
+ signalSignature.object())
+ );
+} else {
+ Shiboken::AutoDecRef result(
+ PyObject_CallMethod(pyTimer,
+ const_cast<char *>("connect"),
+ const_cast<char *>("OsO"),
+ pyTimer,
+ SIGNAL(timeout()),
+ %PYARG_2)
+ );
+}
+
+timer->connect(timer, SIGNAL(timeout()), timer, SLOT(deleteLater()), Qt::DirectConnection);
+Shiboken::Object::releaseOwnership(reinterpret_cast<SbkObject *>(pyTimer));
+Py_XDECREF(pyTimer);
+timer->start(%1);
+// @snippet qtimer-singleshot-2
+
+// @snippet qprocess-startdetached
+qint64 pid;
+%RETURN_TYPE retval = %TYPE::%FUNCTION_NAME(%1, %2, %3, &pid);
+%PYARG_0 = PyTuple_New(2);
+PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[%RETURN_TYPE](retval));
+PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[qint64](pid));
+// @snippet qprocess-startdetached
+
+// @snippet qcoreapplication-init
+static void QCoreApplicationConstructor(PyObject *self, PyObject *pyargv, QCoreApplicationWrapper **cptr)
+{
+ static int argc;
+ static char **argv;
+ PyObject *stringlist = PyTuple_GET_ITEM(pyargv, 0);
+ if (Shiboken::listToArgcArgv(stringlist, &argc, &argv, "PySideApp")) {
+ *cptr = new QCoreApplicationWrapper(argc, argv);
+ Shiboken::Object::releaseOwnership(reinterpret_cast<SbkObject *>(self));
+ PySide::registerCleanupFunction(&PySide::destroyQCoreApplication);
+ }
+}
+// @snippet qcoreapplication-init
+
+// @snippet qcoreapplication-1
+QCoreApplicationConstructor(%PYSELF, args, &%0);
+// @snippet qcoreapplication-1
+
+// @snippet qcoreapplication-2
+PyObject *empty = PyTuple_New(2);
+if (!PyTuple_SetItem(empty, 0, PyList_New(0))) {
+ QCoreApplicationConstructor(%PYSELF, empty, &%0);
+}
+// @snippet qcoreapplication-2
+
+// @snippet qcoreapplication-instance
+PyObject *pyApp = Py_None;
+if (qApp) {
+ pyApp = reinterpret_cast<PyObject *>(
+ Shiboken::BindingManager::instance().retrieveWrapper(qApp));
+ if (!pyApp)
+ pyApp = %CONVERTTOPYTHON[QCoreApplication *](qApp);
+ // this will keep app live after python exit (extra ref)
+}
+// PYSIDE-571: make sure that we return the singleton "None"
+if (Py_TYPE(pyApp) == Py_TYPE(Py_None))
+ Py_DECREF(MakeQAppWrapper(nullptr));
+%PYARG_0 = pyApp;
+Py_XINCREF(%PYARG_0);
+// @snippet qcoreapplication-instance
+
+// @snippet qdatastream-readrawdata
+QByteArray data;
+data.resize(%2);
+int result = 0;
+Py_BEGIN_ALLOW_THREADS
+result = %CPPSELF.%FUNCTION_NAME(data.data(), data.size());
+Py_END_ALLOW_THREADS
+if (result == -1) {
+ Py_INCREF(Py_None);
+ %PYARG_0 = Py_None;
+} else {
+ %PYARG_0 = PyBytes_FromStringAndSize(data.data(), result);
+}
+// @snippet qdatastream-readrawdata
+
+// @snippet qdatastream-writerawdata
+int r = 0;
+Py_BEGIN_ALLOW_THREADS
+r = %CPPSELF.%FUNCTION_NAME(%1, Shiboken::String::len(%PYARG_1));
+Py_END_ALLOW_THREADS
+%PYARG_0 = %CONVERTTOPYTHON[int](r);
+// @snippet qdatastream-writerawdata
+
+// @snippet releaseownership
+Shiboken::Object::releaseOwnership(%PYARG_0);
+// @snippet releaseownership
+
+// @snippet qanimationgroup-clear
+for (int counter = 0, count = %CPPSELF.animationCount(); counter < count; ++counter ) {
+ QAbstractAnimation *animation = %CPPSELF.animationAt(counter);
+ PyObject *obj = %CONVERTTOPYTHON[QAbstractAnimation *](animation);
+ Shiboken::Object::setParent(nullptr, obj);
+ Py_DECREF(obj);
+}
+%CPPSELF.clear();
+// @snippet qanimationgroup-clear
+
+// @snippet qeasingcurve
+PySideEasingCurveFunctor::init();
+// @snippet qeasingcurve
+
+// @snippet qeasingcurve-setcustomtype
+QEasingCurve::EasingFunction func = PySideEasingCurveFunctor::createCustomFuntion(%PYSELF, %PYARG_1);
+if (func)
+ %CPPSELF.%FUNCTION_NAME(func);
+// @snippet qeasingcurve-setcustomtype
+
+// @snippet qeasingcurve-customtype
+//%FUNCTION_NAME()
+%PYARG_0 = PySideEasingCurveFunctor::callable(%PYSELF);
+// @snippet qeasingcurve-customtype
+
+// @snippet qsignaltransition
+if (PyObject_TypeCheck(%1, PySideSignalInstanceTypeF())) {
+ PyObject *dataSource = PySide::Signal::getObject((PySideSignalInstance *)%PYARG_1);
+ Shiboken::AutoDecRef obType(PyObject_Type(dataSource));
+ QObject * sender = %CONVERTTOCPP[QObject *](dataSource);
+ //XXX /|\ omitting this space crashes shiboken!
+ if (sender) {
+ const char *dataSignature = PySide::Signal::getSignature((PySideSignalInstance *)%PYARG_1);
+ QByteArray signature(dataSignature); // Append SIGNAL flag (2)
+ signature.prepend('2');
+ %0 = new QSignalTransitionWrapper(sender, signature, %2);
+ }
+}
+// @snippet qsignaltransition
+
+// @snippet qstate-addtransition-1
+QString signalName(%2);
+if (PySide::SignalManager::registerMetaMethod(%1, signalName.mid(1).toLatin1().data(), QMetaMethod::Signal)) {
+ QSignalTransition *%0 = %CPPSELF->addTransition(%1, %2, %3);
+ %PYARG_0 = %CONVERTTOPYTHON[QSignalTransition *](%0);
+} else {
+ Py_INCREF(Py_None);
+ %PYARG_0 = Py_None;
+}
+// @snippet qstate-addtransition-1
+
+// @snippet qstate-addtransition-2
+// Obviously the label used by the following goto is a very awkward solution,
+// since it refers to a name very tied to the generator implementation.
+// Check bug #362 for more information on this
+// http://bugs.openbossa.org/show_bug.cgi?id=362
+if (!PyObject_TypeCheck(%1, PySideSignalInstanceTypeF()))
+ goto Sbk_%TYPEFunc_%FUNCTION_NAME_TypeError;
+PySideSignalInstance *signalInstance = reinterpret_cast<PySideSignalInstance *>(%1);
+auto sender = %CONVERTTOCPP[QObject *](PySide::Signal::getObject(signalInstance));
+QSignalTransition *%0 = %CPPSELF->%FUNCTION_NAME(sender, PySide::Signal::getSignature(signalInstance),%2);
+%PYARG_0 = %CONVERTTOPYTHON[QSignalTransition *](%0);
+// @snippet qstate-addtransition-2
+
+// @snippet qstatemachine-configuration
+%PYARG_0 = PySet_New(0);
+for (auto *abs_state : %CPPSELF.configuration()) {
+ Shiboken::AutoDecRef obj(%CONVERTTOPYTHON[QAbstractState *](abs_state));
+ Shiboken::Object::setParent(self, obj);
+ PySet_Add(%PYARG_0, obj);
+}
+// @snippet qstatemachine-configuration
+
+// @snippet qstatemachine-defaultanimations
+%PYARG_0 = PyList_New(0);
+for (auto *abs_anim : %CPPSELF.defaultAnimations()) {
+ Shiboken::AutoDecRef obj(%CONVERTTOPYTHON[QAbstractAnimation *](abs_anim));
+ Shiboken::Object::setParent(self, obj);
+ PyList_Append(%PYARG_0, obj);
+}
+// @snippet qstatemachine-defaultanimations
+
+// @snippet qt-signal
+%PYARG_0 = Shiboken::String::fromFormat("2%s",QMetaObject::normalizedSignature(%1).constData());
+// @snippet qt-signal
+
+// @snippet qt-slot
+%PYARG_0 = Shiboken::String::fromFormat("1%s",QMetaObject::normalizedSignature(%1).constData());
+// @snippet qt-slot
+
+// @snippet qt-registerresourcedata
+QT_BEGIN_NAMESPACE
+extern bool
+qRegisterResourceData(int,
+ const unsigned char *,
+ const unsigned char *,
+ const unsigned char *);
+
+extern bool
+qUnregisterResourceData(int,
+ const unsigned char *,
+ const unsigned char *,
+ const unsigned char *);
+QT_END_NAMESPACE
+// @snippet qt-registerresourcedata
+
+// @snippet qt-qregisterresourcedata
+%RETURN_TYPE %0 = %FUNCTION_NAME(%1, reinterpret_cast<uchar *>(PyBytes_AS_STRING(%PYARG_2)),
+ reinterpret_cast<uchar *>(PyBytes_AS_STRING(%PYARG_3)),
+ reinterpret_cast<uchar *>(PyBytes_AS_STRING(%PYARG_4)));
+%PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%0);
+// @snippet qt-qregisterresourcedata
+
+// @snippet qt-qunregisterresourcedata
+%RETURN_TYPE %0 = %FUNCTION_NAME(%1, reinterpret_cast<uchar *>(PyBytes_AS_STRING(%PYARG_2)),
+ reinterpret_cast<uchar *>(PyBytes_AS_STRING(%PYARG_3)),
+ 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
+Py_BEGIN_ALLOW_THREADS
+%FUNCTION_NAME() << %1;
+Py_END_ALLOW_THREADS
+// @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
+Py_BEGIN_ALLOW_THREADS
+(*%CPPSELF) << %1;
+Py_END_ALLOW_THREADS
+// @snippet stream-write-method
+
+// @snippet stream-read-method
+%RETURN_TYPE _cpp_result;
+Py_BEGIN_ALLOW_THREADS
+(*%CPPSELF) >> _cpp_result;
+Py_END_ALLOW_THREADS
+%PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](_cpp_result);
+// @snippet stream-read-method
+
+// @snippet return-qstring-ref
+QString &res = *%0;
+%PYARG_0 = %CONVERTTOPYTHON[QString](res);
+// @snippet return-qstring-ref
+
+// @snippet return-readData
+%RETURN_TYPE %0 = 0;
+if (PyBytes_Check(%PYARG_0)) {
+ %0 = PyBytes_GET_SIZE((PyObject *)%PYARG_0);
+ memcpy(%1, PyBytes_AS_STRING((PyObject *)%PYARG_0), %0);
+} else if (Shiboken::String::check(%PYARG_0)) {
+ %0 = Shiboken::String::len((PyObject *)%PYARG_0);
+ memcpy(%1, Shiboken::String::toCString((PyObject *)%PYARG_0), %0);
+}
+// @snippet return-readData
+
+// @snippet qiodevice-readData
+QByteArray ba(1 + int(%2), char(0));
+Py_BEGIN_ALLOW_THREADS
+%CPPSELF.%FUNCTION_NAME(ba.data(), int(%2));
+Py_END_ALLOW_THREADS
+%PYARG_0 = Shiboken::String::fromCString(ba.constData());
+// @snippet qiodevice-readData
+
+// @snippet qt-module-shutdown
+{ // Avoid name clash
+ Shiboken::AutoDecRef regFunc(static_cast<PyObject *>(nullptr));
+ Shiboken::AutoDecRef atexit(Shiboken::Module::import("atexit"));
+ if (atexit.isNull()) {
+ qWarning("Module atexit not found for registering __moduleShutdown");
+ PyErr_Clear();
+ }else{
+ regFunc.reset(PyObject_GetAttrString(atexit, "register"));
+ if (regFunc.isNull()) {
+ qWarning("Function atexit.register not found for registering __moduleShutdown");
+ PyErr_Clear();
+ }
+ }
+ if (!atexit.isNull() && !regFunc.isNull()){
+ PyObject *shutDownFunc = PyObject_GetAttrString(module, "__moduleShutdown");
+ Shiboken::AutoDecRef args(PyTuple_New(1));
+ PyTuple_SET_ITEM(args, 0, shutDownFunc);
+ Shiboken::AutoDecRef retval(PyObject_Call(regFunc, args, 0));
+ Q_ASSERT(!retval.isNull());
+ }
+}
+// @snippet qt-module-shutdown
+
+
+/*********************************************************************
+ * CONVERSIONS
+ ********************************************************************/
+
+// @snippet conversion-pybool
+%out = %OUTTYPE(%in == Py_True);
+// @snippet conversion-pybool
+
+// @snippet conversion-pylong
+%out = %OUTTYPE(PyLong_AsLong(%in));
+// @snippet conversion-pylong
+
+// @snippet conversion-pylong-unsigned
+%out = %OUTTYPE(PyLong_AsUnsignedLong(%in));
+// @snippet conversion-pylong-unsigned
+
+// @snippet conversion-pylong-quintptr
+#if QT_POINTER_SIZE == 8
+%out = %OUTTYPE(PyLong_AsUnsignedLongLong(%in));
+#else
+%out = %OUTTYPE(PyLong_AsUnsignedLong(%in));
+#endif
+// @snippet conversion-pylong-quintptr
+
+// @snippet conversion-pyunicode
+#ifndef Py_LIMITED_API
+Py_UNICODE *unicode = PyUnicode_AS_UNICODE(%in);
+# if defined(Py_UNICODE_WIDE)
+// cast as Py_UNICODE can be a different type
+# if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+%out = QString::fromUcs4(reinterpret_cast<const char32_t *>(unicode));
+# else
+%out = QString::fromUcs4(reinterpret_cast<const uint *>(unicode));
+# endif // Qt 6
+# else // Py_UNICODE_WIDE
+# if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+%out = QString::fromUtf16(reinterpret_cast<const char16_t *>(unicode), PepUnicode_GetLength(%in));
+# else
+%out = QString::fromUtf16(reinterpret_cast<const ushort *>(unicode), PepUnicode_GetLength(%in));
+# endif // Qt 6
+# endif
+#else
+wchar_t *temp = PyUnicode_AsWideCharString(%in, NULL);
+%out = QString::fromWCharArray(temp);
+PyMem_Free(temp);
+#endif
+// @snippet conversion-pyunicode
+
+// @snippet conversion-pynone
+%out = %OUTTYPE();
+// @snippet conversion-pynone
+
+// @snippet conversion-pystring-char
+char c = %CONVERTTOCPP[char](%in);
+%out = %OUTTYPE(c);
+// @snippet conversion-pystring-char
+
+// @snippet conversion-pyint
+int i = %CONVERTTOCPP[int](%in);
+%out = %OUTTYPE(i);
+// @snippet conversion-pyint
+
+// @snippet conversion-qlonglong
+// PYSIDE-1250: For QVariant, if the type fits into an int; use int preferably.
+qlonglong in = %CONVERTTOCPP[qlonglong](%in);
+constexpr qlonglong intMax = qint64(std::numeric_limits<int>::max());
+constexpr qlonglong intMin = qint64(std::numeric_limits<int>::min());
+%out = in >= intMin && in <= intMax ? %OUTTYPE(int(in)) : %OUTTYPE(in);
+// @snippet conversion-qlonglong
+
+// @snippet conversion-qstring
+QString in = %CONVERTTOCPP[QString](%in);
+%out = %OUTTYPE(in);
+// @snippet conversion-qstring
+
+// @snippet conversion-qbytearray
+QByteArray in = %CONVERTTOCPP[QByteArray](%in);
+%out = %OUTTYPE(in);
+// @snippet conversion-qbytearray
+
+// @snippet conversion-pyfloat
+double in = %CONVERTTOCPP[double](%in);
+%out = %OUTTYPE(in);
+// @snippet conversion-pyfloat
+
+// @snippet conversion-sbkobject
+// a class supported by QVariant?
+const QMetaType metaType = QVariant_resolveMetaType(Py_TYPE(%in));
+if (metaType.isValid()) {
+ QVariant var(metaType);
+ Shiboken::Conversions::SpecificConverter converter(metaType.name());
+ converter.toCpp(pyIn, var.data());
+ %out = var;
+} else {
+ // If the type was not encountered, return a default PyObjectWrapper
+ %out = QVariant::fromValue(PySide::PyObjectWrapper(%in));
+}
+// @snippet conversion-sbkobject
+
+// @snippet conversion-pydict
+QVariant ret = QVariant_convertToVariantMap(%in);
+%out = ret.isValid() ? ret : QVariant::fromValue(PySide::PyObjectWrapper(%in));
+// @snippet conversion-pydict
+
+// @snippet conversion-pylist
+QVariant ret = QVariant_convertToVariantList(%in);
+%out = ret.isValid() ? ret : QVariant::fromValue(PySide::PyObjectWrapper(%in));
+// @snippet conversion-pylist
+
+// @snippet conversion-pyobject
+// Is a shiboken type not known by Qt
+%out = QVariant::fromValue(PySide::PyObjectWrapper(%in));
+// @snippet conversion-pyobject
+
+// @snippet conversion-qjsonobject-pydict
+QVariant dict = QVariant_convertToVariantMap(%in);
+QJsonValue val = QJsonValue::fromVariant(dict);
+%out = val.toObject();
+// @snippet conversion-qjsonobject-pydict
+
+// @snippet conversion-qpair-pysequence
+%out.first = %CONVERTTOCPP[%OUTTYPE_0](PySequence_Fast_GET_ITEM(%in, 0));
+%out.second = %CONVERTTOCPP[%OUTTYPE_1](PySequence_Fast_GET_ITEM(%in, 1));
+// @snippet conversion-qpair-pysequence
+
+// @snippet conversion-qdate-pydate
+int day = PyDateTime_GET_DAY(%in);
+int month = PyDateTime_GET_MONTH(%in);
+int year = PyDateTime_GET_YEAR(%in);
+%out = %OUTTYPE(year, month, day);
+// @snippet conversion-qdate-pydate
+
+// @snippet conversion-qdatetime-pydatetime
+int day = PyDateTime_GET_DAY(%in);
+int month = PyDateTime_GET_MONTH(%in);
+int year = PyDateTime_GET_YEAR(%in);
+int hour = PyDateTime_DATE_GET_HOUR(%in);
+int min = PyDateTime_DATE_GET_MINUTE(%in);
+int sec = PyDateTime_DATE_GET_SECOND(%in);
+int usec = PyDateTime_DATE_GET_MICROSECOND(%in);
+%out = %OUTTYPE(QDate(year, month, day), QTime(hour, min, sec, usec/1000));
+// @snippet conversion-qdatetime-pydatetime
+
+// @snippet conversion-qtime-pytime
+int hour = PyDateTime_TIME_GET_HOUR(%in);
+int min = PyDateTime_TIME_GET_MINUTE(%in);
+int sec = PyDateTime_TIME_GET_SECOND(%in);
+int usec = PyDateTime_TIME_GET_MICROSECOND(%in);
+%out = %OUTTYPE(hour, min, sec, usec/1000);
+// @snippet conversion-qtime-pytime
+
+// @snippet conversion-qbytearray-pybytes
+%out = %OUTTYPE(PyBytes_AS_STRING(%in), PyBytes_GET_SIZE(%in));
+// @snippet conversion-qbytearray-pybytes
+
+// @snippet conversion-qbytearray-pybytearray
+%out = %OUTTYPE(PyByteArray_AsString(%in), PyByteArray_Size(%in));
+// @snippet conversion-qbytearray-pybytearray
+
+// @snippet conversion-qbytearray-pystring
+%out = %OUTTYPE(Shiboken::String::toCString(%in), Shiboken::String::len(%in));
+// @snippet conversion-qbytearray-pystring
+
+/*********************************************************************
+ * NATIVE TO TARGET CONVERSIONS
+ ********************************************************************/
+
+// @snippet return-pybool
+return PyBool_FromLong((bool)%in);
+// @snippet return-pybool
+
+// @snippet return-pybytes
+return PyBytes_FromStringAndSize(%in.constData(), %in.size());
+// @snippet return-pybytes
+
+// @snippet return-pylong
+return PyLong_FromLong(%in);
+// @snippet return-pylong
+
+// @snippet return-pylong-unsigned
+return PyLong_FromUnsignedLong(%in);
+// @snippet return-pylong-unsigned
+
+// @snippet return-pylong-quintptr
+#if QT_POINTER_SIZE == 8
+return PyLong_FromUnsignedLongLong(%in);
+#else
+return PyLong_FromUnsignedLong(%in);
+#endif
+// @snippet return-pylong-quintptr
+
+// @snippet return-pyunicode
+QByteArray ba = %in.toUtf8();
+return PyUnicode_FromStringAndSize(ba.constData(), ba.size());
+// @snippet return-pyunicode
+
+// @snippet return-pyunicode-qchar
+wchar_t c = (wchar_t)%in.unicode();
+return PyUnicode_FromWideChar(&c, 1);
+// @snippet return-pyunicode-qchar
+
+// @snippet return-qvariant
+if (!%in.isValid())
+ Py_RETURN_NONE;
+
+if (qstrcmp(%in.typeName(), "QVariantList") == 0) {
+ QList<QVariant> var = %in.value<QVariantList>();
+ return %CONVERTTOPYTHON[QList<QVariant>](var);
+}
+
+if (qstrcmp(%in.typeName(), "QStringList") == 0) {
+ QStringList var = %in.value<QStringList>();
+ return %CONVERTTOPYTHON[QList<QString>](var);
+}
+
+if (qstrcmp(%in.typeName(), "QVariantMap") == 0) {
+ QMap<QString, QVariant> var = %in.value<QVariantMap>();
+ return %CONVERTTOPYTHON[QMap<QString, QVariant>](var);
+}
+
+Shiboken::Conversions::SpecificConverter converter(cppInRef.typeName());
+if (converter) {
+ void *ptr = cppInRef.data();
+ return converter.toPython(ptr);
+}
+PyErr_Format(PyExc_RuntimeError, "Can't find converter for '%s'.", %in.typeName());
+return 0;
+// @snippet return-qvariant
+
+// @snippet return-qvariant-type
+const char *typeName = QMetaType(%in).name();
+PyObject *%out;
+PyTypeObject *pyType = nullptr;
+if (typeName)
+ pyType = Shiboken::Conversions::getPythonTypeObject(typeName);
+%out = pyType ? (reinterpret_cast<PyObject *>(pyType)) : Py_None;
+Py_INCREF(%out);
+return %out;
+// @snippet return-qvariant-type
+
+// @snippet return-qjsonobject
+// The QVariantMap returned by QJsonObject seems to cause a segfault, so
+// using QJsonObject.toVariantMap() won't work.
+// Wrapping it in a QJsonValue first allows it to work
+QJsonValue val(%in);
+QVariant ret = val.toVariant();
+
+return %CONVERTTOPYTHON[QVariant](ret);
+// @snippet return-qjsonobject
+
+// @snippet return-qpair
+PyObject *%out = PyTuple_New(2);
+PyTuple_SET_ITEM(%out, 0, %CONVERTTOPYTHON[%INTYPE_0](%in.first));
+PyTuple_SET_ITEM(%out, 1, %CONVERTTOPYTHON[%INTYPE_1](%in.second));
+return %out;
+// @snippet return-qpair
+
+// @snippet qthread_pthread_cleanup
+#ifdef Q_OS_UNIX
+# include <stdio.h>
+# include <pthread.h>
+static void qthread_pthread_cleanup(void *arg)
+{
+ // PYSIDE 1282: When terminating a thread using QThread::terminate()
+ // (pthread_cancel()), QThread::run() is aborted and the lock is released,
+ // but ~GilState() is still executed for some reason. Prevent it from
+ // releasing.
+ auto gil = reinterpret_cast<Shiboken::GilState *>(arg);
+ gil->abandon();
+}
+#endif // Q_OS_UNIX
+// @snippet qthread_pthread_cleanup
+
+// @snippet qthread_pthread_cleanup_install
+#ifdef Q_OS_UNIX
+pthread_cleanup_push(qthread_pthread_cleanup, &gil);
+#endif
+// @snippet qthread_pthread_cleanup_install
+
+// @snippet qthread_pthread_cleanup_uninstall
+#ifdef Q_OS_UNIX
+pthread_cleanup_pop(0);
+#endif
+// @snippet qthread_pthread_cleanup_uninstall
+
+// @snippet qlibraryinfo_build
+#if defined(Py_LIMITED_API)
+auto suffix = PyUnicode_FromString(" [limited API]");
+auto oldResult = pyResult;
+pyResult = PyUnicode_Concat(pyResult, suffix);
+Py_DECREF(oldResult);
+Py_DECREF(suffix);
+#endif
+// @snippet qlibraryinfo_build
diff --git a/sources/pyside6/PySide6/glue/qtdatavisualization.cpp b/sources/pyside6/PySide6/glue/qtdatavisualization.cpp
new file mode 100644
index 000000000..119d79a40
--- /dev/null
+++ b/sources/pyside6/PySide6/glue/qtdatavisualization.cpp
@@ -0,0 +1,42 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+// @snippet releaseownership
+Shiboken::Object::releaseOwnership(%PYARG_1);
+// @snippet releaseownership
diff --git a/sources/pyside6/PySide6/glue/qtgui.cpp b/sources/pyside6/PySide6/glue/qtgui.cpp
new file mode 100644
index 000000000..869fb9dc4
--- /dev/null
+++ b/sources/pyside6/PySide6/glue/qtgui.cpp
@@ -0,0 +1,547 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+/*********************************************************************
+ * INJECT CODE
+ ********************************************************************/
+
+// @snippet qtransform-quadtoquad
+QTransform _result;
+if (QTransform::quadToQuad(%1, %2, _result)) {
+ %PYARG_0 = %CONVERTTOPYTHON[QTransform](_result);
+} else {
+ Py_INCREF(Py_None);
+ %PYARG_0 = Py_None;
+}
+// @snippet qtransform-quadtoquad
+
+// @snippet qtransform-quadtosquare
+QTransform _result;
+if (QTransform::quadToSquare(%1, _result)) {
+ %PYARG_0 = %CONVERTTOPYTHON[QTransform](_result);
+} else {
+ Py_INCREF(Py_None);
+ %PYARG_0 = Py_None;
+}
+// @snippet qtransform-quadtosquare
+
+// @snippet qtransform-squaretoquad
+QTransform _result;
+if (QTransform::squareToQuad(%1, _result)) {
+ %PYARG_0 = %CONVERTTOPYTHON[QTransform](_result);
+} else {
+ Py_INCREF(Py_None);
+ %PYARG_0 = Py_None;
+}
+// @snippet qtransform-squaretoquad
+
+// @snippet qbitmap-fromdata
+uchar *buffer = reinterpret_cast<uchar *>(Shiboken::Buffer::getPointer(%PYARG_2));
+QBitmap %0 = QBitmap::fromData(%1, buffer, %3);
+%PYARG_0 = %CONVERTTOPYTHON[QBitmap](%0);
+// @snippet qbitmap-fromdata
+
+// @snippet qtextline-cursortox
+%RETURN_TYPE %0 = %CPPSELF->::%TYPE::%FUNCTION_NAME(&%1, %2);
+%PYARG_0 = PyTuple_New(2);
+PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[%RETURN_TYPE](%0));
+PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[%ARG1_TYPE](%1));
+// @snippet qtextline-cursortox
+
+// @snippet qkeysequence-getitem
+if (_i < 0 || _i >= %CPPSELF.count()) {
+ PyErr_SetString(PyExc_IndexError, "index out of bounds");
+ return 0;
+}
+int item = (*%CPPSELF)[_i];
+return %CONVERTTOPYTHON[int](item);
+// @snippet qkeysequence-getitem
+
+// @snippet qpicture-data
+%PYARG_0 = Shiboken::Buffer::newObject(%CPPSELF.data(), %CPPSELF.size());
+// @snippet qpicture-data
+
+// @snippet qtextblock-setuserdata
+const QTextDocument *doc = %CPPSELF.document();
+if (doc) {
+ Shiboken::AutoDecRef pyDocument(%CONVERTTOPYTHON[QTextDocument *](doc));
+ Shiboken::Object::setParent(pyDocument, %PYARG_1);
+}
+// @snippet qtextblock-setuserdata
+
+// @snippet qtextblock-userdata
+const QTextDocument *doc = %CPPSELF.document();
+if (doc) {
+ Shiboken::AutoDecRef pyDocument(%CONVERTTOPYTHON[QTextDocument *](doc));
+ Shiboken::Object::setParent(pyDocument, %PYARG_0);
+}
+// @snippet qtextblock-userdata
+
+// @snippet qopenglshaderprogram_setuniformvalue_float
+float value = %2;
+%CPPSELF.setUniformValue(%1, value);
+// @snippet qopenglshaderprogram_setuniformvalue_float
+
+// @snippet qopenglshaderprogram_setuniformvalue_int
+int value = %2;
+%CPPSELF.setUniformValue(%1, value);
+// @snippet qopenglshaderprogram_setuniformvalue_int
+
+// @snippet qpolygon-reduce
+PyObject *points = PyList_New(%CPPSELF.count());
+for (int i = 0, i_max = %CPPSELF.count(); i < i_max; ++i){
+ int x, y;
+ %CPPSELF.point(i, &x, &y);
+ QPoint pt = QPoint(x, y);
+ PyList_SET_ITEM(points, i, %CONVERTTOPYTHON[QPoint](pt));
+}
+// @snippet qpolygon-reduce
+
+// @snippet qpolygon-operatorlowerlower
+// %FUNCTION_NAME()
+*%CPPSELF << %1;
+%PYARG_0 = %CONVERTTOPYTHON[QPolygon *](%CPPSELF);
+// @snippet qpolygon-operatorlowerlower
+
+// @snippet qpixmap
+%0 = new %TYPE(QPixmap::fromImage(%1));
+// @snippet qpixmap
+
+// @snippet qimage-constbits
+%PYARG_0 = Shiboken::Buffer::newObject(%CPPSELF.%FUNCTION_NAME(), %CPPSELF.sizeInBytes());
+// @snippet qimage-constbits
+
+// @snippet qimage-bits
+// byteCount() is only available on Qt4.7, so we use bytesPerLine * height
+%PYARG_0 = Shiboken::Buffer::newObject(%CPPSELF.%FUNCTION_NAME(), %CPPSELF.bytesPerLine() * %CPPSELF.height(), Shiboken::Buffer::ReadWrite);
+// @snippet qimage-bits
+
+// @snippet qimage-constscanline
+%PYARG_0 = Shiboken::Buffer::newObject(%CPPSELF.%FUNCTION_NAME(%1), %CPPSELF.bytesPerLine());
+// @snippet qimage-constscanline
+
+// @snippet qimage-scanline
+%PYARG_0 = Shiboken::Buffer::newObject(%CPPSELF.%FUNCTION_NAME(%1), %CPPSELF.bytesPerLine(), Shiboken::Buffer::ReadWrite);
+// @snippet qimage-scanline
+
+// @snippet qcolor-setstate
+Shiboken::AutoDecRef func(PyObject_GetAttr(%PYSELF, PyTuple_GET_ITEM(%1, 0)));
+PyObject *args = PyTuple_GET_ITEM(%1, 1);
+%PYARG_0 = PyObject_Call(func, args, NULL);
+// @snippet qcolor-setstate
+
+// @snippet qcolor-reduce
+switch (%CPPSELF.spec()) {
+ case QColor::Rgb:
+ {
+ float r, g, b, a;
+ %CPPSELF.getRgbF(&r, &g, &b, &a);
+ %PYARG_0 = Py_BuildValue("(ON(s(ffff)))", Py_TYPE(%PYSELF), PyTuple_New(0),
+ "setRgbF", r, g, b, a);
+ break;
+ }
+ case QColor::Hsv:
+ {
+ float h, s, v, a;
+ %CPPSELF.getHsvF(&h, &s, &v, &a);
+ %PYARG_0 = Py_BuildValue("(ON(s(ffff)))", Py_TYPE(%PYSELF), PyTuple_New(0),
+ "setHsvF", h, s, v, a);
+ break;
+ }
+ case QColor::Cmyk:
+ {
+ float c, m, y, k, a;
+ %CPPSELF.getCmykF(&c, &m, &y, &k, &a);
+ %PYARG_0 = Py_BuildValue("(ON(s(fffff)))", Py_TYPE(%PYSELF), PyTuple_New(0),
+ "setCmykF", c, m, y, k, a);
+ break;
+ }
+ case QColor::Hsl:
+ {
+ float h, s, l, a;
+ %CPPSELF.getHslF(&h, &s, &l, &a);
+ %PYARG_0 = Py_BuildValue("(ON(s(ffff)))", Py_TYPE(%PYSELF), PyTuple_New(0),
+ "setHslF", h, s, l, a);
+ break;
+ }
+ default:
+ {
+ %PYARG_0 = Py_BuildValue("(N(O))", PyObject_Type(%PYSELF), Py_None);
+ }
+}
+// @snippet qcolor-reduce
+
+// @snippet qcolor-totuple
+switch (%CPPSELF.spec()) {
+ case QColor::Rgb:
+ {
+ int r, g, b, a;
+ %CPPSELF.getRgb(&r, &g, &b, &a);
+ %PYARG_0 = Py_BuildValue("iiii", r, g, b, a);
+ break;
+ }
+ case QColor::Hsv:
+ {
+ int h, s, v, a;
+ %CPPSELF.getHsv(&h, &s, &v, &a);
+ %PYARG_0 = Py_BuildValue("iiii", h, s, v, a);
+ break;
+ }
+ case QColor::Cmyk:
+ {
+ int c, m, y, k, a;
+ %CPPSELF.getCmyk(&c, &m, &y, &k, &a);
+ %PYARG_0 = Py_BuildValue("iiiii", c, m, y, k, a);
+ break;
+ }
+ case QColor::Hsl:
+ {
+ int h, s, l, a;
+ %CPPSELF.getHsl(&h, &s, &l, &a);
+ %PYARG_0 = Py_BuildValue("iiii", h, s, l, a);
+ break;
+ }
+ default:
+ {
+ %PYARG_0 = 0;
+ }
+}
+// @snippet qcolor-totuple
+
+// @snippet qcolor
+if (%1.type() == QVariant::Color)
+ %0 = new %TYPE(%1.value<QColor>());
+else
+ PyErr_SetString(PyExc_TypeError, "QVariant must be holding a QColor");
+// @snippet qcolor
+
+// @snippet qfontmetricsf-boundingrect
+int *array = nullptr;
+bool errorOccurred = false;
+
+if (numArgs == 5) {
+ array = Shiboken::sequenceToIntArray(%PYARG_5, true);
+ if (PyErr_Occurred()) {
+ delete [] array;
+ errorOccurred = true;
+ }
+}
+
+if (!errorOccurred) {
+ %RETURN_TYPE retval = %CPPSELF.%FUNCTION_NAME(%1, %2, %3, %4, array);
+
+ delete [] array;
+
+ %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](retval);
+}
+// @snippet qfontmetricsf-boundingrect
+
+// @snippet qfontmetricsf-size
+int *array = nullptr;
+bool errorOccurred = false;
+
+if (numArgs == 4) {
+ array = Shiboken::sequenceToIntArray(%PYARG_4, true);
+ if (PyErr_Occurred()) {
+ delete [] array;
+ errorOccurred = true;
+ }
+}
+
+if (!errorOccurred) {
+ %RETURN_TYPE retval = %CPPSELF.%FUNCTION_NAME(%1, %2, %3, array);
+
+ delete [] array;
+
+ %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](retval);
+}
+// @snippet qfontmetricsf-size
+
+// @snippet qfontmetrics-boundingrect-1
+int *array = nullptr;
+bool errorOccurred = false;
+
+if (numArgs == 8) {
+ array = Shiboken::sequenceToIntArray(%PYARG_8, true);
+ if (PyErr_Occurred()) {
+ delete [] array;
+ errorOccurred = true;
+ }
+}
+
+if (!errorOccurred) {
+ %RETURN_TYPE retval = %CPPSELF.%FUNCTION_NAME(%1, %2, %3, %4, %5, %6, %7, array);
+
+ delete [] array;
+
+ %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](retval);
+}
+// @snippet qfontmetrics-boundingrect-1
+
+// @snippet qfontmetrics-boundingrect-2
+int *array = nullptr;
+bool errorOccurred = false;
+
+if (numArgs == 5) {
+ array = Shiboken::sequenceToIntArray(%PYARG_5, true);
+ if (PyErr_Occurred()) {
+ delete [] array;
+ errorOccurred = true;
+ }
+}
+
+if (!errorOccurred) {
+ %RETURN_TYPE retval = %CPPSELF.%FUNCTION_NAME(%1, %2, %3, %4, array);
+
+ delete [] array;
+
+ %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](retval);
+}
+// @snippet qfontmetrics-boundingrect-2
+
+// @snippet qfontmetrics-size
+int *array = nullptr;
+bool errorOccurred = false;
+
+if (numArgs == 4) {
+ array = Shiboken::sequenceToIntArray(%PYARG_4, true);
+ if (PyErr_Occurred()) {
+ delete [] array;
+ errorOccurred = true;
+ }
+}
+
+if (!errorOccurred) {
+ %RETURN_TYPE retval = %CPPSELF.%FUNCTION_NAME(%1, %2, %3, array);
+
+ delete [] array;
+
+ %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](retval);
+}
+// @snippet qfontmetrics-size
+
+// @snippet qpixmapcache-find
+QPixmap p;
+if (%CPPSELF.%FUNCTION_NAME(%1, &p)) {
+ %PYARG_0 = %CONVERTTOPYTHON[QPixmap](p);
+} else {
+ %PYARG_0 = Py_None;
+ Py_INCREF(%PYARG_0);
+}
+// @snippet qpixmapcache-find
+
+// @snippet qstandarditem-setchild-1
+// Clear parent from the old child
+QStandardItem *_i = %CPPSELF->child(%1, %2);
+if (_i) {
+ PyObject *_pyI = %CONVERTTOPYTHON[QStandardItem *](_i);
+ Shiboken::Object::setParent(nullptr, _pyI);
+}
+// @snippet qstandarditem-setchild-1
+
+// @snippet qstandarditem-setchild-2
+// Clear parent from the old child
+QStandardItem *_i = %CPPSELF->child(%1);
+if (_i) {
+ PyObject *_pyI = %CONVERTTOPYTHON[QStandardItem *](_i);
+ Shiboken::Object::setParent(nullptr, _pyI);
+}
+// @snippet qstandarditem-setchild-2
+
+// @snippet qkeyevent-operatornotequal
+bool ret = !(&%CPPSELF == %1);
+%PYARG_0 = %CONVERTTOPYTHON[bool](ret);
+// @snippet qkeyevent-operatornotequal
+
+// @snippet qstandarditemmodel-setitem-1
+// Clear parent from the old child
+QStandardItem *_i = %CPPSELF->item(%1, %2);
+if (_i) {
+ PyObject *_pyI = %CONVERTTOPYTHON[QStandardItem *](_i);
+ Shiboken::Object::setParent(nullptr, _pyI);
+}
+// @snippet qstandarditemmodel-setitem-1
+
+// @snippet qstandarditemmodel-setitem-2
+// Clear parent from the old child
+QStandardItem *_i = %CPPSELF->item(%1);
+if (_i) {
+ PyObject *_pyI = %CONVERTTOPYTHON[QStandardItem *](_i);
+ Shiboken::Object::setParent(nullptr, _pyI);
+}
+// @snippet qstandarditemmodel-setitem-2
+
+// @snippet qstandarditemmodel-setverticalheaderitem
+// Clear parent from the old child
+QStandardItem *_i = %CPPSELF->verticalHeaderItem(%1);
+if (_i) {
+ PyObject *_pyI = %CONVERTTOPYTHON[QStandardItem *](_i);
+ Shiboken::Object::setParent(nullptr, _pyI);
+}
+// @snippet qstandarditemmodel-setverticalheaderitem
+
+// @snippet qstandarditemmodel-clear
+Shiboken::BindingManager &bm = Shiboken::BindingManager::instance();
+SbkObject *pyRoot = bm.retrieveWrapper(%CPPSELF.invisibleRootItem());
+if (pyRoot) {
+ Shiboken::Object::destroy(pyRoot, %CPPSELF.invisibleRootItem());
+}
+
+for (int r=0, r_max = %CPPSELF.rowCount(); r < r_max; r++) {
+ QList<QStandardItem *> ri = %CPPSELF.takeRow(0);
+
+ PyObject *pyResult = %CONVERTTOPYTHON[QList<QStandardItem * >](ri);
+ Shiboken::Object::setParent(Py_None, pyResult);
+ Py_XDECREF(pyResult);
+}
+// @snippet qstandarditemmodel-clear
+
+// @snippet qclipboard-text
+%BEGIN_ALLOW_THREADS
+%RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(%1, %2);
+%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[%ARG1_TYPE](%1));
+// @snippet qclipboard-text
+
+// @snippet qpainter-drawpolygon
+%CPPSELF.%FUNCTION_NAME(%1.data(), %1.size(), %2);
+// @snippet qpainter-drawpolygon
+
+// @snippet qmatrix-map-point
+QPoint p(%CPPSELF.%FUNCTION_NAME(%1));
+%PYARG_0 = %CONVERTTOPYTHON[QPoint](p);
+// @snippet qmatrix-map-point
+
+// @snippet qmatrix4x4
+// PYSIDE-795: All PySequences can be made iterable with PySequence_Fast.
+Shiboken::AutoDecRef seq(PySequence_Fast(%PYARG_1, "Can't turn into sequence"));
+if (PySequence_Size(seq) == 16) {
+ float values[16];
+ for (int i=0; i < 16; ++i) {
+ PyObject *pv = PySequence_Fast_GET_ITEM(seq.object(), i);
+ values[i] = PyFloat_AsDouble(pv);
+ }
+
+ %0 = new %TYPE(values[0], values[1], values[2], values[3],
+ values[4], values[5], values[6], values[7],
+ values[8], values[9], values[10], values[11],
+ values[12], values[13], values[14], values[15]);
+}
+// @snippet qmatrix4x4
+
+// @snippet qmatrix4x4-copydatato
+float values[16];
+%CPPSELF.%FUNCTION_NAME(values);
+%PYARG_0 = PyTuple_New(16);
+for (int i = 0; i < 16; ++i) {
+ PyObject *v = PyFloat_FromDouble(values[i]);
+ PyTuple_SET_ITEM(%PYARG_0, i, v);
+}
+// @snippet qmatrix4x4-copydatato
+
+// @snippet qmatrix4x4-mgetitem
+if (PySequence_Check(_key)) {
+ Shiboken::AutoDecRef key(PySequence_Fast(_key, "Invalid matrix index."));
+ if (PySequence_Fast_GET_SIZE(key.object()) == 2) {
+ PyObject *posx = PySequence_Fast_GET_ITEM(key.object(), 0);
+ PyObject *posy = PySequence_Fast_GET_ITEM(key.object(), 1);
+ Py_ssize_t x = PyInt_AsSsize_t(posx);
+ Py_ssize_t y = PyInt_AsSsize_t(posy);
+ float ret = (*%CPPSELF)(x,y);
+ return %CONVERTTOPYTHON[float](ret);
+ }
+}
+PyErr_SetString(PyExc_IndexError, "Invalid matrix index.");
+return 0;
+// @snippet qmatrix4x4-mgetitem
+
+// @snippet qguiapplication-init
+static void QGuiApplicationConstructor(PyObject *self, PyObject *pyargv, QGuiApplicationWrapper **cptr)
+{
+ static int argc;
+ static char **argv;
+ PyObject *stringlist = PyTuple_GET_ITEM(pyargv, 0);
+ if (Shiboken::listToArgcArgv(stringlist, &argc, &argv, "PySideApp")) {
+ *cptr = new QGuiApplicationWrapper(argc, argv, 0);
+ Shiboken::Object::releaseOwnership(reinterpret_cast<SbkObject *>(self));
+ PySide::registerCleanupFunction(&PySide::destroyQCoreApplication);
+ }
+}
+// @snippet qguiapplication-init
+
+// @snippet qguiapplication-1
+QGuiApplicationConstructor(%PYSELF, args, &%0);
+// @snippet qguiapplication-1
+
+// @snippet qguiapplication-2
+PyObject *empty = PyTuple_New(2);
+if (!PyTuple_SetItem(empty, 0, PyList_New(0))) {
+ QGuiApplicationConstructor(%PYSELF, empty, &%0);
+}
+// @snippet qguiapplication-2
+
+// @snippet qscreen-grabWindow
+WId id = %1;
+%RETURN_TYPE retval = %CPPSELF.%FUNCTION_NAME(id, %2, %3, %4, %5);
+%PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](retval);
+// @snippet qscreen-grabWindow
+
+// @snippet qwindow-fromWinId
+WId id = %1;
+%RETURN_TYPE retval = %CPPSELF.%FUNCTION_NAME(id);
+%PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](retval);
+// @snippet qwindow-fromWinId
+
+/*********************************************************************
+ * CONVERSIONS
+ ********************************************************************/
+
+// @snippet conversion-pylong
+%out = reinterpret_cast<%OUTTYPE>(PyLong_AsVoidPtr(%in));
+// @snippet conversion-pylong
+
+/*********************************************************************
+ * NATIVE TO TARGET CONVERSIONS
+ ********************************************************************/
+
+// @snippet return-pylong-voidptr
+return PyLong_FromVoidPtr(reinterpret_cast<void *>(%in));
+// @snippet return-pylong-voidptr
diff --git a/sources/pyside6/PySide6/glue/qtmultimedia.cpp b/sources/pyside6/PySide6/glue/qtmultimedia.cpp
new file mode 100644
index 000000000..cbe1367cb
--- /dev/null
+++ b/sources/pyside6/PySide6/glue/qtmultimedia.cpp
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+// @snippet upcast
+%BEGIN_ALLOW_THREADS
+QObject * upcastedArg = %CONVERTTOCPP[QObject *](%PYARG_1);
+//XXX /|\ omitting this space crashes shiboken!
+%CPPSELF.%FUNCTION_NAME(reinterpret_cast< %ARG1_TYPE >(upcastedArg));
+%END_ALLOW_THREADS
+// @snippet upcast
+
+// @snippet qvideoframe-bits
+%BEGIN_ALLOW_THREADS
+%RETURN_TYPE %0 = %CPPSELF.%FUNCTION_NAME();
+%END_ALLOW_THREADS
+%PYARG_0 = Shiboken::Buffer::newObject(%0, %CPPSELF.bytesPerLine() * %CPPSELF.height(), Shiboken::Buffer::ReadWrite);
+// @snippet qvideoframe-bits
diff --git a/sources/pyside6/PySide6/glue/qtnetwork.cpp b/sources/pyside6/PySide6/glue/qtnetwork.cpp
new file mode 100644
index 000000000..cdb330c40
--- /dev/null
+++ b/sources/pyside6/PySide6/glue/qtnetwork.cpp
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+// @snippet qudpsocket-readdatagram
+Shiboken::AutoArrayPointer<char> data(%ARGUMENT_NAMES);
+QHostAddress ha;
+quint16 port;
+%BEGIN_ALLOW_THREADS
+%RETURN_TYPE retval = %CPPSELF.%FUNCTION_NAME(data, %ARGUMENT_NAMES, &ha, &port);
+%END_ALLOW_THREADS
+QByteArray ba(data, retval);
+%PYARG_0 = PyTuple_New(3);
+PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[QByteArray](ba));
+PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[QHostAddress](ha));
+PyTuple_SET_ITEM(%PYARG_0, 2, %CONVERTTOPYTHON[quint16](port));
+// @snippet qudpsocket-readdatagram
+
+// @snippet qipv6address-len
+return 16;
+// @snippet qipv6address-len
+
+// @snippet qipv6address-getitem
+if (_i >= 16) {
+ PyErr_SetString(PyExc_IndexError, "index out of bounds");
+ return 0;
+}
+if (_i < 0)
+ _i = 16 - qAbs(_i);
+
+uint item = %CPPSELF.c[_i];
+return %CONVERTTOPYTHON[uint](item);
+// @snippet qipv6address-getitem
+
+// @snippet qipv6address-setitem
+if (_i >= 16) {
+ PyErr_SetString(PyExc_IndexError, "index out of bounds");
+ return -1;
+}
+if (_i < 0)
+ _i = 16 - qAbs(_i);
+quint8 item = %CONVERTTOCPP[quint8](_value);
+%CPPSELF.c[_i] = item;
+return 0;
+// @snippet qipv6address-setitem
diff --git a/sources/pyside6/PySide6/glue/qtopengl.cpp b/sources/pyside6/PySide6/glue/qtopengl.cpp
new file mode 100644
index 000000000..25b6ee096
--- /dev/null
+++ b/sources/pyside6/PySide6/glue/qtopengl.cpp
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+// @snippet qglbuffer-allocate
+int size = (%2 < 0) ? %1.size() : %2;
+%CPPSELF.allocate(static_cast<const void *>(%1.data()), size);
+// @snippet qglbuffer-allocate
+
+// @snippet qglbuffer-read
+char *data = new char[%3];
+bool result = %CPPSELF.read(%1, data, %3);
+QByteArray ret;
+if (result)
+ ret.append(data, %3);
+%PYARG_0 = PyTuple_New(2);
+PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[bool](result));
+PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[QByteArray](ret));
+delete[] data;
+// @snippet qglbuffer-read
+
+// @snippet qglbuffer-write
+int size = (%3 < 0) ? %2.size() : %3;
+%CPPSELF.write(%1, static_cast<const void *>(%2.data()), size);
+// @snippet qglbuffer-write
+
+// @snippet qglbuffer-map
+Py_ssize_t dataSize = %CPPSELF.size();
+void *data = %CPPSELF.map(%1);
+
+if (!data) {
+ Py_INCREF(Py_None);
+ %PYARG_0 = Py_None;
+} else if (%1 == QGLBuffer::ReadOnly) {
+ %PYARG_0 = Shiboken::Buffer::newObject(data, dataSize, Shiboken::Buffer::ReadOnly);
+} else {
+ %PYARG_0 = Shiboken::Buffer::newObject(data, dataSize, Shiboken::Buffer::ReadWrite);
+}
+// @snippet qglbuffer-map
diff --git a/sources/pyside6/PySide6/glue/qtprintsupport.cpp b/sources/pyside6/PySide6/glue/qtprintsupport.cpp
new file mode 100644
index 000000000..300a498c0
--- /dev/null
+++ b/sources/pyside6/PySide6/glue/qtprintsupport.cpp
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+// @snippet setpagesize
+bool out = %CPPSELF.setPageSize(%1);
+%PYARG_0 = %CONVERTTOPYTHON[bool](out);
+// @snippet setpagesize
diff --git a/sources/pyside6/PySide6/glue/qtqml.cpp b/sources/pyside6/PySide6/glue/qtqml.cpp
new file mode 100644
index 000000000..eab6eab95
--- /dev/null
+++ b/sources/pyside6/PySide6/glue/qtqml.cpp
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+// @snippet qmlregistertype
+int %0 = PySide::qmlRegisterType(%ARGUMENT_NAMES);
+%PYARG_0 = %CONVERTTOPYTHON[int](%0);
+// @snippet qmlregistertype
+
+// @snippet qmlregistersingletontype_qobject_callback
+int %0 = PySide::qmlRegisterSingletonType(%ARGUMENT_NAMES, true, true);
+%PYARG_0 = %CONVERTTOPYTHON[int](%0);
+// @snippet qmlregistersingletontype_qobject_callback
+
+// @snippet qmlregistersingletontype_qobject_nocallback
+int %0 = PySide::qmlRegisterSingletonType(%ARGUMENT_NAMES, nullptr, true, false);
+%PYARG_0 = %CONVERTTOPYTHON[int](%0);
+// @snippet qmlregistersingletontype_qobject_nocallback
+
+// @snippet qmlregistersingletontype_qjsvalue
+int %0 = PySide::qmlRegisterSingletonType(nullptr, %ARGUMENT_NAMES, false, true);
+%PYARG_0 = %CONVERTTOPYTHON[int](%0);
+// @snippet qmlregistersingletontype_qjsvalue
+
+// @snippet qmlregisteruncreatabletype
+int %0 = PySide::qmlRegisterType(%ARGUMENT_NAMES, false);
+%PYARG_0 = %CONVERTTOPYTHON[int](%0);
+// @snippet qmlregisteruncreatabletype
+
+// @snippet init
+PySide::initQmlSupport(module);
+// @snippet init
+
+// @snippet qjsengine-toscriptvalue
+%RETURN_TYPE retval = %CPPSELF.%FUNCTION_NAME(%1);
+return %CONVERTTOPYTHON[%RETURN_TYPE](retval);
+// @snippet qjsengine-toscriptvalue
+
+// @snippet qmlelement
+%PYARG_0 = PySide::qmlElementMacro(%ARGUMENT_NAMES);
+// @snippet qmlelement
diff --git a/sources/pyside6/PySide6/glue/qtquick.cpp b/sources/pyside6/PySide6/glue/qtquick.cpp
new file mode 100644
index 000000000..b7c31aff3
--- /dev/null
+++ b/sources/pyside6/PySide6/glue/qtquick.cpp
@@ -0,0 +1,42 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+// @snippet qtquick
+PySide::initQuickSupport(module);
+// @snippet qtquick
diff --git a/sources/pyside6/PySide6/glue/qtscript.cpp b/sources/pyside6/PySide6/glue/qtscript.cpp
new file mode 100644
index 000000000..cf168d6bd
--- /dev/null
+++ b/sources/pyside6/PySide6/glue/qtscript.cpp
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+// @snippet qscriptvalue-repr
+if (%CPPSELF.isVariant() || %CPPSELF.isString()) {
+ QString format = QString::asprintf("%s(\"%s\")",
+ Py_TYPE(%PYSELF)->tp_name,
+ qPrintable(%CPPSELF.toString()));
+ %PYARG_0 = Shiboken::String::fromCString(qPrintable(format));
+ } else {
+ %PYARG_0 = Shiboken::String::fromCString(Py_TYPE(%PYSELF)->tp_name);
+}
+// @snippet qscriptvalue-repr
+
+// @snippet qscriptvalue-mgetitem
+Shiboken::AutoDecRef key(PyObject_Str(_key));
+QVariant res = %CPPSELF.property(Shiboken::String::toCString(key.object())).toVariant();
+if (res.isValid()) {
+ return %CONVERTTOPYTHON[QVariant](res);
+} else {
+ PyObject *errorType = PyInt_Check(_key) ? PyExc_IndexError : PyExc_KeyError;
+ PyErr_SetString(errorType, "Key not found.");
+ return 0;
+}
+// @snippet qscriptvalue-mgetitem
+
+// @snippet qscriptvalueiterator-next
+if (%CPPSELF.hasNext()) {
+ %CPPSELF.next();
+ QString name = %CPPSELF.name();
+ QVariant value = %CPPSELF.value().toVariant();
+ %PYARG_0 = PyTuple_New(2);
+ PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[QString](name));
+ PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[QVariant](value));
+} else {
+ PyErr_SetNone(PyExc_StopIteration);
+}
+// @snippet qscriptvalueiterator-next
diff --git a/sources/pyside6/PySide6/glue/qtuitools.cpp b/sources/pyside6/PySide6/glue/qtuitools.cpp
new file mode 100644
index 000000000..1d9ffe9b2
--- /dev/null
+++ b/sources/pyside6/PySide6/glue/qtuitools.cpp
@@ -0,0 +1,238 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+// @snippet uitools-loadui
+/*
+ * Based on code provided by:
+ * Antonio Valentino <antonio.valentino at tiscali.it>
+ * Frédéric <frederic.mantegazza at gbiloba.org>
+ */
+
+#include <shiboken.h>
+#include <QUiLoader>
+#include <QFile>
+#include <QWidget>
+
+static void createChildrenNameAttributes(PyObject *root, QObject *object)
+{
+ for (auto *child : object->children()) {
+ const QByteArray name = child->objectName().toLocal8Bit();
+
+ if (!name.isEmpty() && !name.startsWith("_") && !name.startsWith("qt_")) {
+ Shiboken::AutoDecRef attrName(Py_BuildValue("s", name.constData()));
+ if (!PyObject_HasAttr(root, attrName)) {
+ Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QObject *](child));
+ PyObject_SetAttr(root, attrName, pyChild);
+ }
+ createChildrenNameAttributes(root, child);
+ }
+ createChildrenNameAttributes(root, child);
+ }
+}
+
+static PyObject *QUiLoadedLoadUiFromDevice(QUiLoader *self, QIODevice *dev, QWidget *parent)
+{
+ QWidget *wdg = self->load(dev, parent);
+
+ if (wdg) {
+ PyObject *pyWdg = %CONVERTTOPYTHON[QWidget *](wdg);
+ createChildrenNameAttributes(pyWdg, wdg);
+ if (parent) {
+ Shiboken::AutoDecRef pyParent(%CONVERTTOPYTHON[QWidget *](parent));
+ Shiboken::Object::setParent(pyParent, pyWdg);
+ }
+ return pyWdg;
+ }
+
+ if (!PyErr_Occurred())
+ PyErr_SetString(PyExc_RuntimeError, "Unable to open/read ui device");
+ return nullptr;
+}
+
+static PyObject *QUiLoaderLoadUiFromFileName(QUiLoader *self, const QString &uiFile, QWidget *parent)
+{
+ QFile fd(uiFile);
+ return QUiLoadedLoadUiFromDevice(self, &fd, parent);
+}
+// @snippet uitools-loadui
+
+// @snippet quiloader
+Q_IMPORT_PLUGIN(PyCustomWidgets);
+// @snippet quiloader
+
+// @snippet quiloader-registercustomwidget
+registerCustomWidget(%PYARG_1);
+%CPPSELF.addPluginPath(""); // force reload widgets
+// @snippet quiloader-registercustomwidget
+
+// @snippet quiloader-load-1
+// Avoid calling the original function: %CPPSELF.%FUNCTION_NAME()
+%PYARG_0 = QUiLoadedLoadUiFromDevice(%CPPSELF, %1, %2);
+// @snippet quiloader-load-1
+
+// @snippet quiloader-load-2
+// Avoid calling the original function: %CPPSELF.%FUNCTION_NAME()
+%PYARG_0 = QUiLoaderLoadUiFromFileName(%CPPSELF, %1, %2);
+// @snippet quiloader-load-2
+
+// @snippet loaduitype
+/*
+Arguments:
+ %PYARG_1 (uifile)
+*/
+// 1. Generate the Python code from the UI file
+PyObject *strObj = PyUnicode_AsUTF8String(%PYARG_1);
+char *arg1 = PyBytes_AsString(strObj);
+QByteArray uiFileName(arg1);
+Py_DECREF(strObj);
+
+QFile uiFile(uiFileName);
+
+if (!uiFile.exists()) {
+ qCritical().noquote() << "File" << uiFileName << "does not exists";
+ Py_RETURN_NONE;
+}
+
+if (uiFileName.isEmpty()) {
+ qCritical() << "Error converting the UI filename to QByteArray";
+ Py_RETURN_NONE;
+}
+
+// Use the 'pyside6-uic' wrapper instead of 'uic'
+// This approach is better than rely on 'uic' since installing
+// the wheels cover this case.
+QString uicBin("pyside6-uic");
+QStringList uicArgs = {QString::fromUtf8(uiFileName)};
+
+QProcess uicProcess;
+uicProcess.start(uicBin, uicArgs);
+if (!uicProcess.waitForFinished()) {
+ qCritical() << "Cannot run 'pyside6-uic': " << uicProcess.errorString() << " - "
+ << "Exit status " << uicProcess.exitStatus()
+ << " (" << uicProcess.exitCode() << ")\n"
+ << "Check if 'pyside6-uic' is in PATH";
+ Py_RETURN_NONE;
+}
+QByteArray uiFileContent = uicProcess.readAllStandardOutput();
+QByteArray errorOutput = uicProcess.readAllStandardError();
+
+if (!errorOutput.isEmpty()) {
+ qCritical().noquote() << errorOutput;
+ Py_RETURN_NONE;
+}
+
+// 2. Obtain the 'classname' and the Qt base class.
+QByteArray className;
+QByteArray baseClassName;
+
+// Problem
+// The generated Python file doesn't have the Qt Base class information.
+
+// Solution
+// Use the XML file
+if (!uiFile.open(QIODevice::ReadOnly))
+ Py_RETURN_NONE;
+
+// This will look for the first <widget> tag, e.g.:
+// <widget class="QWidget" name="ThemeWidgetForm">
+// and then extract the information from "class", and "name",
+// to get the baseClassName and className respectively
+QXmlStreamReader reader(&uiFile);
+while (!reader.atEnd() && baseClassName.isEmpty() && className.isEmpty()) {
+ auto token = reader.readNext();
+ if (token == QXmlStreamReader::StartElement && reader.name() == "widget") {
+ baseClassName = reader.attributes().value(QLatin1String("class")).toUtf8();
+ className = reader.attributes().value(QLatin1String("name")).toUtf8();
+ }
+}
+
+uiFile.close();
+
+if (className.isEmpty() || baseClassName.isEmpty() || reader.hasError()) {
+ qCritical() << "An error occurred when parsing the UI file while looking for the class info "
+ << reader.errorString();
+ Py_RETURN_NONE;
+}
+
+QByteArray pyClassName("Ui_"+className);
+
+PyObject *module = PyImport_ImportModule("__main__");
+PyObject *loc = PyModule_GetDict(module);
+
+// 3. exec() the code so the class exists in the context: exec(uiFileContent)
+// The context of PyRun_SimpleString is __main__.
+// 'Py_file_input' is the equivalent to using exec(), since it will execute
+// the code, without returning anything.
+Shiboken::AutoDecRef codeUi(Py_CompileString(uiFileContent.constData(), "<stdin>", Py_file_input));
+if (codeUi.isNull()) {
+ qCritical() << "Error while compiling the generated Python file";
+ Py_RETURN_NONE;
+}
+PyObject *uiObj = PyEval_EvalCode(codeUi, loc, loc);
+
+if (uiObj == nullptr) {
+ qCritical() << "Error while running exec() on the generated code";
+ Py_RETURN_NONE;
+}
+
+// 4. eval() the name of the class on a variable to return
+// 'Py_eval_input' is the equivalent to using eval(), since it will just
+// evaluate an expression.
+Shiboken::AutoDecRef codeClass(Py_CompileString(pyClassName.constData(),"<stdin>", Py_eval_input));
+if (codeClass.isNull()) {
+ qCritical() << "Error while compiling the Python class";
+ Py_RETURN_NONE;
+}
+
+Shiboken::AutoDecRef codeBaseClass(Py_CompileString(baseClassName.constData(), "<stdin>", Py_eval_input));
+if (codeBaseClass.isNull()) {
+ qCritical() << "Error while compiling the base class";
+ Py_RETURN_NONE;
+}
+
+PyObject *classObj = PyEval_EvalCode(codeClass, loc, loc);
+PyObject *baseClassObj = PyEval_EvalCode(codeBaseClass, loc, loc);
+
+%PYARG_0 = PyTuple_New(2);
+if (%PYARG_0 == nullptr) {
+ qCritical() << "Error while creating the return Tuple";
+ Py_RETURN_NONE;
+}
+PyTuple_SET_ITEM(%PYARG_0, 0, classObj);
+PyTuple_SET_ITEM(%PYARG_0, 1, baseClassObj);
+// @snippet loaduitype
diff --git a/sources/pyside6/PySide6/glue/qtwebenginewidgets.cpp b/sources/pyside6/PySide6/glue/qtwebenginewidgets.cpp
new file mode 100644
index 000000000..5ee9f3554
--- /dev/null
+++ b/sources/pyside6/PySide6/glue/qtwebenginewidgets.cpp
@@ -0,0 +1,157 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 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$
+**
+****************************************************************************/
+
+// @snippet qwebenginepage-findtext
+auto callable = %PYARG_3;
+auto callback = [callable](bool found)
+{
+ if (!PyCallable_Check(callable)) {
+ qWarning("Argument 3 of %FUNCTION_NAME must be a callable.");
+ return;
+ }
+ Shiboken::GilState state;
+ Shiboken::AutoDecRef arglist(PyTuple_New(1));
+ PyTuple_SET_ITEM(arglist, 0, %CONVERTTOPYTHON[bool](found));
+ Shiboken::AutoDecRef ret(PyObject_CallObject(callable, arglist));
+ Py_DECREF(callable);
+
+};
+Py_INCREF(callable);
+%CPPSELF.%FUNCTION_NAME(%1, %2, callback);
+// @snippet qwebenginepage-findtext
+
+// @snippet qwebenginepage-print
+auto printer = %PYARG_1;
+auto callable = %PYARG_2;
+auto callback = [printer, callable](bool succeeded)
+{
+ if (!PyCallable_Check(callable)) {
+ qWarning("Argument 2 of %FUNCTION_NAME must be a callable.");
+ return;
+ }
+ Shiboken::GilState state;
+ Shiboken::AutoDecRef arglist(PyTuple_New(1));
+ PyTuple_SET_ITEM(arglist, 0, %CONVERTTOPYTHON[bool](succeeded));
+ Shiboken::AutoDecRef ret(PyObject_CallObject(callable, arglist));
+ Py_DECREF(callable);
+ Py_DECREF(printer);
+
+};
+Py_INCREF(printer); // Add a reference to the printer until asynchronous printing has finished
+Py_INCREF(callable);
+%CPPSELF.%FUNCTION_NAME(%1, callback);
+// @snippet qwebenginepage-print
+
+// @snippet qwebenginepage-convertto
+auto callable = %PYARG_1;
+auto callback = [callable](const QString &text)
+{
+ if (!PyCallable_Check(callable)) {
+ qWarning("Argument 1 of %FUNCTION_NAME must be a callable.");
+ return;
+ }
+ Shiboken::GilState state;
+ Shiboken::AutoDecRef arglist(PyTuple_New(1));
+ PyTuple_SET_ITEM(arglist, 0, %CONVERTTOPYTHON[QString](text));
+ Shiboken::AutoDecRef ret(PyObject_CallObject(callable, arglist));
+ Py_DECREF(callable);
+
+};
+Py_INCREF(callable);
+%CPPSELF.%FUNCTION_NAME(callback);
+// @snippet qwebenginepage-convertto
+
+// @snippet qwebenginepage-runjavascript
+auto callable = %PYARG_3;
+auto callback = [callable](const QVariant &result)
+{
+ if (!PyCallable_Check(callable)) {
+ qWarning("Argument 3 of %FUNCTION_NAME must be a callable.");
+ return;
+ }
+ Shiboken::GilState state;
+ Shiboken::AutoDecRef arglist(PyTuple_New(1));
+ switch (result.type()) {
+ case QVariant::Bool: {
+ const bool value = result.toBool();
+ PyTuple_SET_ITEM(arglist, 0, %CONVERTTOPYTHON[QString](value));
+ }
+ break;
+ case QVariant::Int:
+ case QVariant::UInt:
+ case QVariant::LongLong:
+ case QVariant::ULongLong:
+ case QVariant::Double: {
+ const double number = result.toDouble();
+ PyTuple_SET_ITEM(arglist, 0, %CONVERTTOPYTHON[double](number));
+ }
+ break;
+ default: {
+ const QString value = result.toString();
+ PyTuple_SET_ITEM(arglist, 0, %CONVERTTOPYTHON[QString](value));
+ }
+ break;
+ }
+ // PyTuple_SET_ITEM(arglist, 0, %CONVERTTOPYTHON[bool](found));
+ Shiboken::AutoDecRef ret(PyObject_CallObject(callable, arglist));
+ Py_DECREF(callable);
+
+};
+Py_INCREF(callable);
+%CPPSELF.%FUNCTION_NAME(%1, %2, callback);
+// @snippet qwebenginepage-runjavascript
+
+// @snippet qwebenginepage-printtopdf
+auto callable = %PYARG_1;
+auto callback = [callable](const QByteArray &pdf)
+{
+ if (!PyCallable_Check(callable)) {
+ qWarning("Argument 1 of %FUNCTION_NAME must be a callable.");
+ return;
+ }
+ Shiboken::GilState state;
+ Shiboken::AutoDecRef arglist(PyTuple_New(1));
+ PyTuple_SET_ITEM(arglist, 0, %CONVERTTOPYTHON[QByteArray](pdf));
+ Shiboken::AutoDecRef ret(PyObject_CallObject(callable, arglist));
+ Py_DECREF(callable);
+
+};
+Py_INCREF(callable);
+%CPPSELF.%FUNCTION_NAME(callback, %2);
+// @snippet qwebenginepage-printtopdf
diff --git a/sources/pyside6/PySide6/glue/qtwebkitwidgets.cpp b/sources/pyside6/PySide6/glue/qtwebkitwidgets.cpp
new file mode 100644
index 000000000..c0f182747
--- /dev/null
+++ b/sources/pyside6/PySide6/glue/qtwebkitwidgets.cpp
@@ -0,0 +1,92 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+// @snippet qwebview-page
+auto _pyReturn = reinterpret_cast<SbkObject *>(%PYARG_0);
+if (!Shiboken::Object::hasParentInfo(_pyReturn))
+ Shiboken::Object::setParent(%PYSELF, %PYARG_0);
+// @snippet qwebview-page
+
+// @snippet qwebelementcollection-len
+return %CPPSELF.count();
+// @snippet qwebelementcollection-len
+
+// @snippet qwebelementcollection-getitem
+if (_i < 0 || _i >= %CPPSELF.count()) {
+ PyErr_SetString(PyExc_IndexError, "index out of bounds");
+ return 0;
+}
+QWebElement element = %CPPSELF.at(_i);
+return %CONVERTTOPYTHON[QWebElement](element);
+// @snippet qwebelementcollection-getitem
+
+// @snippet qwebpage-qt-metacall
+static int _signalIndex = -1;
+static QMetaMethod _m;
+
+if (_signalIndex == -1) {
+ _signalIndex = QWebPage::staticMetaObject.indexOfSlot("shouldInterruptJavaScript()")
+ _m = QWebPage::staticMetaObject.method(_signalIndex);
+}
+
+if (_signalIndex == id) {
+ Shiboken::GilState gil;
+ auto self = reinterpret_cast<PyObject *>(Shiboken::BindingManager::instance().retrieveWrapper(this));
+
+ if (self) {
+ Shiboken::AutoDecRef _pyMethod(PyObject_GetAttrString(self, "shouldInterruptJavaScript"));
+ return PySide::SignalManager::callPythonMetaMethod(_m, args, _pyMethod, false);
+ }
+}
+// @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/pyside6/PySide6/glue/qtwidgets.cpp b/sources/pyside6/PySide6/glue/qtwidgets.cpp
new file mode 100644
index 000000000..4f9baadf1
--- /dev/null
+++ b/sources/pyside6/PySide6/glue/qtwidgets.cpp
@@ -0,0 +1,663 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+/*********************************************************************
+ * INJECT CODE
+ ********************************************************************/
+
+// @snippet qtreewidgetitemiterator-next
+if (**%CPPSELF) {
+ QTreeWidgetItemIterator *%0 = new QTreeWidgetItemIterator((*%CPPSELF)++);
+ %PYARG_0 = %CONVERTTOPYTHON[QTreeWidgetItemIterator *](%0);
+}
+// @snippet qtreewidgetitemiterator-next
+
+// @snippet qtreewidgetitemiterator-value
+QTreeWidgetItem *%0 = %CPPSELF.operator *();
+%PYARG_0 = %CONVERTTOPYTHON[QTreeWidgetItem *](%0);
+Shiboken::Object::releaseOwnership(%PYARG_0);
+// @snippet qtreewidgetitemiterator-value
+
+// @snippet qgraphicsitem
+PyObject *userTypeConstant = PyInt_FromLong(QGraphicsItem::UserType);
+PyDict_SetItemString(reinterpret_cast<PyTypeObject *>(Sbk_QGraphicsItem_TypeF())->tp_dict, "UserType", userTypeConstant);
+// @snippet qgraphicsitem
+
+// @snippet qgraphicsitem-scene-return-parenting
+if (%0) {
+ QObject *parent = %0->parent();
+ Shiboken::AutoDecRef pyParent(%CONVERTTOPYTHON[QObject *](parent));
+ Shiboken::Object::setParent(pyParent, %PYARG_0);
+}
+// @snippet qgraphicsitem-scene-return-parenting
+
+// @snippet qgraphicsitem-isblockedbymodalpanel
+QGraphicsItem *item_ = NULL;
+%RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(&item_);
+%PYARG_0 = PyTuple_New(2);
+PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[%RETURN_TYPE](retval_));
+PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[QGraphicsItem *](item_));
+// @snippet qgraphicsitem-isblockedbymodalpanel
+
+// @snippet qitemeditorfactory-registereditor
+Shiboken::Object::releaseOwnership(%PYARG_2);
+// @snippet qitemeditorfactory-registereditor
+
+// @snippet qitemeditorfactory-setdefaultfactory
+//this function is static we need keep ref to default value, to be able to call python virtual functions
+static PyObject *_defaultValue = nullptr;
+%CPPSELF.%FUNCTION_NAME(%1);
+Py_INCREF(%PYARG_1);
+if (_defaultValue)
+ Py_DECREF(_defaultValue);
+
+_defaultValue = %PYARG_1;
+// @snippet qitemeditorfactory-setdefaultfactory
+
+// @snippet qformlayout-fix-args
+int _row;
+QFormLayout::ItemRole _role;
+%CPPSELF->%FUNCTION_NAME(%ARGUMENT_NAMES, &_row, &_role);
+%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
+%RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(%1, %2, %3, %4, &%5, %6);
+%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-glue
+inline PyObject *addActionWithPyObject(QMenu *self, const QIcon &icon, const QString &text, PyObject *callback, const QKeySequence &shortcut)
+{
+ QAction *act = self->addAction(text);
+
+ if (!icon.isNull())
+ act->setIcon(icon);
+
+ if (!shortcut.isEmpty())
+ act->setShortcut(shortcut);
+
+ self->addAction(act);
+
+ PyObject *pyAct = %CONVERTTOPYTHON[QAction *](act);
+ Shiboken::AutoDecRef result(PyObject_CallMethod(pyAct,
+ const_cast<char *>("connect"),
+ const_cast<char *>("OsO"),
+ pyAct,
+ SIGNAL(triggered()), callback));
+ if (result.isNull()) {
+ Py_DECREF(pyAct);
+ return nullptr;
+ }
+
+ return pyAct;
+}
+// @snippet qmenu-glue
+
+// @snippet qmenu-addaction-1
+%PYARG_0 = addActionWithPyObject(%CPPSELF, QIcon(), %1, %2, %3);
+// @snippet qmenu-addaction-1
+
+// @snippet qmenu-addaction-2
+%PYARG_0 = addActionWithPyObject(%CPPSELF, %1, %2, %3, %4);
+// @snippet qmenu-addaction-2
+
+// @snippet qmenu-addaction-3
+%CPPSELF.addAction(%1);
+// @snippet qmenu-addaction-3
+
+// @snippet qmenu-clear
+Shiboken::BindingManager &bm = Shiboken::BindingManager::instance();
+const auto &actions = %CPPSELF.actions();
+for (auto *act : actions) {
+ if (auto wrapper = bm.retrieveWrapper(act)) {
+ auto pyObj = reinterpret_cast<PyObject *>(wrapper);
+ Py_INCREF(pyObj);
+ Shiboken::Object::setParent(NULL, pyObj);
+ Shiboken::Object::invalidate(pyObj);
+ Py_DECREF(pyObj);
+ }
+}
+// @snippet qmenu-clear
+
+// @snippet qmenubar-glue
+inline PyObject *
+addActionWithPyObject(QMenuBar *self, const QString &text, PyObject *callback)
+{
+ QAction *act = self->addAction(text);
+
+ self->addAction(act);
+
+ PyObject *pyAct = %CONVERTTOPYTHON[QAction *](act);
+ PyObject *result = PyObject_CallMethod(pyAct,
+ const_cast<char *>("connect"),
+ const_cast<char *>("OsO"),
+ pyAct,
+ SIGNAL(triggered(bool)), callback);
+
+ if (result == nullptr || result == Py_False) {
+ if (result)
+ Py_DECREF(result);
+ Py_DECREF(pyAct);
+ return nullptr;
+ }
+
+ return pyAct;
+}
+// @snippet qmenubar-glue
+
+// @snippet qmenubar-clear
+const auto &actions = %CPPSELF.actions();
+for (auto *act : actions) {
+ Shiboken::AutoDecRef pyAct(%CONVERTTOPYTHON[QAction *](act));
+ Shiboken::Object::setParent(NULL, pyAct);
+ Shiboken::Object::invalidate(pyAct);
+}
+// @snippet qmenubar-clear
+
+// @snippet qmenubar-addaction-1
+%PYARG_0 = addActionWithPyObject(%CPPSELF, %1, %2);
+// @snippet qmenubar-addaction-1
+
+// @snippet qmenubar-addaction-2
+%CPPSELF.addAction(%1);
+// @snippet qmenubar-addaction-2
+
+// @snippet qshortcut-1
+%0 = new %TYPE(%1, %2);
+// @snippet qshortcut-1
+
+// @snippet qshortcut-2
+Shiboken::AutoDecRef result(PyObject_CallMethod(%PYSELF,
+ const_cast<char *>("connect"),
+ const_cast<char *>("OsO"),
+ %PYSELF, SIGNAL(activated()), %PYARG_3)
+);
+if (!result.isNull())
+ Shiboken::Object::setParent(%PYARG_2, %PYSELF);
+// @snippet qshortcut-2
+
+// @snippet qtoolbox-removeitem
+QWidget *_widget = %CPPSELF.widget(%1);
+if (_widget) {
+ Shiboken::AutoDecRef pyWidget(%CONVERTTOPYTHON[QWidget *](_widget));
+ Shiboken::Object::setParent(0, pyWidget);
+}
+// @snippet qtoolbox-removeitem
+
+// @snippet qlayout-help-functions
+void addLayoutOwnership(QLayout *layout, QLayoutItem *item);
+void removeLayoutOwnership(QLayout *layout, QWidget *widget);
+
+inline QByteArray retrieveObjectName(PyObject *obj)
+{
+ Shiboken::AutoDecRef objName(PyObject_Str(obj));
+ return Shiboken::String::toCString(objName);
+}
+
+inline void addLayoutOwnership(QLayout *layout, QWidget *widget)
+{
+ //transfer ownership to parent widget
+ QWidget *lw = layout->parentWidget();
+ QWidget *pw = widget->parentWidget();
+
+ Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QWidget *](widget));
+
+ //Transfer parent to layout widget
+ if (pw && lw && pw != lw)
+ Shiboken::Object::setParent(0, pyChild);
+
+ if (!lw && !pw) {
+ //keep the reference while the layout is orphan
+ Shiboken::AutoDecRef pyParent(%CONVERTTOPYTHON[QWidget *](layout));
+ Shiboken::Object::keepReference(reinterpret_cast<SbkObject *>(pyParent.object()), retrieveObjectName(pyParent).data(), pyChild, true);
+ } else {
+ if (!lw)
+ lw = pw;
+ Shiboken::AutoDecRef pyParent(%CONVERTTOPYTHON[QWidget *](lw));
+ Shiboken::Object::setParent(pyParent, pyChild);
+ }
+}
+
+inline void addLayoutOwnership(QLayout *layout, QLayout *other)
+{
+ //transfer all children widgets from other to layout parent widget
+ QWidget *parent = layout->parentWidget();
+ if (!parent) {
+ //keep the reference while the layout is orphan
+ Shiboken::AutoDecRef pyParent(%CONVERTTOPYTHON[QLayout *](layout));
+ Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QLayout *](other));
+ Shiboken::Object::keepReference(reinterpret_cast<SbkObject *>(pyParent.object()),
+ retrieveObjectName(pyParent).data(), pyChild, true);
+ return;
+ }
+
+ for (int i=0, i_max=other->count(); i < i_max; i++) {
+ QLayoutItem *item = other->itemAt(i);
+ if (PyErr_Occurred() || !item)
+ return;
+ addLayoutOwnership(layout, item);
+ }
+
+ Shiboken::AutoDecRef pyParent(%CONVERTTOPYTHON[QLayout *](layout));
+ Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QLayout *](other));
+ Shiboken::Object::setParent(pyParent, pyChild);
+}
+
+inline void addLayoutOwnership(QLayout *layout, QLayoutItem *item)
+{
+ if (!item)
+ return;
+
+ if (QWidget *w = item->widget()) {
+ addLayoutOwnership(layout, w);
+ } else {
+ if (QLayout *l = item->layout())
+ addLayoutOwnership(layout, l);
+ }
+
+ Shiboken::AutoDecRef pyParent(%CONVERTTOPYTHON[QLayout *](layout));
+ Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QLayoutItem *](item));
+ Shiboken::Object::setParent(pyParent, pyChild);
+}
+
+static void removeWidgetFromLayout(QLayout *layout, QWidget *widget)
+{
+ QWidget *parent = widget->parentWidget();
+
+ if (!parent) {
+ //remove reference on layout
+ Shiboken::AutoDecRef pyParent(%CONVERTTOPYTHON[QWidget *](layout));
+ Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QWidget *](widget));
+ Shiboken::Object::removeReference(reinterpret_cast<SbkObject *>(pyParent.object()),
+ retrieveObjectName(pyParent).data(), pyChild);
+ } else {
+ //give the ownership to parent
+ Shiboken::AutoDecRef pyParent(%CONVERTTOPYTHON[QWidget *](parent));
+ Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QWidget *](widget));
+ Shiboken::Object::setParent(pyParent, pyChild);
+ }
+}
+
+inline void removeLayoutOwnership(QLayout *layout, QLayoutItem *item)
+{
+ if (QWidget *w = item->widget()) {
+ removeWidgetFromLayout(layout, w);
+ } else {
+ QLayout *l = item->layout();
+ if (l && item != l)
+ removeLayoutOwnership(layout, l);
+ }
+
+ Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QLayoutItem *](item));
+ Shiboken::Object::invalidate(pyChild);
+ Shiboken::Object::setParent(0, pyChild);
+}
+
+inline void removeLayoutOwnership(QLayout *layout, QWidget *widget)
+{
+ if (!widget)
+ return;
+
+ for (int i=0, i_max=layout->count(); i < i_max; i++) {
+ QLayoutItem *item = layout->itemAt(i);
+ if (PyErr_Occurred() || !item)
+ return;
+ if (item->widget() == widget)
+ removeLayoutOwnership(layout, item);
+ }
+}
+// @snippet qlayout-help-functions
+
+// @snippet qlayout-setalignment
+%CPPSELF.setAlignment(%1);
+// @snippet qlayout-setalignment
+
+// @snippet addownership-0
+addLayoutOwnership(%CPPSELF, %0);
+// @snippet addownership-0
+
+// @snippet addownership-1
+addLayoutOwnership(%CPPSELF, %1);
+// @snippet addownership-1
+
+// @snippet addownership-2
+addLayoutOwnership(%CPPSELF, %2);
+// @snippet addownership-2
+
+// @snippet removeownership-1
+removeLayoutOwnership(%CPPSELF, %1);
+// @snippet removeownership-1
+
+// @snippet qgridlayout-getitemposition
+int a, b, c, d;
+%CPPSELF.%FUNCTION_NAME(%1, &a, &b, &c, &d);
+%PYARG_0 = PyTuple_New(4);
+PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[int](a));
+PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[int](b));
+PyTuple_SET_ITEM(%PYARG_0, 2, %CONVERTTOPYTHON[int](c));
+PyTuple_SET_ITEM(%PYARG_0, 3, %CONVERTTOPYTHON[int](d));
+// @snippet qgridlayout-getitemposition
+
+// @snippet qgraphicsscene-destroyitemgroup
+QGraphicsItem *parentItem = %1->parentItem();
+Shiboken::AutoDecRef parent(%CONVERTTOPYTHON[QGraphicsItem *](parentItem));
+const auto &childItems = %1->childItems();
+for (auto *item : childItems)
+ Shiboken::Object::setParent(parent, %CONVERTTOPYTHON[QGraphicsItem *](item));
+%CPPSELF.%FUNCTION_NAME(%1);
+// the arg was destroyed by Qt.
+Shiboken::Object::invalidate(%PYARG_1);
+// @snippet qgraphicsscene-destroyitemgroup
+
+// @snippet qgraphicsscene-addwidget
+%RETURN_TYPE %0 = %CPPSELF.%FUNCTION_NAME(%1, %2);
+%PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%0);
+Shiboken::Object::keepReference(reinterpret_cast<SbkObject *>(%PYARG_0), "setWidget(QWidget*)1", %PYARG_1);
+// @snippet qgraphicsscene-addwidget
+
+// @snippet qgraphicsscene-clear
+const QList<QGraphicsItem *> items = %CPPSELF.items();
+Shiboken::BindingManager &bm = Shiboken::BindingManager::instance();
+for (auto *item : items) {
+ SbkObject *obj = bm.retrieveWrapper(item);
+ if (obj) {
+ if (reinterpret_cast<PyObject *>(obj)->ob_refcnt > 1) // If the refcnt is 1 the object will vannish anyway.
+ Shiboken::Object::invalidate(obj);
+ Shiboken::Object::removeParent(obj);
+ }
+}
+%CPPSELF.%FUNCTION_NAME();
+// @snippet qgraphicsscene-clear
+
+// @snippet qtreewidget-clear
+QTreeWidgetItem *rootItem = %CPPSELF.invisibleRootItem();
+Shiboken::BindingManager &bm = Shiboken::BindingManager::instance();
+
+// PYSIDE-1251:
+// Since some objects can be created with a parent and without
+// being saved on a local variable (refcount = 1), they will be
+// deleted when setting the parent to nullptr, so we change the loop
+// to do this from the last child to the first, to avoid the case
+// when the child(1) points to the original child(2) in case the
+// first one was removed.
+for (int i = rootItem->childCount() - 1; i >= 0; --i) {
+ QTreeWidgetItem *item = rootItem->child(i);
+ if (SbkObject *wrapper = bm.retrieveWrapper(item))
+ Shiboken::Object::setParent(nullptr, reinterpret_cast<PyObject *>(wrapper));
+}
+// @snippet qtreewidget-clear
+
+// @snippet qtreewidgetitem
+// Only call the parent function if this return some value
+// the parent can be the TreeWidget
+if (%0)
+ Shiboken::Object::setParent(%PYARG_0, %PYSELF);
+// @snippet qtreewidgetitem
+
+// @snippet qlistwidget-clear
+Shiboken::BindingManager &bm = Shiboken::BindingManager::instance();
+for (int i = 0, count = %CPPSELF.count(); i < count; ++i) {
+ QListWidgetItem *item = %CPPSELF.item(i);
+ if (auto wrapper = bm.retrieveWrapper(item)) {
+ auto pyObj = reinterpret_cast<PyObject *>(wrapper);
+ Py_INCREF(pyObj);
+ Shiboken::Object::setParent(NULL, pyObj);
+ Shiboken::Object::invalidate(pyObj);
+ Py_DECREF(pyObj);
+ }
+}
+%CPPSELF.%FUNCTION_NAME();
+// @snippet qlistwidget-clear
+
+// @snippet qwidget-glue
+static QString retrieveObjectName(PyObject *obj)
+{
+ Shiboken::AutoDecRef objName(PyObject_Str(obj));
+ return QString(Shiboken::String::toCString(objName));
+}
+
+
+// Transfer objects ownership from layout to widget
+static inline void qwidgetReparentLayout(QWidget *parent, QLayout *layout)
+{
+ Shiboken::AutoDecRef pyParent(%CONVERTTOPYTHON[QWidget *](parent));
+
+ for (int i=0, i_count = layout->count(); i < i_count; i++) {
+ QLayoutItem *item = layout->itemAt(i);
+ if (PyErr_Occurred() || !item)
+ return;
+
+ if (QWidget *w = item->widget()) {
+ QWidget *pw = w->parentWidget();
+ if (pw != parent) {
+ Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QWidget *](w));
+ Shiboken::Object::setParent(pyParent, pyChild);
+ }
+ } else {
+ if (QLayout *l = item->layout())
+ qwidgetReparentLayout(parent, l);
+ }
+ }
+
+ Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QLayout *](layout));
+ Shiboken::Object::setParent(pyParent, pyChild);
+ //remove previous references
+ Shiboken::Object::keepReference(reinterpret_cast<SbkObject *>(pyChild.object()),
+ qPrintable(retrieveObjectName(pyChild)), Py_None);
+}
+
+static inline void qwidgetSetLayout(QWidget *self, QLayout *layout)
+{
+ if (!layout || self->layout())
+ return;
+
+ QObject *oldParent = layout->parent();
+ if (oldParent && oldParent != self) {
+ if (oldParent->isWidgetType()) {
+ // remove old parent policy
+ Shiboken::AutoDecRef pyLayout(%CONVERTTOPYTHON[QLayout *](layout));
+ Shiboken::Object::setParent(Py_None, pyLayout);
+ } else {
+ PyErr_Format(PyExc_RuntimeError, "QWidget::setLayout: Attempting to set QLayout \"%s\" on %s \"%s\", when the QLayout already has a parent",
+ qPrintable(layout->objectName()), self->metaObject()->className(), qPrintable(self->objectName()));
+ return;
+ }
+ }
+
+ if (oldParent != self) {
+ qwidgetReparentLayout(self, layout);
+ if (PyErr_Occurred())
+ return;
+
+ self->setLayout(layout);
+ }
+}
+// @snippet qwidget-glue
+
+// @snippet qwidget-setstyle
+Shiboken::Object::keepReference(reinterpret_cast<SbkObject *>(%PYSELF), "__style__", %PYARG_1);
+// @snippet qwidget-setstyle
+
+// @snippet qwidget-style
+QStyle *myStyle = %CPPSELF->style();
+if (myStyle && qApp) {
+%PYARG_0 = %CONVERTTOPYTHON[QStyle *](myStyle);
+ QStyle *appStyle = qApp->style();
+ if (appStyle == myStyle) {
+ Shiboken::AutoDecRef pyApp(%CONVERTTOPYTHON[QApplication *](qApp));
+ Shiboken::Object::setParent(pyApp, %PYARG_0);
+ Shiboken::Object::releaseOwnership(%PYARG_0);
+ } else {
+ Shiboken::Object::keepReference(reinterpret_cast<SbkObject *>(%PYSELF), "__style__", %PYARG_0);
+ }
+}
+// @snippet qwidget-style
+
+// @snippet qapplication-init
+static void QApplicationConstructor(PyObject *self, PyObject *pyargv, QApplicationWrapper **cptr)
+{
+ static int argc;
+ static char **argv;
+ PyObject *stringlist = PyTuple_GET_ITEM(pyargv, 0);
+ if (Shiboken::listToArgcArgv(stringlist, &argc, &argv, "PySideApp")) {
+ *cptr = new QApplicationWrapper(argc, argv, 0);
+ Shiboken::Object::releaseOwnership(reinterpret_cast<SbkObject *>(self));
+ PySide::registerCleanupFunction(&PySide::destroyQCoreApplication);
+ }
+}
+// @snippet qapplication-init
+
+// @snippet qapplication-setStyle
+if (qApp) {
+ Shiboken::AutoDecRef pyApp(%CONVERTTOPYTHON[QApplication *](qApp));
+ Shiboken::Object::setParent(pyApp, %PYARG_1);
+ Shiboken::Object::releaseOwnership(%PYARG_1);
+}
+// @snippet qapplication-setStyle
+
+// @snippet qwidget-setlayout
+qwidgetSetLayout(%CPPSELF, %1);
+// %FUNCTION_NAME() - disable generation of function call.
+// @snippet qwidget-setlayout
+
+// @snippet qtabwidget-removetab
+QWidget *tab = %CPPSELF.widget(%1);
+if (tab) {
+ Shiboken::AutoDecRef pyWidget(%CONVERTTOPYTHON[QWidget *](tab));
+ %CPPSELF.%FUNCTION_NAME(%1);
+}
+// @snippet qtabwidget-removetab
+
+// @snippet qtabwidget-clear
+Shiboken::BindingManager &bm = Shiboken::BindingManager::instance();
+for (int i = 0, count = %CPPSELF.count(); i < count; ++i) {
+ QWidget *widget = %CPPSELF.widget(i);
+ if (bm.hasWrapper(widget)) {
+ Shiboken::AutoDecRef pyWidget(%CONVERTTOPYTHON[QWidget *](widget));
+ Shiboken::Object::releaseOwnership(pyWidget);
+ }
+}
+%CPPSELF.%FUNCTION_NAME();
+// @snippet qtabwidget-clear
+
+// @snippet qlineedit-addaction
+%CPPSELF.addAction(%1);
+// @snippet qlineedit-addaction
+
+// @snippet qtoolbar-addaction-1
+QAction *action = %CPPSELF.addAction(%1, %2);
+%PYARG_0 = %CONVERTTOPYTHON[QAction *](action);
+Shiboken::AutoDecRef result(PyObject_CallMethod(%PYARG_0,
+ const_cast<char *>("connect"),
+ const_cast<char *>("OsO"),
+ %PYARG_0, SIGNAL(triggered()), %PYARG_3)
+);
+// @snippet qtoolbar-addaction-1
+
+// @snippet qtoolbar-addaction-2
+QAction *action = %CPPSELF.addAction(%1);
+%PYARG_0 = %CONVERTTOPYTHON[QAction *](action);
+Shiboken::AutoDecRef result(PyObject_CallMethod(%PYARG_0,
+ const_cast<char *>("connect"),
+ const_cast<char *>("OsO"),
+ %PYARG_0, SIGNAL(triggered()), %PYARG_2)
+);
+// @snippet qtoolbar-addaction-2
+
+// @snippet qtoolbar-addaction-3
+%CPPSELF.addAction(%1);
+// @snippet qtoolbar-addaction-3
+
+// @snippet qtoolbar-clear
+QList<PyObject *> lst;
+Shiboken::BindingManager &bm = Shiboken::BindingManager::instance();
+const auto &toolButtonChildren = %CPPSELF.findChildren<QToolButton *>();
+for (auto *child : toolButtonChildren) {
+ if (bm.hasWrapper(child)) {
+ PyObject *pyChild = %CONVERTTOPYTHON[QToolButton *](child);
+ Shiboken::Object::setParent(0, pyChild);
+ lst << pyChild;
+ }
+}
+
+//Remove actions
+const auto &actions = %CPPSELF.actions();
+for (auto *act : actions) {
+ Shiboken::AutoDecRef pyAct(%CONVERTTOPYTHON[QAction *](act));
+ Shiboken::Object::setParent(NULL, pyAct);
+ Shiboken::Object::invalidate(pyAct);
+}
+
+%CPPSELF.clear();
+for (auto *obj : lst) {
+ Shiboken::Object::invalidate(reinterpret_cast<SbkObject *>(obj));
+ Py_XDECREF(obj);
+}
+// @snippet qtoolbar-clear
+
+// @snippet qapplication-1
+QApplicationConstructor(%PYSELF, args, &%0);
+// @snippet qapplication-1
+
+// @snippet qapplication-2
+PyObject *empty = PyTuple_New(2);
+if (!PyTuple_SetItem(empty, 0, PyList_New(0)))
+ QApplicationConstructor(%PYSELF, empty, &%0);
+// @snippet qapplication-2
+
+// @snippet qgraphicsproxywidget-setwidget
+QWidget *_old = %CPPSELF.widget();
+if (_old)
+ Shiboken::Object::setParent(nullptr, %CONVERTTOPYTHON[QWidget *](_old));
+%CPPSELF.%FUNCTION_NAME(%1);
+Shiboken::Object::setParent(%PYSELF, %PYARG_1);
+// @snippet qgraphicsproxywidget-setwidget
+
+/*********************************************************************
+ * CONVERSIONS
+ ********************************************************************/
+
+/*********************************************************************
+ * NATIVE TO TARGET CONVERSIONS
+ ********************************************************************/
diff --git a/sources/pyside6/PySide6/glue/qtxml.cpp b/sources/pyside6/PySide6/glue/qtxml.cpp
new file mode 100644
index 000000000..684ff33c4
--- /dev/null
+++ b/sources/pyside6/PySide6/glue/qtxml.cpp
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+// @snippet qxmlentityresolver-resolveentity
+QXmlInputSource *_qxmlinputsource_arg_ = nullptr;
+%BEGIN_ALLOW_THREADS
+%RETURN_TYPE %0 = %CPPSELF.%FUNCTION_NAME(%1, %2, _qxmlinputsource_arg_);
+%END_ALLOW_THREADS
+%PYARG_0 = PyTuple_New(2);
+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/pyside6/PySide6/glue/qtxmlpatterns.cpp b/sources/pyside6/PySide6/glue/qtxmlpatterns.cpp
new file mode 100644
index 000000000..75ad3b265
--- /dev/null
+++ b/sources/pyside6/PySide6/glue/qtxmlpatterns.cpp
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+// @snippet qxmlschemavalidator-schema
+QXmlSchema *%0 = new QXmlSchema(%CPPSELF.schema());
+%PYARG_0 = %CONVERTTOPYTHON[QXmlSchema *](%0);
+// @snippet qxmlschemavalidator-schema