summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaulo Alcantara <pcacjr@zytor.com>2012-02-25 20:51:49 -0300
committerPaulo Alcantara <pcacjr@zytor.com>2012-02-25 21:01:07 -0300
commit797c7b26d1e9c2dc3f7ca9aa48b50c349b732a8b (patch)
tree791351bd2651ff8906d1b62900769599b5e1dbc4
parent5c1472ec04e8796412ef8186cf3d75c7a1740073 (diff)
downloadpyside-bug1138.tar.gz
pyside-bug1138.tar.xz
pyside-bug1138.zip
Fix BUG #1138 - "Subclassing of QUiLoader leads to "Internal C++ objectbug1138
already deleted" exception (again)"" Also avoid the QUILoader object to automatically be set as parent of the returned object for createAction() and createActionGroup() methods of the QUiLoader object. Signed-off-by: Paulo Alcantara <pcacjr@zytor.com>
-rw-r--r--PySide/QtUiTools/typesystem_uitools.xml3
-rw-r--r--tests/QtUiTools/CMakeLists.txt1
-rw-r--r--tests/QtUiTools/bug_1138.py19
-rw-r--r--tests/QtUiTools/bug_1138.ui44
4 files changed, 67 insertions, 0 deletions
diff --git a/PySide/QtUiTools/typesystem_uitools.xml b/PySide/QtUiTools/typesystem_uitools.xml
index 08e98bd..8a46b7a 100644
--- a/PySide/QtUiTools/typesystem_uitools.xml
+++ b/PySide/QtUiTools/typesystem_uitools.xml
@@ -73,18 +73,21 @@
<modify-function signature="createAction(QObject*, const QString&amp;)">
<modify-argument index="return">
<parent index="1" action="add"/>
+ <define-ownership class="target" owner="default"/>
</modify-argument>
</modify-function>
<modify-function signature="createActionGroup(QObject*, const QString&amp;)">
<modify-argument index="return">
<parent index="1" action="add"/>
+ <define-ownership class="target" owner="default"/>
</modify-argument>
</modify-function>
<modify-function signature="createLayout(const QString&amp;, QObject*, const QString&amp;)">
<modify-argument index="return">
<parent index="2" action="add"/>
+ <define-ownership class="target" owner="default"/>
</modify-argument>
</modify-function>
diff --git a/tests/QtUiTools/CMakeLists.txt b/tests/QtUiTools/CMakeLists.txt
index 68ed7f1..39e2e94 100644
--- a/tests/QtUiTools/CMakeLists.txt
+++ b/tests/QtUiTools/CMakeLists.txt
@@ -9,5 +9,6 @@ PYSIDE_TEST(bug_913.py)
PYSIDE_TEST(bug_958.py)
PYSIDE_TEST(bug_965.py)
PYSIDE_TEST(bug_1060.py)
+PYSIDE_TEST(bug_1138.py)
PYSIDE_TEST(uiloader_test.py)
PYSIDE_TEST(ui_test.py)
diff --git a/tests/QtUiTools/bug_1138.py b/tests/QtUiTools/bug_1138.py
new file mode 100644
index 0000000..98a2bc4
--- /dev/null
+++ b/tests/QtUiTools/bug_1138.py
@@ -0,0 +1,19 @@
+from PySide import QtCore, QtGui
+from PySide.QtUiTools import QUiLoader
+from helper import adjust_filename
+
+class MyQUiLoader(QUiLoader):
+ def __init__(self):
+ super(MyQUiLoader, self).__init__()
+
+ def createLayout(self, *args):
+ return super(MyQUiLoader, self).createLayout(*args)
+
+if __name__ == "__main__":
+ app = QtGui.QApplication([])
+
+ ui = MyQUiLoader().load(adjust_filename("bug_1138.ui", __file__))
+
+ label = QtGui.QLabel("test")
+ ui.verLayout.addWidget(label)
+ ui.show()
diff --git a/tests/QtUiTools/bug_1138.ui b/tests/QtUiTools/bug_1138.ui
new file mode 100644
index 0000000..67bb826
--- /dev/null
+++ b/tests/QtUiTools/bug_1138.ui
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>polyline_drawer_widget</class>
+ <widget class="QDockWidget" name="polyline_drawer_widget">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>85</width>
+ <height>502</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="floating">
+ <bool>false</bool>
+ </property>
+ <property name="features">
+ <set>QDockWidget::AllDockWidgetFeatures</set>
+ </property>
+ <property name="allowedAreas">
+ <set>Qt::RightDockWidgetArea</set>
+ </property>
+ <property name="windowTitle">
+ <string/>
+ </property>
+ <widget class="QWidget" name="widget">
+ <layout class="QVBoxLayout" name="verLayout">
+ <property name="sizeConstraint">
+ <enum>QLayout::SetFixedSize</enum>
+ </property>
+ <property name="margin">
+ <number>1</number>
+ </property>
+ </layout>
+ </widget>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>