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)
104 enum class AlternateState {
108 Q_ENUM(AlternateState)
110 QQStyleKitReader(QObject *parent =
nullptr);
113 QQStyleKitExtendableControlType controlType()
const;
114 void setControlType(QQStyleKitExtendableControlType type);
116 ControlType typeAsControlType()
const;
119 bool hovered()
const;
120 void setHovered(
bool hovered);
122 bool enabled()
const;
123 void setEnabled(
bool enabled);
125 bool focused()
const;
126 void setFocused(
bool focused);
128 bool checked()
const;
129 void setChecked(
bool checked);
131 bool pressed()
const;
132 void setPressed(
bool pressed);
134 QQuickPalette *palette()
const;
135 void setPalette(QQuickPalette *palette);
136 QPalette effectivePalette()
const;
138 bool vertical()
const;
139 void setVertical(
bool vertical);
141 bool highlighted()
const;
142 void setHighlighted(
bool highlighted);
144 QQStyleKitStyle *explicitStyle()
const;
145 void setExplicitStyle(QQStyleKitStyle *style);
149 QQStyleKitControlProperties *global()
const;
151 QVariant readStyleProperty(PropertyStorageId key)
const;
152 void writeStyleProperty(PropertyStorageId key,
const QVariant &value);
153 void clearLocalStorage();
155 QQSK::State controlState()
const;
157 void setControlTypeAndState(QQStyleKitExtendableControlType controlType, QQSK::State flags);
159 QObject *target()
const;
160 void setTarget(QObject *target);
164 void setCompleted(
bool completed);
166 bool transitionsEnabled()
const;
167 void setTransitionsEnabled(
bool enabled);
169 static void resetReadersForStyle(
const QQStyleKitStyle *style);
171 static QList<QQStyleKitReader *> s_allReaders;
174 void controlTypeChanged();
175 void customTypeChanged();
176 void propertiesChanged();
177 void enabledChanged();
178 void focusedChanged();
179 void checkedChanged();
180 void hoveredChanged();
181 void pressedChanged();
182 void paletteChanged();
183 void verticalChanged();
184 void highlightedChanged();
188 void onPaletteChanged();
191 void classBegin() override {}
192 void componentComplete() override;
195 void updateControl();
196 void populateLocalStorage();
197 bool dontEmitChangedSignals()
const;
199 QQuickStateGroup *stateGroup();
200 QQmlComponent *createControlChangesComponent()
const;
201 QQmlComponent *createDelegateChangesComponent(
const QString &delegateName)
const;
202 void instantiatePropertyChanges(QQmlComponent *comp);
203 void maybeTrackDelegates();
205 bool rebuildEffectivePalette();
206 bool rebuildEffectiveFont();
209 Q_DISABLE_COPY(QQStyleKitReader)
212
213
214
215
216 QQStyleKitExtendableControlType m_type = ControlType::Unspecified;
218 bool m_dontEmitChangedSignals: 1;
219 bool m_effectiveVariationsDirty: 1;
220 bool m_transitionsEnabled: 1;
223 QPointer<QQuickPalette> m_palette;
224 QPalette m_effectivePalette;
226 bool m_fontDirty =
true;
227 quint64 m_lastTextFontOverridesSignature = 0;
228 mutable QQStyleKitPropertyStorage m_storage;
229 AlternateState m_alternateState = AlternateState::Alternate1;
230 QQSK::State m_state = QQSK::StateFlag::Unspecified;
231 QQuickStateGroup *m_stateGroup =
nullptr;
232 QQSK::Delegates m_trackedDelegates = QQSK::Delegate::NoDelegate;
234 QPointer<QObject> m_target;
235 QPointer<QQStyleKitStyle> m_explicitStyle;
236 QPointer<QQStyleKitReader> m_parentReader;
237 QList<QPointer<QQStyleKitVariation>> m_effectiveVariations;
239 QQStyleKitControlProperties m_global;
241 using PropertyChangesComponents = QMap<std::pair<Qt::totally_ordered_wrapper<QQmlEngine*>, QString>, QQmlComponent *>;
242 static PropertyChangesComponents s_propertyChangesComponents;
244 friend class QQStyleKitControlProperties;
245 friend class QQStyleKitPropertyResolver;
246 friend class QQStyleKitPropertyGroup;