[PyKDE] QListView problem :$

Bart Verwilst verwilst at gentoo.org
Mon Dec 23 14:33:00 GMT 2002


I'm trying to add 2 items to a listview.. I have inherited QListViewItem in a 
TreeViewItem class of my own. Added a top item to the list is no problem. 
Adding several top items works fine as well. But as soon as i want to add a 
child node to one of these top items, my GUI just hangs.. I hope you guys can 
help me out :$ 

Here are the files i'm using:

------------ treeviewitem.py ------------------------

from qt import *

class TreeViewItem(QListViewItem):
	def __init__(self, parent, attrs):
		QListViewItem.__init__(self, parent)
		self.attrs = {}
		self.parent = parent
		self.URL = ""
		self.Hash = ""
		for i in range(self.parent.columns()):
			self.attrs[str(self.parent.columnText(i))] = attrs[i] ## Make a dictionary 
of the columns and their values.
			self.setText(i, attrs[i]) ## Fill listview with its values

	def URL(self, data = ""):
		""" Stores the URL of the down/upload"""
		if data == "":
			return self.URL
			self.URL = data
	def Hash(self, data = ""):
		""" Stores the Hash of the down/upload"""
		if data == "":
			return self.Hash
			self.Hash = data


------------ test.py ------------------------

from qt import qApp
from treeviewitem import *

new_list_item = TreeViewItem(win.lstTest, ("kljklj","kkjl","kkjlk"))

# The above alone works!
# And commenting these lines below work too.. Otherwise, no can do..

new_child_item = TreeViewItem(new_list_item, ("kljklj","kkjl","kkjlk"))


I really hope you guys can help me out :$ 
Thanks in advance!

Bart Verwilst
Gentoo Linux Developer, Desktop Team
Gent, Belgium

More information about the PyQt mailing list