From e7ec7cf9d5e69f30552bcc79e891bf06cfdb3d16 Mon Sep 17 00:00:00 2001 From: Lauro Neto Date: Tue, 23 Mar 2010 16:02:31 -0300 Subject: Updates QMenuBar type system and adds custom code for addAction method. --- PySide/QtGui/glue/qmenubar_glue.h | 20 ++++++++++++++++++++ PySide/QtGui/typesystem_gui_common.xml | 17 ++++++++++++++++- 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 PySide/QtGui/glue/qmenubar_glue.h (limited to 'PySide/QtGui') diff --git a/PySide/QtGui/glue/qmenubar_glue.h b/PySide/QtGui/glue/qmenubar_glue.h new file mode 100644 index 000000000..9568fa87c --- /dev/null +++ b/PySide/QtGui/glue/qmenubar_glue.h @@ -0,0 +1,20 @@ +inline PyObject* +addActionWithPyObject(QMenuBar* self, const QString& text, PyObject* callback) +{ + QAction* act = new QAction(text, self); + + self->addAction(act); + + PyObject* pyAct = Shiboken::Converter::toPython(act); + PyObject* result = PyObject_CallMethod(pyAct, "connect", "OsO", pyAct, + SIGNAL(triggered(bool)), callback); + + if (result == 0 || result == Py_False) { + if (result) + Py_DECREF(result); + Py_DECREF(pyAct); + return 0; + } + + return pyAct; +} diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml index 42293461a..08efe3db5 100644 --- a/PySide/QtGui/typesystem_gui_common.xml +++ b/PySide/QtGui/typesystem_gui_common.xml @@ -1797,12 +1797,27 @@ + + + - + + + + + + + + %PYARG_0 = addActionWithPyObject(%CPPSELF, %1, %2); + + + + + -- cgit v1.2.3