[PyKDE] Help with QListViewItem
Per Gummedal
p.g at figu.no
Wed Sep 13 22:33:52 BST 2000
I have this simple source.
#!/usr/bin/env python
import string, sys
from qt import *
class List(QListView):
def __init__(self, *args):
apply(QListView.__init__,(self,) + args)
self.addColumn("A")
self.addColumn("B")
self.setShowSortIndicator(1);
self.data = (['1','2'], ['11','12'],['2','3'])
for row in self.data:
item = ListItem(self)
for i in range(len(row)):
item.setText(i, row[i])
class ListItem(QListViewItem):
def __init__(self, *args):
apply(QListViewItem.__init__,(self,) + args)
def key(self, col, asc):
print 'key'
return string.rjust(str(self.text()),2)
a = QApplication(sys.argv)
mw = List()
a.setMainWidget(mw)
mw.show()
a.exec_loop()
When I click on the columnheaders to sort, method key is not called.
What am I doing wrong, any ideas ?
Per
More information about the PyQt
mailing list