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
qqstylekitpalette_p.h
Go to the documentation of this file.
1// Copyright (C) 2025 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 QQSTYLEKITPALETTE_P_H
6#define QQSTYLEKITPALETTE_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 <QtQml/QtQml>
20#include <QtQuickTemplates2/private/qquicktheme_p.h>
21#include <QtQuick/private/qquickpalette_p.h>
22
24
25class QQStyleKitPalette : public QObject
26{
27 Q_OBJECT
28 Q_PROPERTY(QQuickPalette *system READ system NOTIFY systemChanged FINAL)
29 Q_PROPERTY(QQuickPalette *checkBox READ checkBox NOTIFY checkBoxChanged FINAL)
30 Q_PROPERTY(QQuickPalette *button READ button NOTIFY buttonChanged FINAL)
31 Q_PROPERTY(QQuickPalette *comboBox READ comboBox NOTIFY comboBoxChanged FINAL)
32 Q_PROPERTY(QQuickPalette *groupBox READ groupBox NOTIFY groupBoxChanged FINAL)
33 Q_PROPERTY(QQuickPalette *itemView READ itemView NOTIFY itemViewChanged FINAL)
34 Q_PROPERTY(QQuickPalette *label READ label NOTIFY labelChanged FINAL)
35 Q_PROPERTY(QQuickPalette *listView READ listView NOTIFY listViewChanged FINAL)
36 Q_PROPERTY(QQuickPalette *menu READ menu NOTIFY menuChanged FINAL)
37 Q_PROPERTY(QQuickPalette *menuBar READ menuBar NOTIFY menuBarChanged FINAL)
38 Q_PROPERTY(QQuickPalette *radioButton READ radioButton NOTIFY radioButtonChanged FINAL)
39 Q_PROPERTY(QQuickPalette *spinBox READ spinBox NOTIFY spinBoxChanged FINAL)
40 Q_PROPERTY(QQuickPalette *switchControl READ switchControl NOTIFY switchControlChanged FINAL)
41 Q_PROPERTY(QQuickPalette *tabBar READ tabBar NOTIFY tabBarChanged FINAL)
42 Q_PROPERTY(QQuickPalette *textArea READ textArea NOTIFY textAreaChanged FINAL)
43 Q_PROPERTY(QQuickPalette *textField READ textField NOTIFY textFieldChanged FINAL)
44 Q_PROPERTY(QQuickPalette *toolBar READ toolBar NOTIFY toolBarChanged FINAL)
45 Q_PROPERTY(QQuickPalette *toolTip READ toolTip NOTIFY toolTipChanged FINAL)
46 Q_PROPERTY(QQuickPalette *tumbler READ tumbler NOTIFY tumblerChanged FINAL)
47
48 QML_NAMED_ELEMENT(StyleKitPalette)
49
50public:
51 QQStyleKitPalette(QObject *parent = nullptr);
52
53 QQuickPalette *system() const;
54 QQuickPalette *checkBox() const;
55 QQuickPalette *button() const;
56 QQuickPalette *comboBox() const;
57 QQuickPalette *groupBox() const;
58 QQuickPalette *itemView() const;
59 QQuickPalette *label() const;
60 QQuickPalette *listView() const;
61 QQuickPalette *menu() const;
62 QQuickPalette *menuBar() const;
63 QQuickPalette *radioButton() const;
64 QQuickPalette *spinBox() const;
65 QQuickPalette *switchControl() const;
66 QQuickPalette *tabBar() const;
67 QQuickPalette *textArea() const;
68 QQuickPalette *textField() const;
69 QQuickPalette *toolBar() const;
70 QQuickPalette *toolTip() const;
71 QQuickPalette *tumbler() const;
72
73 QQStyleKitPalette *fallbackPalette() const;
74 void setFallbackPalette(QQStyleKitPalette *fallback);
75
76signals:
77 void systemChanged();
78 void checkBoxChanged();
79 void buttonChanged();
80 void comboBoxChanged();
81 void groupBoxChanged();
82 void itemViewChanged();
83 void labelChanged();
84 void listViewChanged();
85 void menuChanged();
86 void menuBarChanged();
87 void radioButtonChanged();
88 void spinBoxChanged();
89 void switchControlChanged();
90 void tabBarChanged();
91 void textAreaChanged();
92 void textFieldChanged();
93 void toolBarChanged();
94 void toolTipChanged();
95 void tumblerChanged();
96 void fallbackPaletteChanged();
97
98private:
99 Q_DISABLE_COPY(QQStyleKitPalette)
100 /*
101 The following properties are lazy-created, since it's unlikely that a style
102 sets them all. And since a QQuickPalette is not a QObject, we use std::unique_ptr
103 for memory management. Since each palette is logically independent of this class,
104 we make them mutable so that the getter functions can be const.
105 */
106 mutable std::unique_ptr<QQuickPalette> m_system;
107 mutable std::unique_ptr<QQuickPalette> m_checkBox;
108 mutable std::unique_ptr<QQuickPalette> m_button;
109 mutable std::unique_ptr<QQuickPalette> m_comboBox;
110 mutable std::unique_ptr<QQuickPalette> m_groupBox;
111 mutable std::unique_ptr<QQuickPalette> m_itemView;
112 mutable std::unique_ptr<QQuickPalette> m_label;
113 mutable std::unique_ptr<QQuickPalette> m_listView;
114 mutable std::unique_ptr<QQuickPalette> m_menu;
115 mutable std::unique_ptr<QQuickPalette> m_menuBar;
116 mutable std::unique_ptr<QQuickPalette> m_radioButton;
117 mutable std::unique_ptr<QQuickPalette> m_spinBox;
118 mutable std::unique_ptr<QQuickPalette> m_switchControl;
119 mutable std::unique_ptr<QQuickPalette> m_tabBar;
120 mutable std::unique_ptr<QQuickPalette> m_textArea;
121 mutable std::unique_ptr<QQuickPalette> m_textField;
122 mutable std::unique_ptr<QQuickPalette> m_toolBar;
123 mutable std::unique_ptr<QQuickPalette> m_toolTip;
124 mutable std::unique_ptr<QQuickPalette> m_tumbler;
125
126 QQStyleKitPalette *m_fallbackPalette = nullptr;
127
128 quint32 m_setMask = 0;
129 bool isSet(QQuickTheme::Scope scope) const { return (m_setMask & (1u << int(scope))) != 0; }
130 void markSet(QQuickTheme::Scope scope) { m_setMask |= (1u << int(scope)); }
131
132 friend class QQStyleKitTheme;
133};
134
135QT_END_NAMESPACE
136
137#endif // QQSTYLEKITPALETTE_P_H
Q_INVOKABLE bool styleLoaded() const
void setStyleUrl(const QString &styleUrl)
QQStyleKitStyle * style() const
void transitionsEnabledChanged()
void setStyle(QQStyleKitStyle *style)
void setTransitionsEnabled(bool enabled)
QQStyleKitDebug * debug() const
bool transitionsEnabled() const
QString styleUrl() const
void scrollIndicatorChanged()
void componentComplete() override
Invoked after the root component that caused this instantiation has completed construction.
const QList< QObject * > children() const
void abstractButtonChanged()
void itemDelegateChanged()
void classBegin() override
Invoked after class creation, but before any properties have been set.
QList< QQStyleKitVariation * > variations() const
void switchControlChanged()
QQmlListProperty< QObject > data()
void applicationWindowChanged()
void toolSeparatorChanged()
QQmlComponent * theme() const
void setName(const QString &newName)
void setTheme(QQmlComponent *newTheme)
void filterChanged()
QString filter() const
void setFilter(const QString &filter)
void setControl(QQuickItem *item)
static Q_INVOKABLE bool insideControl(const QObject *child)
void setType(QQStyleKitExtendableControlType type)
QVariant readStyleProperty(PropertyStorageId key) const
void setHovered(bool hovered)
void setPressed(bool pressed)
void effectiveFontChanged()
void customTypeChanged()
static bool transitionEnabled()
QQSK::State controlState() const
void setFocused(bool focused)
void setPalette(QQuickPalette *palette)
static void setTransitionEnabled(bool enabled)
QFont effectiveFont() const
void setFont(const QFont &font)
QQStyleKitExtendableControlType type() const
QQStyleKitControlProperties * global() const
QPalette effectivePalette() const
static QList< QQStyleKitReader * > s_allReaders
void propertiesChanged()
void verticalChanged()
void highlightedChanged()
void setVertical(bool vertical)
QQuickPalette * palette() const
void setEnabled(bool enabled)
void setHighlighted(bool highlighted)
void setChecked(bool checked)
void writeStyleProperty(PropertyStorageId key, const QVariant &value)
QQStyleKitPalette * palettes()
QQStyleKitFont * fonts()
void customThemeNamesChanged()
void themeNamesChanged()
QList< QQStyleKitCustomTheme * > customThemes() const
QStringList themeNames() const
void themeNameChanged()
QQmlComponent * dark() const
QQmlComponent * light() const
QStringList customThemeNames() const
void componentComplete() override
Invoked after the root component that caused this instantiation has completed construction.
QQStyleKitStyle * fallbackStyle() const
QQStyleKitTheme * theme() const
void fallbackStyleChanged()
static QQStyleKitStyle * current()
QQuickPalette * palette() const
void setThemeName(const QString &themeName)
void setDark(QQmlComponent *darkTheme)
QPalette paletteForControlType(QQStyleKitExtendableControlType type) const
QFont fontForControlType(QQStyleKitExtendableControlType type) const
void setLight(QQmlComponent *lightTheme)
QString themeName() const
void setFallbackStyle(QQStyleKitStyle *fallbackStyle)
static QQStyleKitAttached * qmlAttachedProperties(QObject *obj=nullptr)
Combined button and popup list for selecting options.
#define IMPLEMENT_ACCESSORS(NAME, TYPE)