I’m wondering How I can have a string in QML that will be occupied with some arguments? Some thing like this in Qt:
QString str("%1 %2");
str = str.arg("Number").arg(12);//str = "Number 12"
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In QML environment, the arg() function already added to the string prototype, so basically you can use the string.arg() in QML just like C++.
There is less documentation about this, but I’m sure it works in Qt 4.7 + QtQuick 1.1
Take at look at the Qt 5 doc : http://qt-project.org/doc/qt-5.0/qtqml/qml-string.html