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)
96 enum class AlternateState {
100 Q_ENUM(AlternateState)
102 QQStyleKitReader(QObject *parent =
nullptr);
105 QQStyleKitExtendableControlType controlType()
const;
106 void setControlType(QQStyleKitExtendableControlType type);
108 ControlType typeAsControlType()
const;
111 bool hovered()
const;
112 void setHovered(
bool hovered);
114 bool enabled()
const;
115 void setEnabled(
bool enabled);
117 bool focused()
const;
118 void setFocused(
bool focused);
120 bool checked()
const;
121 void setChecked(
bool checked);
123 bool pressed()
const;
124 void setPressed(
bool pressed);
126 QQuickPalette *palette()
const;
127 void setPalette(QQuickPalette *palette);
128 QPalette effectivePalette()
const;
130 bool vertical()
const;
131 void setVertical(
bool vertical);
133 bool highlighted()
const;
134 void setHighlighted(
bool highlighted);
136 QQStyleKitStyle *explicitStyle()
const;
137 void setExplicitStyle(QQStyleKitStyle *style);
141 QQStyleKitControlProperties *global()
const;
143 QVariant readStyleProperty(PropertyStorageId key)
const;
144 void writeStyleProperty(PropertyStorageId key,
const QVariant &value);
145 void clearLocalStorage();
147 QQSK::State controlState()
const;
149 void setControlTypeAndState(QQStyleKitExtendableControlType controlType, QQSK::State flags);
151 QObject *target()
const;
152 void setTarget(QObject *target);
156 void setCompleted(
bool completed);
158 bool transitionsEnabled()
const;
159 void setTransitionsEnabled(
bool enabled);
161 static void resetReadersForStyle(
const QQStyleKitStyle *style);
163 static QList<QQStyleKitReader *> s_allReaders;
166 void controlTypeChanged();
167 void customTypeChanged();
168 void propertiesChanged();
169 void enabledChanged();
170 void focusedChanged();
171 void checkedChanged();
172 void hoveredChanged();
173 void pressedChanged();
174 void paletteChanged();
175 void verticalChanged();
176 void highlightedChanged();
180 void onPaletteChanged();
183 void classBegin() override {}
184 void componentComplete() override;
187 void updateControl();
188 void populateLocalStorage();
189 bool dontEmitChangedSignals()
const;
191 QQuickStateGroup *stateGroup();
192 QQmlComponent *createControlChangesComponent()
const;
193 QQmlComponent *createDelegateChangesComponent(
const QString &delegateName)
const;
194 void instantiatePropertyChanges(QQmlComponent *comp);
195 void maybeTrackDelegates();
197 bool rebuildEffectivePalette();
198 bool rebuildEffectiveFont();
201 Q_DISABLE_COPY(QQStyleKitReader)
204
205
206
207
208 QQStyleKitExtendableControlType m_type = ControlType::Unspecified;
210 bool m_dontEmitChangedSignals: 1;
211 bool m_effectiveVariationsDirty: 1;
212 bool m_transitionsEnabled: 1;
215 QPointer<QQuickPalette> m_palette;
216 QPalette m_effectivePalette;
218 bool m_fontDirty =
true;
219 quint64 m_lastTextFontOverridesSignature = 0;
220 mutable QQStyleKitPropertyStorage m_storage;
221 AlternateState m_alternateState = AlternateState::Alternate1;
222 QQSK::State m_state = QQSK::StateFlag::Unspecified;
223 QQuickStateGroup *m_stateGroup =
nullptr;
224 QQSK::Delegates m_trackedDelegates = QQSK::Delegate::NoDelegate;
226 QPointer<QObject> m_target;
227 QPointer<QQStyleKitStyle> m_explicitStyle;
228 QPointer<QQStyleKitReader> m_parentReader;
229 QList<QPointer<QQStyleKitVariation>> m_effectiveVariations;
231 QQStyleKitControlProperties m_global;
233 using PropertyChangesComponents = QMap<std::pair<Qt::totally_ordered_wrapper<QQmlEngine*>, QString>, QQmlComponent *>;
234 static PropertyChangesComponents s_propertyChangesComponents;
236 friend class QQStyleKitControlProperties;
237 friend class QQStyleKitPropertyResolver;
238 friend class QQStyleKitPropertyGroup;