aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside2/PySide2/QtCore/glue
diff options
context:
space:
mode:
Diffstat (limited to 'sources/pyside2/PySide2/QtCore/glue')
-rw-r--r--sources/pyside2/PySide2/QtCore/glue/qbytearray_bufferprotocol.cpp73
-rw-r--r--sources/pyside2/PySide2/QtCore/glue/qbytearray_mgetitem.cpp87
-rw-r--r--sources/pyside2/PySide2/QtCore/glue/qbytearray_msetitem.cpp158
-rw-r--r--sources/pyside2/PySide2/QtCore/glue/qcoreapplication_init.cpp50
-rw-r--r--sources/pyside2/PySide2/QtCore/glue/qobject_connect.cpp227
-rw-r--r--sources/pyside2/PySide2/QtCore/glue/qobject_findchild.cpp78
6 files changed, 0 insertions, 673 deletions
diff --git a/sources/pyside2/PySide2/QtCore/glue/qbytearray_bufferprotocol.cpp b/sources/pyside2/PySide2/QtCore/glue/qbytearray_bufferprotocol.cpp
deleted file mode 100644
index ed5fef3ae..000000000
--- a/sources/pyside2/PySide2/QtCore/glue/qbytearray_bufferprotocol.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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$
-**
-****************************************************************************/
-
-#if PY_VERSION_HEX < 0x03000000
-
-// QByteArray buffer protocol functions
-// see: http://www.python.org/dev/peps/pep-3118/
-
-extern "C" {
-
-static Py_ssize_t SbkQByteArray_segcountproc(PyObject* self, Py_ssize_t* lenp)
-{
- if (lenp)
- *lenp = Py_TYPE(self)->tp_as_sequence->sq_length(self);
- return 1;
-}
-
-static Py_ssize_t SbkQByteArray_readbufferproc(PyObject* self, Py_ssize_t segment, void** ptrptr)
-{
- if (segment || !Shiboken::Object::isValid(self))
- return -1;
-
- QByteArray* cppSelf = %CONVERTTOCPP[QByteArray*](self);
- *ptrptr = reinterpret_cast<void*>(cppSelf->data());
- return cppSelf->size();
-}
-
-PyBufferProcs SbkQByteArrayBufferProc = {
- /*bf_getreadbuffer*/ &SbkQByteArray_readbufferproc,
- /*bf_getwritebuffer*/ (writebufferproc) &SbkQByteArray_readbufferproc,
- /*bf_getsegcount*/ &SbkQByteArray_segcountproc,
- /*bf_getcharbuffer*/ (charbufferproc) &SbkQByteArray_readbufferproc
-};
-
-}
-
-#endif
diff --git a/sources/pyside2/PySide2/QtCore/glue/qbytearray_mgetitem.cpp b/sources/pyside2/PySide2/QtCore/glue/qbytearray_mgetitem.cpp
deleted file mode 100644
index 9612f41b0..000000000
--- a/sources/pyside2/PySide2/QtCore/glue/qbytearray_mgetitem.cpp
+++ /dev/null
@@ -1,87 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-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;
-
-#ifdef IS_PY3K
- PyObject *key = _key;
-#else
- PySliceObject *key = reinterpret_cast<PySliceObject *>(_key);
-#endif
- if (PySlice_GetIndicesEx(key, %CPPSELF.count(), &start, &stop, &step, &slicelength) < 0) {
- return NULL;
- }
-
- 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 NULL;
-}
diff --git a/sources/pyside2/PySide2/QtCore/glue/qbytearray_msetitem.cpp b/sources/pyside2/PySide2/QtCore/glue/qbytearray_msetitem.cpp
deleted file mode 100644
index 1349f40f1..000000000
--- a/sources/pyside2/PySide2/QtCore/glue/qbytearray_msetitem.cpp
+++ /dev/null
@@ -1,158 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-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
-#ifdef IS_PY3K
- if (PyBytes_Check(_value)) {
- if (Py_SIZE(_value) != 1) {
- PyErr_SetString(PyExc_ValueError, "bytes must be of size 1");
-#else
- if (PyString_CheckExact(_value)) {
- if (Py_SIZE(_value) != 1) {
- PyErr_SetString(PyExc_ValueError, "str must be of size 1");
-#endif
- 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 *>(SbkPySide2_QtCoreTypes[SBK_QBYTEARRAY_IDX])) {
- if (PyObject_Length(_value) != 1) {
- PyErr_SetString(PyExc_ValueError, "QByteArray must be of size 1");
- return -1;
- }
- } else {
-#ifdef IS_PY3K
- PyErr_SetString(PyExc_ValueError, "a bytes, bytearray, QByteArray of size 1 is required");
-#else
- PyErr_SetString(PyExc_ValueError, "a str, bytearray, QByteArray of size 1 is required");
-#endif
- 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;
-
-#ifdef IS_PY3K
- PyObject *key = _key;
-#else
- PySliceObject *key = reinterpret_cast<PySliceObject *>(_key);
-#endif
- 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 NULL, 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 == NULL || _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 *>(SbkPySide2_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, value_length, 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;
-#ifdef IS_PY3K
- if (PyLong_Check(item)) {
-#else
- if (PyLong_Check(item) || PyInt_Check(item)) {
-#endif
- int overflow;
- long ival = PyLong_AsLongAndOverflow(item, &overflow);
- // Not suppose to bigger than 255 because only bytes, bytearray, QByteArray were accept
- const char *el = reinterpret_cast<const char*>(&ival);
- temp = QByteArray(el);
- } 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;
-}
-
-
diff --git a/sources/pyside2/PySide2/QtCore/glue/qcoreapplication_init.cpp b/sources/pyside2/PySide2/QtCore/glue/qcoreapplication_init.cpp
deleted file mode 100644
index 9bdaa011e..000000000
--- a/sources/pyside2/PySide2/QtCore/glue/qcoreapplication_init.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 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$
-**
-****************************************************************************/
-
-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);
- }
-}
diff --git a/sources/pyside2/PySide2/QtCore/glue/qobject_connect.cpp b/sources/pyside2/PySide2/QtCore/glue/qobject_connect.cpp
deleted file mode 100644
index 20f3720bf..000000000
--- a/sources/pyside2/PySide2/QtCore/glue/qobject_connect.cpp
+++ /dev/null
@@ -1,227 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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$
-**
-****************************************************************************/
-
-static bool isDecorator(PyObject* method, PyObject* self)
-{
- Shiboken::AutoDecRef methodName(PyObject_GetAttrString(method, "__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 = 0;
- *self = 0;
- }
-
- 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;
- }
-
- if (usingGlobalReceiver) {
- PySide::SignalManager& signalManager = PySide::SignalManager::instance();
- *receiver = signalManager.globalReceiver(source, callback);
- *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;
- Py_BEGIN_ALLOW_THREADS
- connection = QObject::connect(source, signal - 1, receiver, slot - 1, type);
- Py_END_ALLOW_THREADS
- 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 = 0;
- PyObject* self = 0;
- QByteArray callbackSig;
- bool usingGlobalReceiver = getReceiver(source, signal, callback, &receiver, &self, &callbackSig);
- if (receiver == 0 && self == 0)
- 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((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;
- Py_BEGIN_ALLOW_THREADS
- connection = QMetaObject::connect(source, signalIndex, receiver, slotIndex, type);
- Py_END_ALLOW_THREADS
- 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 = 0;
- PyObject* self = 0;
- QByteArray callbackSig;
- QMetaMethod slotMethod;
- bool usingGlobalReceiver = getReceiver(NULL, signal, callback, &receiver, &self, &callbackSig);
- if (receiver == 0 && self == 0)
- 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;
- Py_BEGIN_ALLOW_THREADS
- disconnected = QMetaObject::disconnectOne(source, signalIndex, receiver, slotIndex);
- Py_END_ALLOW_THREADS
-
- 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;
-}
diff --git a/sources/pyside2/PySide2/QtCore/glue/qobject_findchild.cpp b/sources/pyside2/PySide2/QtCore/glue/qobject_findchild.cpp
deleted file mode 100644
index b32d104fd..000000000
--- a/sources/pyside2/PySide2/QtCore/glue/qobject_findchild.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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$
-**
-****************************************************************************/
-
-static QObject* _findChildHelper(const QObject* parent, const QString& name, PyTypeObject* desiredType)
-{
- foreach(QObject* child, parent->children()) {
- Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QObject*](child));
- if (PyType_IsSubtype(Py_TYPE(pyChild), desiredType)
- && (name.isNull() || name == child->objectName())) {
- return child;
- }
- }
-
- QObject* obj;
- foreach(QObject* child, parent->children()) {
- obj = _findChildHelper(child, name, desiredType);
- if (obj)
- return obj;
- }
- return 0;
-}
-
-static inline bool _findChildrenComparator(const QObject*& child, const QRegExp& name)
-{
- return name.indexIn(child->objectName()) != -1;
-}
-
-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)
-{
- foreach(const QObject* 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);
- }
-}