aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2018-06-06 15:08:53 -0700
committerGerald Combs <gerald@wireshark.org>2018-06-07 15:38:53 +0000
commit0882e94cff6a6a5087bfaf3883c9842cb8f9d944 (patch)
tree16562728e0346e4f45562a60c5a0799b684727ff /ui
parent0ac8960b9f34156841b91a39328c0185748f1ebd (diff)
Qt: Set the ByteViewText field and protocol foreground.
Set a foreground color when we add a field and protocol format range. On some systems the highlight background is darker or lighter than the normal background, and we need to adjust the foreground to match. Add a note about correctly handling our hover rect color. Change-Id: Ib6b50403dec889280eb3d27f3deb10150d22a599 Reviewed-on: https://code.wireshark.org/review/28076 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'ui')
-rw-r--r--ui/qt/widgets/byte_view_text.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/ui/qt/widgets/byte_view_text.cpp b/ui/qt/widgets/byte_view_text.cpp
index 7717067a87..636f2c1cd0 100644
--- a/ui/qt/widgets/byte_view_text.cpp
+++ b/ui/qt/widgets/byte_view_text.cpp
@@ -222,6 +222,8 @@ void ByteViewText::paintEvent(QPaintEvent *)
painter.restore();
// We can't do this in drawLine since the next line might draw over our rect.
+ // This looks best when our highlight and background have similar lightnesses.
+ // We might want to set a composition mode when that's not the case.
if (!hover_outlines_.isEmpty()) {
qreal pen_width = 1.0;
qreal hover_alpha = 0.6;
@@ -484,9 +486,11 @@ bool ByteViewText::addFormatRange(QList<QTextLayout::FormatRange> &fmt_list, int
return false;
case ModeField:
format_range.format.setBackground(palette().highlight());
+ format_range.format.setForeground(palette().highlightedText());
break;
case ModeProtocol:
format_range.format.setBackground(palette().window());
+ format_range.format.setForeground(palette().windowText());
break;
case ModeOffsetNormal:
format_range.format.setForeground(offset_normal_fg_);