[Kourse 3] Fixing krazy2 issues

Dominik Haumann dhdev at gmx.de
Thu Jan 15 16:00:31 CET 2009


Hi Philipp,

On Thursday 15 January 2009, Philipp Klaffert wrote:
> @@ -54,7 +53,7 @@
>          return true;
>      }
>
> -    if (!name.startsWith("Timeline:") &&
> !name.startsWith("TimelineWithFriends:")  &&
> !name.startsWith("Profile:")) {
> +    if 
> (!name.startsWith(QString("Timeline:")) &&
> !name.startsWith(QString("TimelineWithFriends:"))  &&
> !name.startsWith(QString("Profile:"))) { return false;
>      }

This is also what implicitly happens: const char* is implicitely converted 
to a QString. The right way is afaik to use QLatin1String, see also 
http://doc.trolltech.com/latest/qlatin1string.html for a better 
explanation :)

And then, such optimizations should only be used in time critical cases, as 
the readability decreases when wrapping all strings (more text to read). 
But that's just my personal opinion, and maybe that's always the case in 
plasma - I don't know the preferred way here.

Hope this helps :)
Dominik


More information about the Plasma-devel mailing list