QString::fromLatin1
Zack Rusin
zack at kde.org
Wed Jul 9 06:45:44 BST 2003
On Tuesday 08 July 2003 22:27, Benjamin Meyer wrote:
> In kmainwindow.cpp when storing settings it wraps the string with
> QString::fromLatin1() Such as:
> "config->writeEntry(QString::fromLatin1("StatusBar"), entryList,
> ';');" Some of the classes do this, some don't. What is the value
> of doing this?
If QT_NO_CAST_ASCII is defined while compiling a Qt app the QString(
const char *str ) is disabled meaning all things like
void someFunc( const QString& );
someFunc( "wrong" );
won't compile anymore and the only way of creating a QString from a
const char* is the QString::fromLatin1 function. Some apps do that
(e.g. Kopete) to reduce the number of implicit casting all over the
code.
> Should it be done at the KConfig level rather then
> sometimes?
Doesn't really matter.
> Is it historical?
Nope.
> Can it be removed?
I'd rather see more code using it, but as long as we're not using
QT_NO_CAST_ASCII it's not mandatory.
Zack
--
ICMP: The protocol that goes PING!
More information about the kde-core-devel
mailing list