[PyKDE] Problem with QListView

Simon Green GreenCS at logica.com
Wed Mar 29 18:14:35 BST 2000


Hi all,

I've recently started work on a little project. I'm writing a program to
automatically check for updates to selected RPM packages, and I decided
a nice GUI would be useful to keep the configuration in order.
Originally I was going to use Tkinter, which I've used before, but
decided I should go with the flow and use a toolkit that fitted in with
the current crop of window managers. I prefer KDE to Gnome (thanks
largely to the fact that the first Gnome version I had was buggy and
didn't start properly half the time) so I found PyQt/PyKDE. Anyway, one
of the things I wanted to do was show a list with the following items: a
tag (basically a number), a connection type (FTP, HTTP), a hostname, and
a free-text description.

I decided that a QListView looked perfect for what I wanted. When I
started to work on it, though, I had a bit of a problem. I could create
the object, and I could add QListViewItems to it. (Contrary to the Qt
docs, you *have* to use insertItem(), but that's not a problem). I
confirmed the child QListViewItem objects were there by using
childCount(). It returned 3 which was what I inserted while I was just
testing the look of the interface. I was also able to successfully add
the headers. However, as soon as you do a QListView.show(), something
seems to go badly wrong.  The software goes into an infinte loop, and it
looks like it's in the C code, not Python code, since if you put a print
before and after the show() call, only the first one prints out. The
program uses 100% CPU, so it's not just waiting for something else to
show() first.

Are there any known problems with it, or is there some gotcha I haven't
seen in the documentation? As far as I can see, I only need to create
it, possibly move/size/otherwise pretty-fy, insert the QListViewItems I
want using insertItem(), and then show() it. Am I missing something?

BTW: thanks to Phil Thompson and Boudewijn Rempt for the excellent work
porting the lib and writing the tutorial! (Without either of which, of
course, I wouldn't have got as far as I did!).

Cheers
Simon






More information about the PyQt mailing list