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
qqstylekitpropertyresolver_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 QQSTYLEKITPROPERTYRESOLVER_P_H
6#define QQSTYLEKITPROPERTYRESOLVER_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
22
24
27class QQStyleKitStyle;
29class QQStyleKitReader;
33
34// The stack-allocated capacity should be large enough to cover the maximum expected
35// nesting depth of controls in the application, to avoid heap allocation.
36using AttachedVariationList = QVarLengthArray<const QQStyleKitVariationAttached *, 20>;
38{
40
41public:
42 enum class PathId { // REMOVE THIS AS WELL
45 };
46 Q_ENUM(PathId)
47
54
56 const QQStyleKitPropertyGroup *group,
57 const QQSK::Property property,
58 const QQSK::Property alternative = QQSK::Property::NoProperty);
59
60 static bool writeStyleProperty(
61 const QQStyleKitPropertyGroup *group,
62 const QQSK::Property property,
63 const QVariant &value);
64
65 static bool hasLocalStyleProperty(
66 const QQStyleKitPropertyGroup *group,
67 const QQSK::Property property);
68
70 QQStyleKitExtendableControlType exactType);
71
72private:
73 static bool s_styleWarningsIssued;
74 static bool s_isReadingProperty;
75 static QQSK::State s_cachedState;
76 static QVarLengthArray<QQSK::StateFlag, 10> s_cachedStateList;
77
78private:
79 template <class T>
80 static QVariant readPropertyInStorageForState(
81 const PropertyPathId main, const PropertyPathId alternative,
82 const T *storageProvider, QQSK::State state);
83
84 template <class INDICES_CONTAINER>
85 static QVariant readPropertyInControlForStates(
86 const PropertyPathId main, const PropertyPathId alternative,
87 const QQStyleKitControl *control, INDICES_CONTAINER &stateListIndices,
88 int startIndex, int recursionLevel);
89
90 static QVariant readPropertyInControl(
91 const PropertyPathIds &ids, const QQStyleKitControl *control);
92
93 static QVariant readPropertyInRelevantControls(
94 const QQStyleKitControls *controls, const PropertyPathIds &ids,
95 const QQStyleKitExtendableControlType exactType,
96 const QList<QQStyleKitExtendableControlType> baseTypes);
97
98 static QVariant readPropertyInVariations(
99 const QList<QPointer<QQStyleKitVariation>> &variations,
100 const QQStyleKitStyleAndThemeBase *styleOrTheme,
101 const PropertyPathIds &ids,
102 const QQStyleKitExtendableControlType exactType,
103 const QList<QQStyleKitExtendableControlType> baseTypes);
104
105 static QVariant readPropertyInStyle(
106 QQStyleKitStyle *style,
107 const PropertyPathIds &ids,
108 QQStyleKitReader *styleReader);
109
110 static void cacheReaderState(QQSK::State state);
111
112 static inline void addVariationToReader(
113 QQStyleKitReader *styleReader,
114 QQStyleKitStyleAndThemeBase *styleOrTheme,
115 QQStyleKitVariation *variation);
116
117 static void addInstanceVariationsToReader(
118 QQStyleKitReader *styleReader,
119 QQStyleKitStyleAndThemeBase *styleOrTheme,
120 const AttachedVariationList &attachedVariations);
121
122 static void addTypeVariationsToReader(
123 QQStyleKitReader *styleReader,
124 QQStyleKitStyleAndThemeBase *styleOrTheme,
125 const AttachedVariationList &attachedVariations);
126
127 static void rebuildVariationsForReader(QQStyleKitReader *styleReader, QQStyleKitStyle *style);
128};
129
130QT_END_NAMESPACE
131
132#endif // QQSTYLEKITPROPERTYRESOLVER_P_H
QQSK::Property property() const
PropertyStorageId storageId(QQSK::State state) const
PropertyPathId_t pathId() const
QQStyleKitDelegateProperties * delegateStyle() const
void componentComplete() override
Invoked after the root component that caused this instantiation has completed construction.
void setDelegateStyle(QQStyleKitDelegateProperties *delegateProperties)
QQStyleKitDelegateProperties * first() const
QQStyleKitDelegateProperties * second() const
QQStyleKitDelegateProperties * foreground() const
void emitGlobally(QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals) const
void emitGlobally(QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals) const
QQStyleKitDelegateProperties * foreground() const
QQStyleKitIndicatorProperties * down() const
QQStyleKitIndicatorProperties * up() const
bool setStyleProperty(QQSK::Property property, T value)
QQStyleKitPropertyGroupSpace m_groupSpace
void emitChangedForAllStylePropertiesRecursive(EmitFlags emitFlags)
T styleProperty(QQSK::Property property, const T &defaultValue) const
T styleProperty(QQSK::Property property, QQSK::Property alternative=QQSK::Property::NoProperty) const
T * lazyCreateGroup(T *const &ptr, QQSK::PropertyGroup group) const
QQSK::PropertyPathFlags pathFlags() const
void handleStylePropertyChanged(void(SUBCLASS::*changedSignal)())
PropertyPathId propertyPathId(QQSK::Property property, PropertyPathId::Flag flag) const
void handleStylePropertiesChanged(CHANGED_SIGNALS... changedSignals)
bool isDefined(QQSK::Property property) const
QQStyleKitControlProperties * controlProperties() const
static QVariant readStyleProperty(const QQStyleKitPropertyGroup *group, const QQSK::Property property, const QQSK::Property alternative=QQSK::Property::NoProperty)
static bool hasLocalStyleProperty(const QQStyleKitPropertyGroup *group, const QQSK::Property property)
static const QList< QQStyleKitExtendableControlType > baseTypesForType(QQStyleKitExtendableControlType exactType)
static bool writeStyleProperty(const QQStyleKitPropertyGroup *group, const QQSK::Property property, const QVariant &value)
void setBottomPadding(qreal bottomPadding)
void setAlignment(Qt::Alignment alignment)
void emitGlobally(QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals) const
Combined button and popup list for selecting options.
constexpr PropertyPathId_t nestedGroupCount
constexpr PropertyPathId_t nestedGroupsStartSize
constexpr PropertyPathId_t maxStateCombinationCount
constexpr PropertyPathId_t subtypeStorageSpaceSize
constexpr PropertyPathId_t stateStorageSpaceSize
constexpr PropertyPathId_t subtypeCount
constexpr PropertyPathId_t maxPropertyStorageSpaceSize