Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/util/qquickstate_p.h |
Source code | Switch to Preprocessed file |
Line | Source | Count |
---|---|---|
1 | /**************************************************************************** | - |
2 | ** | - |
3 | ** Copyright (C) 2016 The Qt Company Ltd. | - |
4 | ** Contact: https://www.qt.io/licensing/ | - |
5 | ** | - |
6 | ** This file is part of the QtQuick module of the Qt Toolkit. | - |
7 | ** | - |
8 | ** $QT_BEGIN_LICENSE:LGPL$ | - |
9 | ** Commercial License Usage | - |
10 | ** Licensees holding valid commercial Qt licenses may use this file in | - |
11 | ** accordance with the commercial license agreement provided with the | - |
12 | ** Software or, alternatively, in accordance with the terms contained in | - |
13 | ** a written agreement between you and The Qt Company. For licensing terms | - |
14 | ** and conditions see https://www.qt.io/terms-conditions. For further | - |
15 | ** information use the contact form at https://www.qt.io/contact-us. | - |
16 | ** | - |
17 | ** GNU Lesser General Public License Usage | - |
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - |
19 | ** General Public License version 3 as published by the Free Software | - |
20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the | - |
21 | ** packaging of this file. Please review the following information to | - |
22 | ** ensure the GNU Lesser General Public License version 3 requirements | - |
23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. | - |
24 | ** | - |
25 | ** GNU General Public License Usage | - |
26 | ** Alternatively, this file may be used under the terms of the GNU | - |
27 | ** General Public License version 2.0 or (at your option) the GNU General | - |
28 | ** Public license version 3 or any later version approved by the KDE Free | - |
29 | ** Qt Foundation. The licenses are as published by the Free Software | - |
30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 | - |
31 | ** included in the packaging of this file. Please review the following | - |
32 | ** information to ensure the GNU General Public License requirements will | - |
33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and | - |
34 | ** https://www.gnu.org/licenses/gpl-3.0.html. | - |
35 | ** | - |
36 | ** $QT_END_LICENSE$ | - |
37 | ** | - |
38 | ****************************************************************************/ | - |
39 | - | |
40 | #ifndef QQUICKSTATE_H | - |
41 | #define QQUICKSTATE_H | - |
42 | - | |
43 | // | - |
44 | // W A R N I N G | - |
45 | // ------------- | - |
46 | // | - |
47 | // This file is not part of the Qt API. It exists purely as an | - |
48 | // implementation detail. This header file may change from version to | - |
49 | // version without notice, or even be removed. | - |
50 | // | - |
51 | // We mean it. | - |
52 | // | - |
53 | - | |
54 | #include <qqml.h> | - |
55 | #include <qqmlproperty.h> | - |
56 | #include <QtCore/qobject.h> | - |
57 | #include <QtCore/qsharedpointer.h> | - |
58 | #include <private/qtquickglobal_p.h> | - |
59 | #include <private/qqmlabstractbinding_p.h> | - |
60 | - | |
61 | QT_BEGIN_NAMESPACE | - |
62 | - | |
63 | class QQuickStateActionEvent; | - |
64 | class QQmlBinding; | - |
65 | class QQmlExpression; | - |
66 | - | |
67 | class Q_QUICK_PRIVATE_EXPORT QQuickStateAction | - |
68 | { | - |
69 | public: | - |
70 | QQuickStateAction(); | - |
71 | QQuickStateAction(QObject *, const QString &, const QVariant &); | - |
72 | QQuickStateAction(QObject *, const QQmlProperty &property, const QString &, | - |
73 | const QVariant &); | - |
74 | - | |
75 | bool restore:1; | - |
76 | bool actionDone:1; | - |
77 | bool reverseEvent:1; | - |
78 | bool deletableToBinding:1; | - |
79 | - | |
80 | QQmlProperty property; | - |
81 | QVariant fromValue; | - |
82 | QVariant toValue; | - |
83 | - | |
84 | QQmlAbstractBinding::Ptr fromBinding; | - |
85 | QQmlAbstractBinding::Ptr toBinding; | - |
86 | QQuickStateActionEvent *event; | - |
87 | - | |
88 | //strictly for matching | - |
89 | QObject *specifiedObject; | - |
90 | QString specifiedProperty; | - |
91 | - | |
92 | void deleteFromBinding(); | - |
93 | }; | - |
94 | - | |
95 | class Q_AUTOTEST_EXPORT QQuickStateActionEvent | - |
96 | { | - |
97 | public: | - |
98 | virtual ~QQuickStateActionEvent(); | - |
99 | - | |
100 | enum EventType { Script, SignalHandler, ParentChange, AnchorChanges }; | - |
101 | - | |
102 | virtual EventType type() const = 0; | - |
103 | - | |
104 | virtual void execute(); | - |
105 | virtual bool isReversable(); | - |
106 | virtual void reverse(); | - |
107 | virtual void saveOriginals() {} | - |
108 | virtual bool needsCopy() { return false; } never executed: return false; | 0 |
109 | virtual void copyOriginals(QQuickStateActionEvent *) {} | - |
110 | - | |
111 | virtual bool isRewindable() { return isReversable(); } executed 44 times by 3 tests: return isReversable(); Executed by:
| 44 |
112 | virtual void rewind() {} | - |
113 | virtual void saveCurrentValues() {} | - |
114 | virtual void saveTargetValues() {} | - |
115 | - | |
116 | virtual bool changesBindings(); | - |
117 | virtual void clearBindings(); | - |
118 | virtual bool mayOverride(QQuickStateActionEvent*other); | - |
119 | }; | - |
120 | - | |
121 | //### rename to QQuickStateChange? | - |
122 | class QQuickStateGroup; | - |
123 | class QQuickState; | - |
124 | class QQuickStateOperationPrivate; | - |
125 | class Q_QUICK_PRIVATE_EXPORT QQuickStateOperation : public QObject | - |
126 | { | - |
127 | Q_OBJECT | - |
128 | public: | - |
129 | QQuickStateOperation(QObject *parent = nullptr) | - |
130 | : QObject(parent) {} never executed: end of block | 0 |
131 | typedef QList<QQuickStateAction> ActionList; | - |
132 | - | |
133 | virtual ActionList actions(); | - |
134 | - | |
135 | QQuickState *state() const; | - |
136 | void setState(QQuickState *state); | - |
137 | - | |
138 | protected: | - |
139 | QQuickStateOperation(QObjectPrivate &dd, QObject *parent = nullptr); | - |
140 | - | |
141 | private: | - |
142 | Q_DECLARE_PRIVATE(QQuickStateOperation) executed 622 times by 18 tests: return reinterpret_cast<QQuickStateOperationPrivate *>(qGetPtrHelper(d_ptr)); Executed by:
executed 60 times by 3 tests: return reinterpret_cast<const QQuickStateOperationPrivate *>(qGetPtrHelper(d_ptr)); Executed by:
| 60-622 |
143 | Q_DISABLE_COPY(QQuickStateOperation) | - |
144 | }; | - |
145 | - | |
146 | typedef QQuickStateOperation::ActionList QQuickStateActions; | - |
147 | - | |
148 | class QQuickTransition; | - |
149 | class QQuickStatePrivate; | - |
150 | class Q_QUICK_PRIVATE_EXPORT QQuickState : public QObject | - |
151 | { | - |
152 | Q_OBJECT | - |
153 | - | |
154 | Q_PROPERTY(QString name READ name WRITE setName) | - |
155 | Q_PROPERTY(QQmlBinding *when READ when WRITE setWhen) | - |
156 | Q_PROPERTY(QString extend READ extends WRITE setExtends) | - |
157 | Q_PROPERTY(QQmlListProperty<QQuickStateOperation> changes READ changes) | - |
158 | Q_CLASSINFO("DefaultProperty", "changes") | - |
159 | Q_CLASSINFO("DeferredPropertyNames", "changes") | - |
160 | - | |
161 | public: | - |
162 | QQuickState(QObject *parent=nullptr); | - |
163 | ~QQuickState() override; | - |
164 | - | |
165 | QString name() const; | - |
166 | void setName(const QString &); | - |
167 | bool isNamed() const; | - |
168 | - | |
169 | /*'when' is a QQmlBinding to limit state changes oscillation | - |
170 | due to the unpredictable order of evaluation of bound expressions*/ | - |
171 | bool isWhenKnown() const; | - |
172 | QQmlBinding *when() const; | - |
173 | void setWhen(QQmlBinding *); | - |
174 | - | |
175 | QString extends() const; | - |
176 | void setExtends(const QString &); | - |
177 | - | |
178 | QQmlListProperty<QQuickStateOperation> changes(); | - |
179 | int operationCount() const; | - |
180 | QQuickStateOperation *operationAt(int) const; | - |
181 | - | |
182 | QQuickState &operator<<(QQuickStateOperation *); | - |
183 | - | |
184 | void apply(QQuickTransition *, QQuickState *revert); | - |
185 | void cancel(); | - |
186 | - | |
187 | QQuickStateGroup *stateGroup() const; | - |
188 | void setStateGroup(QQuickStateGroup *); | - |
189 | - | |
190 | bool containsPropertyInRevertList(QObject *target, const QString &name) const; | - |
191 | bool changeValueInRevertList(QObject *target, const QString &name, const QVariant &revertValue); | - |
192 | bool changeBindingInRevertList(QObject *target, const QString &name, QQmlAbstractBinding *binding); | - |
193 | bool removeEntryFromRevertList(QObject *target, const QString &name); | - |
194 | void addEntryToRevertList(const QQuickStateAction &action); | - |
195 | void removeAllEntriesFromRevertList(QObject *target); | - |
196 | void addEntriesToRevertList(const QList<QQuickStateAction> &actions); | - |
197 | QVariant valueInRevertList(QObject *target, const QString &name) const; | - |
198 | QQmlAbstractBinding *bindingInRevertList(QObject *target, const QString &name) const; | - |
199 | - | |
200 | bool isStateActive() const; | - |
201 | - | |
202 | Q_SIGNALS: | - |
203 | void completed(); | - |
204 | - | |
205 | private: | - |
206 | Q_DECLARE_PRIVATE(QQuickState) executed 9926 times by 20 tests: return reinterpret_cast<QQuickStatePrivate *>(qGetPtrHelper(d_ptr)); Executed by:
executed 6286 times by 19 tests: return reinterpret_cast<const QQuickStatePrivate *>(qGetPtrHelper(d_ptr)); Executed by:
| 6286-9926 |
207 | Q_DISABLE_COPY(QQuickState) | - |
208 | }; | - |
209 | - | |
210 | QT_END_NAMESPACE | - |
211 | - | |
212 | QML_DECLARE_TYPE(QQuickStateOperation) | - |
213 | QML_DECLARE_TYPE(QQuickState) | - |
214 | - | |
215 | #endif // QQUICKSTATE_H | - |
Source code | Switch to Preprocessed file |