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)
69 HorizontalHeaderViewDelegate,
108 VerticalHeaderViewDelegate
112 enum class AlternateState {
116 Q_ENUM(AlternateState)
118 QQStyleKitReader(QObject *parent =
nullptr);
121 QQStyleKitExtendableControlType controlType()
const;
122 void setControlType(QQStyleKitExtendableControlType type);
124 ControlType typeAsControlType()
const;
127 bool hovered()
const;
128 void setHovered(
bool hovered);
130 bool enabled()
const;
131 void setEnabled(
bool enabled);
133 bool focused()
const;
134 void setFocused(
bool focused);
136 bool checked()
const;
137 void setChecked(
bool checked);
139 bool pressed()
const;
140 void setPressed(
bool pressed);
142 QQuickPalette *palette()
const;
143 void setPalette(QQuickPalette *palette);
144 QPalette effectivePalette()
const;
146 bool vertical()
const;
147 void setVertical(
bool vertical);
149 bool highlighted()
const;
150 void setHighlighted(
bool highlighted);
152 QQStyleKitStyle *explicitStyle()
const;
153 void setExplicitStyle(QQStyleKitStyle *style);
157 QQStyleKitControlProperties *global()
const;
159 QVariant readStyleProperty(PropertyStorageId key)
const;
160 void writeStyleProperty(PropertyStorageId key,
const QVariant &value);
161 void clearLocalStorage();
163 QQSK::State controlState()
const;
165 void setControlTypeAndState(QQStyleKitExtendableControlType controlType, QQSK::State flags,
166 bool applyStateChange =
true);
168 QObject *target()
const;
169 void setTarget(QObject *target);
173 void setCompleted(
bool completed);
175 bool transitionsEnabled()
const;
176 void setTransitionsEnabled(
bool enabled);
178 static void resetReadersForStyle(
const QQStyleKitStyle *style);
180 static QList<QQStyleKitReader *> s_allReaders;
183 void controlTypeChanged();
184 void customTypeChanged();
185 void propertiesChanged();
186 void enabledChanged();
187 void focusedChanged();
188 void checkedChanged();
189 void hoveredChanged();
190 void pressedChanged();
191 void paletteChanged();
192 void verticalChanged();
193 void highlightedChanged();
197 void onPaletteChanged();
200 void classBegin() override {}
201 void componentComplete() override;
204 void updateControl(
bool applyStateChange =
true);
205 void populateLocalStorage();
206 bool dontEmitChangedSignals()
const;
208 QQuickStateGroup *stateGroup();
209 QQmlComponent *createControlChangesComponent()
const;
210 QQmlComponent *createDelegateChangesComponent(
const QString &delegateName)
const;
211 void instantiatePropertyChanges(QQmlComponent *comp);
212 void maybeTrackDelegates();
214 bool rebuildEffectivePalette();
215 bool rebuildEffectiveFont();
218 Q_DISABLE_COPY(QQStyleKitReader)
221
222
223
224
225 QQStyleKitExtendableControlType m_type = ControlType::Unspecified;
227 bool m_dontEmitChangedSignals: 1;
228 bool m_effectiveVariationsDirty: 1;
229 bool m_transitionsEnabled: 1;
232 QPointer<QQuickPalette> m_palette;
233 QPalette m_effectivePalette;
235 bool m_fontDirty =
true;
236 quint64 m_lastTextFontOverridesSignature = 0;
237 mutable QQStyleKitPropertyStorage m_storage;
238 AlternateState m_alternateState = AlternateState::Alternate1;
239 QQSK::State m_state = QQSK::StateFlag::Unspecified;
240 QQuickStateGroup *m_stateGroup =
nullptr;
241 QQSK::Delegates m_trackedDelegates = QQSK::Delegate::NoDelegate;
243 QPointer<QObject> m_target;
244 QPointer<QQStyleKitStyle> m_explicitStyle;
245 QPointer<QQStyleKitReader> m_parentReader;
246 QList<QPointer<QQStyleKitVariation>> m_effectiveVariations;
248 QQStyleKitControlProperties m_global;
250 using PropertyChangesComponents = QMap<std::pair<Qt::totally_ordered_wrapper<QQmlEngine*>, QString>, QPointer<QQmlComponent>>;
251 static PropertyChangesComponents s_propertyChangesComponents;
253 friend class QQStyleKitControlProperties;
254 friend class QQStyleKitPropertyResolver;
255 friend class QQStyleKitPropertyGroup;