Qt: Explicitly set the byte view painter font.
authorGerald Combs <gerald@wireshark.org>
Fri, 23 Oct 2015 22:07:35 +0000 (15:07 -0700)
committerGerald Combs <gerald@wireshark.org>
Fri, 23 Oct 2015 23:25:13 +0000 (23:25 +0000)
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 <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
ui/qt/byte_view_text.cpp

index 092a2118cdf8dc1a1df632f1e5d8ff06ab68371e..85566c16801cba95c8eea04952d69c835ea57c9d 100644 (file)
@@ -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;