forked from qt-creator/qt-creator
Do not use deprecated Qt functionality.
Replace all* remaining deprecated Qt 4 functions with their Qt 5 counterparts. This means we no longer need to define the QT_DISABLE_DEPRECATED_BEFORE macro. This patch is relatively small because most source-compatible changes of this kind have been done before. * The one exception is the QmlDesigner, which uses QWeakPointer in a deprecated way all over the place. Change-Id: Id4b839c6685f3b5bdf2b89137f95231758ec53c7 Reviewed-by: Eike Ziller <eike.ziller@digia.com> Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
@@ -341,36 +341,11 @@ QString WatchData::toString() const
|
||||
return res + QLatin1Char('}');
|
||||
}
|
||||
|
||||
static QString htmlEscape(const QString &plain)
|
||||
{
|
||||
#if QT_VERSION >= 0x050000
|
||||
return Qt::escape(plain);
|
||||
#else
|
||||
// Copied from Qt to avoid GUI dependency
|
||||
// (Qt::escape has been moved in Qt 5)
|
||||
QString rich;
|
||||
rich.reserve(int(plain.length() * qreal(1.1)));
|
||||
for (int i = 0; i < plain.length(); ++i) {
|
||||
if (plain.at(i) == QLatin1Char('<'))
|
||||
rich += QLatin1String("<");
|
||||
else if (plain.at(i) == QLatin1Char('>'))
|
||||
rich += QLatin1String(">");
|
||||
else if (plain.at(i) == QLatin1Char('&'))
|
||||
rich += QLatin1String("&");
|
||||
else if (plain.at(i) == QLatin1Char('"'))
|
||||
rich += QLatin1String(""");
|
||||
else
|
||||
rich += plain.at(i);
|
||||
}
|
||||
return rich;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Format a tooltip fow with aligned colon.
|
||||
static void formatToolTipRow(QTextStream &str,
|
||||
const QString &category, const QString &value)
|
||||
{
|
||||
QString val = htmlEscape(value);
|
||||
QString val = value.toHtmlEscaped();
|
||||
val.replace(QLatin1Char('\n'), QLatin1String("<br>"));
|
||||
str << "<tr><td>" << category << "</td><td> : </td><td>"
|
||||
<< val << "</td></tr>";
|
||||
|
||||
Reference in New Issue
Block a user