From e11d804898ec287ea5ab20a1cfc25fe31a8b57bc Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Wed, 19 Jul 2017 21:20:41 +0300 Subject: [PATCH] improve checkbox layout in manager --- app/layoutsDelegates/checkboxdelegate.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/app/layoutsDelegates/checkboxdelegate.cpp b/app/layoutsDelegates/checkboxdelegate.cpp index 66d2e7e6a..df3eaeef8 100644 --- a/app/layoutsDelegates/checkboxdelegate.cpp +++ b/app/layoutsDelegates/checkboxdelegate.cpp @@ -1,6 +1,7 @@ #include "checkboxdelegate.h" #include +#include #include #include #include @@ -16,9 +17,20 @@ void CheckBoxDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opti QStyleOptionViewItem viewItemOption(option); if (option.state & QStyle::State_Selected) { - painter->setBrush(option.palette.highlight()); QPen nPen; - nPen.setColor(option.palette.highlight().color()); + QBrush nBrush; + + if (option.state & QStyle::State_Active) { + nBrush = option.palette.highlight(); + } else if (option.state & QStyle::State_MouseOver) { + nBrush = option.palette.brush(QPalette::Inactive, QPalette::Highlight); + } else { + nBrush = option.palette.brush(QPalette::Inactive, QPalette::Highlight); + } + + painter->setBrush(nBrush); + nPen.setColor(nBrush.color()); + painter->setPen(nPen); painter->drawRect(option.rect); }