[PyQt] QVariant.toPyObject semantics

Lorenzo Berni lorenzo at lilik.it
Fri Jan 9 17:50:14 GMT 2009


Hi all, I've a question about QVariant toPyObject method.

I want to store a dict in a QVariant (i hate QVariant, but i need them  
for QSettings and Qt.UserData in QListWidget...) i try to make an  
interface for converting all the python types in qt types and store  
the qt types in QVariants but it doesn't work on linux (on mac os x it  
works fine). I decide to try the toPyObject method.

On linux, when i store a dict in a QVariant and i call the toPyObject  
method it returns exactly the python types found in the stored dict.

In mac os x, with the same dict, when i try to retrieve it with the  
toPyObject method it returns a dict with all the python strs (or  
unicodes)  converted in QStrings and it converts when it can, all the  
python types in qt types.

Why the same method has a different behaviour on Linux and Mac OS X?

Linux: PyQt 4.4.3 Qt 4.4.1 python 2.5.2

Mac OS X: PyQt 4.4.4 - Qt 4.4.3 python 2.5.1

Help are greatly appreciated :D



More information about the PyQt mailing list