summaryrefslogtreecommitdiffstats
path: root/tests/QtGui/bug_1129.py
blob: 565b7792f9e3e195eb00d2268593cd3a1fd7223c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
''' unit test for BUG #1129 '''
''' See http://bugs.pyside.org/show_bug.cgi?id=1129. '''

from PySide import QtCore, QtGui
from helper import UsesQApplication
import unittest

class Item(QtGui.QStandardItem):
    def data(self, role):
        if role == QtCore.Qt.DisplayRole:
            return str(self.model())

        return super(Item, self).data(role)

class Window(QtGui.QMainWindow):
    def __init__(self, parent=None):
        super(Window, self).__init__(parent)

        model = QtGui.QStandardItemModel(1, 1, self)
        model.setItem(0, 0, Item())

        self.setCentralWidget(QtGui.QTreeView(self))
        self.centralWidget().setModel(model)

        QtCore.QTimer.singleShot(0, self.raise_)

class QStandardItemTestCase(UsesQApplication):
    def testDataFunction(self):
        w = Window()
        w.show()

if __name__ == "__main__":
    unittest.main()