34class Q_LABSSTYLEKIT_EXPORT
QQStyleKitReader :
public QQStyleKitControlProperties,
public QQmlParserStatus
37 Q_INTERFACES(QQmlParserStatus)
38 Q_PROPERTY(QQStyleKitExtendableControlType controlType READ controlType WRITE setControlType NOTIFY controlTypeChanged FINAL)
39 Q_PROPERTY(
bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged FINAL)
40 Q_PROPERTY(
bool focused READ focused WRITE setFocused NOTIFY focusedChanged FINAL)
41 Q_PROPERTY(
bool checked READ checked WRITE setChecked NOTIFY checkedChanged FINAL)
42 Q_PROPERTY(
bool hovered READ hovered WRITE setHovered NOTIFY hoveredChanged FINAL)
43 Q_PROPERTY(
bool pressed READ pressed WRITE setPressed NOTIFY pressedChanged FINAL)
44 Q_PROPERTY(
bool vertical READ vertical WRITE setVertical NOTIFY verticalChanged FINAL)
45 Q_PROPERTY(
bool highlighted READ highlighted WRITE setHighlighted NOTIFY highlightedChanged FINAL)
46 Q_PROPERTY(QFont font READ font NOTIFY fontChanged FINAL)
47 Q_PROPERTY(QQuickPalette *palette READ palette WRITE setPalette NOTIFY paletteChanged FINAL)
48 Q_PROPERTY(QQStyleKitControlProperties *global READ global CONSTANT FINAL)
50 QML_NAMED_ELEMENT(StyleReader)
100 enum class AlternateState {
104 Q_ENUM(AlternateState)
106 QQStyleKitReader(QObject *parent =
nullptr);
109 QQStyleKitExtendableControlType controlType()
const;
110 void setControlType(QQStyleKitExtendableControlType type);
112 ControlType typeAsControlType()
const;
115 bool hovered()
const;
116 void setHovered(
bool hovered);
118 bool enabled()
const;
119 void setEnabled(
bool enabled);
121 bool focused()
const;
122 void setFocused(
bool focused);
124 bool checked()
const;
125 void setChecked(
bool checked);
127 bool pressed()
const;
128 void setPressed(
bool pressed);
130 QQuickPalette *palette()
const;
131 void setPalette(QQuickPalette *palette);
132 QPalette effectivePalette()
const;
134 bool vertical()
const;
135 void setVertical(
bool vertical);
137 bool highlighted()
const;
138 void setHighlighted(
bool highlighted);
140 QQStyleKitStyle *explicitStyle()
const;
141 void setExplicitStyle(QQStyleKitStyle *style);
145 QQStyleKitControlProperties *global()
const;
147 QVariant readStyleProperty(PropertyStorageId key)
const;
148 void writeStyleProperty(PropertyStorageId key,
const QVariant &value);
149 void clearLocalStorage();
151 QQSK::State controlState()
const;
153 void setControlTypeAndState(QQStyleKitExtendableControlType controlType, QQSK::State flags);
155 QObject *target()
const;
156 void setTarget(QObject *target);
160 void setCompleted(
bool completed);
162 bool transitionsEnabled()
const;
163 void setTransitionsEnabled(
bool enabled);
165 static void resetReadersForStyle(
const QQStyleKitStyle *style);
167 static QList<QQStyleKitReader *> s_allReaders;
170 void controlTypeChanged();
171 void customTypeChanged();
172 void propertiesChanged();
173 void enabledChanged();
174 void focusedChanged();
175 void checkedChanged();
176 void hoveredChanged();
177 void pressedChanged();
178 void paletteChanged();
179 void verticalChanged();
180 void highlightedChanged();
184 void onPaletteChanged();
187 void classBegin() override {}
188 void componentComplete() override;
191 void updateControl();
192 void populateLocalStorage();
193 bool dontEmitChangedSignals()
const;
195 QQuickStateGroup *stateGroup();
196 QQmlComponent *createControlChangesComponent()
const;
197 QQmlComponent *createDelegateChangesComponent(
const QString &delegateName)
const;
198 void instantiatePropertyChanges(QQmlComponent *comp);
199 void maybeTrackDelegates();
201 bool rebuildEffectivePalette();
202 bool rebuildEffectiveFont();
205 Q_DISABLE_COPY(QQStyleKitReader)
208
209
210
211
212 QQStyleKitExtendableControlType m_type = ControlType::Unspecified;
214 bool m_dontEmitChangedSignals: 1;
215 bool m_effectiveVariationsDirty: 1;
216 bool m_transitionsEnabled: 1;
219 QPointer<QQuickPalette> m_palette;
220 QPalette m_effectivePalette;
222 bool m_fontDirty =
true;
223 quint64 m_lastTextFontOverridesSignature = 0;
224 mutable QQStyleKitPropertyStorage m_storage;
225 AlternateState m_alternateState = AlternateState::Alternate1;
226 QQSK::State m_state = QQSK::StateFlag::Unspecified;
227 QQuickStateGroup *m_stateGroup =
nullptr;
228 QQSK::Delegates m_trackedDelegates = QQSK::Delegate::NoDelegate;
230 QPointer<QObject> m_target;
231 QPointer<QQStyleKitStyle> m_explicitStyle;
232 QPointer<QQStyleKitReader> m_parentReader;
233 QList<QPointer<QQStyleKitVariation>> m_effectiveVariations;
235 QQStyleKitControlProperties m_global;
237 using PropertyChangesComponents = QMap<std::pair<Qt::totally_ordered_wrapper<QQmlEngine*>, QString>, QQmlComponent *>;
238 static PropertyChangesComponents s_propertyChangesComponents;
240 friend class QQStyleKitControlProperties;
241 friend class QQStyleKitPropertyResolver;
242 friend class QQStyleKitPropertyGroup;