I want convert bool to QString.
Whats the most efficient way to do it?, This is my code but sure that there is other way better.
bool test = true;
test ? "1" : "0";
Thanks.
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.
You can use the static
QString::numbermethod – the bool will be implicitly cast to int to match the integer form of the static factory method, which returns aQStringcontaining0or1.