readEntry and booleans

Thomas Braxton thomas_braxton at cox.net
Wed Jan 4 17:00:58 GMT 2006


On Wednesday 04 January 2006 05:04, André Wöbbeking wrote:
> On Wednesday 04 January 2006 02:24, Thomas Braxton wrote:
> > On Tuesday 03 January 2006 16:59, David Faure wrote:
> > > On Tuesday 03 January 2006 23:00, Cornelius Schumacher wrote:
> > > > compare
> > > >   readEntry( "key", QVariant( false ) ).toBool()
> > > > to
> > > >   readBoolEntry( "key", false )
> > >
> > > Since booleans convert so badly to QVariant, maybe we should keep
> > > readBoolEntry or add a readEntry( key, bool ) overload?
> >
> > The problem wasn't with booleans, it was with zeroes. (i.e.
> > false/int(0)/uint(0))
> >
> > As far as I can tell this member template fixes everything
> > template <typename T> T readEntry(key, const T&) const
>
> What happens for readEntry("bla", 0) now? In this case we've to use
> int(0), double(0), and so on, right?

it picks the right function now.

> And two other things:
>
> 1) can we check if the QVariant is convertable (see
> qVariantCanConvert()) at least for debug code?

I can add it to readEntry(key, QVariant).

> 2) can we also get rid off readEntry(key, QString)?

do we really want to? strings and paths are handled specially so we would need 
the functionality somewhere.

>
> Cheers,
> André

Thomas




More information about the kde-core-devel mailing list