diff options
author | Christian Tismer <tismer@stackless.com> | 2020-08-01 14:29:45 +0200 |
---|---|---|
committer | Christian Tismer <tismer@stackless.com> | 2020-09-14 16:05:34 +0200 |
commit | c39a7cac8767d91dbe98c959edeb68d05071b4b3 (patch) | |
tree | 9e7e907f3d15bf7b1e5eef45e2b67918c6cc4c0d /sources/pyside2/libpyside | |
parent | b4e2db38840e103b4c33dc5a417aa729f318cd96 (diff) |
Do some cleanup to pysideproperty.cpp and feature select
Change-Id: Id7e1a4f9f938f9b86e1e905936b78c1531f5a566
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'sources/pyside2/libpyside')
-rw-r--r-- | sources/pyside2/libpyside/pysideproperty.cpp | 20 | ||||
-rw-r--r-- | sources/pyside2/libpyside/pysideproperty.h | 18 |
2 files changed, 16 insertions, 22 deletions
diff --git a/sources/pyside2/libpyside/pysideproperty.cpp b/sources/pyside2/libpyside/pysideproperty.cpp index 85db745ae..433615e10 100644 --- a/sources/pyside2/libpyside/pysideproperty.cpp +++ b/sources/pyside2/libpyside/pysideproperty.cpp @@ -73,7 +73,7 @@ static PyMethodDef PySidePropertyMethods[] = { }; static PyGetSetDef PySidePropertyType_getset[] = { - {"__doc__", qPropertyDocGet, nullptr, nullptr, nullptr}, + {const_cast<char *>("__doc__"), qPropertyDocGet, nullptr, nullptr, nullptr}, {nullptr, nullptr, nullptr, nullptr, nullptr} }; @@ -167,7 +167,7 @@ static PyObject *qpropertyTpNew(PyTypeObject *subtype, PyObject * /* args */, Py return reinterpret_cast<PyObject *>(me); } -int qpropertyTpInit(PyObject *self, PyObject *args, PyObject *kwds) +static int qpropertyTpInit(PyObject *self, PyObject *args, PyObject *kwds) { PyObject *type = nullptr; auto data = reinterpret_cast<PySideProperty *>(self); @@ -218,7 +218,7 @@ int qpropertyTpInit(PyObject *self, PyObject *args, PyObject *kwds) return -1; } -void qpropertyDeAlloc(PyObject *self) +static void qpropertyDeAlloc(PyObject *self) { qpropertyClear(self); if (PepRuntime_38_flag) { @@ -229,7 +229,7 @@ void qpropertyDeAlloc(PyObject *self) Py_TYPE(self)->tp_free(self); } -PyObject *qPropertyCall(PyObject *self, PyObject *args, PyObject * /* kw */) +static PyObject *qPropertyCall(PyObject *self, PyObject *args, PyObject * /* kw */) { PyObject *callback = PyTuple_GetItem(args, 0); if (PyFunction_Check(callback)) { @@ -246,7 +246,7 @@ PyObject *qPropertyCall(PyObject *self, PyObject *args, PyObject * /* kw */) return nullptr; } -PyObject *qPropertySetter(PyObject *self, PyObject *callback) +static PyObject *qPropertySetter(PyObject *self, PyObject *callback) { if (PyFunction_Check(callback)) { PySideProperty *prop = reinterpret_cast<PySideProperty *>(self); @@ -262,7 +262,7 @@ PyObject *qPropertySetter(PyObject *self, PyObject *callback) return nullptr; } -PyObject *qPropertyGetter(PyObject *self, PyObject *callback) +static PyObject *qPropertyGetter(PyObject *self, PyObject *callback) { if (PyFunction_Check(callback)) { PySideProperty *prop = reinterpret_cast<PySideProperty *>(self); @@ -291,8 +291,7 @@ static PyObject *qPropertyDocGet(PyObject *self, void *) return PyString_FromString(doc); #endif } - Py_INCREF(Py_None); - return Py_None; + Py_RETURN_NONE; } @@ -433,11 +432,6 @@ PySideProperty *getObject(PyObject *source, PyObject *name) { PyObject *attr = nullptr; - if (Shiboken::Object::isUserType(source)) { - if (auto dict = reinterpret_cast<SbkObject *>(source)->ob_dict) - attr = PyDict_GetItem(dict, name); - } - attr = getFromType(Py_TYPE(source), name); if (attr && checkType(attr)) { Py_INCREF(attr); diff --git a/sources/pyside2/libpyside/pysideproperty.h b/sources/pyside2/libpyside/pysideproperty.h index a97b2a48f..4a467b186 100644 --- a/sources/pyside2/libpyside/pysideproperty.h +++ b/sources/pyside2/libpyside/pysideproperty.h @@ -62,7 +62,7 @@ namespace PySide { namespace Property { typedef void (*MetaCallHandler)(PySideProperty*,PyObject*,QMetaObject::Call, void**); -PYSIDE_API bool checkType(PyObject* pyObj); +PYSIDE_API bool checkType(PyObject *pyObj); /** * This function call set property function and pass value as arg @@ -73,7 +73,7 @@ PYSIDE_API bool checkType(PyObject* pyObj); * @param value The value to set in property * @return Return 0 if ok or -1 if this function fail **/ -PYSIDE_API int setValue(PySideProperty* self, PyObject* source, PyObject* value); +PYSIDE_API int setValue(PySideProperty *self, PyObject *source, PyObject *value); /** * This function call get property function @@ -83,7 +83,7 @@ PYSIDE_API int setValue(PySideProperty* self, PyObject* source, PyObject* value) * @param source The QObject witch has the property * @return Return the result of property get function or 0 if this fail **/ -PYSIDE_API PyObject* getValue(PySideProperty* self, PyObject* source); +PYSIDE_API PyObject *getValue(PySideProperty *self, PyObject *source); /** * This function return the notify name used on this property @@ -91,7 +91,7 @@ PYSIDE_API PyObject* getValue(PySideProperty* self, PyObject* source); * @param self The property object * @return Return a const char with the notify name used **/ -PYSIDE_API const char* getNotifyName(PySideProperty* self); +PYSIDE_API const char *getNotifyName(PySideProperty *self); /** @@ -101,14 +101,14 @@ PYSIDE_API const char* getNotifyName(PySideProperty* self); * @param name The property name * @return Return a new reference to property object **/ -PYSIDE_API PySideProperty* getObject(PyObject* source, PyObject* name); +PYSIDE_API PySideProperty *getObject(PyObject *source, PyObject *name); -PYSIDE_API void setMetaCallHandler(PySideProperty* self, MetaCallHandler handler); +PYSIDE_API void setMetaCallHandler(PySideProperty *self, MetaCallHandler handler); -PYSIDE_API void setTypeName(PySideProperty* self, const char* typeName); +PYSIDE_API void setTypeName(PySideProperty *self, const char *typeName); -PYSIDE_API void setUserData(PySideProperty* self, void* data); -PYSIDE_API void* userData(PySideProperty* self); +PYSIDE_API void setUserData(PySideProperty *self, void *data); +PYSIDE_API void* userData(PySideProperty *self); } //namespace Property } //namespace PySide |