[patch] Re: kconfiggroup template 'mess'

David Faure faure at kde.org
Tue Oct 30 11:49:49 GMT 2007


On Tuesday 30 October 2007, Thiago Macieira wrote:
> Em Tuesday 30 October 2007 10:04:23 Jarosław Staniek escreveu:
> > > the const char* / QByteArray ones are workarounds from older times where
> > > we couldn't break source compatibility.
> >
> > Dirk,
> > I've just tried this, and we have ambiguousity:
> 
> Remove both: leave only the QString version.
> 
> QString automatically converts from const char*.

... using strlen (slow) and copying each char into a QChar (slow).
And then KConfig uses QByteArray internally, so you convert all this back to 8 bit data again?
This doesn't seem sensible at all.

> But it doesn't convert from QByteArray. A simple call to .data() 
> or .constData() solves the problem, or wrapping in QString::fromLatin1 or 
> QLatin1String.
> 
> That requires porting code, however. And breaking binary- and 
> source-compatibility.

*If* we have to choose a single key type, I would much rather have QByteArray for 
config keys, since that's what's used internally.
The code that passes a QString is more rare, usually from times where the only API
for string manipulation was in QString, but nowadays QByteArray can do this as well.
However is it really late for changing the API again! Didn't we say the next one who does
this gets killed?

-- 
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