From 1f633cfc840de148e928d121a613237ea5dafb0a Mon Sep 17 00:00:00 2001 From: Gerald Combs Date: Thu, 29 Sep 2016 11:25:52 -0700 Subject: 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 Petri-Dish: Gerald Combs Tested-by: Petri Dish Buildbot Reviewed-by: Roland Knall --- ui/qt/preference_editor_frame.cpp | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'ui/qt/preference_editor_frame.cpp') 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 -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) -// Qt::escape -#include -#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', "
"); QString tooltip = QString("%1").arg(description); ui->preferenceTitleLabel->setToolTip(tooltip); -- cgit v1.2.1