summaryrefslogtreecommitdiff
path: root/ui/qt/module_preferences_scroll_area.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/module_preferences_scroll_area.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/module_preferences_scroll_area.cpp')
-rw-r--r--ui/qt/module_preferences_scroll_area.cpp13
1 files changed, 2 insertions, 11 deletions
diff --git a/ui/qt/module_preferences_scroll_area.cpp b/ui/qt/module_preferences_scroll_area.cpp
index 1c6840b1e3..3af4899b96 100644
--- a/ui/qt/module_preferences_scroll_area.cpp
+++ b/ui/qt/module_preferences_scroll_area.cpp
@@ -42,10 +42,6 @@
#include <QRadioButton>
#include <QScrollBar>
#include <QSpacerItem>
-#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
-// Qt::escape
-#include <QTextDocument>
-#endif
Q_DECLARE_METATYPE(pref_t *)
@@ -63,7 +59,7 @@ static const QString title_to_shortcut(const char *title) {
extern "C" {
// Callbacks prefs routines
-/* show a single preference on the GtkGrid of a preference page */
+/* Add a single preference to the QVBoxLayout of a preference page */
static guint
pref_show(pref_t *pref, gpointer layout_ptr)
{
@@ -72,12 +68,7 @@ pref_show(pref_t *pref, gpointer layout_ptr)
if (!pref || !vb) return 0;
// 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);