summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Filho <renato.filho@openbossa.org>2011-05-19 18:12:00 -0300
committerRenato Filho <renato.filho@openbossa.org>2011-05-23 17:43:23 -0300
commitfe06dba43ca7cd7ed5864b1035bfca46acc3dadb (patch)
tree0b5ec8669f3ee8bf5d964b3477eda1badff7d1a2
parentcef6db95483f278212429a63bd4e6814a81066f8 (diff)
downloadpyside-fe06dba43ca7cd7ed5864b1035bfca46acc3dadb.tar.gz
pyside-fe06dba43ca7cd7ed5864b1035bfca46acc3dadb.tar.xz
pyside-fe06dba43ca7cd7ed5864b1035bfca46acc3dadb.zip
Create checkType for libpyside objects.
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org> Hugo Parente Lima <hugo.pl@gmail.com>
-rw-r--r--libpyside/pysideproperty.cpp7
-rw-r--r--libpyside/pysideproperty.h2
-rw-r--r--libpyside/pysidesignal.cpp7
-rw-r--r--libpyside/pysidesignal.h2
4 files changed, 17 insertions, 1 deletions
diff --git a/libpyside/pysideproperty.cpp b/libpyside/pysideproperty.cpp
index fb91165..5f11d36 100644
--- a/libpyside/pysideproperty.cpp
+++ b/libpyside/pysideproperty.cpp
@@ -205,7 +205,7 @@ void init(PyObject* module)
PyModule_AddObject(module, QPROPERTY_CLASS_NAME, ((PyObject*)&PySidePropertyType));
}
-bool isPropertyType(PyObject* pyObj)
+bool checkType(PyObject* pyObj)
{
if (pyObj) {
return PyType_IsSubtype(pyObj->ob_type, &PySidePropertyType);
@@ -213,6 +213,11 @@ bool isPropertyType(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/libpyside/pysideproperty.h b/libpyside/pysideproperty.h
index b5bad18..ce2704a 100644
--- a/libpyside/pysideproperty.h
+++ b/libpyside/pysideproperty.h
@@ -43,7 +43,9 @@ namespace PySide { namespace Property {
typedef void (*MetaCallHandler)(PySideProperty*,PyObject*,QMetaObject::Call, void**);
+PYSIDE_API bool checkType(PyObject* pyObj);
+//Deprecated (use checkType)
PYSIDE_API bool isPropertyType(PyObject* pyObj);
/**
diff --git a/libpyside/pysidesignal.cpp b/libpyside/pysidesignal.cpp
index 4cbc789..763456a 100644
--- a/libpyside/pysidesignal.cpp
+++ b/libpyside/pysidesignal.cpp
@@ -473,6 +473,13 @@ void init(PyObject* module)
Py_INCREF(&PySideSignalInstanceType);
}
+bool checkType(PyObject* pyObj)
+{
+ if (pyObj)
+ return PyType_IsSubtype(pyObj->ob_type, &PySideSignalType);
+ return false;
+}
+
void updateSourceObject(PyObject* source)
{
PyTypeObject * objType = reinterpret_cast<PyTypeObject *>(PyObject_Type(source));
diff --git a/libpyside/pysidesignal.h b/libpyside/pysidesignal.h
index 443572c..d0efe16 100644
--- a/libpyside/pysidesignal.h
+++ b/libpyside/pysidesignal.h
@@ -49,6 +49,8 @@ extern "C"
namespace PySide { namespace Signal {
+PYSIDE_API bool checkType(PyObject* type);
+
/**
* This function creates a Signal object which stay attached to QObject class
*