From 00776f832abfad00c765ad2d471315c0fe6d2509 Mon Sep 17 00:00:00 2001
From: Paul Zander
Date: Wed, 25 Apr 2018 08:29:37 +0200
Subject: Qt: Make the selected packet in the packet list more clear.
When using coloring rules the selected packet is sometime hard to recognize. The stylesheet of the packet list is extended for this.
Bug: 14621
Change-Id: Ied465e0e211b3c11e69cb71f89988eb45622dd72
Reviewed-on: https://code.wireshark.org/review/27141
Petri-Dish: Roland Knall
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall
---
ui/qt/packet_list.cpp | 36 ++++++++++++++++++++++++------------
1 file changed, 24 insertions(+), 12 deletions(-)
(limited to 'ui')
diff --git a/ui/qt/packet_list.cpp b/ui/qt/packet_list.cpp
index e90c72d75d..549f0eaa82 100644
--- a/ui/qt/packet_list.cpp
+++ b/ui/qt/packet_list.cpp
@@ -271,16 +271,20 @@ PacketList::PacketList(QWidget *parent) :
if (style_inactive_selected) {
// XXX Style the protocol tree as well?
+ QPalette active_pal = palette();
+ active_pal.setCurrentColorGroup(QPalette::Active);
+ QColor active_border = QColor::fromRgb(ColorUtils::alphaBlend(
+ active_pal.highlightedText(),
+ active_pal.highlight(),
+ 0.25));
+
QPalette inactive_pal = palette();
inactive_pal.setCurrentColorGroup(QPalette::Inactive);
- QColor border = QColor::fromRgb(ColorUtils::alphaBlend(
+ QColor inactive_border = QColor::fromRgb(ColorUtils::alphaBlend(
inactive_pal.highlightedText(),
inactive_pal.highlight(),
0.25));
- QColor shadow = QColor::fromRgb(ColorUtils::alphaBlend(
- inactive_pal.highlightedText(),
- inactive_pal.highlight(),
- 0.07));
+
setStyleSheet(QString(
"QTreeView::item:selected:first:!active {"
" border-left: 1px solid %1;"
@@ -289,17 +293,25 @@ PacketList::PacketList(QWidget *parent) :
" border-right: 1px solid %1;"
"}"
"QTreeView::item:selected:!active {"
- " border-top: 1px solid %1;"
- " border-bottom: 1px solid %1;"
+ " border-top: 0px solid %1;"
+ " border-bottom: 0px solid %1;"
" color: %2;"
- // Try to approximate a subtle box shadow.
- " background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1"
- " stop: 0 %4, stop: 0.2 %3, stop: 0.8 %3, stop: 1 %4);"
+ // Use a linear background gradient
+ " background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1 stop: 0 %1, stop: 1 %3);"
+ "}"
+ "QTreeView::item:selected:active {"
+ " border-top: 0px solid %4;"
+ " border-bottom: 0px solid %4;"
+ " color: %5;"
+ // Use a linear background gradient
+ " background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1 stop: 0 %4, stop: 1 %6);"
"}")
- .arg(border.name())
+ .arg(inactive_border.name())
.arg(inactive_pal.highlightedText().color().name())
.arg(inactive_pal.highlight().color().name())
- .arg(shadow.name())
+ .arg(active_border.name())
+ .arg(active_pal.highlightedText().color().name())
+ .arg(active_pal.highlight().color().name())
);
}
--
cgit v1.2.3