summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/widgets/styles/qfusionstyle.cpp2
-rw-r--r--src/widgets/styles/qfusionstyle_p.h28
2 files changed, 27 insertions, 3 deletions
diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp
index 8e52a4b425..4121292cc7 100644
--- a/src/widgets/styles/qfusionstyle.cpp
+++ b/src/widgets/styles/qfusionstyle.cpp
@@ -1417,7 +1417,7 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio
QRect leftRect;
QRect rect = bar->rect;
QColor textColor = option->palette.text().color();
- QColor alternateTextColor = option->palette.highlightedText().color();
+ QColor alternateTextColor = d->highlightedText(option->palette);
painter->save();
bool vertical = false, inverted = false;
diff --git a/src/widgets/styles/qfusionstyle_p.h b/src/widgets/styles/qfusionstyle_p.h
index 1c8089e736..affb85bbb1 100644
--- a/src/widgets/styles/qfusionstyle_p.h
+++ b/src/widgets/styles/qfusionstyle_p.h
@@ -55,6 +55,8 @@
#include "qcommonstyle.h"
#include "qcommonstyle_p.h"
+#include <qpa/qplatformtheme.h>
+#include "private/qguiapplication_p.h"
#ifndef QT_NO_STYLE_FUSION
@@ -83,10 +85,32 @@ public:
return QColor(255, 255, 255, 30);
}
+ // On mac we want a standard blue color used when the system palette is used
+ bool isMacSystemPalette(const QPalette &pal) const {
+ Q_UNUSED(pal);
+#ifdef Q_OS_MAC
+ const QPalette *themePalette = QGuiApplicationPrivate::platformTheme()->palette();
+ if (themePalette->color(QPalette::Normal, QPalette::Highlight) ==
+ pal.color(QPalette::Normal, QPalette::Highlight) &&
+ themePalette->color(QPalette::Normal, QPalette::HighlightedText) ==
+ pal.color(QPalette::Normal, QPalette::HighlightedText))
+ return true;
+#endif
+ return false;
+ }
+
QColor highlight(const QPalette &pal) const {
+ if (isMacSystemPalette(pal))
+ return QColor(60, 140, 230);
return pal.color(QPalette::Active, QPalette::Highlight);
}
+ QColor highlightedText(const QPalette &pal) const {
+ if (isMacSystemPalette(pal))
+ return Qt::white;
+ return pal.color(QPalette::Active, QPalette::HighlightedText);
+ }
+
QColor outline(const QPalette &pal) const {
if (!pal.window().texture().isNull())
return QColor(0, 0, 0, 160);
@@ -94,7 +118,7 @@ public:
}
QColor highlightedOutline(const QPalette &pal) const {
- QColor highlightedOutline = pal.highlight().color().darker(125);
+ QColor highlightedOutline = highlight(pal).darker(125);
if (highlightedOutline.value() > 160)
highlightedOutline.setHsl(highlightedOutline.hue(), highlightedOutline.saturation(), 160);
return highlightedOutline;
@@ -109,7 +133,7 @@ public:
QColor buttonColor(const QPalette &pal) const {
QColor buttonColor = pal.button().color();
int val = qGray(buttonColor.rgb());
- buttonColor = buttonColor.lighter(100 + qMax(0, (180- val)/6));
+ buttonColor = buttonColor.lighter(100 + qMax(1, (180 - val)/6));
buttonColor.setHsv(buttonColor.hue(), buttonColor.saturation() * 0.75, buttonColor.value());
return buttonColor;
}