From 31961361dd8d6b6dc87cf9a6000c1fc5565a0d17 Mon Sep 17 00:00:00 2001 From: Collin Kidder Date: Tue, 26 Feb 2019 20:28:19 -0500 Subject: [PATCH] Make the main view model use the system colors and alternate row background --- canframemodel.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/canframemodel.cpp b/canframemodel.cpp index eea4ae0..41f4f7c 100644 --- a/canframemodel.cpp +++ b/canframemodel.cpp @@ -227,6 +227,7 @@ QVariant CANFrameModel::data(const QModelIndex &index, int role) const int dLen; QString tempString; CANFrame thisFrame; + static bool rowFlip = false; if (!index.isValid()) return QVariant(); @@ -246,8 +247,9 @@ QVariant CANFrameModel::data(const QModelIndex &index, int role) const return msg->bgColor; } } - //return QApplication::palette().color(QPalette::Button); - return QColor(Qt::white); + rowFlip = !rowFlip; + if (rowFlip) return QApplication::palette().color(QPalette::Base); + else return QApplication::palette().color(QPalette::AlternateBase); } if (role == Qt::TextAlignmentRole)