I want to do something like this in C++ using Qt:
int i = 5;
QString directory = ":/karim/pic" + i + ".jpg";
where +
means I want to concatenate the strings and the integer (that is, directory
should be :/karim/pic5.jpg
). How can I do this?
Qt's idiom for things like this is the arg()
function of QString.
QString directory = QString(":/karim/pic%1.jpg").arg(i);