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)
111 enum class AlternateState {
115 Q_ENUM(AlternateState)
117 QQStyleKitReader(QObject *parent =
nullptr);
120 QQStyleKitExtendableControlType controlType()
const;
121 void setControlType(QQStyleKitExtendableControlType type);
123 ControlType typeAsControlType()
const;
126 bool hovered()
const;
127 void setHovered(
bool hovered);
129 bool enabled()
const;
130 void setEnabled(
bool enabled);
132 bool focused()
const;
133 void setFocused(
bool focused);
135 bool checked()
const;
136 void setChecked(
bool checked);
138 bool pressed()
const;
139 void setPressed(
bool pressed);
141 QQuickPalette *palette()
const;
142 void setPalette(QQuickPalette *palette);
143 QPalette effectivePalette()
const;
145 bool vertical()
const;
146 void setVertical(
bool vertical);
148 bool highlighted()
const;
149 void setHighlighted(
bool highlighted);
151 QQStyleKitStyle *explicitStyle()
const;
152 void setExplicitStyle(QQStyleKitStyle *style);
156 QQStyleKitControlProperties *global()
const;
158 QVariant readStyleProperty(PropertyStorageId key)
const;
159 void writeStyleProperty(PropertyStorageId key,
const QVariant &value);
160 void clearLocalStorage();
162 QQSK::State controlState()
const;
164 void setControlTypeAndState(QQStyleKitExtendableControlType controlType, QQSK::State flags,
165 bool applyStateChange =
true);
167 QObject *target()
const;
168 void setTarget(QObject *target);
172 void setCompleted(
bool completed);
174 bool transitionsEnabled()
const;
175 void setTransitionsEnabled(
bool enabled);
177 static void resetReadersForStyle(
const QQStyleKitStyle *style);
179 static QList<QQStyleKitReader *> s_allReaders;
182 void controlTypeChanged();
183 void customTypeChanged();
184 void propertiesChanged();
185 void enabledChanged();
186 void focusedChanged();
187 void checkedChanged();
188 void hoveredChanged();
189 void pressedChanged();
190 void paletteChanged();
191 void verticalChanged();
192 void highlightedChanged();
196 void onPaletteChanged();
199 void classBegin() override {}
200 void componentComplete() override;
203 void updateControl(
bool applyStateChange =
true);
204 void populateLocalStorage();
205 bool dontEmitChangedSignals()
const;
207 QQuickStateGroup *stateGroup();
208 QQmlComponent *createControlChangesComponent()
const;
209 QQmlComponent *createDelegateChangesComponent(
const QString &delegateName)
const;
210 void instantiatePropertyChanges(QQmlComponent *comp);
211 void maybeTrackDelegates();
213 bool rebuildEffectivePalette();
214 bool rebuildEffectiveFont();
217 Q_DISABLE_COPY(QQStyleKitReader)
220
221
222
223
224 QQStyleKitExtendableControlType m_type = ControlType::Unspecified;
226 bool m_dontEmitChangedSignals: 1;
227 bool m_effectiveVariationsDirty: 1;
228 bool m_transitionsEnabled: 1;
231 QPointer<QQuickPalette> m_palette;
232 QPalette m_effectivePalette;
234 bool m_fontDirty =
true;
235 quint64 m_lastTextFontOverridesSignature = 0;
236 mutable QQStyleKitPropertyStorage m_storage;
237 AlternateState m_alternateState = AlternateState::Alternate1;
238 QQSK::State m_state = QQSK::StateFlag::Unspecified;
239 QQuickStateGroup *m_stateGroup =
nullptr;
240 QQSK::Delegates m_trackedDelegates = QQSK::Delegate::NoDelegate;
242 QPointer<QObject> m_target;
243 QPointer<QQStyleKitStyle> m_explicitStyle;
244 QPointer<QQStyleKitReader> m_parentReader;
245 QList<QPointer<QQStyleKitVariation>> m_effectiveVariations;
247 QQStyleKitControlProperties m_global;
249 using PropertyChangesComponents = QMap<std::pair<Qt::totally_ordered_wrapper<QQmlEngine*>, QString>, QPointer<QQmlComponent>>;
250 static PropertyChangesComponents s_propertyChangesComponents;
252 friend class QQStyleKitControlProperties;
253 friend class QQStyleKitPropertyResolver;
254 friend class QQStyleKitPropertyGroup;