[PyKDE] subclassing QListViewItem

Peter Bienstman Peter.Bienstman at ugent.be
Mon Oct 27 18:26:00 GMT 2003


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi all,

The following code works as expected:

QListViewItem(self.element_list, "foo")

But now I'm trying to subclass a QListViewItem:

class ElementItem(QListViewItem):
    def __init__(self,  parent, elem):
        QListViewItem.__init__(parent, "foo")  # line x
	...

If I try this:

ElementItem(self.element_list, elem)

I get:

line x: TypeError: unbound method __init__() must be called with QListViewItem 
instance as first argument (got QListView instance instead)

But I was able to give it a QListView as first constructor argument when I 
created the ListViewItems directly.

Am I missing something?

Thanks!

- -- 
- ------------------------------------------------
Peter Bienstman
Ghent University, Dep. of Information Technology
Sint-Pietersnieuwstraat 41, B-9000 Gent, Belgium
tel: +32 9 264 34 45, fax: +32 9 264 35 93
WWW: http://photonics.intec.ugent.be
email: Peter.Bienstman at ugent.be
- ------------------------------------------------
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQE/nVTM4dgPAIjyquoRAi1zAJ48Ufq23JkbIkgja96Obrdyq2Pe2QCeI0Xq
fWz22T3CwG+YjiD67Z4Kqoc=
=5rfs
-----END PGP SIGNATURE-----




More information about the PyQt mailing list