Update qtcommon.h

This commit is contained in:
恍兮惚兮 2024-04-23 20:05:31 +08:00
parent 24ae167d1a
commit d3babbea76

View File

@ -32,8 +32,9 @@ struct Localizer { Localizer() { Localize(); } };
inline std::wstring S(const QString& s) { inline std::wstring S(const QString& s) {
//s.toStdWString will crash. unknown why. //s.toStdWString will crash. unknown why.
std::wstring ws; std::wstring ws;
ws.resize(s.size()); ws.resize(s.size()+1);
s.toWCharArray(ws.data()); s.toWCharArray(ws.data());
ws.resize(s.size());
return ws; return ws;
} }
inline QString S(const std::string& s) { return QString::fromStdString(s); } inline QString S(const std::string& s) { return QString::fromStdString(s); }