QT中三種數據類型之間的轉換:
QString qtStr;
std::string stdStr;
char* chStr;
則有:
(1)
qtStr = stdStr.c_str();
(2)
stdStr = qtStr.local8Bit(); 或者stdStr=qtStr.toStdString;
(3)
chStr=stdStr.c_str();
chStr=(const char*)qtStr.local8Bit();
chStr=(char*)stdStr;
(4)
int 轉QString
int a=10;
QString b;
b=QString::number(a)