You need to test = test.append("This is a test of the Arg Function %1").arg(x);
because arg
returns new string.
Example from here:
QString i; // current file's number
QString total; // number of files to process
QString fileName; // current file's name
QString status = QString("Processing file %1 of %2: %3")
.arg(i).arg(total).arg(fileName);
Or like vahancho suggested:
test.append(QString("This is a test of the Arg Function %1").arg(x));
Michael Burr suggested:
test += QString("This is a test of the Arg Function %1").arg(x);
Another one without arg
:
test.sprintf("This is a test of the Arg Function %d", x);
And you may have a look at that guy How to format a QString?