Try this:
double d1 = 0.5,d2 = 30.0
QString str = "abc";
str.append(QString("%1").arg(d1));
str.append(" def ");
str.append(QString("%1").arg(d2));
[EDITED] The point is, the "arg" is a method of a class QString and must be used with an instance of it. In your not-working example you don't do this.