On Sun, 19 Jul 2009 11:01:17 -0700 (PDT), Demetrius Cassidy <[email protected]> wrote: > For some reason as of 4.5.2, QVariant is behaving much differently than > from > 4.5.1. It seems that if I have a QVariant with a python list or tuple, that > doing toPyObject() on the QVariant object return a python list of > QVariants!! This means for each item in my list, I would also need to do a > .toPyObject! > > This is completely different behavior than how it worked in 4.5.1, where > doing toPyObject would return the original list of strings, not a list of > QVariants. > > Test Code: > > from PyQt4.QtCore import QVariant > > def testVariant(): > var = QVariant(['one', 'two', 'three']) > > varObj = var.toPyObject() > > print "checking if varObject is of type list" > print(isinstance(varObj, list)) > > for item in varObj: > print(item) > > > testVariant() > > > Output: > > checking if varObject is of type list > True > <PyQt4.QtCore.QVariant object at 0x012A97D8> > <PyQt4.QtCore.QVariant object at 0x012A9810> > <PyQt4.QtCore.QVariant object at 0x012A9848>
Should be fixed in the current SIP and PyQt snapshots. Note that toPyObject() will return a list of QStrings, not a list of Python strings - it doesn't return the original list. If you can confirm there are no other problems I'll make a new release in a day or two. Phil _______________________________________________ PyQt mailing list [email protected] http://www.riverbankcomputing.com/mailman/listinfo/pyqt
