How i can convert int to QString

  • I maked my function to convert int to QString like:

    QString convertInt(int number)
    if (number == 0)
    return "0";
    QString temp="";
    QString returnvalue="";
    while (number>0)
    for (int i=0;i<temp.length();i++)
    return returnvalue;

    my quis. is there any function more easy then this.


    [EDIT: code formatting, please wrap in @-tags, Volker]

    1. QString tmp = QString::number(myInt)
    2. QString tmp = tr("%1").arg(myInt)

  • Thank you so much,it works


Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.