From a2ac80f8eb2ae14e34ec012840dde48625a2c879 Mon Sep 17 00:00:00 2001 From: "craig.p.drummond" Date: Sun, 5 Oct 2014 12:03:14 +0000 Subject: [PATCH] For windows builds, when window is not focused, draw sidebar selection as a darkened background. --- ChangeLog | 2 ++ support/fancytabwidget.cpp | 14 +++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 0b2e280ee..31c6d6842 100644 --- a/ChangeLog +++ b/ChangeLog @@ -78,6 +78,8 @@ crash dialog appearing. 55. If a command fails to be sent to MPD, and the socket is in an error state, then completely disconnect and reconnect. +56. For windows builds, when window is not focused, draw sidebar selection as + a darkened background. 1.4.2 ----- diff --git a/support/fancytabwidget.cpp b/support/fancytabwidget.cpp index fd670a052..5cf4a858a 100644 --- a/support/fancytabwidget.cpp +++ b/support/fancytabwidget.cpp @@ -213,6 +213,11 @@ void FancyTabProxyStyle::drawControl(ControlElement element, const QStyleOption #ifdef Q_OS_MAC OSXStyle::self()->drawSelection(styleOpt, p, selected ? 1.0 : (fader*1.0)/150.0); #else + #ifdef Q_OS_WIN + if (QPalette::Active!=styleOpt.palette.currentColorGroup()) { + styleOpt.palette.setColor(QPalette::Highlight, styleOpt.palette.color(QPalette::Window).darker(110)); + } + #endif QApplication::style()->drawPrimitive(QStyle::PE_PanelItemViewItem, &styleOpt, p, 0); #endif } @@ -518,6 +523,11 @@ void FancyTabBar::paintTab(QPainter *painter, int tabIndex, bool gtkStyle) const #ifdef Q_OS_MAC OSXStyle::self()->drawSelection(styleOpt, painter, selected ? 1.0 : tabs[tabIndex]->fader()/150.0); #else + #ifdef Q_OS_WIN + if (QPalette::Active!=styleOpt.palette.currentColorGroup()) { + styleOpt.palette.setColor(QPalette::Highlight, styleOpt.palette.color(QPalette::Window).darker(110)); + } + #endif QApplication::style()->drawPrimitive(QStyle::PE_PanelItemViewItem, &styleOpt, painter, 0); #endif } @@ -533,7 +543,9 @@ void FancyTabBar::paintTab(QPainter *painter, int tabIndex, bool gtkStyle) const #ifdef Q_OS_MAC painter->setPen(selected ? OSXStyle::self()->viewPalette().highlightedText().color() : OSXStyle::self()->viewPalette().foreground().color()); #else - painter->setPen(selected ? QApplication::palette().highlightedText().color() : palette().foreground().color()); +// painter->setPen(selected ? QApplication::palette().highlightedText().color() : palette().foreground().color()); + painter->setPen(selected && styleOpt.state&QStyle::State_Active + ? QApplication::palette().highlightedText().color() : QApplication::palette().foreground().color()); #endif int textFlags = Qt::AlignCenter | Qt::AlignBottom; painter->drawText(tabTextRect, textFlags, tabText);