formatNumber performance
David Faure
faure at kde.org
Tue May 16 12:02:39 BST 2006
On Tuesday 16 May 2006 12:33, John Tapsell wrote:
> > Where does it read configuration from KConfig? I don't see that.
> It finds out which locale we are in to know whether to use , or . for
> the decimal place.
Yes but KLocale doesn't do that on every call to formatNumber.
The config-reading is done only once, so it can hardly be the problem you're seeing.
> > I wanted to suggest QLocale::toString() which it already uses with
> > QString::number() implicitly. But now I don't know how does this follow
> > the user setting e.g. for group separator or decimal point?
>
> Can someone follow up on this. I'm guessing that kapplication calls
> QLocale::setDefault - is this true?
No (and if anything did that, it should be KLocale; kapp is being made optional).
Someone would need to map our locales (kdebase/l10n/) to the QLocale enums.
Alternatively, we could do the number to string conversion ourselves to avoid
it being QLocale-dependent - being QLocale-dependent wasn't the idea of the KLocale
code, obviously.
--
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).
More information about the kde-core-devel
mailing list