[PyQt] A possible bug in PyQt when loading Boolean values via QSettings
phil at riverbankcomputing.com
Sun Dec 26 10:59:45 GMT 2010
On Sun, 26 Dec 2010 10:45:37 +1100, Xavion <xavion.0 at gmail.com> wrote:
> After further research, not even the following code works:
> User.System.bPreferSUdo = bool( str.title( oItems ) )
Of course not. bool() just looks at the length of the string, it doesn't
try and place any interpretation on the value of the string.
> I had to use the following code, which isn't exactly pretty:
> User.System.bPreferSUdo = ( oItems == True ) or ( oItems == "true" )
> The second method takes into account that the value could be coming from
> cache or file. Are you sure that this is how you want it to be for PyQt
> programmers on Linux from now on?
PyQt has no way of knowing whether "false" is the backend representation
of False or a string setting that happens to have the value of "false".
Only the application knows how to interpret the value.
More information about the PyQt