From 8e8db9b917e1ad9cdfeca0fd92bc864fbd94fd1e Mon Sep 17 00:00:00 2001 From: Gerald Combs Date: Fri, 23 Oct 2015 15:07:35 -0700 Subject: [PATCH] Qt: Explicitly set the byte view painter font. Set the painter font at the beginning of each paintEvent. It looks like we either aren't calling setFont at the right time or the QAbstractScrollArea viewport sometimes ignores its parent font. Bug: 11594 Change-Id: Id4484f6b990be112bbc5728d5ad0e31a74a60201 Reviewed-on: https://code.wireshark.org/review/11231 Petri-Dish: Gerald Combs Tested-by: Petri Dish Buildbot Reviewed-by: Gerald Combs --- ui/qt/byte_view_text.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ui/qt/byte_view_text.cpp b/ui/qt/byte_view_text.cpp index 092a2118cd..85566c1680 100644 --- a/ui/qt/byte_view_text.cpp +++ b/ui/qt/byte_view_text.cpp @@ -130,8 +130,6 @@ const guint8 *ByteViewText::dataAndLength(guint *data_len_ptr) void ByteViewText::setMonospaceFont(const QFont &mono_font) { mono_font_ = mono_font; -// mono_bold_font_ = QFont(mono_font); -// mono_bold_font_.setBold(true); const QFontMetricsF fm(mono_font); font_width_ = fm.width('M'); @@ -149,6 +147,7 @@ void ByteViewText::paintEvent(QPaintEvent *) { QPainter painter(viewport()); painter.translate(-horizontalScrollBar()->value() * font_width_, 0); + painter.setFont(font()); // Pixel offset of this row int row_y = 0; -- 2.34.1