Answers for "how to convert int to qstring"

3

from integer to qstring qt

Use QString::number():

int i = 42;
QString s = QString::number(i);
Posted by: Guest on March-08-2020
0

int to qstring

// Qt 5 + C++11
auto i = 13;    
auto printable = QStringLiteral("My magic number is %1. That's all!").arg(i);

// Qt 5
int i = 13;    
QString printable = QStringLiteral("My magic number is %1. That's all!").arg(i);

// Qt 4
int i = 13;    
QString printable = QString::fromLatin1("My magic number is %1. That's all!").arg(i);
Posted by: Guest on October-27-2021

Browse Popular Code Answers by Language