wireshark/wireshark-1.12.0-qt-QFont-stylename.patch

58 lines
2.3 KiB
Diff
Raw Normal View History

From: Andreas Stieger <andreas.stieger@gmx.de>
Date: Fri, 8 Aug 2014 19:50:24 +0200
Subject: [PATCH] Qt: Fix when build with Qt < 4.8.0
Upstream: Committed
References: https://www.wireshark.org/lists/wireshark-dev/201408/msg00074.html https://code.wireshark.org/review/#/c/3508/ https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commitdiff;h=020d0f89637faab8ec0e25e07d64eb66d96c2a72
Declared minimum requirement is Qt 4.6.0.
QFont.styleName is not available in Qt < 4.8
Fails on SLE11 with libqt4-devel-4.6.3-5.25.5:
[ 567s] qt_ui_utils.cpp: In function 'void smooth_font_size(QFont&)':
[ 567s] qt_ui_utils.cpp:58: error: 'class QFont' has no member named 'styleName'
---
ui/qt/font_color_preferences_frame.cpp | 8 +++++++-
ui/qt/qt_ui_utils.cpp | 4 ++++
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/ui/qt/font_color_preferences_frame.cpp b/ui/qt/font_color_preferences_frame.cpp
index e9f4a5d..38c894c 100644
--- a/ui/qt/font_color_preferences_frame.cpp
+++ b/ui/qt/font_color_preferences_frame.cpp
@@ -81,9 +81,15 @@ void FontColorPreferencesFrame::updateWidgets()
{
int margin = style()->pixelMetric(QStyle::PM_LayoutLeftMargin);
+#if QT_VERSION < QT_VERSION_CHECK(4, 8, 0)
ui->fontPushButton->setText(
- cur_font_.family() + " "/* + cur_font_.styleName() + " "*/ +
+ cur_font_.family() + " " +
QString::number(cur_font_.pointSizeF(), 'f', 1));
+#else
+ ui->fontPushButton->setText(
+ cur_font_.family() + " " + cur_font_.styleName() + " " +
+ QString::number(cur_font_.pointSizeF(), 'f', 1));
+#endif
ui->fontSampleLineEdit->setFont(cur_font_);
QString line_edit_ss = QString("QLineEdit { margin-left: %1px; }").arg(margin);
diff --git a/ui/qt/qt_ui_utils.cpp b/ui/qt/qt_ui_utils.cpp
index 8ad29d2..f4a0621 100644
--- a/ui/qt/qt_ui_utils.cpp
+++ b/ui/qt/qt_ui_utils.cpp
@@ -55,7 +55,11 @@ QString gchar_free_to_qstring(gchar *glib_string) {
void smooth_font_size(QFont &font) {
QFontDatabase fdb;
+#if QT_VERSION < QT_VERSION_CHECK(4, 8, 0)
+ QList<int> size_list = fdb.smoothSizes(font.family(), "");
+#else
QList<int> size_list = fdb.smoothSizes(font.family(), font.styleName());
+#endif
if (size_list.size() < 2) return;
--
1.7.9.5