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 fillControlAltSecondary, // checkbox/RadioButton default color (alpha)
46 fillControlAltTertiary, // checkbox/RadioButton hover color (alpha)
47 fillControlAltQuarternary, // checkbox/RadioButton pressed color (alpha)
48 fillControlAltDisabled, // checkbox/RadioButton disabled color (alpha)
49 fillAccentDefault, // button default color (alpha)
50 fillAccentSecondary, // button hover color (alpha)
51 fillAccentTertiary, // button pressed color (alpha)
52 fillAccentDisabled, // button disabled color (alpha)
53 textPrimary, // text of default/hovered control
54 textSecondary, // text of pressed control
55 textDisabled, // text of disabled control
56 textOnAccentPrimary, // text of default/hovered control on accent color
57 textOnAccentSecondary, // text of pressed control on accent color
58 textOnAccentDisabled, // text of disabled control on accent color
59};
60
62{
64public:
67 void drawComplexControl(ComplexControl control, const QStyleOptionComplex *option,
68 QPainter *painter, const QWidget *widget) const override;
69 void drawPrimitive(PrimitiveElement element, const QStyleOption *option,
70 QPainter *painter, const QWidget *widget) const override;
71 QRect subElementRect(QStyle::SubElement element, const QStyleOption *option,
72 const QWidget *widget = nullptr) const override;
73 QRect subControlRect(ComplexControl control, const QStyleOptionComplex *option,
74 SubControl subControl, const QWidget *widget) const override;
75 void drawControl(ControlElement element, const QStyleOption *option,
76 QPainter *painter, const QWidget *widget) const override;
77 int styleHint(StyleHint hint, const QStyleOption *opt = nullptr,
78 const QWidget *widget = nullptr, QStyleHintReturn *returnData = nullptr) const override;
79 void polish(QWidget* widget) override;
80
81 QSize sizeFromContents(ContentsType type, const QStyleOption *option,
82 const QSize &size, const QWidget *widget) const override;
83 int pixelMetric(PixelMetric metric, const QStyleOption *option = nullptr,
84 const QWidget *widget = nullptr) const override;
85 void polish(QPalette &pal) override;
86 void unpolish(QWidget *widget) override;
87protected:
89
90private:
91 QColor calculateAccentColor(const QStyleOption *option) const;
92 QPen borderPenControlAlt(const QStyleOption *option) const;
93 enum class ControlType
94 {
95 Control,
96 ControlAlt
97 };
98 QBrush controlFillBrush(const QStyleOption *option, ControlType controlType) const;
99 // ControlType::ControlAlt can be mapped to QPalette directly
100 QColor controlTextColor(const QStyleOption *option,
101 QPalette::ColorRole role = QPalette::ButtonText) const;
102 void drawLineEditFrame(QPainter *p, const QRectF &rect, const QStyleOption *o, bool isEditable = true) const;
103 inline QColor winUI3Color(enum WINUI3Color col) const;
104
105private:
108 friend class QStyleFactory;
109
110 bool highContrastTheme = false;
111 int colorSchemeIndex = 0;
112};
113
115 Q_DECLARE_PUBLIC(QWindows11Style)
116};
117
118QT_END_NAMESPACE
119
120#endif // QWINDOWS11STYLE_P_H
friend class QPainter
friend class QWidget
Definition qpainter.h:431
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
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
QRect subControlRect(ComplexControl control, const QStyleOptionComplex *option, SubControl subControl, const QWidget *widget) const override
QWindows11Style(QWindows11StylePrivate &dd)
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
~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
WINUI3Color
@ fillControlAltSecondary
@ fillControlTertiary
@ frameColorStrongDisabled
@ textOnAccentPrimary
@ fillControlDefault
@ controlStrokeSecondary
@ frameColorStrong
@ surfaceStroke
@ fillControlDisabled
@ subtleHighlightColor
@ textPrimary
@ controlFillSolid
@ fillAccentSecondary
@ frameColorLight
@ subtlePressedColor
@ textDisabled
@ fillControlSecondary
@ textSecondary
@ controlStrokeOnAccentSecondary
@ fillAccentDefault
@ textOnAccentSecondary
@ focusFrameOuterStroke
@ textOnAccentDisabled
@ fillControlAltQuarternary
@ menuPanelFill
@ controlStrongFill
@ controlStrokePrimary
@ fillAccentDisabled
@ fillControlAltTertiary
@ fillControlAltDisabled
@ focusFrameInnerStroke
@ fillAccentTertiary