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 type READ type WRITE setType NOTIFY typeChanged FINAL)
47
49
50public:
87 Q_ENUM(ControlType)
88
93 Q_ENUM(AlternateState)
94
97
99 void setType(QQStyleKitExtendableControlType type);
100#ifdef QT_DEBUG
102#endif
103
104 bool hovered() const;
105 void setHovered(bool hovered);
106
107 bool enabled() const;
108 void setEnabled(bool enabled);
109
110 bool focused() const;
111 void setFocused(bool focused);
112
113 bool checked() const;
114 void setChecked(bool checked);
115
116 bool pressed() const;
117 void setPressed(bool pressed);
118
119 QQuickPalette *palette() const;
120 void setPalette(QQuickPalette *palette);
122
123 bool vertical() const;
124 void setVertical(bool vertical);
125
126 bool highlighted() const;
127 void setHighlighted(bool highlighted);
128
129 QFont font() const;
130 void setFont(const QFont &font);
131 QFont effectiveFont() const;
132
134
135 QVariant readStyleProperty(PropertyStorageId key) const;
136 void writeStyleProperty(PropertyStorageId key, const QVariant &value);
137 void clearLocalStorage();
138
139 QQSK::State controlState() const;
140
141 static void setTransitionEnabled(bool enabled);
142 static bool transitionEnabled();
143 static void resetAll();
144
146
147signals:
161
162private slots:
163 void onPaletteChanged();
164
165private:
166 void updateControl();
167 void populateLocalStorage();
168 bool dontEmitChangedSignals() const;
169
170 QQuickStateGroup *stateGroup();
171 QQmlComponent *createControlChangesComponent() const;
172 QQmlComponent *createDelegateChangesComponent(const QString &delegateName) const;
173 void instantiatePropertyChanges(QQmlComponent *comp);
174 void maybeTrackDelegates();
175
176 bool rebuildEffectivePalette();
177 bool rebuildEffectiveFont();
178
179private:
181
182 /* The reason we have a QQStyleKitExtendableControlType in addition to
183 * QQStyleKitReader::ControlType, is that we allow the style to define controls types
184 * in the style beyond the types we offer in Qt Quick Controls. The predefined controls
185 * (QQStyleKitReader::ControlType) have types that starts at 100000 (ControlType::Unspecified),
186 * and any number before that is available for use for defining custom controls. */
188
189 bool m_dontEmitChangedSignals: 1;
190 bool m_effectiveVariationsDirty: 1;
191
192 QPointer<QQuickPalette> m_palette;
193 QPalette m_effectivePalette;
194 QFont m_font;
195 QFont m_effectiveFont;
196 bool m_effectiveFontDirty = true;
197 quint64 m_lastTextFontOverridesSignature = 0;
198 mutable QQStyleKitPropertyStorage m_storage;
199 AlternateState m_alternateState = AlternateState::Alternate1;
200 QQSK::State m_state = QQSK::StateFlag::Unspecified;
201 QQuickStateGroup *m_stateGroup = nullptr;
202 QQSK::Delegates m_trackedDelegates = QQSK::Delegate::NoDelegate;
203
204 QPointer<QQStyleKitReader> m_parentReader;
205 QList<QPointer<QQStyleKitVariation>> m_effectiveInAppVariations;
206 QList<QPointer<QQStyleKitVariation>> m_effectiveInStyleVariations;
207
209
210 static QMap<QString, QQmlComponent *> s_propertyChangesComponents;
211
215};
216
217QT_END_NAMESPACE
218
219#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)
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)
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.