How to convert int to QString?

后端 未结 8 837
面向向阳花
面向向阳花 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:09

    Use QString::number():

    int i = 42;
    QString s = QString::number(i);
    
    0 讨论(0)
  • 2021-01-29 19:10

    If you need locale-aware number formatting, use QLocale::toString instead.

    0 讨论(0)
提交回复
热议问题