Removed glue code for QObject.inherits function.
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org>
Hugo Parente Lima <hugo.pl@gmail.com>
This commit is contained in:
parent
f549793a5c
commit
ebaf95ca1a
3 changed files with 20 additions and 19 deletions
|
|
@ -1382,25 +1382,6 @@
|
||||||
%PYARG_0 = %CONVERTTOPYTHON[bool](qobjectDisconnectCallback(%1, %2, %3));
|
%PYARG_0 = %CONVERTTOPYTHON[bool](qobjectDisconnectCallback(%1, %2, %3));
|
||||||
</inject-code>
|
</inject-code>
|
||||||
</add-function>
|
</add-function>
|
||||||
<inject-code class="native" position="beginning">
|
|
||||||
static bool
|
|
||||||
qobjectInheritsInternal(PyTypeObject *objType, const char *class_name)
|
|
||||||
{
|
|
||||||
if (strcmp(objType->tp_name, class_name) == 0)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
PyTypeObject* base = (objType)->tp_base;
|
|
||||||
if (base == 0)
|
|
||||||
return false;
|
|
||||||
return qobjectInheritsInternal(base, class_name);
|
|
||||||
}
|
|
||||||
</inject-code>
|
|
||||||
<modify-function signature="inherits(const char*) const">
|
|
||||||
<inject-code class="target" position="beginning">
|
|
||||||
bool retval = qobjectInheritsInternal(self->ob_type, %1) ? true : %CPPSELF.%FUNCTION_NAME(%1);
|
|
||||||
%PYARG_0 = %CONVERTTOPYTHON[bool](retval);
|
|
||||||
</inject-code>
|
|
||||||
</modify-function>
|
|
||||||
<inject-code class="native" file="glue/qobject_findchild.cpp"/>
|
<inject-code class="native" file="glue/qobject_findchild.cpp"/>
|
||||||
<add-function signature="findChild(PyTypeObject*, const QString&)" return-type="PyObject*">
|
<add-function signature="findChild(PyTypeObject*, const QString&)" return-type="PyObject*">
|
||||||
<inject-code class="target" position="beginning">
|
<inject-code class="target" position="beginning">
|
||||||
|
|
|
||||||
|
|
@ -284,5 +284,17 @@ PyObject* getMetaDataFromQObject(QObject* cppSelf, PyObject* self, PyObject* nam
|
||||||
return attr;
|
return attr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool inherits(PyTypeObject* objType, const char* class_name)
|
||||||
|
{
|
||||||
|
if (strcmp(objType->tp_name, class_name) == 0)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
PyTypeObject* base = (objType)->tp_base;
|
||||||
|
if (base == 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return inherits(base, class_name);
|
||||||
|
}
|
||||||
|
|
||||||
} //namespace PySide
|
} //namespace PySide
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -102,6 +102,14 @@ PYSIDE_API void destroyQCoreApplication();
|
||||||
*/
|
*/
|
||||||
PYSIDE_API PyObject* getMetaDataFromQObject(QObject* cppSelf, PyObject* self, PyObject* name);
|
PYSIDE_API PyObject* getMetaDataFromQObject(QObject* cppSelf, PyObject* self, PyObject* name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if self inherits from class_name
|
||||||
|
* \param self Python object
|
||||||
|
* \param class_name strict with the class name
|
||||||
|
* \return Returns true if self object inherits from class_name, otherwise returns false
|
||||||
|
*/
|
||||||
|
PYSIDE_API bool inherits(PyTypeObject* self, const char* class_name);
|
||||||
|
|
||||||
} //namespace PySide
|
} //namespace PySide
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue