将int类型转为QString类型

版权声明:版权所有,盗版必究。欢迎转载收藏。 https://blog.csdn.net/yl_best/article/details/80105872

有两种方法:
1.  QString :: number

    int a = 63;
    QString s10 = QString::number(a, 10);     //s == '63'
    QString s16 = QString::number(a, 16).toUpper();     //s == '3F'

2. QString::arg
    int rowCount = 0;
    QString s2 = QString("rowCount: %1. we need %2 rows more").arg(rowCount).arg(iSample);    //"rowCount: 0. we need 63 rows more"

注意:%后面是数字1,2,3……,不是%d, %l等

猜你喜欢

转载自blog.csdn.net/yl_best/article/details/80105872