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
qqstylekitreader_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 QQSTYLEKITREADER_P_H
6#define QQSTYLEKITREADER_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 <QtQuick/private/qquickpalette_p.h>
21
25
27
28class QQuickPalette;
31
33{
34 Q_OBJECT
35 Q_PROPERTY(QQStyleKitExtendableControlType controlType READ controlType WRITE setControlType NOTIFY controlTypeChanged FINAL)
46
48
49public:
86 Q_ENUM(ControlType)
87
92 Q_ENUM(AlternateState)
93
96
98 void setControlType(QQStyleKitExtendableControlType type);
99#ifdef QT_DEBUG
101#endif
102
103 bool hovered() const;
104 void setHovered(bool hovered);
105
106 bool enabled() const;
107 void setEnabled(bool enabled);
108
109 bool focused() const;
110 void setFocused(bool focused);
111
112 bool checked() const;
113 void setChecked(bool checked);
114
115 bool pressed() const;
116 void setPressed(bool pressed);
117
118 QQuickPalette *palette() const;
119 void setPalette(QQuickPalette *palette);
121
122 bool vertical() const;
123 void setVertical(bool vertical);
124
125 bool highlighted() const;
126 void setHighlighted(bool highlighted);
127
128 QFont font() const;
129
131
132 QVariant readStyleProperty(PropertyStorageId key) const;
133 void writeStyleProperty(PropertyStorageId key, const QVariant &value);
134 void clearLocalStorage();
135
136 QQSK::State controlState() const;
137
138 static void setTransitionEnabled(bool enabled);
139 static bool transitionEnabled();
140 static void resetAll();
141
143
144signals:
157
158private slots:
159 void onPaletteChanged();
160
161private:
162 void updateControl();
163 void populateLocalStorage();
164 bool dontEmitChangedSignals() const;
165
166 QQuickStateGroup *stateGroup();
167 QQmlComponent *createControlChangesComponent() const;
168 QQmlComponent *createDelegateChangesComponent(const QString &delegateName) const;
169 void instantiatePropertyChanges(QQmlComponent *comp);
170 void maybeTrackDelegates();
171
172 bool rebuildEffectivePalette();
173 bool rebuildEffectiveFont();
174
175private:
177
178 /* The reason we have a QQStyleKitExtendableControlType in addition to
179 * QQStyleKitReader::ControlType, is that we allow the style to define controls types
180 * in the style beyond the types we offer in Qt Quick Controls. The predefined controls
181 * (QQStyleKitReader::ControlType) have types that starts at 100000 (ControlType::Unspecified),
182 * and any number before that is available for use for defining custom controls. */
184
185 bool m_dontEmitChangedSignals: 1;
186 bool m_effectiveVariationsDirty: 1;
187
188 QPointer<QQuickPalette> m_palette;
189 QPalette m_effectivePalette;
190 QFont m_font;
191 bool m_fontDirty = true;
192 quint64 m_lastTextFontOverridesSignature = 0;
193 mutable QQStyleKitPropertyStorage m_storage;
194 AlternateState m_alternateState = AlternateState::Alternate1;
195 QQSK::State m_state = QQSK::StateFlag::Unspecified;
196 QQuickStateGroup *m_stateGroup = nullptr;
197 QQSK::Delegates m_trackedDelegates = QQSK::Delegate::NoDelegate;
198
199 QPointer<QQStyleKitReader> m_parentReader;
200 QList<QPointer<QQStyleKitVariation>> m_effectiveInAppVariations;
201 QList<QPointer<QQStyleKitVariation>> m_effectiveInStyleVariations;
202
204
205 static QMap<QString, QQmlComponent *> s_propertyChangesComponents;
206
210};
211
212QT_END_NAMESPACE
213
214#endif // QQSTYLEKITREADER_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 filterChanged()
QString filter() const
void setFilter(const QString &filter)
void setControl(QQuickItem *item)
static Q_INVOKABLE bool insideControl(const QObject *child)
QVariant readStyleProperty(PropertyStorageId key) const
void setHovered(bool hovered)
void setPressed(bool pressed)
void customTypeChanged()
static bool transitionEnabled()
QQSK::State controlState() const
void setFocused(bool focused)
void setPalette(QQuickPalette *palette)
static void setTransitionEnabled(bool enabled)
QQStyleKitControlProperties * global() const
void setControlType(QQStyleKitExtendableControlType type)
QPalette effectivePalette() const
static QList< QQStyleKitReader * > s_allReaders
void propertiesChanged()
void verticalChanged()
void highlightedChanged()
void setVertical(bool vertical)
QQStyleKitExtendableControlType controlType() const
QQuickPalette * palette() const
void setEnabled(bool enabled)
void setHighlighted(bool highlighted)
void setChecked(bool checked)
void writeStyleProperty(PropertyStorageId key, const QVariant &value)
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.