Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qwindows11style_p.h
Go to the documentation of this file.
1// Copyright (C) 2022 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
5#ifndef QWINDOWS11STYLE_P_H
6#define QWINDOWS11STYLE_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtWidgets/private/qtwidgetsglobal_p.h>
20#include <qwindowsvistastyle_p_p.h>
21
23
25
27 subtleHighlightColor, //Subtle highlight based on alpha used for hovered elements
28 subtlePressedColor, //Subtle highlight based on alpha used for pressed elements
29 frameColorLight, //Color of frame around flyouts and controls except for Checkbox and Radiobutton
30 frameColorStrong, //Color of frame around Checkbox and Radiobuttons (normal and hover)
31 frameColorStrongDisabled, //Color of frame around Checkbox and Radiobuttons (pressed and disabled)
32 controlStrongFill, //Color of controls with strong filling such as the right side of a slider
35 menuPanelFill, //Color of menu panel
36 controlStrokeOnAccentSecondary, //Color of frame around Buttons in accent color
37 controlFillSolid, //Color for solid fill
38 surfaceStroke, //Color of MDI window frames
41 fillControlDefault, // button default color (alpha)
42 fillControlSecondary, // button hover color (alpha)
43 fillControlTertiary, // button pressed color (alpha)
44 fillControlDisabled, // button disabled color (alpha)
45 fillControlInputActive, // input active
46 fillControlAltSecondary, // checkbox/RadioButton default color (alpha)
47 fillControlAltTertiary, // checkbox/RadioButton hover color (alpha)
48 fillControlAltQuarternary, // checkbox/RadioButton pressed color (alpha)
49 fillControlAltDisabled, // checkbox/RadioButton disabled color (alpha)
50 fillAccentDefault, // button default color (alpha)
51 fillAccentSecondary, // button hover color (alpha)
52 fillAccentTertiary, // button pressed color (alpha)
53 fillAccentDisabled, // button disabled color (alpha)
54 fillMicaAltDefault, // tabbar button default
55 fillMicaAltTransparent, // tabbar button (not selected, not hovered)
56 fillMicaAltSecondary, // tabbar button (not selected, hovered)
57 textPrimary, // text of default/hovered control
58 textSecondary, // text of pressed control
59 textDisabled, // text of disabled control
60 textOnAccentPrimary, // text of default/hovered control on accent color
61 textOnAccentSecondary, // text of pressed control on accent color
62 textOnAccentDisabled, // text of disabled control on accent color
63 dividerStrokeDefault, // divider color (alpha)
64};
65
67{
69public:
70 enum class Icon : ushort {
71 AcceptMedium = 0xF78C,
72 Dash12 = 0xE629,
73 CheckMark = 0xE73E,
76 CaretUpSolid8 = 0xEDDB,
78 ChevronDown = 0xE70D,
79 ChevronUp = 0xE70E,
80 ChevronUpMed = 0xE971,
88 ChromeRestore = 0xE923,
89 ChromeClose = 0xE8BB,
90 More = 0xE712,
91 Help = 0xE897,
92 Clear = 0xE894,
93 };
94
97 void drawComplexControl(ComplexControl control, const QStyleOptionComplex *option,
98 QPainter *painter, const QWidget *widget) const override;
99 void drawPrimitive(PrimitiveElement element, const QStyleOption *option,
100 QPainter *painter, const QWidget *widget) const override;
101 QRect subElementRect(QStyle::SubElement element, const QStyleOption *option,
102 const QWidget *widget = nullptr) const override;
103 QRect subControlRect(ComplexControl control, const QStyleOptionComplex *option,
104 SubControl subControl, const QWidget *widget) const override;
105 void drawControl(ControlElement element, const QStyleOption *option,
106 QPainter *painter, const QWidget *widget) const override;
107 int styleHint(StyleHint hint, const QStyleOption *opt = nullptr,
108 const QWidget *widget = nullptr, QStyleHintReturn *returnData = nullptr) const override;
109 void polish(QWidget* widget) override;
110
111 QSize sizeFromContents(ContentsType type, const QStyleOption *option,
112 const QSize &size, const QWidget *widget) const override;
113 int pixelMetric(PixelMetric metric, const QStyleOption *option = nullptr,
114 const QWidget *widget = nullptr) const override;
115 void polish(QPalette &pal) override;
116 void unpolish(QWidget *widget) override;
117 QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *option = nullptr,
118 const QWidget *widget = nullptr) const override;
119 QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option = nullptr,
120 const QWidget *widget = nullptr) const override;
121 void polish(QApplication *app) override;
122 void unpolish(QApplication *app) override;
123 bool eventFilter(QObject *obj, QEvent *event) override;
124
125protected:
127
128private:
129 void dwmSetWindowCornerPreference(const QWidget *widget, bool bSet) const;
130 QColor calculateAccentColor(const QStyleOption *option) const;
131 QPen borderPenControlAlt(const QStyleOption *option) const;
132 enum class ControlType
133 {
134 Control,
135 ControlAlt
136 };
137 QBrush controlFillBrush(const QStyleOption *option, ControlType controlType) const;
138 QBrush inputFillBrush(const QStyleOption *option, const QWidget *widget) const;
139 // ControlType::ControlAlt can be mapped to QPalette directly
140 QColor controlTextColor(const QStyleOption *option, bool ignoreIsChecked = false) const;
141 void drawLineEditFrame(QPainter *p, const QRectF &rect, const QStyleOption *o, bool isEditable = true) const;
142 inline QColor winUI3Color(enum WINUI3Color col) const;
143 static inline QString fluentIcon(Icon i) { return QChar(ushort(i)); }
144
145private:
148 friend class QStyleFactory;
149
150 bool highContrastTheme = false;
151 int colorSchemeIndex = 0;
152
153 mutable QVarLengthFlatMap<int, int, 8> m_fontPoint2ChevronDownMedWidth;
154};
155
157 Q_DECLARE_PUBLIC(QWindows11Style)
158
160
161protected:
164};
165
166QT_END_NAMESPACE
167
168#endif // QWINDOWS11STYLE_P_H
friend class QPainter
friend class QWidget
Definition qpainter.h:431
QVarLengthFlatMap< QWindows11Style::Icon, QIcon, 16 > m_standardIcons
The QWindows11Style class provides a look and feel suitable for applications on Microsoft Windows 11.
void drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const override
QWindows11Style()
Constructs a QWindows11Style object.
bool eventFilter(QObject *obj, QEvent *event) override
void unpolish(QWidget *widget) override
void polish(QWidget *widget) override
void drawComplexControl(ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget) const override
QSize sizeFromContents(ContentsType type, const QStyleOption *option, const QSize &size, const QWidget *widget) const override
void unpolish(QApplication *app) override
QRect subControlRect(ComplexControl control, const QStyleOptionComplex *option, SubControl subControl, const QWidget *widget) const override
QWindows11Style(QWindows11StylePrivate &dd)
QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *option=nullptr, const QWidget *widget=nullptr) const override
void polish(QPalette &pal) override
int pixelMetric(PixelMetric metric, const QStyleOption *option=nullptr, const QWidget *widget=nullptr) const override
int styleHint(StyleHint hint, const QStyleOption *opt=nullptr, const QWidget *widget=nullptr, QStyleHintReturn *returnData=nullptr) const override
void drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const override
QRect subElementRect(QStyle::SubElement element, const QStyleOption *option, const QWidget *widget=nullptr) const override
QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option=nullptr, const QWidget *widget=nullptr) const override
void polish(QApplication *app) override
~QWindows11Style() override
Destructor.
The QWindowsVistaStyle class provides a look and feel suitable for applications on Microsoft Windows ...
QRect subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const override
QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc, const QWidget *widget) const override
int styleHint(StyleHint hint, const QStyleOption *opt=nullptr, const QWidget *widget=nullptr, QStyleHintReturn *returnData=nullptr) const override
SubControl hitTestComplexControl(ComplexControl control, const QStyleOptionComplex *option, const QPoint &pos, const QWidget *widget=nullptr) const override
void drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const override
void polish(QWidget *widget) override
int pixelMetric(PixelMetric metric, const QStyleOption *option=nullptr, const QWidget *widget=nullptr) const override
QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt, const QWidget *widget=nullptr) const override
QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option=nullptr, const QWidget *widget=nullptr) const override
\reimp
~QWindowsVistaStyle() override
Destructor.
void polish(QPalette &pal) override
void drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget=nullptr) const override
QSize sizeFromContents(ContentsType type, const QStyleOption *option, const QSize &size, const QWidget *widget) const override
QWindowsVistaStyle(QWindowsVistaStylePrivate &dd)
void drawComplexControl(ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget) const override
void unpolish(QWidget *widget) override
Combined button and popup list for selecting options.
WINUI3Color
@ dividerStrokeDefault
@ fillControlAltSecondary
@ fillControlTertiary
@ frameColorStrongDisabled
@ textOnAccentPrimary
@ fillControlDefault
@ controlStrokeSecondary
@ frameColorStrong
@ surfaceStroke
@ fillControlDisabled
@ fillMicaAltSecondary
@ subtleHighlightColor
@ textPrimary
@ controlFillSolid
@ fillAccentSecondary
@ frameColorLight
@ subtlePressedColor
@ fillMicaAltDefault
@ textDisabled
@ fillControlSecondary
@ textSecondary
@ controlStrokeOnAccentSecondary
@ fillAccentDefault
@ textOnAccentSecondary
@ focusFrameOuterStroke
@ textOnAccentDisabled
@ fillControlAltQuarternary
@ fillControlInputActive
@ menuPanelFill
@ controlStrongFill
@ fillMicaAltTransparent
@ controlStrokePrimary
@ fillAccentDisabled
@ fillControlAltTertiary
@ fillControlAltDisabled
@ focusFrameInnerStroke
@ fillAccentTertiary