From 08f3c48dbd299be6e42cc3c378b7732c2d80beed Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 11 May 2020 15:24:16 +0200 Subject: libpyside: Remove deprecated API Remove deprecated functions and class DestroyListener, which had hard-coded Qt 5 specific meta object data. Task-number: PYSIDE-904 Change-Id: Idce86cd5df12dc918335f043c8d7a5f0a95db990 Reviewed-by: Cristian Maureira-Fredes --- sources/pyside2/libpyside/CMakeLists.txt | 5 - sources/pyside2/libpyside/destroylistener.cpp | 103 --------------------- sources/pyside2/libpyside/destroylistener.h | 72 -------------- sources/pyside2/libpyside/pyside.cpp | 8 -- sources/pyside2/libpyside/pyside.h | 1 - sources/pyside2/libpyside/pysideproperty.cpp | 5 - sources/pyside2/libpyside/pysideproperty.h | 3 - sources/pyside2/libpyside/pysidesignal.cpp | 31 ------- sources/pyside2/libpyside/pysidesignal.h | 15 --- .../shiboken2/generator/shiboken2/cppgenerator.cpp | 1 - 10 files changed, 244 deletions(-) delete mode 100644 sources/pyside2/libpyside/destroylistener.cpp delete mode 100644 sources/pyside2/libpyside/destroylistener.h diff --git a/sources/pyside2/libpyside/CMakeLists.txt b/sources/pyside2/libpyside/CMakeLists.txt index 7493a453a..f83b7eeff 100644 --- a/sources/pyside2/libpyside/CMakeLists.txt +++ b/sources/pyside2/libpyside/CMakeLists.txt @@ -38,11 +38,8 @@ else() set(QML_LIBRARIES "") endif() -qt5_wrap_cpp(DESTROYLISTENER_MOC "destroylistener.h") - set(libpyside_SRC dynamicqmetaobject.cpp - destroylistener.cpp signalmanager.cpp globalreceiverv2.cpp pysideclassinfo.cpp @@ -54,7 +51,6 @@ set(libpyside_SRC pysideweakref.cpp pyside.cpp pysidestaticstrings.cpp - ${DESTROYLISTENER_MOC} ) # Add python files to project explorer in Qt Creator, when opening the CMakeLists.txt as a project, @@ -125,7 +121,6 @@ endif() # set(libpyside_HEADERS - destroylistener.h dynamicqmetaobject.h pysideclassinfo.h pysidemacros.h diff --git a/sources/pyside2/libpyside/destroylistener.cpp b/sources/pyside2/libpyside/destroylistener.cpp deleted file mode 100644 index 319a126cf..000000000 --- a/sources/pyside2/libpyside/destroylistener.cpp +++ /dev/null @@ -1,103 +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$ -** -****************************************************************************/ - -#include -#include "destroylistener.h" - -#include - -PySide::DestroyListener *PySide::DestroyListener::m_instance = nullptr; - -namespace PySide -{ - -struct DestroyListenerPrivate -{ - static bool m_destroyed; -}; - - -DestroyListener *DestroyListener::instance() -{ - if (!m_instance) - m_instance = new DestroyListener(0); - return m_instance; -} - -void DestroyListener::destroy() -{ - if (m_instance) { - m_instance->disconnect(); - delete m_instance; - m_instance = 0; - } -} - -void DestroyListener::listen(QObject *obj) -{ - SbkObject *wrapper = Shiboken::BindingManager::instance().retrieveWrapper(obj); - if (!wrapper) // avoid problem with multiple inheritance - return; - - if (Py_IsInitialized() == 0) - onObjectDestroyed(obj); - else - QObject::connect(obj, SIGNAL(destroyed(QObject *)), this, SLOT(onObjectDestroyed(QObject *)), Qt::DirectConnection); -} - -void DestroyListener::onObjectDestroyed(QObject *obj) -{ - SbkObject *wrapper = Shiboken::BindingManager::instance().retrieveWrapper(obj); - if (wrapper) //make sure the object exists before destroy - Shiboken::Object::destroy(wrapper, obj); -} - -DestroyListener::DestroyListener(QObject *parent) - : QObject(parent) -{ - m_d = new DestroyListenerPrivate(); -} - -DestroyListener::~DestroyListener() -{ - delete m_d; -} - -}//namespace - diff --git a/sources/pyside2/libpyside/destroylistener.h b/sources/pyside2/libpyside/destroylistener.h deleted file mode 100644 index dedcca662..000000000 --- a/sources/pyside2/libpyside/destroylistener.h +++ /dev/null @@ -1,72 +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$ -** -****************************************************************************/ - -#ifndef PYSIDE_DESTROY_LISTENER -#define PYSIDE_DESTROY_LISTENER - -#include "pysidemacros.h" - -#include - -namespace PySide -{ -struct DestroyListenerPrivate; -/// \deprecated This class is deprecated and isn't used by libpyside anymore. -class PYSIDE_API DestroyListener : public QObject -{ - Q_OBJECT - public: - PYSIDE_DEPRECATED(static DestroyListener *instance()); - static void destroy(); - void listen(QObject *obj); - - public Q_SLOTS: - void onObjectDestroyed(QObject *obj); - - private: - static DestroyListener *m_instance; - DestroyListenerPrivate *m_d; - DestroyListener(QObject *parent); - ~DestroyListener() override; -}; - -}//namespace - -#endif - diff --git a/sources/pyside2/libpyside/pyside.cpp b/sources/pyside2/libpyside/pyside.cpp index d22958398..aa0833d67 100644 --- a/sources/pyside2/libpyside/pyside.cpp +++ b/sources/pyside2/libpyside/pyside.cpp @@ -50,7 +50,6 @@ #include "pysidemetafunction_p.h" #include "pysidemetafunction.h" #include "dynamicqmetaobject.h" -#include "destroylistener.h" #include #include @@ -166,12 +165,10 @@ void registerCleanupFunction(CleanupFunction func) void runCleanupFunctions() { - //PySide::DestroyListener::instance()->destroy(); while (!cleanupFunctionList.isEmpty()) { CleanupFunction f = cleanupFunctionList.pop(); f(); } - PySide::DestroyListener::destroy(); } static void destructionVisitor(SbkObject *pyObj, void *data) @@ -271,11 +268,6 @@ const QMetaObject *retrieveMetaObject(PyObject *pyObj) return retrieveMetaObject(pyTypeObj); } -void initDynamicMetaObject(SbkObjectType *type, const QMetaObject *base) -{ - initDynamicMetaObject(type, base, 0); -} - void initQObjectSubType(SbkObjectType *type, PyObject *args, PyObject * /* kwds */) { PyTypeObject *qObjType = Shiboken::Conversions::getPythonTypeObject("QObject*"); diff --git a/sources/pyside2/libpyside/pyside.h b/sources/pyside2/libpyside/pyside.h index ae400e1fe..95abaeeb1 100644 --- a/sources/pyside2/libpyside/pyside.h +++ b/sources/pyside2/libpyside/pyside.h @@ -99,7 +99,6 @@ template struct initQtMetaType { }; -PYSIDE_DEPRECATED(PYSIDE_API void initDynamicMetaObject(SbkObjectType *type, const QMetaObject *base)); PYSIDE_API void initDynamicMetaObject(SbkObjectType *type, const QMetaObject *base, std::size_t cppObjSize); PYSIDE_API void initQObjectSubType(SbkObjectType *type, PyObject *args, PyObject *kwds); diff --git a/sources/pyside2/libpyside/pysideproperty.cpp b/sources/pyside2/libpyside/pysideproperty.cpp index bdabf1202..9e1b54ff7 100644 --- a/sources/pyside2/libpyside/pysideproperty.cpp +++ b/sources/pyside2/libpyside/pysideproperty.cpp @@ -378,11 +378,6 @@ bool checkType(PyObject *pyObj) return false; } -bool isPropertyType(PyObject *pyObj) -{ - return checkType(pyObj); -} - int setValue(PySideProperty *self, PyObject *source, PyObject *value) { PyObject *fset = self->d->fset; diff --git a/sources/pyside2/libpyside/pysideproperty.h b/sources/pyside2/libpyside/pysideproperty.h index 0ea5e84d6..a97b2a48f 100644 --- a/sources/pyside2/libpyside/pysideproperty.h +++ b/sources/pyside2/libpyside/pysideproperty.h @@ -64,9 +64,6 @@ typedef void (*MetaCallHandler)(PySideProperty*,PyObject*,QMetaObject::Call, voi PYSIDE_API bool checkType(PyObject* pyObj); -/// @deprecated Use checkType -PYSIDE_DEPRECATED(PYSIDE_API bool isPropertyType(PyObject* pyObj)); - /** * This function call set property function and pass value as arg * This function does not check the property object type diff --git a/sources/pyside2/libpyside/pysidesignal.cpp b/sources/pyside2/libpyside/pysidesignal.cpp index be4c367f7..f50ad8ac6 100644 --- a/sources/pyside2/libpyside/pysidesignal.cpp +++ b/sources/pyside2/libpyside/pysidesignal.cpp @@ -805,32 +805,6 @@ PySideSignalInstance *newObjectFromMethod(PyObject *source, const QListdata = new PySideSignalData; - self->data->signalName = name; - self->homonymousMethod = 0; - - va_start(listSignatures, name); - sig = va_arg(listSignatures, char *); - - while (sig != NULL) { - if (strcmp(sig, "void") == 0) - appendSignature(self, SignalSignature("")); - else - appendSignature(self, SignalSignature(sig)); - - sig = va_arg(listSignatures, char *); - } - - va_end(listSignatures); - - return self; -} - template static typename T::value_type join(T t, const char *sep) { @@ -914,11 +888,6 @@ PyObject *buildQtCompatible(const QByteArray &signature) return Shiboken::String::fromStringAndSize(ba, ba.size()); } -void addSignalToWrapper(SbkObjectType *wrapperType, const char *signalName, PySideSignal *signal) -{ - _addSignalToWrapper(wrapperType, signalName, signal); -} - PyObject *getObject(PySideSignalInstance *signal) { return signal->d->source; diff --git a/sources/pyside2/libpyside/pysidesignal.h b/sources/pyside2/libpyside/pysidesignal.h index a2d58a27c..a6742227f 100644 --- a/sources/pyside2/libpyside/pysidesignal.h +++ b/sources/pyside2/libpyside/pysidesignal.h @@ -74,16 +74,6 @@ namespace Signal { PYSIDE_API bool checkType(PyObject* type); -/** - * This function creates a Signal object which stays attached to QObject class - * - * @param name of the Signal to be registered on meta object - * @param signatures a list of signatures supported by this signal, ended with a NULL pointer - * @return Return a new reference to PyObject* of type PySideSignal - * @deprecated Use registerSignals - **/ -PYSIDE_DEPRECATED(PYSIDE_API PySideSignal* newObject(const char* name, ...)); - /** * Register all C++ signals of a QObject on Python type. */ @@ -132,11 +122,6 @@ PYSIDE_API const char* getSignature(PySideSignalInstance* signal); **/ PYSIDE_API void updateSourceObject(PyObject* source); -/** - * @deprecated Use registerSignals - **/ -PYSIDE_DEPRECATED(PYSIDE_API void addSignalToWrapper(SbkObjectType* wrapperType, const char* signalName, PySideSignal* signal)); - /** * This function verifies if the signature is a QtSignal base on SIGNAL flag * @param signature The signal signature diff --git a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp index 166a31dfd..43cdff41e 100644 --- a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp +++ b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp @@ -312,7 +312,6 @@ void CppGenerator::generateClass(QTextStream &s, GeneratorContext &classContext) s << "#include \n" << "#include \n" << "#include \n" - << "#include \n" << "#include \n\n" << "QT_WARNING_DISABLE_DEPRECATED\n\n"; } -- cgit v1.2.3