How to convert int to QString?

Ahmad picture Ahmad · Jul 9, 2010 · Viewed 503.9k times · Source

Is there a QString function which takes an int and outputs it as a QString?

Answer

Georg Fritzsche picture Georg Fritzsche · Jul 9, 2010

Use QString::number():

int i = 42;
QString s = QString::number(i);