readEntry and booleans

Olivier Goffart ogoffart at kde.org
Wed Jan 4 10:54:30 GMT 2006


Le Mercredi 4 Janvier 2006 12:04, André Wöbbeking a écrit :
> 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?

Or maybe  readEntry<double>("bla" , 0)

Note:  it seems that it mean that we will not be compatible with MSVC6 
(according to http://doc.trolltech.com/4.0/qvariant.html#value )
(Personally, I don't care)

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


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

This is AFAIK the base function



And can't we get ride of all theses double functions  QString/char* ?
Why don't we use simply QString ?
Or self class KConfigKey that has a constructor with char* and QString

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20060104/d22bd350/attachment.sig>


More information about the kde-core-devel mailing list