[PyKDE] QListView

Fredrik Juhlin laz at strakt.com
Sat Dec 21 18:27:01 GMT 2002


On Sat, Dec 21, 2002 at 07:13:25PM +0200, Oleksandr Yakovlyev wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> 
> maybe it is off topic, but i not found nothing yet about it:
> 
> If i defined my own ListViewItem with my functions
> 
> class MyListViewItem(QListViewItem)
> 	...
> 
> class MyListView(QListView)
> 	...
> 	self.connect(listview, SIGNAL("clicked ( QListViewItem * item )"), 
> self.myslot )
> 
> what type of object I will receive with signal 
> "clicked ( QListViewItem * item )" ?
Since you'll get an instance of an item in the list, it will be a 
MyListViewItem (assuming, of course, that that was what you 
instantiated in the first place.)

> and how check what type of object (if i have few ListViewItem declared ?)
isinstance(item, MyListViewItem). Usage of isinstance() is frowned by 
Python purists though, and they would probably suggest that your 
different types of item objects all implemented e.g. an itemType() 
method for figuring out what kind of item it is.

//Fredrik




More information about the PyQt mailing list