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 GetHelpApp = 0xEA6B,
91 More = 0xE712,
92 Stop = 0xE71A,
93 Refresh = 0xE72C,
94 Delete = 0xE74D,
95 Save = 0xE74E,
96 Mute = 0xE74F,
97 ReturnKey = 0xE751,
98 Volume = 0xE767,
99 Play = 0xE768,
100 Pause = 0xE769,
102 Warning = 0xE7BA,
103 Document = 0xE7C3,
105 Home = 0xE80F,
106 Help = 0xE897,
107 Previous = 0xE892,
108 Next = 0xE893,
109 Clear = 0xE894,
110 OpenFile = 0xE8E5,
111 NewFolder = 0xE8F4,
112 BulletedList = 0xE8FD,
113 Info = 0xE946,
115 Network = 0xE968,
116 Shield = 0xEA18,
117 ErrorBadge = 0xEA39,
118 HardDrive = 0xEDA2,
119 ButtonMenu = 0xEDE3,
120 FastForward = 0xEB9D,
121 Rewind = 0xEB9E,
124 CaretSolidUp = 0xF090,
127 FolderList = 0xF2CE,
128 };
129
132 void drawComplexControl(ComplexControl control, const QStyleOptionComplex *option,
133 QPainter *painter, const QWidget *widget) const override;
134 void drawPrimitive(PrimitiveElement element, const QStyleOption *option,
135 QPainter *painter, const QWidget *widget) const override;
136 QRect subElementRect(QStyle::SubElement element, const QStyleOption *option,
137 const QWidget *widget = nullptr) const override;
138 QRect subControlRect(ComplexControl control, const QStyleOptionComplex *option,
139 SubControl subControl, const QWidget *widget) const override;
140 void drawControl(ControlElement element, const QStyleOption *option,
141 QPainter *painter, const QWidget *widget) const override;
142 int styleHint(StyleHint hint, const QStyleOption *opt = nullptr,
143 const QWidget *widget = nullptr, QStyleHintReturn *returnData = nullptr) const override;
144 void polish(QWidget* widget) override;
145
146 QSize sizeFromContents(ContentsType type, const QStyleOption *option,
147 const QSize &size, const QWidget *widget) const override;
148 int pixelMetric(PixelMetric metric, const QStyleOption *option = nullptr,
149 const QWidget *widget = nullptr) const override;
150 void polish(QPalette &pal) override;
151 void unpolish(QWidget *widget) override;
152 QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *option = nullptr,
153 const QWidget *widget = nullptr) const override;
154 QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option = nullptr,
155 const QWidget *widget = nullptr) const override;
156 void polish(QApplication *app) override;
157 void unpolish(QApplication *app) override;
158 bool eventFilter(QObject *obj, QEvent *event) override;
159 QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap,
160 const QStyleOption *option) const override;
161
162protected:
164
165private:
166 void dwmSetWindowCornerPreference(const QWidget *widget, bool bSet) const;
167 QColor calculateAccentColor(const QStyleOption *option) const;
168 QPen borderPenControlAlt(const QStyleOption *option) const;
169 enum class ControlType
170 {
171 Control,
172 ControlAlt
173 };
174 QBrush controlFillBrush(const QStyleOption *option, ControlType controlType) const;
175 QBrush inputFillBrush(const QStyleOption *option, const QWidget *widget) const;
176 // ControlType::ControlAlt can be mapped to QPalette directly
177 QColor controlTextColor(const QStyleOption *option, bool ignoreIsChecked = false) const;
178 void drawLineEditFrame(QPainter *p, const QRectF &rect, const QStyleOption *o, bool isEditable = true) const;
179 void drawIndicatorArrow(QPainter *painter, const QRect &rect, PrimitiveElement arrowType,
180 QPen pen) const;
181#if QT_CONFIG(toolbutton)
183 const QStyleOptionToolButton *option, const QWidget *widget) const;
184#endif
185 inline QColor winUI3Color(enum WINUI3Color col) const;
186 static inline QChar fluentIcon(Icon i) { return QChar(ushort(i)); }
187 template <typename C>
188 int widthFromChar(const QFont &widgetFont, Icon icon, C &cacheContainer) const;
189
190private:
193 friend class QStyleFactory;
194
195 bool highContrastTheme = false;
196 int colorSchemeIndex = 0;
197
198 mutable QVarLengthFlatMap<int, int, 8> m_fontPoint2ChevronDownMedWidth;
199 mutable QVarLengthFlatMap<int, int, 8> m_fontPoint2ChevronUpWidth;
200};
201
203 Q_DECLARE_PUBLIC(QWindows11Style)
204
206
207protected:
210};
211
212QT_END_NAMESPACE
213
214#endif // QWINDOWS11STYLE_P_H
friend class QPainter
friend class QWidget
Definition qpainter.h:432
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
QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *option) const 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