I write a long QString with more than 9 arguments, I simply use it like this:
QString html = QObject::tr(
"%1 %2 %3 %4 %5 %6 %7 %8 %9 %10 ...").arg(a, b, c, d, e, f, g, h, i, j);
But QtCreator yields and error, that there can not be more than 9 args ... I read the docs: http://doc.qt.io/qt-5/qstring.html, where there is an arg
function definition:
QString arg(const QString & a1, const QString & a2, const QString & a3, const QString & a4, const QString & a5, const QString & a6, const QString & a7, const QString & a8, const QString & a9) const
So it seems that's the issue. Is there any elegant way I can deal with this, or I can only concatenate 2 strings?
You can chain .arg()
calls like this, with up to 9 arguments in each one:
QObject::tr("%1 %2 %3 %4 %5 %6 %7 %8 %9 %10 ...")
.arg(a, b, c)
.arg(d)
.arg(e, f, g, h)
.arg(i, j);