diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-06-24 18:46:26 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-06-24 18:46:26 +0200 |
commit | 0225a252f756359d1fca5474998a2a11cdbda46d (patch) | |
tree | 1475ce065f1d71d9cd334e608062876f81af6a95 /sources/pyside2/PySide2 | |
parent | 2bc0decca59d867dbf893e34cf9f2ff9745ab603 (diff) | |
parent | 6a22e8cb35cfccbacd65b56e193bf2ae83f205ea (diff) |
Merge remote-tracking branch 'origin/5.12' into 5.13
Change-Id: Ia09beccd944e1276caa6aecbeb248e69917b7115
Diffstat (limited to 'sources/pyside2/PySide2')
19 files changed, 314 insertions, 309 deletions
diff --git a/sources/pyside2/PySide2/QtCore/glue/qeasingcurve_glue.cpp b/sources/pyside2/PySide2/QtCore/glue/qeasingcurve_glue.cpp index 46a69be31..6629d3c91 100644 --- a/sources/pyside2/PySide2/QtCore/glue/qeasingcurve_glue.cpp +++ b/sources/pyside2/PySide2/QtCore/glue/qeasingcurve_glue.cpp @@ -47,13 +47,13 @@ #define __ECF_ATT_NAME__ "__ecf__" #define MAX_CUSTOM_FUNCTIONS 10 -static void deleteData(void* data); +static void deleteData(void *data); struct CustomFunctionsData { static CustomFunctionsData m_list[MAX_CUSTOM_FUNCTIONS]; - PySideEasingCurveFunctor* m_obj; + PySideEasingCurveFunctor *m_obj; QEasingCurve::EasingFunction m_func; }; @@ -95,9 +95,9 @@ struct CustomFunctions<0> } }; -void deleteData(void* data) +void deleteData(void *data) { - delete (PySideEasingCurveFunctor*)(data); + delete (PySideEasingCurveFunctor *)(data); } void PySideEasingCurveFunctor::init() @@ -105,10 +105,10 @@ void PySideEasingCurveFunctor::init() CustomFunctions<MAX_CUSTOM_FUNCTIONS-1>::init(); } -QEasingCurve::EasingFunction PySideEasingCurveFunctor::createCustomFuntion(PyObject* parent, PyObject* pyFunc) +QEasingCurve::EasingFunction PySideEasingCurveFunctor::createCustomFuntion(PyObject *parent, PyObject *pyFunc) { for(int i=0; i < MAX_CUSTOM_FUNCTIONS; i++) { - CustomFunctionsData& data = CustomFunctionsData::m_list[i]; + CustomFunctionsData &data = CustomFunctionsData::m_list[i]; if (data.m_obj == 0) { data.m_obj = new PySideEasingCurveFunctor(i, parent, pyFunc); return data.m_func; @@ -128,8 +128,8 @@ PySideEasingCurveFunctor::~PySideEasingCurveFunctor() qreal PySideEasingCurveFunctor::operator()(qreal progress) { Shiboken::GilState state; - PyObject* args = Py_BuildValue("(f)", progress); - PyObject* result = PyObject_CallObject(m_func, args); + PyObject *args = Py_BuildValue("(f)", progress); + PyObject *result = PyObject_CallObject(m_func, args); qreal cppResult = 0.0; if (result) { Shiboken::Conversions::pythonToCppCopy(Shiboken::Conversions::PrimitiveTypeConverter<qreal>(), result, &cppResult); @@ -139,18 +139,18 @@ qreal PySideEasingCurveFunctor::operator()(qreal progress) return cppResult; } -PyObject* PySideEasingCurveFunctor::callable() +PyObject *PySideEasingCurveFunctor::callable() { Py_INCREF(m_func); return m_func; } -PyObject* PySideEasingCurveFunctor::callable(PyObject* parent) +PyObject *PySideEasingCurveFunctor::callable(PyObject *parent) { return PyObject_GetAttrString(parent, __ECF_ATT_NAME__); } -PySideEasingCurveFunctor::PySideEasingCurveFunctor(int index, PyObject* parent, PyObject* pyFunc) +PySideEasingCurveFunctor::PySideEasingCurveFunctor(int index, PyObject *parent, PyObject *pyFunc) : m_parent(parent), m_func(pyFunc), m_index(index) { PyObject_SetAttrString(m_parent, __ECF_ATT_NAME__, m_func); diff --git a/sources/pyside2/PySide2/QtCore/glue/qeasingcurve_glue.h b/sources/pyside2/PySide2/QtCore/glue/qeasingcurve_glue.h index 358ea9eec..f6c80fa99 100644 --- a/sources/pyside2/PySide2/QtCore/glue/qeasingcurve_glue.h +++ b/sources/pyside2/PySide2/QtCore/glue/qeasingcurve_glue.h @@ -38,7 +38,7 @@ ****************************************************************************/ #ifndef __QEASINGCURVE_GLUE__ -#define __QEASINGCURVE_GLUE__ +#define __QEASINGCURVE_GLUE__ #include <sbkpython.h> #include <QEasingCurve> @@ -47,20 +47,20 @@ class PySideEasingCurveFunctor { public: static void init(); - static QEasingCurve::EasingFunction createCustomFuntion(PyObject* parent, PyObject* pyFunc); + static QEasingCurve::EasingFunction createCustomFuntion(PyObject *parent, PyObject *pyFunc); qreal operator()(qreal progress); - PyObject* callable(); //Return New reference - static PyObject* callable(PyObject* parent); //Return New reference + PyObject *callable(); //Return New reference + static PyObject *callable(PyObject *parent); //Return New reference ~PySideEasingCurveFunctor(); private: - PyObject* m_parent; - PyObject* m_func; + PyObject *m_parent; + PyObject *m_func; int m_index; - PySideEasingCurveFunctor(int index, PyObject* parent, PyObject *pyFunc); + PySideEasingCurveFunctor(int index, PyObject *parent, PyObject *pyFunc); }; #endif diff --git a/sources/pyside2/PySide2/QtQml/pysideqmlregistertype.cpp b/sources/pyside2/PySide2/QtQml/pysideqmlregistertype.cpp index 9d9ddc799..2386620ca 100644 --- a/sources/pyside2/PySide2/QtQml/pysideqmlregistertype.cpp +++ b/sources/pyside2/PySide2/QtQml/pysideqmlregistertype.cpp @@ -54,19 +54,19 @@ #ifndef PYSIDE_MAX_QML_TYPES // Maximum number of different Qt QML types the user can export to QML using // qmlRegisterType. This limit exists because the QML engine instantiates objects -// by calling a function with one argument (a void* pointer where the object should +// by calling a function with one argument (a void *pointer where the object should // be created), and thus does not allow us to choose which object to create. Thus // we create a C++ factory function for each new registered type at compile time. #define PYSIDE_MAX_QML_TYPES 50 #endif // Forward declarations. -static void propListMetaCall(PySideProperty* pp, PyObject* self, QMetaObject::Call call, +static void propListMetaCall(PySideProperty *pp, PyObject *self, QMetaObject::Call call, void **args); // All registered python types and their creation functions. -static PyObject* pyTypes[PYSIDE_MAX_QML_TYPES]; -static void (*createFuncs[PYSIDE_MAX_QML_TYPES])(void*); +static PyObject *pyTypes[PYSIDE_MAX_QML_TYPES]; +static void (*createFuncs[PYSIDE_MAX_QML_TYPES])(void *); // Mutex used to avoid race condition on PySide::nextQObjectMemoryAddr. static QMutex nextQmlElementMutex; @@ -74,12 +74,12 @@ static QMutex nextQmlElementMutex; template<int N> struct ElementFactoryBase { - static void createInto(void* memory) + static void createInto(void *memory) { QMutexLocker locker(&nextQmlElementMutex); PySide::setNextQObjectMemoryAddr(memory); Shiboken::GilState state; - PyObject* obj = PyObject_CallObject(pyTypes[N], 0); + PyObject *obj = PyObject_CallObject(pyTypes[N], 0); if (!obj || PyErr_Occurred()) PyErr_Print(); PySide::setNextQObjectMemoryAddr(0); @@ -152,7 +152,7 @@ int PySide::qmlRegisterType(PyObject *pyObj, const char *uri, int versionMajor, pyTypes[nextType] = pyObj; // FIXME: Fix this to assign new type ids each time. - type.typeId = qMetaTypeId<QObject*>(); + type.typeId = qMetaTypeId<QObject *>(); type.listId = qMetaTypeId<QQmlListProperty<QObject> >(); type.attachedPropertiesFunction = QQmlPrivate::attachedPropertiesFunc<QObject>(); type.attachedPropertiesMetaObject = QQmlPrivate::attachedPropertiesMetaObject<QObject>(); @@ -194,22 +194,22 @@ extern "C" // This is the user data we store in the property. struct QmlListProperty { - PyTypeObject* type; - PyObject* append; - PyObject* at; - PyObject* clear; - PyObject* count; + PyTypeObject *type; + PyObject *append; + PyObject *at; + PyObject *clear; + PyObject *count; }; -static int propListTpInit(PyObject* self, PyObject* args, PyObject* kwds) +static int propListTpInit(PyObject *self, PyObject *args, PyObject *kwds) { static const char *kwlist[] = {"type", "append", "at", "clear", "count", 0}; - PySideProperty* pySelf = reinterpret_cast<PySideProperty*>(self); - QmlListProperty* data = new QmlListProperty; + PySideProperty *pySelf = reinterpret_cast<PySideProperty *>(self); + QmlListProperty *data = new QmlListProperty; memset(data, 0, sizeof(QmlListProperty)); if (!PyArg_ParseTupleAndKeywords(args, kwds, - "OO|OOO:QtQml.ListProperty", (char**) kwlist, + "OO|OOO:QtQml.ListProperty", (char **) kwlist, &data->type, &data->append, &data->at, @@ -224,10 +224,10 @@ static int propListTpInit(PyObject* self, PyObject* args, PyObject* kwds) return 1; } -void propListTpFree(void* self) +void propListTpFree(void *self) { - PySideProperty* pySelf = reinterpret_cast<PySideProperty*>(self); - delete reinterpret_cast<QmlListProperty*>(PySide::Property::userData(pySelf)); + auto pySelf = reinterpret_cast<PySideProperty *>(self); + delete reinterpret_cast<QmlListProperty *>(PySide::Property::userData(pySelf)); // calls base type constructor Py_TYPE(pySelf)->tp_base->tp_free(self); } @@ -266,10 +266,10 @@ void propListAppender(QQmlListProperty<QObject> *propList, QObject *item) Shiboken::GilState state; Shiboken::AutoDecRef args(PyTuple_New(2)); - PyTuple_SET_ITEM(args, 0, Shiboken::Conversions::pointerToPython((SbkObjectType*)SbkPySide2_QtCoreTypes[SBK_QOBJECT_IDX], propList->object)); - PyTuple_SET_ITEM(args, 1, Shiboken::Conversions::pointerToPython((SbkObjectType*)SbkPySide2_QtCoreTypes[SBK_QOBJECT_IDX], item)); + PyTuple_SET_ITEM(args, 0, Shiboken::Conversions::pointerToPython((SbkObjectType *)SbkPySide2_QtCoreTypes[SBK_QOBJECT_IDX], propList->object)); + PyTuple_SET_ITEM(args, 1, Shiboken::Conversions::pointerToPython((SbkObjectType *)SbkPySide2_QtCoreTypes[SBK_QOBJECT_IDX], item)); - QmlListProperty* data = reinterpret_cast<QmlListProperty*>(propList->data); + auto data = reinterpret_cast<QmlListProperty *>(propList->data); Shiboken::AutoDecRef retVal(PyObject_CallObject(data->append, args)); if (PyErr_Occurred()) @@ -282,9 +282,9 @@ int propListCount(QQmlListProperty<QObject> *propList) Shiboken::GilState state; Shiboken::AutoDecRef args(PyTuple_New(1)); - PyTuple_SET_ITEM(args, 0, Shiboken::Conversions::pointerToPython((SbkObjectType*)SbkPySide2_QtCoreTypes[SBK_QOBJECT_IDX], propList->object)); + PyTuple_SET_ITEM(args, 0, Shiboken::Conversions::pointerToPython((SbkObjectType *)SbkPySide2_QtCoreTypes[SBK_QOBJECT_IDX], propList->object)); - QmlListProperty* data = reinterpret_cast<QmlListProperty*>(propList->data); + auto data = reinterpret_cast<QmlListProperty *>(propList->data); Shiboken::AutoDecRef retVal(PyObject_CallObject(data->count, args)); // Check return type @@ -303,17 +303,17 @@ QObject *propListAt(QQmlListProperty<QObject> *propList, int index) Shiboken::GilState state; Shiboken::AutoDecRef args(PyTuple_New(2)); - PyTuple_SET_ITEM(args, 0, Shiboken::Conversions::pointerToPython((SbkObjectType*)SbkPySide2_QtCoreTypes[SBK_QOBJECT_IDX], propList->object)); + PyTuple_SET_ITEM(args, 0, Shiboken::Conversions::pointerToPython((SbkObjectType *)SbkPySide2_QtCoreTypes[SBK_QOBJECT_IDX], propList->object)); PyTuple_SET_ITEM(args, 1, Shiboken::Conversions::copyToPython(Shiboken::Conversions::PrimitiveTypeConverter<int>(), &index)); - QmlListProperty* data = reinterpret_cast<QmlListProperty*>(propList->data); + auto data = reinterpret_cast<QmlListProperty *>(propList->data); Shiboken::AutoDecRef retVal(PyObject_CallObject(data->at, args)); QObject *result = 0; if (PyErr_Occurred()) PyErr_Print(); else if (PyType_IsSubtype(Py_TYPE(retVal), data->type)) - Shiboken::Conversions::pythonToCppPointer((SbkObjectType*)SbkPySide2_QtCoreTypes[SBK_QOBJECT_IDX], retVal, &result); + Shiboken::Conversions::pythonToCppPointer((SbkObjectType *)SbkPySide2_QtCoreTypes[SBK_QOBJECT_IDX], retVal, &result); return result; } @@ -323,9 +323,9 @@ void propListClear(QQmlListProperty<QObject> * propList) Shiboken::GilState state; Shiboken::AutoDecRef args(PyTuple_New(1)); - PyTuple_SET_ITEM(args, 0, Shiboken::Conversions::pointerToPython((SbkObjectType*)SbkPySide2_QtCoreTypes[SBK_QOBJECT_IDX], propList->object)); + PyTuple_SET_ITEM(args, 0, Shiboken::Conversions::pointerToPython((SbkObjectType *)SbkPySide2_QtCoreTypes[SBK_QOBJECT_IDX], propList->object)); - QmlListProperty* data = reinterpret_cast<QmlListProperty*>(propList->data); + auto data = reinterpret_cast<QmlListProperty *>(propList->data); Shiboken::AutoDecRef retVal(PyObject_CallObject(data->clear, args)); if (PyErr_Occurred()) @@ -333,18 +333,18 @@ void propListClear(QQmlListProperty<QObject> * propList) } // qt_metacall specialization for ListProperties -static void propListMetaCall(PySideProperty* pp, PyObject* self, QMetaObject::Call call, void** args) +static void propListMetaCall(PySideProperty *pp, PyObject *self, QMetaObject::Call call, void **args) { if (call != QMetaObject::ReadProperty) return; - QmlListProperty* data = reinterpret_cast<QmlListProperty*>(PySide::Property::userData(pp)); - QObject* qobj; - Shiboken::Conversions::pythonToCppPointer((SbkObjectType*)SbkPySide2_QtCoreTypes[SBK_QOBJECT_IDX], self, &qobj); + auto data = reinterpret_cast<QmlListProperty *>(PySide::Property::userData(pp)); + QObject *qobj; + Shiboken::Conversions::pythonToCppPointer((SbkObjectType *)SbkPySide2_QtCoreTypes[SBK_QOBJECT_IDX], self, &qobj); QQmlListProperty<QObject> declProp(qobj, data, &propListAppender, &propListCount, &propListAt, &propListClear); // Copy the data to the memory location requested by the meta call - void* v = args[0]; + void *v = args[0]; *reinterpret_cast<QQmlListProperty<QObject> *>(v) = declProp; } @@ -469,7 +469,7 @@ PyTypeObject *QtQml_VolatileBoolTypeF(void) return type; } -void PySide::initQmlSupport(PyObject* module) +void PySide::initQmlSupport(PyObject *module) { ElementFactory<PYSIDE_MAX_QML_TYPES - 1>::init(); diff --git a/sources/pyside2/PySide2/QtQml/pysideqmlregistertype.h b/sources/pyside2/PySide2/QtQml/pysideqmlregistertype.h index 0ef6539a5..e94ea043f 100644 --- a/sources/pyside2/PySide2/QtQml/pysideqmlregistertype.h +++ b/sources/pyside2/PySide2/QtQml/pysideqmlregistertype.h @@ -47,7 +47,7 @@ struct SbkObjectType; namespace PySide { -extern void* nextQmlElementMemoryAddr; +extern void *nextQmlElementMemoryAddr; /** * Init the QML support doing things like registering QtQml.ListProperty and create the necessary stuff for @@ -55,7 +55,7 @@ extern void* nextQmlElementMemoryAddr; * * \param module QtQml python module */ -void initQmlSupport(PyObject* module); +void initQmlSupport(PyObject *module); /** * PySide implementation of qmlRegisterType<T> function. diff --git a/sources/pyside2/PySide2/QtQuick/pysidequickregistertype.cpp b/sources/pyside2/PySide2/QtQuick/pysidequickregistertype.cpp index e50b1dfc7..7278edff3 100644 --- a/sources/pyside2/PySide2/QtQuick/pysidequickregistertype.cpp +++ b/sources/pyside2/PySide2/QtQuick/pysidequickregistertype.cpp @@ -62,7 +62,7 @@ // All registered python types and their creation functions. static PyObject *pyTypes[PYSIDE_MAX_QUICK_TYPES]; -static void (*createFuncs[PYSIDE_MAX_QUICK_TYPES])(void*); +static void (*createFuncs[PYSIDE_MAX_QUICK_TYPES])(void *); // Mutex used to avoid race condition on PySide::nextQObjectMemoryAddr. static QMutex nextQmlElementMutex; @@ -153,8 +153,8 @@ void registerTypeIfInheritsFromClass( ::Construct, sizeof(QQmlListProperty<WrapperClass>), static_cast< ::QFlags<QMetaType::TypeFlag> >( - QtPrivate::QMetaTypeTypeFlags<QQmlListProperty<WrapperClass> >::Flags), - static_cast<QMetaObject*>(0)); + QtPrivate::QMetaTypeTypeFlags<QQmlListProperty<WrapperClass> >::Flags), + nullptr); if (lstType == -1) { PyErr_Format(PyExc_TypeError, "Meta type registration of \"%s\" for QML usage failed.", typeListName.constData()); diff --git a/sources/pyside2/PySide2/QtScript/qscript_value_iterator_glue.cpp b/sources/pyside2/PySide2/QtScript/qscript_value_iterator_glue.cpp index fd9cd84a3..11dfd19b0 100644 --- a/sources/pyside2/PySide2/QtScript/qscript_value_iterator_glue.cpp +++ b/sources/pyside2/PySide2/QtScript/qscript_value_iterator_glue.cpp @@ -1,3 +1,3 @@ %PYARG_0 = Shiboken::Object::newObject( - reinterpret_cast<SbkObjectType*>(Shiboken::SbkType< ::QScriptValueIterator >()), + reinterpret_cast<SbkObjectType *>(Shiboken::SbkType< ::QScriptValueIterator >()), new QScriptValueIterator(*%CPPSELF), true, true); diff --git a/sources/pyside2/PySide2/QtUiTools/glue/plugins.h b/sources/pyside2/PySide2/QtUiTools/glue/plugins.h index d1b250d50..9bfcec6ea 100644 --- a/sources/pyside2/PySide2/QtUiTools/glue/plugins.h +++ b/sources/pyside2/PySide2/QtUiTools/glue/plugins.h @@ -43,13 +43,14 @@ #include <QPluginLoader> #include "customwidgets.h" -inline void registerCustomWidget(PyObject* obj) +inline void registerCustomWidget(PyObject *obj) { - static PyCustomWidgets* plugin = 0; + static PyCustomWidgets *plugin = nullptr; if (plugin == 0) { - foreach(QObject* o, QPluginLoader::staticInstances()) { - plugin = qobject_cast<PyCustomWidgets*>(o); + const auto &instances = QPluginLoader::staticInstances(); + for (QObject *o : instances) { + plugin = qobject_cast<PyCustomWidgets *>(o); if (plugin) break; } diff --git a/sources/pyside2/PySide2/glue/qtcore.cpp b/sources/pyside2/PySide2/glue/qtcore.cpp index 9db4e2e82..cb5cb4e68 100644 --- a/sources/pyside2/PySide2/glue/qtcore.cpp +++ b/sources/pyside2/PySide2/glue/qtcore.cpp @@ -60,8 +60,8 @@ bool py2kStrCheck(PyObject *obj) static const char *QVariant_resolveMetaType(PyTypeObject *type, int *typeId) { if (PyObject_TypeCheck(type, SbkObjectType_TypeF())) { - SbkObjectType* sbkType = (SbkObjectType*)type; - const char* typeName = Shiboken::ObjectType::getOriginalName(sbkType); + auto sbkType = reinterpret_cast<SbkObjectType *>(type); + const char *typeName = Shiboken::ObjectType::getOriginalName(sbkType); if (!typeName) return nullptr; const bool valueType = '*' != typeName[qstrlen(typeName) - 1]; @@ -105,7 +105,7 @@ static QVariant QVariant_convertToValueList(PyObject *list) Shiboken::AutoDecRef element(PySequence_GetItem(list, 0)); int typeId; - const char *typeName = QVariant_resolveMetaType(element.cast<PyTypeObject*>(), &typeId); + const char *typeName = QVariant_resolveMetaType(element.cast<PyTypeObject *>(), &typeId); if (typeName) { QByteArray listTypeName("QList<"); listTypeName += typeName; @@ -220,7 +220,7 @@ double _abs = qAbs(%1); // @snippet qt-postroutine namespace PySide { -static QStack<PyObject*> globalPostRoutineFunctions; +static QStack<PyObject *> globalPostRoutineFunctions; void globalPostRoutineCallback() { Shiboken::GilState state; @@ -260,7 +260,7 @@ PyModule_AddStringConstant(module, "__version__", qVersion()); // @snippet qt-version // @snippet qobject-connect -static bool isDecorator(PyObject* method, PyObject* self) +static bool isDecorator(PyObject *method, PyObject *self) { Shiboken::AutoDecRef methodName(PyObject_GetAttrString(method, "__name__")); if (!PyObject_HasAttr(self, methodName)) @@ -269,18 +269,18 @@ static bool isDecorator(PyObject* method, PyObject* self) 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) +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); + 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); + if (*self && %CHECKTYPE[QObject *](*self)) + *receiver = %CONVERTTOCPP[QObject *](*self); } else if (PyCallable_Check(callback)) { // Ok, just a callable object *receiver = nullptr; @@ -292,14 +292,14 @@ static bool getReceiver(QObject *source, const char* signal, PyObject* callback, // 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(); + 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(); + PySide::SignalManager &signalManager = PySide::SignalManager::instance(); *receiver = signalManager.globalReceiver(source, callback); *callbackSig = PySide::Signal::getCallbackSignature(signal, *receiver, callback, usingGlobalReceiver).toLatin1(); } @@ -307,7 +307,7 @@ static bool getReceiver(QObject *source, const char* signal, PyObject* callback, return usingGlobalReceiver; } -static bool qobjectConnect(QObject* source, const char* signal, QObject* receiver, const char* slot, Qt::ConnectionType type) +static bool qobjectConnect(QObject *source, const char *signal, QObject *receiver, const char *slot, Qt::ConnectionType type) { if (!signal || !slot) return false; @@ -329,12 +329,12 @@ static bool qobjectConnect(QObject* source, const char* signal, QObject* receive return connection; } -static bool qobjectConnect(QObject* source, QMetaMethod signal, QObject* receiver, QMetaMethod slot, Qt::ConnectionType type) +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) +static bool qobjectConnectCallback(QObject *source, const char *signal, PyObject *callback, Qt::ConnectionType type) { if (!signal || !PySide::Signal::checkQtSignal(signal)) return false; @@ -344,23 +344,23 @@ static bool qobjectConnectCallback(QObject* source, const char* signal, PyObject if (signalIndex == -1) return false; - PySide::SignalManager& signalManager = PySide::SignalManager::instance(); + PySide::SignalManager &signalManager = PySide::SignalManager::instance(); // Extract receiver from callback - QObject* receiver = nullptr; - PyObject* self = nullptr; + 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(); + 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)) { + 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); @@ -388,11 +388,11 @@ static bool qobjectConnectCallback(QObject* source, const char* signal, PyObject if (usingGlobalReceiver) signalManager.notifyGlobalReceiver(receiver); #ifndef AVOID_PROTECTED_HACK - source->connectNotify(signalMethod); //Qt5: QMetaMethod instead of char* + source->connectNotify(signalMethod); //Qt5: QMetaMethod instead of char * #else - // Need to cast to QObjectWrapper* and call the public version of + // 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* + reinterpret_cast<QObjectWrapper *>(source)->connectNotify(signalMethod); //Qt5: QMetaMethod instead of char * #endif return connection; @@ -405,23 +405,23 @@ static bool qobjectConnectCallback(QObject* source, const char* signal, PyObject } -static bool qobjectDisconnectCallback(QObject* source, const char* signal, PyObject* callback) +static bool qobjectDisconnectCallback(QObject *source, const char *signal, PyObject *callback) { if (!PySide::Signal::checkQtSignal(signal)) return false; - PySide::SignalManager& signalManager = PySide::SignalManager::instance(); + PySide::SignalManager &signalManager = PySide::SignalManager::instance(); // Extract receiver from callback - QObject* receiver = nullptr; - PyObject* self = nullptr; + 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(); + const QMetaObject *metaObject = receiver->metaObject(); int signalIndex = source->metaObject()->indexOfSignal(++signal); int slotIndex = -1; @@ -438,11 +438,11 @@ static bool qobjectDisconnectCallback(QObject* source, const char* signal, PyObj signalManager.releaseGlobalReceiver(source, receiver); #ifndef AVOID_PROTECTED_HACK - source->disconnectNotify(slotMethod); //Qt5: QMetaMethod instead of char* + source->disconnectNotify(slotMethod); //Qt5: QMetaMethod instead of char * #else - // Need to cast to QObjectWrapper* and call the public version of + // 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* + reinterpret_cast<QObjectWrapper *>(source)->disconnectNotify(slotMethod); //Qt5: QMetaMethod instead of char * #endif return true; } @@ -706,10 +706,10 @@ qRegisterMetaType<QVector<int> >("QVector<int>"); // @snippet qobject-metaobject // @snippet qobject-findchild-1 -static QObject* _findChildHelper(const QObject* parent, const QString& name, PyTypeObject* desiredType) +static QObject *_findChildHelper(const QObject *parent, const QString &name, PyTypeObject *desiredType) { for (auto *child : parent->children()) { - Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QObject*](child)); + Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QObject *](child)); if (PyType_IsSubtype(Py_TYPE(pyChild), desiredType) && (name.isNull() || name == child->objectName())) { return child; @@ -724,21 +724,21 @@ static QObject* _findChildHelper(const QObject* parent, const QString& name, PyT return nullptr; } -static inline bool _findChildrenComparator(const QObject*& child, const QRegExp& name) +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) +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) +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)); + 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); @@ -747,18 +747,18 @@ static void _findChildrenHelper(const QObject* parent, const T& name, PyTypeObje // @snippet qobject-findchild-1 // @snippet qobject-findchild-2 -QObject *child = _findChildHelper(%CPPSELF, %2, (PyTypeObject*)%PYARG_1); -%PYARG_0 = %CONVERTTOPYTHON[QObject*](child); +QObject *child = _findChildHelper(%CPPSELF, %2, reinterpret_cast<PyTypeObject *>(%PYARG_1)); +%PYARG_0 = %CONVERTTOPYTHON[QObject *](child); // @snippet qobject-findchild-2 // @snippet qobject-findchildren-1 %PYARG_0 = PyList_New(0); -_findChildrenHelper(%CPPSELF, %2, (PyTypeObject*)%PYARG_1, %PYARG_0); +_findChildrenHelper(%CPPSELF, %2, reinterpret_cast<PyTypeObject *>(%PYARG_1), %PYARG_0); // @snippet qobject-findchildren-1 // @snippet qobject-findchildren-2 %PYARG_0 = PyList_New(0); -_findChildrenHelper(%CPPSELF, %2, (PyTypeObject*)%PYARG_1, %PYARG_0); +_findChildrenHelper(%CPPSELF, %2, reinterpret_cast<PyTypeObject *>(%PYARG_1), %PYARG_0); // @snippet qobject-findchildren-2 // @snippet qobject-tr @@ -942,8 +942,7 @@ if (PyIndex_Check(_key)) { 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); + temp = QByteArray(reinterpret_cast<const char *>(&ival)); } else { temp = %CONVERTTOCPP[QByteArray](item); } @@ -969,18 +968,19 @@ 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) +static int SbkQByteArray_getbufferproc(PyObject *obj, Py_buffer *view, int flags) { if (!view || !Shiboken::Object::isValid(obj)) return -1; - QByteArray* cppSelf = %CONVERTTOCPP[QByteArray*](obj); + QByteArray * cppSelf = %CONVERTTOCPP[QByteArray *](obj); + //XXX /|\ omitting this space crashes shiboken! view->obj = obj; - view->buf = reinterpret_cast<void*>(cppSelf->data()); + view->buf = reinterpret_cast<void *>(cppSelf->data()); view->len = cppSelf->size(); view->readonly = 0; view->itemsize = 1; - view->format = const_cast<char*>("c"); + view->format = const_cast<char *>("c"); view->ndim = 1; view->shape = NULL; view->strides = &view->itemsize; @@ -992,20 +992,21 @@ static int SbkQByteArray_getbufferproc(PyObject* obj, Py_buffer *view, int flags } #if PY_VERSION_HEX < 0x03000000 -static Py_ssize_t SbkQByteArray_segcountproc(PyObject* self, Py_ssize_t* lenp) +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) +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()); + QByteArray * cppSelf = %CONVERTTOCPP[QByteArray *](self); + //XXX /|\ omitting this space crashes shiboken! + *ptrptr = reinterpret_cast<void *>(cppSelf->data()); return cppSelf->size(); } @@ -1191,7 +1192,7 @@ return !result ? -1 : 0; // @snippet qbytearray-setitem // @snippet qfiledevice-unmap -uchar *ptr = reinterpret_cast<uchar*>(Shiboken::Buffer::getPointer(%PYARG_1)); +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 @@ -1229,8 +1230,8 @@ if (socket != nullptr) { // @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); +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 @@ -1241,17 +1242,18 @@ 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); +QTimer * timer = %CONVERTTOCPP[QTimer *](pyTimer); +//XXX /|\ omitting this space crashes shiboken! Shiboken::AutoDecRef result( PyObject_CallMethod(pyTimer, - const_cast<char*>("connect"), - const_cast<char*>("OsOs"), + const_cast<char *>("connect"), + const_cast<char *>("OsOs"), pyTimer, SIGNAL(timeout()), %PYARG_2, %3) ); -Shiboken::Object::releaseOwnership((SbkObject*)pyTimer); +Shiboken::Object::releaseOwnership((SbkObject *)pyTimer); Py_XDECREF(pyTimer); timer->setSingleShot(true); timer->connect(timer, SIGNAL(timeout()), timer, SLOT(deleteLater())); @@ -1263,16 +1265,16 @@ timer->start(%1); 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); +QTimer * timer = %CONVERTTOCPP[QTimer *](pyTimer); timer->setSingleShot(true); if (PyObject_TypeCheck(%2, PySideSignalInstanceTypeF())) { - PySideSignalInstance *signalInstance = reinterpret_cast<PySideSignalInstance*>(%2); + 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"), + const_cast<char *>("connect"), + const_cast<char *>("OsOO"), pyTimer, SIGNAL(timeout()), PySide::Signal::getObject(signalInstance), @@ -1281,8 +1283,8 @@ if (PyObject_TypeCheck(%2, PySideSignalInstanceTypeF())) { } else { Shiboken::AutoDecRef result( PyObject_CallMethod(pyTimer, - const_cast<char*>("connect"), - const_cast<char*>("OsO"), + const_cast<char *>("connect"), + const_cast<char *>("OsO"), pyTimer, SIGNAL(timeout()), %PYARG_2) @@ -1290,7 +1292,7 @@ if (PyObject_TypeCheck(%2, PySideSignalInstanceTypeF())) { } timer->connect(timer, SIGNAL(timeout()), timer, SLOT(deleteLater()), Qt::DirectConnection); -Shiboken::Object::releaseOwnership((SbkObject*)pyTimer); +Shiboken::Object::releaseOwnership(reinterpret_cast<SbkObject *>(pyTimer)); Py_XDECREF(pyTimer); timer->start(%1); // @snippet qtimer-singleshot-2 @@ -1322,7 +1324,7 @@ static void QCoreApplicationConstructor(PyObject *self, PyObject *pyargv, QCoreA 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)); + Shiboken::Object::releaseOwnership(reinterpret_cast<SbkObject *>(self)); PySide::registerCleanupFunction(&PySide::destroyQCoreApplication); } } @@ -1342,10 +1344,10 @@ if (!PyTuple_SetItem(empty, 0, PyList_New(0))) { // @snippet qcoreapplication-instance PyObject *pyApp = Py_None; if (qApp) { - pyApp = reinterpret_cast<PyObject*>( + pyApp = reinterpret_cast<PyObject *>( Shiboken::BindingManager::instance().retrieveWrapper(qApp)); if (!pyApp) - pyApp = %CONVERTTOPYTHON[QCoreApplication*](qApp); + pyApp = %CONVERTTOPYTHON[QCoreApplication *](qApp); // this will keep app live after python exit (extra ref) } // PYSIDE-571: make sure that we return the singleton "None" @@ -1379,7 +1381,7 @@ Shiboken::Object::releaseOwnership(%PYARG_0); // @snippet qanimationgroup-clear for (int counter = 0, count = %CPPSELF.animationCount(); counter < count; ++counter ) { QAbstractAnimation *animation = %CPPSELF.animationAt(counter); - PyObject *obj = %CONVERTTOPYTHON[QAbstractAnimation*](animation); + PyObject *obj = %CONVERTTOPYTHON[QAbstractAnimation *](animation); Shiboken::Object::setParent(nullptr, obj); Py_DECREF(obj); } @@ -1403,11 +1405,12 @@ if (func) // @snippet qsignaltransition if (PyObject_TypeCheck(%1, PySideSignalInstanceTypeF())) { - PyObject *dataSource = PySide::Signal::getObject((PySideSignalInstance*)%PYARG_1); + PyObject *dataSource = PySide::Signal::getObject((PySideSignalInstance *)%PYARG_1); Shiboken::AutoDecRef obType(PyObject_Type(dataSource)); - QObject* sender = %CONVERTTOCPP[QObject*](dataSource); + QObject * sender = %CONVERTTOCPP[QObject *](dataSource); + //XXX /|\ omitting this space crashes shiboken! if (sender) { - const char*dataSignature = PySide::Signal::getSignature((PySideSignalInstance*)%PYARG_1); + 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); @@ -1419,7 +1422,7 @@ if (PyObject_TypeCheck(%1, PySideSignalInstanceTypeF())) { 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); + %PYARG_0 = %CONVERTTOPYTHON[QSignalTransition *](%0); } else { Py_INCREF(Py_None); %PYARG_0 = Py_None; @@ -1433,16 +1436,17 @@ if (PySide::SignalManager::registerMetaMethod(%1, signalName.mid(1).toLatin1().d // 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); -QObject* sender = %CONVERTTOCPP[QObject*](PySide::Signal::getObject(signalInstance)); +PySideSignalInstance *signalInstance = reinterpret_cast<PySideSignalInstance *>(%1); +QObject * sender = %CONVERTTOCPP[QObject *](PySide::Signal::getObject(signalInstance)); +//XXX /|\ omitting this space crashes shiboken! QSignalTransition *%0 = %CPPSELF->%FUNCTION_NAME(sender, PySide::Signal::getSignature(signalInstance),%2); -%PYARG_0 = %CONVERTTOPYTHON[QSignalTransition*](%0); +%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::AutoDecRef obj(%CONVERTTOPYTHON[QAbstractState *](abs_state)); Shiboken::Object::setParent(self, obj); PySet_Add(%PYARG_0, obj); } @@ -1451,7 +1455,7 @@ for (auto *abs_state : %CPPSELF.configuration()) { // @snippet qstatemachine-defaultanimations %PYARG_0 = PyList_New(0); for (auto *abs_anim : %CPPSELF.defaultAnimations()) { - Shiboken::AutoDecRef obj(%CONVERTTOPYTHON[QAbstractAnimation*](abs_anim)); + Shiboken::AutoDecRef obj(%CONVERTTOPYTHON[QAbstractAnimation *](abs_anim)); Shiboken::Object::setParent(self, obj); PyList_Append(%PYARG_0, obj); } @@ -1482,16 +1486,16 @@ 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))); +%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))); +%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 @@ -1502,8 +1506,8 @@ QT_END_NAMESPACE // @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); + 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 @@ -1529,11 +1533,11 @@ QString &res = *%0; // @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); + %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); + %0 = Shiboken::String::len((PyObject *)%PYARG_0); + memcpy(%1, Shiboken::String::toCString((PyObject *)%PYARG_0), %0); } // @snippet return-readData @@ -1545,7 +1549,7 @@ QByteArray ba(1 + int(%2), char(0)); // @snippet qt-module-shutdown { // Avoid name clash - Shiboken::AutoDecRef regFunc((PyObject*)NULL); + 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"); @@ -1586,12 +1590,12 @@ QByteArray ba(1 + int(%2), char(0)); // @snippet conversion-pyunicode #ifndef Py_LIMITED_API -Py_UNICODE* unicode = PyUnicode_AS_UNICODE(%in); +Py_UNICODE *unicode = PyUnicode_AS_UNICODE(%in); # if defined(Py_UNICODE_WIDE) // cast as Py_UNICODE can be a different type -%out = QString::fromUcs4((const uint*)unicode); +%out = QString::fromUcs4((const uint *)unicode); # else -%out = QString::fromUtf16((const ushort*)unicode, PyUnicode_GET_SIZE(%in)); +%out = QString::fromUtf16((const ushort *)unicode, PyUnicode_GET_SIZE(%in)); # endif #else wchar_t *temp = PyUnicode_AsWideCharString(%in, NULL); @@ -1602,7 +1606,8 @@ PyMem_Free(temp); // @snippet conversion-pystring #ifndef IS_PY3K -const char* str = %CONVERTTOCPP[const char*](%in); +const char * str = %CONVERTTOCPP[const char *](%in); +//XXX /|\ omitting this space crashes shiboken! %out = %OUTTYPE(str); #endif // @snippet conversion-pystring @@ -1650,7 +1655,7 @@ if (!typeCode || !typeName) { %out = QVariant::fromValue(PySide::PyObjectWrapper(%in)); } else { - QVariant var(typeCode, (void*)0); + QVariant var(typeCode, nullptr); Shiboken::Conversions::SpecificConverter converter(typeName); converter.toCpp(pyIn, var.data()); %out = var; @@ -1680,12 +1685,12 @@ QVariant ret = QVariant_convertToVariantList(%in); const char *typeName; if (Shiboken::String::checkType(reinterpret_cast<PyTypeObject *>(%in))) typeName = "QString"; -else if (%in == reinterpret_cast<PyObject*>(&PyFloat_Type)) +else if (%in == reinterpret_cast<PyObject *>(&PyFloat_Type)) typeName = "double"; // float is a UserType in QVariant. -else if (%in == reinterpret_cast<PyObject*>(&PyLong_Type)) +else if (%in == reinterpret_cast<PyObject *>(&PyLong_Type)) typeName = "int"; // long is a UserType in QVariant. else if (Py_TYPE(%in) == SbkObjectType_TypeF()) - typeName = Shiboken::ObjectType::getOriginalName((SbkObjectType*)%in); + typeName = Shiboken::ObjectType::getOriginalName((SbkObjectType *)%in); else typeName = reinterpret_cast<PyTypeObject *>(%in)->tp_name; %out = QVariant::nameToType(typeName); @@ -1825,7 +1830,7 @@ PyObject *%out; PyTypeObject *pyType = nullptr; if (typeName) pyType = Shiboken::Conversions::getPythonTypeObject(typeName); -%out = pyType ? (reinterpret_cast<PyObject*>(pyType)) : Py_None; +%out = pyType ? (reinterpret_cast<PyObject *>(pyType)) : Py_None; Py_INCREF(%out); return %out; // @snippet return-qvariant-type diff --git a/sources/pyside2/PySide2/glue/qtgui.cpp b/sources/pyside2/PySide2/glue/qtgui.cpp index aef9e4b59..5be8cc287 100644 --- a/sources/pyside2/PySide2/glue/qtgui.cpp +++ b/sources/pyside2/PySide2/glue/qtgui.cpp @@ -72,7 +72,7 @@ if (QTransform::squareToQuad(%1, _result)) { // @snippet qtransform-squaretoquad // @snippet qbitmap-fromdata -uchar *buffer = reinterpret_cast<uchar*>(Shiboken::Buffer::getPointer(%PYARG_2)); +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 @@ -102,7 +102,7 @@ return %CONVERTTOPYTHON[int](item); // @snippet qtextblock-setuserdata const QTextDocument *doc = %CPPSELF.document(); if (doc) { - Shiboken::AutoDecRef pyDocument(%CONVERTTOPYTHON[QTextDocument*](doc)); + Shiboken::AutoDecRef pyDocument(%CONVERTTOPYTHON[QTextDocument *](doc)); Shiboken::Object::setParent(pyDocument, %PYARG_1); } // @snippet qtextblock-setuserdata @@ -110,7 +110,7 @@ if (doc) { // @snippet qtextblock-userdata const QTextDocument *doc = %CPPSELF.document(); if (doc) { - Shiboken::AutoDecRef pyDocument(%CONVERTTOPYTHON[QTextDocument*](doc)); + Shiboken::AutoDecRef pyDocument(%CONVERTTOPYTHON[QTextDocument *](doc)); Shiboken::Object::setParent(pyDocument, %PYARG_0); } // @snippet qtextblock-userdata @@ -138,7 +138,7 @@ for (int i = 0, i_max = %CPPSELF.count(); i < i_max; ++i){ // @snippet qpolygon-operatorlowerlower // %FUNCTION_NAME() *%CPPSELF << %1; -%PYARG_0 = %CONVERTTOPYTHON[QPolygon*](%CPPSELF); +%PYARG_0 = %CONVERTTOPYTHON[QPolygon *](%CPPSELF); // @snippet qpolygon-operatorlowerlower // @snippet qpixmap @@ -372,7 +372,7 @@ if (%CPPSELF.%FUNCTION_NAME(%1, &p)) { // Clear parent from the old child QStandardItem *_i = %CPPSELF->child(%1, %2); if (_i) { - PyObject *_pyI = %CONVERTTOPYTHON[QStandardItem*](_i); + PyObject *_pyI = %CONVERTTOPYTHON[QStandardItem *](_i); Shiboken::Object::setParent(nullptr, _pyI); } // @snippet qstandarditem-setchild-1 @@ -381,7 +381,7 @@ if (_i) { // Clear parent from the old child QStandardItem *_i = %CPPSELF->child(%1); if (_i) { - PyObject *_pyI = %CONVERTTOPYTHON[QStandardItem*](_i); + PyObject *_pyI = %CONVERTTOPYTHON[QStandardItem *](_i); Shiboken::Object::setParent(nullptr, _pyI); } // @snippet qstandarditem-setchild-2 @@ -395,7 +395,7 @@ bool ret = !(&%CPPSELF == %1); // Clear parent from the old child QStandardItem *_i = %CPPSELF->item(%1, %2); if (_i) { - PyObject *_pyI = %CONVERTTOPYTHON[QStandardItem*](_i); + PyObject *_pyI = %CONVERTTOPYTHON[QStandardItem *](_i); Shiboken::Object::setParent(nullptr, _pyI); } // @snippet qstandarditemmodel-setitem-1 @@ -404,7 +404,7 @@ if (_i) { // Clear parent from the old child QStandardItem *_i = %CPPSELF->item(%1); if (_i) { - PyObject *_pyI = %CONVERTTOPYTHON[QStandardItem*](_i); + PyObject *_pyI = %CONVERTTOPYTHON[QStandardItem *](_i); Shiboken::Object::setParent(nullptr, _pyI); } // @snippet qstandarditemmodel-setitem-2 @@ -413,7 +413,7 @@ if (_i) { // Clear parent from the old child QStandardItem *_i = %CPPSELF->verticalHeaderItem(%1); if (_i) { - PyObject *_pyI = %CONVERTTOPYTHON[QStandardItem*](_i); + PyObject *_pyI = %CONVERTTOPYTHON[QStandardItem *](_i); Shiboken::Object::setParent(nullptr, _pyI); } // @snippet qstandarditemmodel-setverticalheaderitem @@ -503,7 +503,7 @@ static void QGuiApplicationConstructor(PyObject *self, PyObject *pyargv, QGuiApp 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)); + Shiboken::Object::releaseOwnership(reinterpret_cast<SbkObject *>(self)); PySide::registerCleanupFunction(&PySide::destroyQCoreApplication); } } diff --git a/sources/pyside2/PySide2/glue/qtmultimedia.cpp b/sources/pyside2/PySide2/glue/qtmultimedia.cpp index 520b5c4fa..5a3f3a5e7 100644 --- a/sources/pyside2/PySide2/glue/qtmultimedia.cpp +++ b/sources/pyside2/PySide2/glue/qtmultimedia.cpp @@ -39,7 +39,8 @@ // @snippet upcast %BEGIN_ALLOW_THREADS -QObject* upcastedArg = %CONVERTTOCPP[QObject*](%PYARG_1); +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 diff --git a/sources/pyside2/PySide2/glue/qtopengl.cpp b/sources/pyside2/PySide2/glue/qtopengl.cpp index 6c106522c..25b6ee096 100644 --- a/sources/pyside2/PySide2/glue/qtopengl.cpp +++ b/sources/pyside2/PySide2/glue/qtopengl.cpp @@ -39,7 +39,7 @@ // @snippet qglbuffer-allocate int size = (%2 < 0) ? %1.size() : %2; -%CPPSELF.allocate((const void*) %1.data(), size); +%CPPSELF.allocate(static_cast<const void *>(%1.data()), size); // @snippet qglbuffer-allocate // @snippet qglbuffer-read @@ -47,7 +47,7 @@ char *data = new char[%3]; bool result = %CPPSELF.read(%1, data, %3); QByteArray ret; if (result) - ret.append((const char*)data, %3); + 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)); @@ -56,12 +56,12 @@ delete[] data; // @snippet qglbuffer-write int size = (%3 < 0) ? %2.size() : %3; -%CPPSELF.write(%1, (const void*) %2.data(), size); +%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); +void *data = %CPPSELF.map(%1); if (!data) { Py_INCREF(Py_None); diff --git a/sources/pyside2/PySide2/glue/qtscript.cpp b/sources/pyside2/PySide2/glue/qtscript.cpp index 7efc26f3e..cf168d6bd 100644 --- a/sources/pyside2/PySide2/glue/qtscript.cpp +++ b/sources/pyside2/PySide2/glue/qtscript.cpp @@ -54,7 +54,7 @@ QVariant res = %CPPSELF.property(Shiboken::String::toCString(key.object())).toVa if (res.isValid()) { return %CONVERTTOPYTHON[QVariant](res); } else { - PyObject* errorType = PyInt_Check(_key) ? PyExc_IndexError : PyExc_KeyError; + PyObject *errorType = PyInt_Check(_key) ? PyExc_IndexError : PyExc_KeyError; PyErr_SetString(errorType, "Key not found."); return 0; } diff --git a/sources/pyside2/PySide2/glue/qtuitools.cpp b/sources/pyside2/PySide2/glue/qtuitools.cpp index d0469e97d..552a9009c 100644 --- a/sources/pyside2/PySide2/glue/qtuitools.cpp +++ b/sources/pyside2/PySide2/glue/qtuitools.cpp @@ -48,14 +48,14 @@ #include <QFile> #include <QWidget> -static void createChildrenNameAttributes(PyObject* root, QObject* object) +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_")) { if (!PyObject_HasAttrString(root, name.constData())) { - Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QObject*](child)); + Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QObject *](child)); PyObject_SetAttrString(root, name.constData(), pyChild); } createChildrenNameAttributes(root, child); @@ -64,15 +64,15 @@ static void createChildrenNameAttributes(PyObject* root, QObject* object) } } -static PyObject* QUiLoadedLoadUiFromDevice(QUiLoader* self, QIODevice* dev, QWidget* parent) +static PyObject *QUiLoadedLoadUiFromDevice(QUiLoader *self, QIODevice *dev, QWidget *parent) { - QWidget* wdg = self->load(dev, parent); + QWidget *wdg = self->load(dev, parent); if (wdg) { - PyObject* pyWdg = %CONVERTTOPYTHON[QWidget*](wdg); + PyObject *pyWdg = %CONVERTTOPYTHON[QWidget *](wdg); createChildrenNameAttributes(pyWdg, wdg); if (parent) { - Shiboken::AutoDecRef pyParent(%CONVERTTOPYTHON[QWidget*](parent)); + Shiboken::AutoDecRef pyParent(%CONVERTTOPYTHON[QWidget *](parent)); Shiboken::Object::setParent(pyParent, pyWdg); } return pyWdg; @@ -83,7 +83,7 @@ static PyObject* QUiLoadedLoadUiFromDevice(QUiLoader* self, QIODevice* dev, QWid return nullptr; } -static PyObject* QUiLoaderLoadUiFromFileName(QUiLoader* self, const QString& uiFile, QWidget* parent) +static PyObject *QUiLoaderLoadUiFromFileName(QUiLoader *self, const QString &uiFile, QWidget *parent) { QFile fd(uiFile); return QUiLoadedLoadUiFromDevice(self, &fd, parent); diff --git a/sources/pyside2/PySide2/glue/qtwebkitwidgets.cpp b/sources/pyside2/PySide2/glue/qtwebkitwidgets.cpp index 086ee3b85..c0f182747 100644 --- a/sources/pyside2/PySide2/glue/qtwebkitwidgets.cpp +++ b/sources/pyside2/PySide2/glue/qtwebkitwidgets.cpp @@ -38,7 +38,7 @@ ****************************************************************************/ // @snippet qwebview-page -SbkObject* _pyReturn = reinterpret_cast<SbkObject*>(%PYARG_0); +auto _pyReturn = reinterpret_cast<SbkObject *>(%PYARG_0); if (!Shiboken::Object::hasParentInfo(_pyReturn)) Shiboken::Object::setParent(%PYSELF, %PYARG_0); // @snippet qwebview-page @@ -67,7 +67,7 @@ if (_signalIndex == -1) { if (_signalIndex == id) { Shiboken::GilState gil; - PyObject* self = (PyObject*)Shiboken::BindingManager::instance().retrieveWrapper(this); + auto self = reinterpret_cast<PyObject *>(Shiboken::BindingManager::instance().retrieveWrapper(this)); if (self) { Shiboken::AutoDecRef _pyMethod(PyObject_GetAttrString(self, "shouldInterruptJavaScript")); diff --git a/sources/pyside2/PySide2/glue/qtwidgets.cpp b/sources/pyside2/PySide2/glue/qtwidgets.cpp index b44be183d..0e0b025a6 100644 --- a/sources/pyside2/PySide2/glue/qtwidgets.cpp +++ b/sources/pyside2/PySide2/glue/qtwidgets.cpp @@ -44,13 +44,13 @@ // @snippet qtreewidgetitemiterator-next if (**%CPPSELF) { QTreeWidgetItemIterator *%0 = new QTreeWidgetItemIterator((*%CPPSELF)++); - %PYARG_0 = %CONVERTTOPYTHON[QTreeWidgetItemIterator*](%0); + %PYARG_0 = %CONVERTTOPYTHON[QTreeWidgetItemIterator *](%0); } // @snippet qtreewidgetitemiterator-next // @snippet qtreewidgetitemiterator-value -QTreeWidgetItem *%0 = %CPPSELF.operator*(); -%PYARG_0 = %CONVERTTOPYTHON[QTreeWidgetItem*](%0); +QTreeWidgetItem *%0 = %CPPSELF.operator *(); +%PYARG_0 = %CONVERTTOPYTHON[QTreeWidgetItem *](%0); Shiboken::Object::releaseOwnership(%PYARG_0); // @snippet qtreewidgetitemiterator-value @@ -62,7 +62,7 @@ PyDict_SetItemString(reinterpret_cast<PyTypeObject *>(Sbk_QGraphicsItem_TypeF()) // @snippet qgraphicsitem-scene-return-parenting if (%0) { QObject *parent = %0->parent(); - Shiboken::AutoDecRef pyParent(%CONVERTTOPYTHON[QObject*](parent)); + Shiboken::AutoDecRef pyParent(%CONVERTTOPYTHON[QObject *](parent)); Shiboken::Object::setParent(pyParent, %PYARG_0); } // @snippet qgraphicsitem-scene-return-parenting @@ -72,7 +72,7 @@ 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_)); +PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[QGraphicsItem *](item_)); // @snippet qgraphicsitem-isblockedbymodalpanel // @snippet qitemeditorfactory-registereditor @@ -81,7 +81,7 @@ Shiboken::Object::releaseOwnership(%PYARG_2); // @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 = 0; +static PyObject *_defaultValue = nullptr; %CPPSELF.%FUNCTION_NAME(%1); Py_INCREF(%PYARG_1); if (_defaultValue) @@ -111,9 +111,9 @@ 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) +inline PyObject *addActionWithPyObject(QMenu *self, const QIcon &icon, const QString &text, PyObject *callback, const QKeySequence &shortcut) { - QAction* act = self->addAction(text); + QAction *act = self->addAction(text); if (!icon.isNull()) act->setIcon(icon); @@ -123,7 +123,7 @@ inline PyObject* addActionWithPyObject(QMenu* self, const QIcon& icon, const QSt self->addAction(act); - PyObject* pyAct = %CONVERTTOPYTHON[QAction*](act); + PyObject *pyAct = %CONVERTTOPYTHON[QAction *](act); Shiboken::AutoDecRef result(PyObject_CallMethod(pyAct, const_cast<char *>("connect"), const_cast<char *>("OsO"), @@ -151,7 +151,7 @@ inline PyObject* addActionWithPyObject(QMenu* self, const QIcon& icon, const QSt // @snippet qmenu-addaction-3 // @snippet qmenu-clear -Shiboken::BindingManager& bm = Shiboken::BindingManager::instance(); +Shiboken::BindingManager &bm = Shiboken::BindingManager::instance(); const auto &actions = %CPPSELF.actions(); for (auto *act : actions) { if (auto wrapper = bm.retrieveWrapper(act)) { @@ -165,15 +165,15 @@ for (auto *act : actions) { // @snippet qmenu-clear // @snippet qmenubar-glue -inline PyObject* -addActionWithPyObject(QMenuBar* self, const QString& text, PyObject* callback) +inline PyObject * +addActionWithPyObject(QMenuBar *self, const QString &text, PyObject *callback) { - QAction* act = self->addAction(text); + QAction *act = self->addAction(text); self->addAction(act); - PyObject* pyAct = %CONVERTTOPYTHON[QAction*](act); - PyObject* result = PyObject_CallMethod(pyAct, + PyObject *pyAct = %CONVERTTOPYTHON[QAction *](act); + PyObject *result = PyObject_CallMethod(pyAct, const_cast<char *>("connect"), const_cast<char *>("OsO"), pyAct, @@ -193,7 +193,7 @@ addActionWithPyObject(QMenuBar* self, const QString& text, PyObject* callback) // @snippet qmenubar-clear const auto &actions = %CPPSELF.actions(); for (auto *act : actions) { - Shiboken::AutoDecRef pyAct(%CONVERTTOPYTHON[QAction*](act)); + Shiboken::AutoDecRef pyAct(%CONVERTTOPYTHON[QAction *](act)); Shiboken::Object::setParent(NULL, pyAct); Shiboken::Object::invalidate(pyAct); } @@ -224,28 +224,28 @@ if (!result.isNull()) // @snippet qtoolbox-removeitem QWidget *_widget = %CPPSELF.widget(%1); if (_widget) { - Shiboken::AutoDecRef pyWidget(%CONVERTTOPYTHON[QWidget*](_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); +void addLayoutOwnership(QLayout *layout, QLayoutItem *item); +void removeLayoutOwnership(QLayout *layout, QWidget *widget); -inline QByteArray retrieveObjectName(PyObject* obj) +inline QByteArray retrieveObjectName(PyObject *obj) { Shiboken::AutoDecRef objName(PyObject_Str(obj)); return Shiboken::String::toCString(objName); } -inline void addLayoutOwnership(QLayout* layout, QWidget* widget) +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)); + Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QWidget *](widget)); //Transfer parent to layout widget if (pw && lw && pw != lw) @@ -253,99 +253,98 @@ inline void addLayoutOwnership(QLayout* layout, QWidget* widget) 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); + 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::AutoDecRef pyParent(%CONVERTTOPYTHON[QWidget *](lw)); Shiboken::Object::setParent(pyParent, pyChild); } } -inline void addLayoutOwnership(QLayout* layout, QLayout* other) +inline void addLayoutOwnership(QLayout *layout, QLayout *other) { //transfer all children widgets from other to layout parent widget - QWidget* parent = layout->parentWidget(); + 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); + 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); + 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::AutoDecRef pyParent(%CONVERTTOPYTHON[QLayout *](layout)); + Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QLayout *](other)); Shiboken::Object::setParent(pyParent, pyChild); } -inline void addLayoutOwnership(QLayout* layout, QLayoutItem* item) +inline void addLayoutOwnership(QLayout *layout, QLayoutItem *item) { if (!item) return; - QWidget* w = item->widget(); - if (w) + if (QWidget *w = item->widget()) { addLayoutOwnership(layout, w); - else { - QLayout* l = item->layout(); - if (l) + } else { + if (QLayout *l = item->layout()) addLayoutOwnership(layout, l); } - Shiboken::AutoDecRef pyParent(%CONVERTTOPYTHON[QLayout*](layout)); - Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QLayoutItem*](item)); + Shiboken::AutoDecRef pyParent(%CONVERTTOPYTHON[QLayout *](layout)); + Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QLayoutItem *](item)); Shiboken::Object::setParent(pyParent, pyChild); } -static void removeWidgetFromLayout(QLayout* layout, QWidget* widget) +static void removeWidgetFromLayout(QLayout *layout, QWidget *widget) { - QWidget* parent = widget->parentWidget(); + 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); + 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::AutoDecRef pyParent(%CONVERTTOPYTHON[QWidget *](parent)); + Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QWidget *](widget)); Shiboken::Object::setParent(pyParent, pyChild); } } -inline void removeLayoutOwnership(QLayout* layout, QLayoutItem* item) +inline void removeLayoutOwnership(QLayout *layout, QLayoutItem *item) { - QWidget* w = item->widget(); - if (w) + if (QWidget *w = item->widget()) { removeWidgetFromLayout(layout, w); - else { - QLayout* l = item->layout(); + } else { + QLayout *l = item->layout(); if (l && item != l) removeLayoutOwnership(layout, l); } - Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QLayoutItem*](item)); + Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QLayoutItem *](item)); Shiboken::Object::invalidate(pyChild); Shiboken::Object::setParent(0, pyChild); } -inline void removeLayoutOwnership(QLayout* layout, QWidget* widget) +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); + QLayoutItem *item = layout->itemAt(i); if (PyErr_Occurred() || !item) return; if (item->widget() == widget) @@ -385,11 +384,11 @@ 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)); +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)); + Shiboken::Object::setParent(parent, %CONVERTTOPYTHON[QGraphicsItem *](item)); %BEGIN_ALLOW_THREADS %CPPSELF.%FUNCTION_NAME(%1); %END_ALLOW_THREADS @@ -400,16 +399,16 @@ Shiboken::Object::invalidate(%PYARG_1); // @snippet qgraphicsscene-addwidget %RETURN_TYPE %0 = %CPPSELF.%FUNCTION_NAME(%1, %2); %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%0); -Shiboken::Object::keepReference((SbkObject*)%PYARG_0, "setWidget(QWidget*)1", %PYARG_1); +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(); +const QList<QGraphicsItem *> items = %CPPSELF.items(); +Shiboken::BindingManager &bm = Shiboken::BindingManager::instance(); for (auto *item : items) { - SbkObject* obj = bm.retrieveWrapper(item); + 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. + 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); } @@ -422,9 +421,8 @@ QTreeWidgetItem *rootItem = %CPPSELF.invisibleRootItem(); Shiboken::BindingManager &bm = Shiboken::BindingManager::instance(); for (int i = 0, i_count = rootItem->childCount(); i < i_count; ++i) { QTreeWidgetItem *item = rootItem->child(i); - SbkObject* wrapper = bm.retrieveWrapper(item); - if (wrapper) - Shiboken::Object::setParent(0, reinterpret_cast<PyObject*>(wrapper)); + if (SbkObject *wrapper = bm.retrieveWrapper(item)) + Shiboken::Object::setParent(nullptr, reinterpret_cast<PyObject *>(wrapper)); } // @snippet qtreewidget-clear @@ -440,7 +438,7 @@ 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); + auto pyObj = reinterpret_cast<PyObject *>(wrapper); Py_INCREF(pyObj); Shiboken::Object::setParent(NULL, pyObj); Shiboken::Object::invalidate(pyObj); @@ -461,31 +459,30 @@ static QString retrieveObjectName(PyObject *obj) // Transfer objects ownership from layout to widget static inline void qwidgetReparentLayout(QWidget *parent, QLayout *layout) { - Shiboken::AutoDecRef pyParent(%CONVERTTOPYTHON[QWidget*](parent)); + Shiboken::AutoDecRef pyParent(%CONVERTTOPYTHON[QWidget *](parent)); for (int i=0, i_count = layout->count(); i < i_count; i++) { - QLayoutItem* item = layout->itemAt(i); + QLayoutItem *item = layout->itemAt(i); if (PyErr_Occurred() || !item) return; - QWidget* w = item->widget(); - if (w) { - QWidget* pw = w->parentWidget(); + if (QWidget *w = item->widget()) { + QWidget *pw = w->parentWidget(); if (pw != parent) { - Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QWidget*](w)); + Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QWidget *](w)); Shiboken::Object::setParent(pyParent, pyChild); } } else { - QLayout* l = item->layout(); - if (l) + if (QLayout *l = item->layout()) qwidgetReparentLayout(parent, l); } } - Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QLayout*](layout)); + 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); + Shiboken::Object::keepReference(reinterpret_cast<SbkObject *>(pyChild.object()), + qPrintable(retrieveObjectName(pyChild)), Py_None); } static inline void qwidgetSetLayout(QWidget *self, QLayout *layout) @@ -493,11 +490,11 @@ static inline void qwidgetSetLayout(QWidget *self, QLayout *layout) if (!layout || self->layout()) return; - QObject* oldParent = layout->parent(); + QObject *oldParent = layout->parent(); if (oldParent && oldParent != self) { if (oldParent->isWidgetType()) { // remove old parent policy - Shiboken::AutoDecRef pyLayout(%CONVERTTOPYTHON[QLayout*](layout)); + 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", @@ -517,20 +514,20 @@ static inline void qwidgetSetLayout(QWidget *self, QLayout *layout) // @snippet qwidget-glue // @snippet qwidget-setstyle -Shiboken::Object::keepReference(reinterpret_cast<SbkObject*>(%PYSELF), "__style__", %PYARG_1); +Shiboken::Object::keepReference(reinterpret_cast<SbkObject *>(%PYSELF), "__style__", %PYARG_1); // @snippet qwidget-setstyle // @snippet qwidget-style -QStyle* myStyle = %CPPSELF->style(); +QStyle *myStyle = %CPPSELF->style(); if (myStyle && qApp) { -%PYARG_0 = %CONVERTTOPYTHON[QStyle*](myStyle); +%PYARG_0 = %CONVERTTOPYTHON[QStyle *](myStyle); QStyle *appStyle = qApp->style(); if (appStyle == myStyle) { - Shiboken::AutoDecRef pyApp(%CONVERTTOPYTHON[QApplication*](qApp)); + 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); + Shiboken::Object::keepReference(reinterpret_cast<SbkObject *>(%PYSELF), "__style__", %PYARG_0); } } // @snippet qwidget-style @@ -543,7 +540,7 @@ static void QApplicationConstructor(PyObject *self, PyObject *pyargv, QApplicati 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)); + Shiboken::Object::releaseOwnership(reinterpret_cast<SbkObject *>(self)); PySide::registerCleanupFunction(&PySide::destroyQCoreApplication); } } @@ -551,7 +548,7 @@ static void QApplicationConstructor(PyObject *self, PyObject *pyargv, QApplicati // @snippet qapplication-setStyle if (qApp) { - Shiboken::AutoDecRef pyApp(%CONVERTTOPYTHON[QApplication*](qApp)); + Shiboken::AutoDecRef pyApp(%CONVERTTOPYTHON[QApplication *](qApp)); Shiboken::Object::setParent(pyApp, %PYARG_1); Shiboken::Object::releaseOwnership(%PYARG_1); } @@ -563,19 +560,19 @@ qwidgetSetLayout(%CPPSELF, %1); // @snippet qwidget-setlayout // @snippet qtabwidget-removetab -QWidget* tab = %CPPSELF.widget(%1); +QWidget *tab = %CPPSELF.widget(%1); if (tab) { - Shiboken::AutoDecRef pyWidget(%CONVERTTOPYTHON[QWidget*](tab)); + Shiboken::AutoDecRef pyWidget(%CONVERTTOPYTHON[QWidget *](tab)); %CPPSELF.%FUNCTION_NAME(%1); } // @snippet qtabwidget-removetab // @snippet qtabwidget-clear -Shiboken::BindingManager& bm = Shiboken::BindingManager::instance(); +Shiboken::BindingManager &bm = Shiboken::BindingManager::instance(); for (int i = 0, count = %CPPSELF.count(); i < count; ++i) { - QWidget* widget = %CPPSELF.widget(i); + QWidget *widget = %CPPSELF.widget(i); if (bm.hasWrapper(widget)) { - Shiboken::AutoDecRef pyWidget(%CONVERTTOPYTHON[QWidget*](widget)); + Shiboken::AutoDecRef pyWidget(%CONVERTTOPYTHON[QWidget *](widget)); Shiboken::Object::releaseOwnership(pyWidget); } } @@ -588,7 +585,7 @@ for (int i = 0, count = %CPPSELF.count(); i < count; ++i) { // @snippet qtoolbar-addaction-1 QAction *action = %CPPSELF.addAction(%1, %2); -%PYARG_0 = %CONVERTTOPYTHON[QAction*](action); +%PYARG_0 = %CONVERTTOPYTHON[QAction *](action); Shiboken::AutoDecRef result(PyObject_CallMethod(%PYARG_0, const_cast<char *>("connect"), const_cast<char *>("OsO"), @@ -598,7 +595,7 @@ Shiboken::AutoDecRef result(PyObject_CallMethod(%PYARG_0, // @snippet qtoolbar-addaction-2 QAction *action = %CPPSELF.addAction(%1); -%PYARG_0 = %CONVERTTOPYTHON[QAction*](action); +%PYARG_0 = %CONVERTTOPYTHON[QAction *](action); Shiboken::AutoDecRef result(PyObject_CallMethod(%PYARG_0, const_cast<char *>("connect"), const_cast<char *>("OsO"), @@ -611,12 +608,12 @@ Shiboken::AutoDecRef result(PyObject_CallMethod(%PYARG_0, // @snippet qtoolbar-addaction-3 // @snippet qtoolbar-clear -QList<PyObject* > lst; -Shiboken::BindingManager& bm = Shiboken::BindingManager::instance(); -const auto &toolButtonChildren = %CPPSELF.findChildren<QToolButton*>(); +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); + PyObject *pyChild = %CONVERTTOPYTHON[QToolButton *](child); Shiboken::Object::setParent(0, pyChild); lst << pyChild; } @@ -625,14 +622,14 @@ for (auto *child : toolButtonChildren) { //Remove actions const auto &actions = %CPPSELF.actions(); for (auto *act : actions) { - Shiboken::AutoDecRef pyAct(%CONVERTTOPYTHON[QAction*](act)); + 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)); + Shiboken::Object::invalidate(reinterpret_cast<SbkObject *>(obj)); Py_XDECREF(obj); } // @snippet qtoolbar-clear @@ -648,9 +645,9 @@ if (!PyTuple_SetItem(empty, 0, PyList_New(0))) // @snippet qapplication-2 // @snippet qgraphicsproxywidget-setwidget -QWidget* _old = %CPPSELF.widget(); +QWidget *_old = %CPPSELF.widget(); if (_old) - Shiboken::Object::setParent(nullptr, %CONVERTTOPYTHON[QWidget*](_old)); + Shiboken::Object::setParent(nullptr, %CONVERTTOPYTHON[QWidget *](_old)); %CPPSELF.%FUNCTION_NAME(%1); Shiboken::Object::setParent(%PYSELF, %PYARG_1); // @snippet qgraphicsproxywidget-setwidget diff --git a/sources/pyside2/PySide2/glue/qtxml.cpp b/sources/pyside2/PySide2/glue/qtxml.cpp index ff8be58e2..684ff33c4 100644 --- a/sources/pyside2/PySide2/glue/qtxml.cpp +++ b/sources/pyside2/PySide2/glue/qtxml.cpp @@ -38,13 +38,13 @@ ****************************************************************************/ // @snippet qxmlentityresolver-resolveentity -QXmlInputSource* _qxmlinputsource_arg_ = nullptr; +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_)); +PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[QXmlInputSource *](_qxmlinputsource_arg_)); // @snippet qxmlentityresolver-resolveentity // @snippet qdomdocument-setcontent diff --git a/sources/pyside2/PySide2/glue/qtxmlpatterns.cpp b/sources/pyside2/PySide2/glue/qtxmlpatterns.cpp index b559ad1d4..75ad3b265 100644 --- a/sources/pyside2/PySide2/glue/qtxmlpatterns.cpp +++ b/sources/pyside2/PySide2/glue/qtxmlpatterns.cpp @@ -38,6 +38,6 @@ ****************************************************************************/ // @snippet qxmlschemavalidator-schema -QXmlSchema* %0 = new QXmlSchema(%CPPSELF.schema()); -%PYARG_0 = %CONVERTTOPYTHON[QXmlSchema*](%0); +QXmlSchema *%0 = new QXmlSchema(%CPPSELF.schema()); +%PYARG_0 = %CONVERTTOPYTHON[QXmlSchema *](%0); // @snippet qxmlschemavalidator-schema diff --git a/sources/pyside2/PySide2/pysideqtesttouch.h b/sources/pyside2/PySide2/pysideqtesttouch.h index 60d3bbe25..115c7835e 100644 --- a/sources/pyside2/PySide2/pysideqtesttouch.h +++ b/sources/pyside2/PySide2/pysideqtesttouch.h @@ -66,28 +66,28 @@ namespace QTest if (commitWhenDestroyed) commit(); } - PySideQTouchEventSequence* press(int touchId, const QPoint &pt, QWindow *window = 0) + PySideQTouchEventSequence *press(int touchId, const QPoint &pt, QWindow *window = nullptr) { QTouchEvent::TouchPoint &p = point(touchId); p.setScreenPos(mapToScreen(window, pt)); p.setState(Qt::TouchPointPressed); return this; } - PySideQTouchEventSequence* move(int touchId, const QPoint &pt, QWindow *window = 0) + PySideQTouchEventSequence *move(int touchId, const QPoint &pt, QWindow *window = nullptr) { QTouchEvent::TouchPoint &p = point(touchId); p.setScreenPos(mapToScreen(window, pt)); p.setState(Qt::TouchPointMoved); return this; } - PySideQTouchEventSequence* release(int touchId, const QPoint &pt, QWindow *window = 0) + PySideQTouchEventSequence *release(int touchId, const QPoint &pt, QWindow *window = nullptr) { QTouchEvent::TouchPoint &p = point(touchId); p.setScreenPos(mapToScreen(window, pt)); p.setState(Qt::TouchPointReleased); return this; } - PySideQTouchEventSequence* stationary(int touchId) + PySideQTouchEventSequence *stationary(int touchId) { QTouchEvent::TouchPoint &p = pointOrPreviousPoint(touchId); p.setState(Qt::TouchPointStationary); @@ -95,7 +95,7 @@ namespace QTest } #ifdef QT_WIDGETS_LIB - PySideQTouchEventSequence* press(int touchId, const QPoint &pt, QWidget *widget = 0) + PySideQTouchEventSequence *press(int touchId, const QPoint &pt, QWidget *widget = nullptr) { QTouchEvent::TouchPoint &p = point(touchId); p.setScreenPos(mapToScreen(widget, pt)); @@ -103,7 +103,7 @@ namespace QTest return this; } - PySideQTouchEventSequence* move(int touchId, const QPoint &pt, QWidget *widget = 0) + PySideQTouchEventSequence *move(int touchId, const QPoint &pt, QWidget *widget = nullptr) { QTouchEvent::TouchPoint &p = point(touchId); p.setScreenPos(mapToScreen(widget, pt)); @@ -111,7 +111,7 @@ namespace QTest return this; } - PySideQTouchEventSequence* release(int touchId, const QPoint &pt, QWidget *widget = 0) + PySideQTouchEventSequence *release(int touchId, const QPoint &pt, QWidget *widget = nullptr) { QTouchEvent::TouchPoint &p = point(touchId); p.setScreenPos(mapToScreen(widget, pt)); @@ -198,14 +198,14 @@ private: QTouchDevice *device; bool commitWhenDestroyed; #ifdef QT_WIDGETS_LIB - friend PySideQTouchEventSequence* generateTouchEvent(QWidget *, QTouchDevice*, bool); + friend PySideQTouchEventSequence *generateTouchEvent(QWidget *, QTouchDevice *, bool); #endif - friend PySideQTouchEventSequence* generateTouchEvent(QWindow *, QTouchDevice*, bool); + friend PySideQTouchEventSequence *generateTouchEvent(QWindow *, QTouchDevice *, bool); }; #ifdef QT_WIDGETS_LIB inline - PySideQTouchEventSequence* generateTouchEvent(QWidget *widget, + PySideQTouchEventSequence *generateTouchEvent(QWidget *widget, QTouchDevice *device, bool autoCommit = true) { @@ -213,7 +213,7 @@ private: } #endif inline - PySideQTouchEventSequence* generateTouchEvent(QWindow *window, + PySideQTouchEventSequence *generateTouchEvent(QWindow *window, QTouchDevice *device, bool autoCommit = true) { diff --git a/sources/pyside2/PySide2/qpytextobject.h b/sources/pyside2/PySide2/qpytextobject.h index ecdfa7fb5..1968ac385 100644 --- a/sources/pyside2/PySide2/qpytextobject.h +++ b/sources/pyside2/PySide2/qpytextobject.h @@ -54,9 +54,10 @@ class QPyTextObject : public QObject, public QTextObjectInterface Q_OBJECT Q_INTERFACES(QTextObjectInterface) public: - QPyTextObject(QObject* parent = 0) : QObject(parent) {} - void drawObject(QPainter* painter, const QRectF& rect, QTextDocument* doc, int posInDocument, const QTextFormat& format ) = 0; - QSizeF intrinsicSize(QTextDocument* doc, int posInDocument, const QTextFormat& format ) = 0; + QPyTextObject(QObject *parent = nullptr) : QObject(parent) {} + void drawObject(QPainter *painter, const QRectF &rect, QTextDocument *doc, + int posInDocument, const QTextFormat &format) = 0; + QSizeF intrinsicSize(QTextDocument *doc, int posInDocument, const QTextFormat &format) = 0; }; #endif |