[PyQt] QSettings boolean converted to unicode with SIP API v2
Jugdish
jugdizh at gmail.com
Thu Apr 15 12:09:44 BST 2010
When using v2 of the API for QString and QVariant, if you write a boolean
value to a QSettings file and then read the value back in from a different
session, it comes back as a unicode string. Example:
##################
# write out the qsettings file
##################
import sip
sip.setapi('QVariant', 2)
sip.setapi('QString', 2)
from PyQt4 import QtCore
settings = QtCore.QSettings()
settings.setValue("foo", False)
##################
# separate session, read in the qsettings file
##################
import sip
sip.setapi('QVariant', 2)
sip.setapi('QString', 2)
from PyQt4 import QtCore
settings = QtCore.QSettings()
val = settings.value("foo")
print "val = %s (%s)" % (val, type(val))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20100415/8fff3e53/attachment.html>
More information about the PyQt
mailing list