From 4f6749f16d0a920820a3b6deb657a335f5bc3a2e Mon Sep 17 00:00:00 2001 From: Srivats P Date: Fri, 3 Mar 2023 17:37:43 +0530 Subject: [PATCH] Set alternate colors for port stats row headers All 'sent' rows including the row header have the alt color, and the 'recv' rows including the row header has the base color. This change should make it easier to quickly distinguish sent/recv rows --- client/portstatsmodel.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/client/portstatsmodel.cpp b/client/portstatsmodel.cpp index 1fc0d85..4280b9c 100644 --- a/client/portstatsmodel.cpp +++ b/client/portstatsmodel.cpp @@ -20,7 +20,9 @@ along with this program. If not, see #include "portstatsmodel.h" #include "portgrouplist.h" +#include #include +#include #include #include @@ -272,6 +274,14 @@ QVariant PortStatsModel::headerData(int section, Qt::Orientation orientation, in return QVariant(); } + if ((role == Qt::BackgroundRole) && (orientation == Qt::Vertical) + && qApp->styleSheet().isEmpty()) + { + QPalette palette = QApplication::palette(); + return section & 0x1 ? + palette.base() : palette.alternateBase(); + } + if (role != Qt::DisplayRole) return QVariant();