aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2021-06-09 14:08:29 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2021-06-09 17:05:15 +0200
commitaf72829368a7a9c170749ece4225d529bc844cc2 (patch)
tree186873bb68007b254c444fb6a77236f443d2c82a
parentf090ca3c4431cb1ae569502fbf4bc68a0b9fa7e8 (diff)
libpyside: Add type check for PySideSignalInstanceType
Pick-to: 6.1 Task-number: PYSIDE-1482 Change-Id: I00d30c95bd5835b6d904bc28f671e284017fffb5 Reviewed-by: Christian Tismer <tismer@stackless.com>
-rw-r--r--sources/pyside6/libpyside/pysidesignal.cpp6
-rw-r--r--sources/pyside6/libpyside/pysidesignal.h16
2 files changed, 21 insertions, 1 deletions
diff --git a/sources/pyside6/libpyside/pysidesignal.cpp b/sources/pyside6/libpyside/pysidesignal.cpp
index faa6fdce1..276da1cad 100644
--- a/sources/pyside6/libpyside/pysidesignal.cpp
+++ b/sources/pyside6/libpyside/pysidesignal.cpp
@@ -733,6 +733,12 @@ bool checkType(PyObject *pyObj)
return false;
}
+bool checkInstanceType(PyObject *pyObj)
+{
+ return pyObj != nullptr
+ && PyType_IsSubtype(Py_TYPE(pyObj), PySideSignalInstanceTypeF()) != 0;
+}
+
void updateSourceObject(PyObject *source)
{
PyTypeObject *objType = reinterpret_cast<PyTypeObject *>(PyObject_Type(source));
diff --git a/sources/pyside6/libpyside/pysidesignal.h b/sources/pyside6/libpyside/pysidesignal.h
index 55e1ee405..edef37af1 100644
--- a/sources/pyside6/libpyside/pysidesignal.h
+++ b/sources/pyside6/libpyside/pysidesignal.h
@@ -72,7 +72,21 @@ extern "C"
namespace PySide {
namespace Signal {
-PYSIDE_API bool checkType(PyObject *type);
+/**
+ * This function checks for the PySideSignal type.
+ *
+ * @param pyObj
+ * @return whether pyObj is a PySideSignal
+ **/
+PYSIDE_API bool checkType(PyObject *pyObj);
+
+/**
+ * This function checks for the PySideSignalInstanceType type.
+ *
+ * @param pyObj
+ * @return Whether pyObj is a PySideSignalInstance
+ **/
+PYSIDE_API bool checkInstanceType(PyObject *pyObj);
/**
* Register all C++ signals of a QObject on Python type.