aboutsummaryrefslogtreecommitdiffstats
path: root/PySide/QtGui
diff options
context:
space:
mode:
authorrenatofilho <renato.filho@openbossa.org>2010-09-30 12:07:20 -0300
committerrenatofilho <renato.filho@openbossa.org>2010-09-30 14:43:02 -0300
commit44af04703081f529c433f0fbc5229e9e0d12304f (patch)
treec910d2dc860adde48cb70854bad79f607738843d /PySide/QtGui
parent5222609f31c298f4f729789a0f7764a4496b5ae9 (diff)
Fix QWidget::style / QWidget::setStyle ownership rules.
Fixes bug #389. Reviewer: Luciano Wolf <luciano.wolf@openbossa.org> Marcelo Lira <marcelo.lira@openbossa.org>
Diffstat (limited to 'PySide/QtGui')
-rw-r--r--PySide/QtGui/typesystem_gui_common.xml25
1 files changed, 25 insertions, 0 deletions
diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml
index 6e1ef31d8..b490319e2 100644
--- a/PySide/QtGui/typesystem_gui_common.xml
+++ b/PySide/QtGui/typesystem_gui_common.xml
@@ -3248,6 +3248,31 @@
<modify-argument index="1" invalidate-after-use="yes"/>
</modify-function>
+ <modify-function signature="setStyle(QStyle*)">
+ <inject-code class="target" position="end">
+ Shiboken::keepReference(reinterpret_cast&lt;Shiboken::SbkBaseWrapper*&gt;(%PYSELF), "__style__", %PYARG_1);
+ </inject-code>
+ </modify-function>
+ <modify-function signature="style()const">
+ <inject-code class="target" position="end">
+ QStyle* myStyle = %CPPSELF->style();
+ if (myStyle &amp;&amp; qApp) {
+ %PYARG_0 = %CONVERTTOPYTHON[QStyle*](myStyle);
+ QStyle *appStyle = qApp->style();
+ if (appStyle == myStyle) {
+ Shiboken::AutoDecRef pyApp(%CONVERTTOPYTHON[QApplication*](qApp));
+ Shiboken::setParent(pyApp, %PYARG_0);
+ SbkBaseWrapper_setOwnership(%PYARG_0, false);
+ } else {
+ Shiboken::keepReference(reinterpret_cast&lt;Shiboken::SbkBaseWrapper*&gt;(%PYSELF), "__style__", %PYARG_0);
+ }
+ }
+ </inject-code>
+ <modify-argument index="return">
+ <define-ownership owner="default"/>
+ </modify-argument>
+ </modify-function>
+
<modify-function signature="render(QPainter*,QPoint,QRegion,QFlags&lt;QWidget::RenderFlag&gt;)">
<modify-argument index="2">
<!-- Removed because the render(QPainter*) overload conflicts with the identical function in QGraphicsView -->