aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorPaul Zander <p.j.zander@lighting.com>2018-04-25 08:29:37 +0200
committerRoland Knall <rknall@gmail.com>2018-04-30 11:14:44 +0000
commit00776f832abfad00c765ad2d471315c0fe6d2509 (patch)
tree7d7955acbfc24116051c763a844f0b2439819f1b /ui
parent4694c7acf0772d780499f1d4d83fe52e0d9a7fe7 (diff)
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 <rknall@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Roland Knall <rknall@gmail.com>
Diffstat (limited to 'ui')
-rw-r--r--ui/qt/packet_list.cpp36
1 files changed, 24 insertions, 12 deletions
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())
);
}