[PyQt] Another problem with QVariant v2 API and QSettings
detlev
detlev at die-offenbachs.de
Tue Dec 29 13:51:56 GMT 2009
Hi,
I just discovered another problem. Enter this code in a Python console.
>>> import sip
>>> sip.setapi("QString",2)
>>> sip.setapi("QVariant",2)
>>> from PyQt4.QtCore import *
>>> s=QSettings()
>>> s.setValue("k6", {1:1, 2:2, 3:3})
>>> s.setValue("k7", "Hello world")
>>> s.value("k6")
{1: 1, 2: 2, 3: 3}
>>> s.value("k7")
u'Hello world'
>>> s=None
QVariant::save: unable to save type 256.
>>> s
>>> s=QSettings()
>>> s.value("k6")
QVariant::load: unable to load type 256.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
SystemError: error return without exception set
>>> s.value("k7")
u'Hello world'
The settings file contains these entries.
k6=@Variant(\0\0\0\x7f\0\0\0\xePyQt_PyObject\0)
k7=Hello world
Regards,
Detlev
--
Detlev Offenbach
detlev at die-offenbachs.de
More information about the PyQt
mailing list