4#ifndef QFUSIONSTYLE_P_P_H
5#define QFUSIONSTYLE_P_P_H
18#include <QtWidgets/private/qtwidgetsglobal_p.h>
21#include <qpa/qplatformtheme.h>
22#include "private/qguiapplication_p.h"
24#if QT_CONFIG(style_fusion)
28class QFusionStylePrivate :
public QCommonStylePrivate
30 Q_DECLARE_PUBLIC(QFusionStyle)
33 QFusionStylePrivate();
36 static constexpr QColor lightShade = QColor(255, 255, 255, 90);
37 static constexpr QColor darkShade = QColor(0, 0, 0, 60);
38 static constexpr QColor topShadow = QColor(0, 0, 0, 18);
39 static constexpr QColor innerContrastLine = QColor(255, 255, 255, 30);
42 bool isMacSystemPalette(
const QPalette &pal)
const {
44#if defined(Q_OS_MACOS)
45 const QPalette *themePalette = QGuiApplicationPrivate::platformTheme()->palette();
46 if (themePalette && themePalette->color(QPalette::Normal, QPalette::Highlight) ==
47 pal.color(QPalette::Normal, QPalette::Highlight) &&
48 themePalette->color(QPalette::Normal, QPalette::HighlightedText) ==
49 pal.color(QPalette::Normal, QPalette::HighlightedText))
55 QColor highlight(
const QPalette &pal)
const {
56 if (isMacSystemPalette(pal))
57 return QColor(60, 140, 230);
58 return pal.color(QPalette::Highlight);
61 QColor highlightedText(
const QPalette &pal)
const {
62 if (isMacSystemPalette(pal))
64 return pal.color(QPalette::HighlightedText);
67 QColor outline(
const QPalette &pal)
const {
68 if (pal.window().style() == Qt::TexturePattern)
69 return QColor(0, 0, 0, 160);
70 return pal.window().color().darker(140);
73 QColor highlightedOutline(
const QPalette &pal)
const {
74 QColor highlightedOutline = highlight(pal).darker(125);
75 if (highlightedOutline.value() > 160)
76 highlightedOutline.setHsl(highlightedOutline.hue(), highlightedOutline.saturation(), 160);
77 return highlightedOutline;
80 QColor tabFrameColor(
const QPalette &pal)
const {
81 if (pal.window().style() == Qt::TexturePattern)
82 return QColor(255, 255, 255, 8);
83 return buttonColor(pal).lighter(104);
86 QColor buttonColor(
const QPalette &pal)
const {
87 QColor buttonColor = pal.button().color();
88 int val = qGray(buttonColor.rgb());
89 buttonColor = buttonColor.lighter(100 + qMax(1, (180 - val)/6));
90 buttonColor.setHsv(buttonColor.hue(), buttonColor.saturation() * 0.75, buttonColor.value());
98 menuCheckMarkWidth = 12