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)
116 enum class AlternateState {
120 Q_ENUM(AlternateState)
122 QQStyleKitReader(QObject *parent =
nullptr);
125 QQStyleKitExtendableControlType controlType()
const;
126 void setControlType(QQStyleKitExtendableControlType type);
128 ControlType typeAsControlType()
const;
131 bool hovered()
const;
132 void setHovered(
bool hovered);
134 bool enabled()
const;
135 void setEnabled(
bool enabled);
137 bool focused()
const;
138 void setFocused(
bool focused);
140 bool checked()
const;
141 void setChecked(
bool checked);
143 bool pressed()
const;
144 void setPressed(
bool pressed);
146 QQuickPalette *palette()
const;
147 void setPalette(QQuickPalette *palette);
148 QPalette effectivePalette()
const;
150 bool vertical()
const;
151 void setVertical(
bool vertical);
153 bool highlighted()
const;
154 void setHighlighted(
bool highlighted);
156 QQStyleKitStyle *explicitStyle()
const;
157 void setExplicitStyle(QQStyleKitStyle *style);
161 QQStyleKitControlProperties *global()
const;
163 QVariant readStyleProperty(PropertyStorageId key)
const;
164 void writeStyleProperty(PropertyStorageId key,
const QVariant &value);
165 void clearLocalStorage();
167 QQSK::State controlState()
const;
169 void setControlTypeAndState(QQStyleKitExtendableControlType controlType, QQSK::State flags,
170 bool applyStateChange =
true);
172 QObject *target()
const;
173 void setTarget(QObject *target);
177 void setCompleted(
bool completed);
179 bool transitionsEnabled()
const;
180 void setTransitionsEnabled(
bool enabled);
182 static void resetReadersForStyle(
const QQStyleKitStyle *style);
184 static QList<QQStyleKitReader *> s_allReaders;
187 void controlTypeChanged();
188 void customTypeChanged();
189 void propertiesChanged();
190 void enabledChanged();
191 void focusedChanged();
192 void checkedChanged();
193 void hoveredChanged();
194 void pressedChanged();
195 void paletteChanged();
196 void verticalChanged();
197 void highlightedChanged();
201 void onPaletteChanged();
204 void classBegin() override {}
205 void componentComplete() override;
208 void updateControl(
bool applyStateChange =
true);
209 void populateLocalStorage();
210 bool dontEmitChangedSignals()
const;
212 QQuickStateGroup *stateGroup();
213 QQmlComponent *createControlChangesComponent()
const;
214 QQmlComponent *createDelegateChangesComponent(
const QString &delegateName)
const;
215 void instantiatePropertyChanges(QQmlComponent *comp);
216 void maybeTrackDelegates();
218 bool rebuildEffectivePalette();
219 bool rebuildEffectiveFont();
222 Q_DISABLE_COPY(QQStyleKitReader)
225
226
227
228
229 QQStyleKitExtendableControlType m_type = ControlType::Unspecified;
231 bool m_dontEmitChangedSignals: 1;
232 bool m_effectiveVariationsDirty: 1;
233 bool m_transitionsEnabled: 1;
236 QPointer<QQuickPalette> m_palette;
237 QPalette m_effectivePalette;
239 bool m_fontDirty =
true;
240 quint64 m_lastTextFontOverridesSignature = 0;
241 mutable QQStyleKitPropertyStorage m_storage;
242 AlternateState m_alternateState = AlternateState::Alternate1;
243 QQSK::State m_state = QQSK::StateFlag::Unspecified;
244 QQuickStateGroup *m_stateGroup =
nullptr;
245 QQSK::Delegates m_trackedDelegates = QQSK::Delegate::NoDelegate;
247 QPointer<QObject> m_target;
248 QPointer<QQStyleKitStyle> m_explicitStyle;
249 QPointer<QQStyleKitReader> m_parentReader;
250 QList<QPointer<QQStyleKitVariation>> m_effectiveVariations;
252 QQStyleKitControlProperties m_global;
254 using PropertyChangesComponents = QMap<std::pair<Qt::totally_ordered_wrapper<QQmlEngine*>, QString>, QPointer<QQmlComponent>>;
255 static PropertyChangesComponents s_propertyChangesComponents;
257 friend class QQStyleKitControlProperties;
258 friend class QQStyleKitPropertyResolver;
259 friend class QQStyleKitPropertyGroup;