On Thursday 14 April 2011 20:36:31 Myles Jackson wrote:
> The thing that confused me was this
> 
> >>>  settings = QSettings()
> >>>  settings = PySide.QtCore.QSettings()
> >>>  settings.setValue("mySetting", True)
> >>>  settings.value("mySetting")
> 
> True
> 
> >>>  type(settings.value("mySetting"))
> 
> <type 'bool'>
> 
> Should this return unicode as well?

Yes, it should, because in C++ settings.value() returns a QVariant holding a 
QString and PySide transforms a QVariant holding a QString into an unicode.

> Cheers Hugo!
> 
> On 15/04/11 11:22, Hugo Parente Lima wrote:
> > On Thursday 14 April 2011 20:01:53 Myles Jackson wrote:
> >> I noticed this too, the serialization in the QSettings.sync function
> >> seems to write the bool value to the settings file as 'true' or 'false'.
> >> 
> >> As such when you then get the value again i.e value('useZip', False)  it
> >> returns unicode instead of bool.
> > 
> > Check out bug 345 to read an explanation about this issue and why this
> > issue isn't really an issue =]
> > 
> > http://bugs.pyside.org/show_bug.cgi?id=345
> > 
> >> On 15/04/11 10:58, Eli Stevens (Gmail) wrote:
> >>> I'm seeing the following, and am trying to figure out if it's an error
> >>> in my application, or a bug in pyside.
> >>> 
> >>>           self.actions['toggleFooOption'].setChecked(self.settings.valu
> >>>           e(' bar',
> >>> 
> >>> False))
> >>> 
> >>> That's connected to:
> >>>       @Slot(bool)
> >>>       
> >>>       def toggleFooOption(self, val):
> >>>           if self.settings.value('useZip', False) != val\:
> >>>               self.settings.setValue('useZip', val)
> >>> 
> >>> However, when i set that option in the UI, close the application, and
> >>> then restart on windows, self.settings.value('bar', False) returns
> >>> u'true' (ie. a string).  Looking in the registry shows a REG_SZ key,
> >>> which lines up.  On OSX, the program works fine.
> >>> 
> >>> Is anyone else seeing the same behavior?  It's possible that there's
> >>> something in my application (sadly, not open source, so I can't post
> >>> the whole thing) that's causing it, but it doesn't seem that way to
> >>> me.
> >>> 
> >>> Thanks,
> >>> Eli
> >>> _______________________________________________
> >>> PySide mailing list
> >>> [email protected]
> >>> http://lists.pyside.org/listinfo/pyside
> >> 
> >> _______________________________________________
> >> PySide mailing list
> >> [email protected]
> >> http://lists.pyside.org/listinfo/pyside

-- 
Hugo Parente Lima
INdT - Instituto Nokia de Tecnologia

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
PySide mailing list
[email protected]
http://lists.pyside.org/listinfo/pyside

Reply via email to