hi i am trying to concatenate a variable with a string. How can i do this?
here is the code
Code:
void login::show_user() { tr("Your username is user_name")); }
i want to concatenate user_name in QMessageBox to display username
Printable View
hi i am trying to concatenate a variable with a string. How can i do this?
here is the code
Code:
void login::show_user() { tr("Your username is user_name")); }
i want to concatenate user_name in QMessageBox to display username
You can simply use + operator, or opt of string arguments..
QString message = "Your user name is " + user_name;
QString message = QString("Your user name is %1").arg(user_name).
Do read Qt Assistant..it helps