aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Filho <renato.filho@openbossa.org>2011-08-24 17:22:56 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:54:47 -0300
commit138d8c42681a0fd2a73d8ac94aae375af21e6892 (patch)
tree3a067b244d77eeb67e16d626b093c4c4e69a0994
parentf5a1baac2f018bf75023c9ec98c06b885ac3c1ff (diff)
Fixed QMenu, QMenuBar, QToolBar clear function.
During the clear function all QActions need be destroyed. Reviewed by: Hugo Parente <hugo.lima@openbossa.org> Luciano Wolf <luciano.wolf@openbossa.org>
-rw-r--r--PySide/QtGui/typesystem_gui_common.xml42
1 files changed, 42 insertions, 0 deletions
diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml
index 626c249bc..c35a759b2 100644
--- a/PySide/QtGui/typesystem_gui_common.xml
+++ b/PySide/QtGui/typesystem_gui_common.xml
@@ -2370,6 +2370,10 @@
<modify-argument index="3">
<replace-default-expression with="0" />
</modify-argument>
+ <modify-argument index="return">
+ <parent index="this" action="add"/>
+ </modify-argument>
+
<inject-code class="target" position="beginning">
%PYARG_0 = addActionWithPyObject(%CPPSELF, QIcon(), %1, %2, %3);
</inject-code>
@@ -2379,11 +2383,25 @@
<modify-argument index="4">
<replace-default-expression with="0" />
</modify-argument>
+ <modify-argument index="return">
+ <parent index="this" action="add"/>
+ </modify-argument>
+
<inject-code class="target" position="beginning">
%PYARG_0 = addActionWithPyObject(%CPPSELF, %1, %2, %3, %4);
</inject-code>
</add-function>
+ <modify-function signature="clear()">
+ <inject-code>
+ foreach(QAction *act, %CPPSELF.actions()) {
+ Shiboken::AutoDecRef pyAct(%CONVERTTOPYTHON[QAction*](act));
+ Shiboken::Object::setParent(NULL, pyAct);
+ Shiboken::Object::invalidate(pyAct);
+ }
+ </inject-code>
+ </modify-function>
+
</object-type>
<object-type name="QMenuBar">
@@ -2434,6 +2452,15 @@
<parent index="this" action="add"/>
</modify-argument>
</modify-function>
+ <modify-function signature="clear()">
+ <inject-code>
+ foreach(QAction *act, %CPPSELF.actions()) {
+ Shiboken::AutoDecRef pyAct(%CONVERTTOPYTHON[QAction*](act));
+ Shiboken::Object::setParent(NULL, pyAct);
+ Shiboken::Object::invalidate(pyAct);
+ }
+ </inject-code>
+ </modify-function>
</object-type>
<object-type name="QMotifStyle">
<!--### Obsolete in 4.3-->
@@ -5123,6 +5150,10 @@
<modify-argument index="4">
<remove-argument />
</modify-argument>
+ <modify-argument index="return">
+ <parent index="this" action="add"/>
+ </modify-argument>
+
<inject-code>
QAction* action = %CPPSELF.addAction(%1, %2);
%PYARG_0 = %CONVERTTOPYTHON[QAction*](action);
@@ -5136,6 +5167,9 @@
<modify-argument index="3">
<remove-argument />
</modify-argument>
+ <modify-argument index="return">
+ <parent index="this" action="add"/>
+ </modify-argument>
<inject-code>
QAction* action = %CPPSELF.addAction(%1);
%PYARG_0 = %CONVERTTOPYTHON[QAction*](action);
@@ -5189,6 +5223,14 @@
lst &lt;&lt; pyChild;
}
}
+
+ //Remove actions
+ foreach(QAction *act, %CPPSELF.actions()) {
+ Shiboken::AutoDecRef pyAct(%CONVERTTOPYTHON[QAction*](act));
+ Shiboken::Object::setParent(NULL, pyAct);
+ Shiboken::Object::invalidate(pyAct);
+ }
+
%CPPSELF.clear();
foreach(PyObject* obj, lst) {
Shiboken::Object::invalidate(reinterpret_cast&lt;SbkObject* &gt;(obj));