mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-01-12 18:24:58 +08:00
Fix compile error: ‘escape’ is not a member of ‘Qt’
This commit is contained in:
parent
ea9d65f377
commit
3b5e7eb0ea
@ -34,6 +34,7 @@
|
|||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
#include <QLocale>
|
#include <QLocale>
|
||||||
|
|
||||||
#ifdef QBT_USES_QT5
|
#ifdef QBT_USES_QT5
|
||||||
#include <QCollator>
|
#include <QCollator>
|
||||||
#endif
|
#endif
|
||||||
@ -217,6 +218,23 @@ QString Utils::String::toHtmlEscaped(const QString &str)
|
|||||||
#ifdef QBT_USES_QT5
|
#ifdef QBT_USES_QT5
|
||||||
return str.toHtmlEscaped();
|
return str.toHtmlEscaped();
|
||||||
#else
|
#else
|
||||||
return Qt::escape(str);
|
// code from Qt
|
||||||
|
QString rich;
|
||||||
|
const int len = str.length();
|
||||||
|
rich.reserve(int(len * 1.1));
|
||||||
|
for (int i = 0; i < len; ++i) {
|
||||||
|
if (str.at(i) == QLatin1Char('<'))
|
||||||
|
rich += QLatin1String("<");
|
||||||
|
else if (str.at(i) == QLatin1Char('>'))
|
||||||
|
rich += QLatin1String(">");
|
||||||
|
else if (str.at(i) == QLatin1Char('&'))
|
||||||
|
rich += QLatin1String("&");
|
||||||
|
else if (str.at(i) == QLatin1Char('"'))
|
||||||
|
rich += QLatin1String(""");
|
||||||
|
else
|
||||||
|
rich += str.at(i);
|
||||||
|
}
|
||||||
|
rich.squeeze();
|
||||||
|
return rich;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user