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)
103 enum class AlternateState {
107 Q_ENUM(AlternateState)
109 QQStyleKitReader(QObject *parent =
nullptr);
112 QQStyleKitExtendableControlType controlType()
const;
113 void setControlType(QQStyleKitExtendableControlType type);
115 ControlType typeAsControlType()
const;
118 bool hovered()
const;
119 void setHovered(
bool hovered);
121 bool enabled()
const;
122 void setEnabled(
bool enabled);
124 bool focused()
const;
125 void setFocused(
bool focused);
127 bool checked()
const;
128 void setChecked(
bool checked);
130 bool pressed()
const;
131 void setPressed(
bool pressed);
133 QQuickPalette *palette()
const;
134 void setPalette(QQuickPalette *palette);
135 QPalette effectivePalette()
const;
137 bool vertical()
const;
138 void setVertical(
bool vertical);
140 bool highlighted()
const;
141 void setHighlighted(
bool highlighted);
143 QQStyleKitStyle *explicitStyle()
const;
144 void setExplicitStyle(QQStyleKitStyle *style);
148 QQStyleKitControlProperties *global()
const;
150 QVariant readStyleProperty(PropertyStorageId key)
const;
151 void writeStyleProperty(PropertyStorageId key,
const QVariant &value);
152 void clearLocalStorage();
154 QQSK::State controlState()
const;
156 void setControlTypeAndState(QQStyleKitExtendableControlType controlType, QQSK::State flags);
158 QObject *target()
const;
159 void setTarget(QObject *target);
163 void setCompleted(
bool completed);
165 bool transitionsEnabled()
const;
166 void setTransitionsEnabled(
bool enabled);
168 static void resetReadersForStyle(
const QQStyleKitStyle *style);
170 static QList<QQStyleKitReader *> s_allReaders;
173 void controlTypeChanged();
174 void customTypeChanged();
175 void propertiesChanged();
176 void enabledChanged();
177 void focusedChanged();
178 void checkedChanged();
179 void hoveredChanged();
180 void pressedChanged();
181 void paletteChanged();
182 void verticalChanged();
183 void highlightedChanged();
187 void onPaletteChanged();
190 void classBegin() override {}
191 void componentComplete() override;
194 void updateControl();
195 void populateLocalStorage();
196 bool dontEmitChangedSignals()
const;
198 QQuickStateGroup *stateGroup();
199 QQmlComponent *createControlChangesComponent()
const;
200 QQmlComponent *createDelegateChangesComponent(
const QString &delegateName)
const;
201 void instantiatePropertyChanges(QQmlComponent *comp);
202 void maybeTrackDelegates();
204 bool rebuildEffectivePalette();
205 bool rebuildEffectiveFont();
208 Q_DISABLE_COPY(QQStyleKitReader)
211
212
213
214
215 QQStyleKitExtendableControlType m_type = ControlType::Unspecified;
217 bool m_dontEmitChangedSignals: 1;
218 bool m_effectiveVariationsDirty: 1;
219 bool m_transitionsEnabled: 1;
222 QPointer<QQuickPalette> m_palette;
223 QPalette m_effectivePalette;
225 bool m_fontDirty =
true;
226 quint64 m_lastTextFontOverridesSignature = 0;
227 mutable QQStyleKitPropertyStorage m_storage;
228 AlternateState m_alternateState = AlternateState::Alternate1;
229 QQSK::State m_state = QQSK::StateFlag::Unspecified;
230 QQuickStateGroup *m_stateGroup =
nullptr;
231 QQSK::Delegates m_trackedDelegates = QQSK::Delegate::NoDelegate;
233 QPointer<QObject> m_target;
234 QPointer<QQStyleKitStyle> m_explicitStyle;
235 QPointer<QQStyleKitReader> m_parentReader;
236 QList<QPointer<QQStyleKitVariation>> m_effectiveVariations;
238 QQStyleKitControlProperties m_global;
240 using PropertyChangesComponents = QMap<std::pair<Qt::totally_ordered_wrapper<QQmlEngine*>, QString>, QQmlComponent *>;
241 static PropertyChangesComponents s_propertyChangesComponents;
243 friend class QQStyleKitControlProperties;
244 friend class QQStyleKitPropertyResolver;
245 friend class QQStyleKitPropertyGroup;