//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."));