QT编程中的char*,wchar_t*与QString之间的转换

//QString to wchar_t:
const wchar_t * encodedName = reinterpret_cast<const wchar_t *>(fileName.utf16());

//QString to char * (general case):
const char * tmp = str.toUtf8().constData();

//wchar_t* to QString
wchar_t szMsg[100] = {0};
_stprintf(szMsg,L"Connect [%s] failed!",ssid);
QString str1= QString::fromWCharArray(szMsg);

//char* to QString
QStirng str2(tr("Please try again later."));

上一篇:Qt:QTableWidgetItem


下一篇:QT 中文路径乱码