summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--PySide/QtGui/typesystem_gui_common.xml7
-rw-r--r--tests/QtGui/CMakeLists.txt1
-rw-r--r--tests/QtGui/bug_1041.py35
3 files changed, 43 insertions, 0 deletions
diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml
index 552636a..14a4ef7 100644
--- a/PySide/QtGui/typesystem_gui_common.xml
+++ b/PySide/QtGui/typesystem_gui_common.xml
@@ -1890,6 +1890,13 @@
<define-ownership class="target" owner="default"/>
</modify-argument>
</modify-function>
+ <modify-function signature="selectionModel() const">
+ <modify-argument index="return">
+ <!-- Defining ownership as "default" avoids the object to be
+ automatically set as parent of the returned pointer. -->
+ <define-ownership class="target" owner="default"/>
+ </modify-argument>
+ </modify-function>
<modify-function signature="setIndexWidget(const QModelIndex &amp;, QWidget *)">
<modify-argument index="2">
<parent index="this" action="add"/>
diff --git a/tests/QtGui/CMakeLists.txt b/tests/QtGui/CMakeLists.txt
index 9bac913..5998ca5 100644
--- a/tests/QtGui/CMakeLists.txt
+++ b/tests/QtGui/CMakeLists.txt
@@ -79,6 +79,7 @@ PYSIDE_TEST(bug_991.py)
PYSIDE_TEST(bug_998.py)
PYSIDE_TEST(bug_1002.py)
PYSIDE_TEST(bug_1006.py)
+PYSIDE_TEST(bug_1041.py)
PYSIDE_TEST(bug_1048.py)
PYSIDE_TEST(bug_1077.py)
PYSIDE_TEST(customproxywidget_test.py)
diff --git a/tests/QtGui/bug_1041.py b/tests/QtGui/bug_1041.py
new file mode 100644
index 0000000..735bf73
--- /dev/null
+++ b/tests/QtGui/bug_1041.py
@@ -0,0 +1,35 @@
+''' unit test for BUG #1041 '''
+
+import sys
+from PySide.QtGui import *
+from PySide.QtCore import *
+
+class BugWindow(QMainWindow):
+ def __init__(self):
+ super(BugWindow, self).__init__()
+ self.setCentralWidget(QTableView())
+ self.timer = QTimer(self)
+ self.timer.timeout.connect(self.doTest)
+ self.timer.start(20)
+ self.count = 0
+
+ @Slot()
+ def doTest(self):
+ self.m = QStandardItemModel(1, 1, None)
+
+ try:
+ table = self.centralWidget()
+ table.setModel(self.m)
+ table.selectionModel()
+ except AttributeError:
+ sys.exit(-1)
+
+ if self.count >= 50:
+ QApplication.instance().quit()
+
+ self.count += 1
+
+if __name__ == "__main__":
+ app = QApplication(sys.argv)
+ window = BugWindow()
+ sys.exit(app.exec_())