diff options
author | Renato Araujo Oliveira Filho <renato.filho@openbossa.org> | 2011-01-03 19:54:40 -0300 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-08 16:48:07 -0300 |
commit | cc7d8dd1386138a5e88afe64664f51c33aad2f56 (patch) | |
tree | a447067f09c84da9d9d794f651f05f18c80cebb8 /PySide | |
parent | 1f1f82d5827c3ec77fcd4ee6b6ab47afa0473007 (diff) |
Created support to function qAddPostRoutine.
Created unit test for bug #515
Fixes bug #515
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org>
Lauro Moura <lauro.neto@openbossa.org>
Diffstat (limited to 'PySide')
-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()"> |