[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    [PyQt] Serious problem with QVariant v2 API and QSettings
From:       detlev <detlev () die-offenbachs ! de>
Date:       2009-12-29 13:45:16
Message-ID: 200912291445.16462.detlev () die-offenbachs ! de
[Download RAW message or body]

Hi,

QSettings is not working correctly with the QVariant v2 API. Enter the 
following in a Python console.

>>> import sip
>>> sip.setapi("QString",2)
>>> sip.setapi("QVariant",2)
>>> from PyQt4.QtCore import *
>>> s=QSettings()
>>> s.setValue("k1", 1)
>>> s.value("k1")
1
>>> s=None
>>> s=QSettings()
>>> s.value("k1")
u'1'
>>>

Setting the variable s to None causes the contents to be written to disk. 
After recreating the QSettings object, which causes the previously saved file 
to be read, the formerly int value has changed to a unicode string. Same 
happens for bool values (and probably other Python types). A list of integers 
is changed to a list of strings.

Regards,
Detlev
-- 
Detlev Offenbach
detlev@die-offenbachs.de
_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic