readEntry and booleans
André Wöbbeking
Woebbeking at onlinehome.de
Wed Jan 4 11:04:57 GMT 2006
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?
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)?
Cheers,
André
More information about the kde-core-devel
mailing list