Encoding problems due to automatic QByteArray <-> QString casting

Milian Wolff mail at milianw.de
Wed Jul 22 13:27:10 UTC 2009


See also: https://bugs.kde.org/show_bug.cgi?id=183182

The problem here is that QString has a ctor which converts a QByteArray 
implicitly to a QString. Apparently that fucks up encoding everytime. We 
had to fix that at like four different places, always replacing the 
implicit stuff with QString::fromUtf8(...).

Now a friend of mine told me that there are:

-DQT_NO_CAST_FROM_ASCII
-DQT_ASCII_CAST_WARNINGS
-DQT_NO_CAST_TO_ASCII

Could/should we use those? It would show these kind of errors much earlier.

Would anyone have a problem with using the QString::from* all the time. 
To me it looks like we should use the more explicit form...

Too bad we can't mark functions/methods explicit :-/
-- 
Milian Wolff
http://milianw.de




More information about the KDevelop-devel mailing list