summaryrefslogtreecommitdiff
path: root/ui/qt/preference_editor_frame.cpp
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2016-09-29 11:25:52 -0700
committerRoland Knall <rknall@gmail.com>2016-09-29 19:41:25 +0000
commit1f633cfc840de148e928d121a613237ea5dafb0a (patch)
treeaa62ef33e7fc762faaccc27fc9d95b40b1f788d8 /ui/qt/preference_editor_frame.cpp
parent5f69295c47a9a72ae27d8404860ab8170591cb1d (diff)
downloadwireshark-1f633cfc840de148e928d121a613237ea5dafb0a.tar.gz
Qt: Add html_escape to qt_ui_utils.
Add an html_escape convenience function, which escapes HTML metacharacters using Qt::escape on Qt4 and QString::toHtmlEscaped on Qt5. Use it where we were previously using #if QT_VERSION and calling the API-specific functions. Change-Id: Ifda3e9634a37fc00bdb46e08d5711f934692fef5 Reviewed-on: https://code.wireshark.org/review/17984 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Roland Knall <rknall@gmail.com>
Diffstat (limited to 'ui/qt/preference_editor_frame.cpp')
-rw-r--r--ui/qt/preference_editor_frame.cpp12
1 files changed, 1 insertions, 11 deletions
diff --git a/ui/qt/preference_editor_frame.cpp b/ui/qt/preference_editor_frame.cpp
index 0e196c0a8a..8cacdf5f21 100644
--- a/ui/qt/preference_editor_frame.cpp
+++ b/ui/qt/preference_editor_frame.cpp
@@ -38,11 +38,6 @@
#include <QPushButton>
-#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
-// Qt::escape
-#include <QTextDocument>
-#endif
-
// To do:
// - Handle PREF_FILENAME and PREF_DIRNAME.
@@ -85,12 +80,7 @@ void PreferenceEditorFrame::editPreference(preference *pref, pref_module *module
ui->preferenceTitleLabel->setText(QString("%1:").arg(pref->title));
// Convert the pref description from plain text to rich text.
- QString description;
-#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
- description = Qt::escape(pref->description);
-#else
- description = QString(pref->description).toHtmlEscaped();
-#endif
+ QString description = html_escape(pref->description);
description.replace('\n', "<br>");
QString tooltip = QString("<span>%1</span>").arg(description);
ui->preferenceTitleLabel->setToolTip(tooltip);