1 QString与int相互转换
QString qstr = QString::number(123); int i = atoi(qstr.toStdString().c_str());
也可以这样:
int i = atoi(qstr.ascii());
2 QString与string,即std::string
string s = qstr.toStdString(); QString qstr2 = QString::fromStdString(s);
2023-12-02 19:41:22
1 QString与int相互转换
QString qstr = QString::number(123); int i = atoi(qstr.toStdString().c_str());
也可以这样:
int i = atoi(qstr.ascii());
2 QString与string,即std::string
string s = qstr.toStdString(); QString qstr2 = QString::fromStdString(s);