[PyKDE] QStringList

Karolina Lindqvist pgd-karolina.lindqvist at algonet.se
Wed Sep 27 17:19:02 BST 2000


I have started to get my old PyQt/PyKDE program to work with PyQt-2.0 and 
only Qt. Except for documented changed behaviour, I got the following problem:

Code snippet:

 print "filenames=", filenames, "count=", filenames.count()
        for f in filenames:
            print "f=", f

Printout from execution:

filenames= <qt.QStringList instance at 815dd50> count= 924
Traceback (innermost last):
  File "thumbs.py", line 558, in ?
    appwidget.loadthumbs(argv[1])
  File "thumbs.py", line 270, in loadthumbs
    self.thumbs.loadthumbs(dirname)
  File "thumbstable.py", line 109, in loadthumbs
    for f in filenames:
AttributeError: __getitem__    

So my question is, how do I access the individual items in a QStringList?
It used to be with indexing [], but as you can see, that now gives Attribute 
error. The string list obviously contains 924 items, in the above example. I 
would also expect that printing out the QstringList would print out the list 
of items, or with str() or ``. I have some vague memory that it used to do 
that, but all three now gives the result <qt.QStringList instance at.... >    

The PyQt or Qt documentation does not appear to give any help.  

As this used to work, this appears to be a change of behaviour, but to what? 

I am using PyQt-2.0 together with Qt-2.2.0

-- Karolina





More information about the PyQt mailing list