[PyQt] QSettings.value() returns string instead of bool

Andreas Pakulat apaku at gmx.de
Sun Mar 6 15:44:10 GMT 2011


On 06.03.11 15:48:19, Hans-Peter Jansen wrote:
> On Sunday 06 March 2011, 15:13:13 Andreas Pakulat wrote:
> > On 06.03.11 13:23:53, Phil Thompson wrote:
> > > On Sun, 6 Mar 2011 13:49:16 +0100, Andreas Pakulat <apaku at gmx.de> 
> wrote:
> > > > Hi,
> > > >
> > > > I'm using sip API v2 for QVariant here and using
> > > > QSettings.setValue/value does not work correctly for booleans.
> > > > See the attached two scripts. In write.py everything looks good,
> > > > I can store and get back a Python boolean. But running read.py
> > > > which only reads from the QSettings object always returns a
> > > > string instead of a boolean value. It almost looks like the wrong
> > > > QSettings overload is being called...
> > > >
> > > > My versions are:
> > > > Qt4: 4.7.1
> > > > PyQt4: 4.7.3
> > > > Python: 2.6.6
> > > > Sip: 4.10.2
> > > >
> > > > Is this something thats fixed in newer PyQt4 versions maybe?
> > >
> > > See...
> > >
> > > http://www.riverbankcomputing.com/static/Docs/PyQt4/html/python_v3.
> > >html#qsettings
> >
> > Seems I was too fast with the thanks :(
> > In the above mentioned version of PyQt4 the QSettings.value()
> > function has no type argument. So I guess I'm stuck with manual
> > conversion for now.
> 
> Yes.
> 
> See this discussion for the issue:
> http://www.riverbankcomputing.com/pipermail/pyqt/2010-December/028915.html
> http://www.riverbankcomputing.com/pipermail/pyqt/2010-December/028919.html
> 
> and this for the related announcement:
> http://www.riverbankcomputing.com/pipermail/pyqt/2011-January/029032.html
> 
> which happened as: PyQt v4.8.3 and SIP v4.12.1.

Thanks for digging that up for me. I'll refine my version-check then to
4.8.3...

Andreas



More information about the PyQt mailing list