How to write a QString on several lines?

canardman picture canardman · Nov 25, 2010 · Viewed 10.7k times · Source

Do you have a better way to do that ?

QString str("I am a long long long"
              + QString("long long long")
              + QString("long QString") );

I don't like all this QString.

Answer

robert picture robert · Nov 25, 2010

In C++ string literals are automatically concatenated when placed next to each other.

QString str("I am a long long long"
    "long long long"
    "long QString");