How to convert int to QString?

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

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

8条回答
  •  猫巷女王i
    2021-01-29 18:54

    Moreover to convert whatever you want, you can use QVariant. For an int to a QString you get:

    QVariant(3).toString();
    

    A float to a string or a string to a float:

    QVariant(3.2).toString();
    QVariant("5.2").toFloat();
    

提交回复
热议问题