How to convert int to QString?

后端 未结 8 853
面向向阳花
面向向阳花 2021-01-29 18:36

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

8条回答
  •  北荒
    北荒 (楼主)
    2021-01-29 19:06

    I always use QString::setNum().

    int i = 10;
    double d = 10.75;
    QString str;
    str.setNum(i);
    str.setNum(d);
    

    setNum() is overloaded in many ways. See QString class reference.

提交回复
热议问题