若该文为原创文章,未经允许不得转载
原博主博客地址:https://blog.csdn.net/qq21497936
原博主博客导航:https://blog.csdn.net/qq21497936/article/details/102478062
本文章博客地址:https://blog.csdn.net/qq21497936/article/details/100009953
各位读者,知识无穷而人力有穷,要么改需求,要么找专业人士,要么自己研究
红胖子(红模仿)的博文大全:开发技术集合(包含Qt实用技术、树莓派、三维、OpenCV、OpenGL、ffmpeg、OSG、单片机、软硬结合等等)持续更新中…(点击传送门)
Qt开发专栏:实用技巧(点击传送门)
QString 转wchar_t*
wchar_t szBuf[1024]; QString str = tr("hello"); wcscpy_s(reinterpret_cast<wchar_t*>(szBuf), sizeof(szBuf) / sizeof(wchar_t), reinterpret_cast<const wchar_t*>(str.utf16()));
wchar_t *转QString
wchar_t* wptr = L"test"; QString ret = QString::fromWCharArray(wptr); QString ret2 = QString((QChar*)wptr, wcslen(wptr));
QString转LPCWSTR
LPCWSTR lpcwstr; lpcwstr = (LPCWSTR)dirPath.toStdWString().c_str()
LPCWSTR转QString
LPCWSTR lpcwstr; QString str = QString::fromStdWString(lpcwstr);
QString转std::string
QString qStr = "hello"; std::string s = qStr.toStdString();
std::string转QString
std::string str = “hello”; QString qStr = QString::fromStdString(str);
原博主博客地址:https://blog.csdn.net/qq21497936
原博主博客导航:https://blog.csdn.net/qq21497936/article/details/102478062
本文章博客地址:https://blog.csdn.net/qq21497936/article/details/100009953