From cab10aa7b4b49ae4161d39f56d218d1af8dfc4bb Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Wed, 8 Feb 2017 13:19:21 +0800 Subject: [PATCH] Use QString::toStdString() Qt5 utilized the desired toUtf8() instead of toAscii(). --- src/base/utils/string.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/base/utils/string.cpp b/src/base/utils/string.cpp index f631d56aa..51e4d62ac 100644 --- a/src/base/utils/string.cpp +++ b/src/base/utils/string.cpp @@ -177,8 +177,12 @@ QString Utils::String::fromStdString(const std::string &str) std::string Utils::String::toStdString(const QString &str) { +#ifdef QBT_USES_QT5 + return str.toStdString(); +#else QByteArray utf8 = str.toUtf8(); return std::string(utf8.constData(), utf8.length()); +#endif } // to send numbers instead of strings with suffixes