[PyKDE] QListViewItem problems
Per Gummedal
per.gummedal at broadpark.no
Fri May 2 09:51:00 BST 2003
Hi
I'm running python2.2.2, pyqt3.6, qt3.1.2 on win2000.
This program leaks memory when sorting.
If I remove the overridden key method there is no leaking.
Is it just me, or does anybody else see the same problem ?
Some thoughts ?
Thanks
Per
import sys, random
from qt import *
class ListView(QListView):
def __init__(self, *args):
QListView.__init__(self, None, 'Test', Qt.WType_TopLevel)
self.setCaption('Test')
self.addColumn('Col 1')
self.addColumn('Col 2')
def refresh(self, x):
self.clear()
for i in range(x):
item = ListViewItem(self)
item.key = str(random.randrange(1, 100))
item.setText(0, 'a ' + str(i))
item.setText(1, 'b ' + str(i))
class ListViewItem(QListViewItem):
def __init__(self, *args):
QListViewItem.__init__(self, *args)
def key(self, col, asc):
return self.key
a = QApplication(sys.argv)
widget = ListView()
widget.refresh(500)
widget.resize(200,200)
a.setMainWidget(widget)
widget.show()
a.exec_loop()
More information about the PyQt
mailing list