Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qquickstate_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QQUICKSTATE_H
5#define QQUICKSTATE_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <qqml.h>
19#include <qqmlproperty.h>
20#include <QtCore/qobject.h>
21#include <QtCore/qsharedpointer.h>
22#include <private/qtquickglobal_p.h>
23#include <private/qqmlabstractbinding_p.h>
24#include <private/qqmlanybinding_p.h>
25
26#include <QtCore/private/qproperty_p.h>
27
29
31class QQmlBinding;
32class QQmlExpression;
33
61
63{
64public:
66
67 enum EventType { Script, SignalHandler, ParentChange, AnchorChanges };
68
69 virtual EventType type() const = 0;
70
71 virtual void execute();
72 virtual bool isReversable();
73 virtual void reverse();
74 virtual void saveOriginals() {}
75 virtual bool needsCopy() { return false; }
77
78 virtual bool isRewindable() { return isReversable(); }
79 virtual void rewind() {}
80 virtual void saveCurrentValues() {}
81 virtual void saveTargetValues() {}
82
83 virtual bool changesBindings();
84 virtual void clearBindings();
85 virtual bool mayOverride(QQuickStateActionEvent*other);
86};
87
88//### rename to QQuickStateChange?
90class QQuickState;
92class Q_QUICK_EXPORT QQuickStateOperation : public QObject
93{
97public:
98 QQuickStateOperation(QObject *parent = nullptr)
99 : QObject(parent) {}
100 typedef QList<QQuickStateAction> ActionList;
101
102 virtual ActionList actions();
103
104 QQuickState *state() const;
105 void setState(QQuickState *state);
106
107protected:
108 QQuickStateOperation(QObjectPrivate &dd, QObject *parent = nullptr);
109
110private:
111 Q_DECLARE_PRIVATE(QQuickStateOperation)
112 Q_DISABLE_COPY(QQuickStateOperation)
113};
114
116
117class QQuickTransition;
119class Q_QUICK_EXPORT QQuickState : public QObject
120{
122
124 Q_PROPERTY(bool when READ when WRITE setWhen)
125 Q_PROPERTY(QString extend READ extends WRITE setExtends)
127 Q_CLASSINFO("DefaultProperty", "changes")
128 Q_CLASSINFO("DeferredPropertyNames", "changes")
131
132public:
133 QQuickState(QObject *parent=nullptr);
134 ~QQuickState() override;
135
136 QString name() const;
137 void setName(const QString &);
138 bool isNamed() const;
139
140 bool isWhenKnown() const;
141 bool when() const;
142 void setWhen(bool);
143
144 QString extends() const;
145 void setExtends(const QString &);
146
148 int operationCount() const;
149 QQuickStateOperation *operationAt(int) const;
150
151 QQuickState &operator<<(QQuickStateOperation *);
152
153 void apply(QQuickTransition *, QQuickState *revert);
154 void cancel();
155
156 QQuickStateGroup *stateGroup() const;
157 void setStateGroup(QQuickStateGroup *);
158
159 bool containsPropertyInRevertList(QObject *target, const QString &name) const;
160 bool changeValueInRevertList(QObject *target, const QString &name, const QVariant &revertValue);
161 bool changeBindingInRevertList(QObject *target, const QString &name, QQmlAnyBinding binding);
162 bool removeEntryFromRevertList(QObject *target, const QString &name);
163 void addEntryToRevertList(const QQuickStateAction &action);
164 void removeAllEntriesFromRevertList(QObject *target);
165 void addEntriesToRevertList(const QList<QQuickStateAction> &actions);
166 QVariant valueInRevertList(QObject *target, const QString &name) const;
167 QQmlAnyBinding bindingInRevertList(QObject *target, const QString &name) const;
168
169 bool isStateActive() const;
170
172 void completed();
173
174private:
175 Q_DECLARE_PRIVATE(QQuickState)
176 Q_DISABLE_COPY(QQuickState)
177};
178
180
181#endif // QQUICKSTATE_H
\inmodule QtCore
Definition qobject.h:103
QQmlAnyBinding is an abstraction over the various bindings in QML.
The QQmlExpression class evaluates JavaScript in a QML context.
The QQmlListProperty class allows applications to expose list-like properties of QObject-derived clas...
Definition qqmllist.h:24
The QQmlProperty class abstracts accessing properties on objects created from QML.
virtual void saveTargetValues()
virtual void saveOriginals()
virtual void saveCurrentValues()
virtual bool needsCopy()
virtual void rewind()
virtual bool isRewindable()
virtual EventType type() const =0
virtual void copyOriginals(QQuickStateActionEvent *)
QQmlProperty property
QQmlAnyBinding fromBinding
QObject * specifiedObject
QQuickStateActionEvent * event
QString specifiedProperty
QQmlAnyBinding toBinding
QQuickStateOperation(QObject *parent=nullptr)
QList< QQuickStateAction > ActionList
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
\inmodule QtCore
Definition qvariant.h:65
employee setName("Richard Schmit")
else opt state
[0]
Combined button and popup list for selecting options.
GLenum target
GLuint name
#define QML_ANONYMOUS
#define QML_NAMED_ELEMENT(NAME)
#define QML_ADDED_IN_VERSION(MAJOR, MINOR)
QQuickStateOperation::ActionList QQuickStateActions
#define Q_AUTOTEST_EXPORT
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_CLASSINFO(name, value)
#define Q_SIGNALS
const char property[13]
Definition qwizard.cpp:101
future cancel()
QSharedPointer< T > other(t)
[5]