diff options
Diffstat (limited to 'PySide/QtCore/typesystem_core.xml')
-rw-r--r-- | PySide/QtCore/typesystem_core.xml | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml index c785f797d..df04ca9c8 100644 --- a/PySide/QtCore/typesystem_core.xml +++ b/PySide/QtCore/typesystem_core.xml @@ -596,6 +596,37 @@ </inject-code> </add-function> + <inject-code class="native" position="beginning"> + namespace PySide { + static QStack<PyObject*> globalPostRoutineFunctions; + void globalPostRoutineCallback() + { + foreach(PyObject* callback, globalPostRoutineFunctions) { + Shiboken::AutoDecRef result(PyObject_CallObject(callback, NULL)); + Py_DECREF(callback); + } + globalPostRoutineFunctions.clear(); + } + void addPostRoutine(PyObject* callback) + { + if (PyCallable_Check(callback)) { + globalPostRoutineFunctions << callback; + Py_INCREF(callback); + } else { + PyErr_SetString(PyExc_TypeError, "qAddPostRoutine: The argument must be a callable object."); + } + } + } // namespace + </inject-code> + <add-function signature="qAddPostRoutine(PyObject*)"> + <inject-code class="target" position="beginning"> + PySide::addPostRoutine(%1); + </inject-code> + </add-function> + <inject-code class="target" position="end"> + qAddPostRoutine(PySide::globalPostRoutineCallback); + </inject-code> + <inject-code class="target" position="end" file="glue/qt_version.cpp" /> <add-function signature="__moduleShutdown()"> |