Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/util/qquickpropertychanges.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||
2 | - | |||||||||||||||||||
3 | - | |||||||||||||||||||
4 | - | |||||||||||||||||||
5 | - | |||||||||||||||||||
6 | - | |||||||||||||||||||
7 | class QQuickReplaceSignalHandler : public QQuickStateActionEvent | - | ||||||||||||||||||
8 | { | - | ||||||||||||||||||
9 | public: | - | ||||||||||||||||||
10 | QQuickReplaceSignalHandler() {} | - | ||||||||||||||||||
11 | ~QQuickReplaceSignalHandler() {} | - | ||||||||||||||||||
12 | - | |||||||||||||||||||
13 | EventType type() const override { return executed 40 times by 1 test: SignalHandler;return SignalHandler; Executed by:
executed 40 times by 1 test: }return SignalHandler; Executed by:
| 40 | ||||||||||||||||||
14 | - | |||||||||||||||||||
15 | QQmlProperty property; | - | ||||||||||||||||||
16 | QQmlBoundSignalExpressionPointer expression; | - | ||||||||||||||||||
17 | QQmlBoundSignalExpressionPointer reverseExpression; | - | ||||||||||||||||||
18 | QQmlBoundSignalExpressionPointer rewindExpression; | - | ||||||||||||||||||
19 | - | |||||||||||||||||||
20 | void execute() override { | - | ||||||||||||||||||
21 | QQmlPropertyPrivate::setSignalExpression(property, expression); | - | ||||||||||||||||||
22 | } executed 26 times by 1 test: end of block Executed by:
| 26 | ||||||||||||||||||
23 | - | |||||||||||||||||||
24 | bool isReversable() override { return executed 84 times by 1 test: true;return true; Executed by:
executed 84 times by 1 test: }return true; Executed by:
| 84 | ||||||||||||||||||
25 | void reverse() override { | - | ||||||||||||||||||
26 | QQmlPropertyPrivate::setSignalExpression(property, reverseExpression); | - | ||||||||||||||||||
27 | } executed 8 times by 1 test: end of block Executed by:
| 8 | ||||||||||||||||||
28 | - | |||||||||||||||||||
29 | void saveOriginals() override { | - | ||||||||||||||||||
30 | saveCurrentValues(); | - | ||||||||||||||||||
31 | reverseExpression = rewindExpression; | - | ||||||||||||||||||
32 | } executed 16 times by 1 test: end of block Executed by:
| 16 | ||||||||||||||||||
33 | - | |||||||||||||||||||
34 | bool needsCopy() override { return executed 6 times by 1 test: true;return true; Executed by:
executed 6 times by 1 test: }return true; Executed by:
| 6 | ||||||||||||||||||
35 | void copyOriginals(QQuickStateActionEvent *other) override | - | ||||||||||||||||||
36 | { | - | ||||||||||||||||||
37 | QQuickReplaceSignalHandler *rsh = static_cast<QQuickReplaceSignalHandler*>(other); | - | ||||||||||||||||||
38 | saveCurrentValues(); | - | ||||||||||||||||||
39 | if (rsh == this
| 0-6 | ||||||||||||||||||
40 | return; never executed: return; | 0 | ||||||||||||||||||
41 | reverseExpression = rsh->reverseExpression; | - | ||||||||||||||||||
42 | } executed 6 times by 1 test: end of block Executed by:
| 6 | ||||||||||||||||||
43 | - | |||||||||||||||||||
44 | void rewind() override { | - | ||||||||||||||||||
45 | QQmlPropertyPrivate::setSignalExpression(property, rewindExpression); | - | ||||||||||||||||||
46 | } never executed: end of block | 0 | ||||||||||||||||||
47 | void saveCurrentValues() override { | - | ||||||||||||||||||
48 | rewindExpression = QQmlPropertyPrivate::signalExpression(property); | - | ||||||||||||||||||
49 | } executed 34 times by 1 test: end of block Executed by:
| 34 | ||||||||||||||||||
50 | - | |||||||||||||||||||
51 | bool mayOverride(QQuickStateActionEvent *other) override { | - | ||||||||||||||||||
52 | if (other == this
| 6-8 | ||||||||||||||||||
53 | return executed 8 times by 1 test: true;return true; Executed by:
executed 8 times by 1 test: return true; Executed by:
| 8 | ||||||||||||||||||
54 | if (other->type() != type()
| 0-6 | ||||||||||||||||||
55 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||
56 | if (static_cast<
| 0-6 | ||||||||||||||||||
57 | return executed 6 times by 1 test: true;return true; Executed by:
executed 6 times by 1 test: return true; Executed by:
| 6 | ||||||||||||||||||
58 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||
59 | } | - | ||||||||||||||||||
60 | }; | - | ||||||||||||||||||
61 | - | |||||||||||||||||||
62 | - | |||||||||||||||||||
63 | class QQuickPropertyChangesPrivate : public QQuickStateOperationPrivate | - | ||||||||||||||||||
64 | { | - | ||||||||||||||||||
65 | inline QQuickPropertyChanges* q_func() { return static_cast<QQuickPropertyChanges *>(q_ptr); } inline const QQuickPropertyChanges* q_func() const { return static_cast<const QQuickPropertyChanges *>(q_ptr); } friend class QQuickPropertyChanges; | - | ||||||||||||||||||
66 | public: | - | ||||||||||||||||||
67 | QQuickPropertyChangesPrivate() : decoded(true), restore(true), | - | ||||||||||||||||||
68 | isExplicit(false) {} executed 456 times by 17 tests: end of block Executed by:
| 456 | ||||||||||||||||||
69 | - | |||||||||||||||||||
70 | QPointer<QObject> object; | - | ||||||||||||||||||
71 | QList<const QV4::CompiledData::Binding *> bindings; | - | ||||||||||||||||||
72 | QQmlRefPointer<QV4::CompiledData::CompilationUnit> compilationUnit; | - | ||||||||||||||||||
73 | - | |||||||||||||||||||
74 | bool decoded : 1; | - | ||||||||||||||||||
75 | bool restore : 1; | - | ||||||||||||||||||
76 | bool isExplicit : 1; | - | ||||||||||||||||||
77 | - | |||||||||||||||||||
78 | void decode(); | - | ||||||||||||||||||
79 | void decodeBinding(const QString &propertyPrefix, const QV4::CompiledData::Unit *qmlUnit, const QV4::CompiledData::Binding *binding); | - | ||||||||||||||||||
80 | - | |||||||||||||||||||
81 | class ExpressionChange { | - | ||||||||||||||||||
82 | public: | - | ||||||||||||||||||
83 | ExpressionChange(const QString &_name, | - | ||||||||||||||||||
84 | const QV4::CompiledData::Binding *_binding, | - | ||||||||||||||||||
85 | QQmlBinding::Identifier _id, | - | ||||||||||||||||||
86 | const QString& _expr, | - | ||||||||||||||||||
87 | const QUrl &_url, | - | ||||||||||||||||||
88 | int _line, | - | ||||||||||||||||||
89 | int _column) | - | ||||||||||||||||||
90 | : name(_name), binding(_binding), id(_id), expression(_expr), url(_url), line(_line), column(_column) {} executed 72 times by 11 tests: end of block Executed by:
| 72 | ||||||||||||||||||
91 | QString name; | - | ||||||||||||||||||
92 | const QV4::CompiledData::Binding *binding; | - | ||||||||||||||||||
93 | QQmlBinding::Identifier id; | - | ||||||||||||||||||
94 | QString expression; | - | ||||||||||||||||||
95 | QUrl url; | - | ||||||||||||||||||
96 | int line; | - | ||||||||||||||||||
97 | int column; | - | ||||||||||||||||||
98 | }; | - | ||||||||||||||||||
99 | - | |||||||||||||||||||
100 | QList<QPair<QString, QVariant> > properties; | - | ||||||||||||||||||
101 | QList<ExpressionChange> expressions; | - | ||||||||||||||||||
102 | QList<QQuickReplaceSignalHandler*> signalReplacements; | - | ||||||||||||||||||
103 | - | |||||||||||||||||||
104 | QQmlProperty property(const QString &); | - | ||||||||||||||||||
105 | }; | - | ||||||||||||||||||
106 | - | |||||||||||||||||||
107 | void QQuickPropertyChangesParser::verifyList(const QV4::CompiledData::Unit *qmlUnit, const QV4::CompiledData::Binding *binding) | - | ||||||||||||||||||
108 | { | - | ||||||||||||||||||
109 | if (binding->type == QV4::CompiledData::Binding::Type_Object
| 2-492 | ||||||||||||||||||
110 | error(qmlUnit->objectAt(binding->value.objectIndex), QQuickPropertyChanges::tr("PropertyChanges does not support creating state-specific objects.")); | - | ||||||||||||||||||
111 | return; executed 2 times by 1 test: return; Executed by:
| 2 | ||||||||||||||||||
112 | } | - | ||||||||||||||||||
113 | - | |||||||||||||||||||
114 | if (binding->type == QV4::CompiledData::Binding::Type_GroupProperty
| 22-470 | ||||||||||||||||||
115 | || binding->type == QV4::CompiledData::Binding::Type_AttachedProperty
| 6-464 | ||||||||||||||||||
116 | const QV4::CompiledData::Object *subObj = qmlUnit->objectAt(binding->value.objectIndex); | - | ||||||||||||||||||
117 | const QV4::CompiledData::Binding *subBinding = subObj->bindingTable(); | - | ||||||||||||||||||
118 | for (quint32 i = 0; i < subObj->nBindings
| 28-32 | ||||||||||||||||||
119 | verifyList(qmlUnit, subBinding); | - | ||||||||||||||||||
120 | } executed 32 times by 6 tests: end of block Executed by:
| 32 | ||||||||||||||||||
121 | } executed 28 times by 6 tests: end of block Executed by:
| 28 | ||||||||||||||||||
122 | } executed 492 times by 17 tests: end of block Executed by:
| 492 | ||||||||||||||||||
123 | - | |||||||||||||||||||
124 | void QQuickPropertyChangesPrivate::decode() | - | ||||||||||||||||||
125 | { | - | ||||||||||||||||||
126 | if (decoded
| 102-454 | ||||||||||||||||||
127 | return; executed 102 times by 5 tests: return; Executed by:
| 102 | ||||||||||||||||||
128 | - | |||||||||||||||||||
129 | for (const QV4::CompiledData::Binding *binding : qAsConst(bindings)) | - | ||||||||||||||||||
130 | decodeBinding(QString(), compilationUnit->data, binding); executed 480 times by 17 tests: decodeBinding(QString(), compilationUnit->data, binding); Executed by:
| 480 | ||||||||||||||||||
131 | - | |||||||||||||||||||
132 | bindings.clear(); | - | ||||||||||||||||||
133 | - | |||||||||||||||||||
134 | decoded = true; | - | ||||||||||||||||||
135 | } executed 454 times by 17 tests: end of block Executed by:
| 454 | ||||||||||||||||||
136 | - | |||||||||||||||||||
137 | void QQuickPropertyChangesPrivate::decodeBinding(const QString &propertyPrefix, const QV4::CompiledData::Unit *qmlUnit, const QV4::CompiledData::Binding *binding) | - | ||||||||||||||||||
138 | { | - | ||||||||||||||||||
139 | QQuickPropertyChanges * const q = q_func(); | - | ||||||||||||||||||
140 | - | |||||||||||||||||||
141 | QString propertyName = propertyPrefix + qmlUnit->stringAt(binding->propertyNameIndex); | - | ||||||||||||||||||
142 | - | |||||||||||||||||||
143 | if (binding->type == QV4::CompiledData::Binding::Type_GroupProperty
| 18-554 | ||||||||||||||||||
144 | || binding->type == QV4::CompiledData::Binding::Type_AttachedProperty
| 72-482 | ||||||||||||||||||
145 | QString pre = propertyName + QLatin1Char('.'); | - | ||||||||||||||||||
146 | const QV4::CompiledData::Object *subObj = qmlUnit->objectAt(binding->value.objectIndex); | - | ||||||||||||||||||
147 | const QV4::CompiledData::Binding *subBinding = subObj->bindingTable(); | - | ||||||||||||||||||
148 | for (quint32 i = 0; i < subObj->nBindings
| 90-92 | ||||||||||||||||||
149 | decodeBinding(pre, qmlUnit, subBinding); | - | ||||||||||||||||||
150 | } executed 92 times by 6 tests: end of block Executed by:
| 92 | ||||||||||||||||||
151 | return; executed 90 times by 6 tests: return; Executed by:
| 90 | ||||||||||||||||||
152 | } | - | ||||||||||||||||||
153 | - | |||||||||||||||||||
154 | if (propertyName.count() >= 3
| 56-426 | ||||||||||||||||||
155 | propertyName.at(0) == QLatin1Char('o')
| 38-388 | ||||||||||||||||||
156 | propertyName.at(1) == QLatin1Char('n')
| 18-20 | ||||||||||||||||||
157 | propertyName.at(2).isUpper()
| 0-18 | ||||||||||||||||||
158 | QQmlProperty prop = property(propertyName); | - | ||||||||||||||||||
159 | if (prop.isSignalProperty()
| 0-18 | ||||||||||||||||||
160 | QQuickReplaceSignalHandler *handler = new QQuickReplaceSignalHandler; | - | ||||||||||||||||||
161 | handler->property = prop; | - | ||||||||||||||||||
162 | handler->expression.take(new QQmlBoundSignalExpression(object, QQmlPropertyPrivate::get(prop)->signalIndex(), | - | ||||||||||||||||||
163 | QQmlContextData::get(qmlContext(q)), object, compilationUnit->runtimeFunctions.at(binding->value.compiledScriptIndex))); | - | ||||||||||||||||||
164 | signalReplacements << handler; | - | ||||||||||||||||||
165 | return; executed 18 times by 1 test: return; Executed by:
| 18 | ||||||||||||||||||
166 | } | - | ||||||||||||||||||
167 | } never executed: end of block | 0 | ||||||||||||||||||
168 | - | |||||||||||||||||||
169 | if (binding->type == QV4::CompiledData::Binding::Type_Script
| 4-400 | ||||||||||||||||||
170 | QUrl url = QUrl(); | - | ||||||||||||||||||
171 | int line = -1; | - | ||||||||||||||||||
172 | int column = -1; | - | ||||||||||||||||||
173 | - | |||||||||||||||||||
174 | QQmlData *ddata = QQmlData::get(q); | - | ||||||||||||||||||
175 | if (ddata
| 0-68 | ||||||||||||||||||
176 | url = ddata->outerContext->url(); | - | ||||||||||||||||||
177 | line = ddata->lineNumber; | - | ||||||||||||||||||
178 | column = ddata->columnNumber; | - | ||||||||||||||||||
179 | } executed 68 times by 11 tests: end of block Executed by:
| 68 | ||||||||||||||||||
180 | - | |||||||||||||||||||
181 | QString expression; | - | ||||||||||||||||||
182 | QQmlBinding::Identifier id = QQmlBinding::Invalid; | - | ||||||||||||||||||
183 | - | |||||||||||||||||||
184 | if (!binding->isTranslationBinding()
| 4-64 | ||||||||||||||||||
185 | expression = binding->valueAsString(qmlUnit); | - | ||||||||||||||||||
186 | id = binding->value.compiledScriptIndex; | - | ||||||||||||||||||
187 | } executed 64 times by 10 tests: end of block Executed by:
| 64 | ||||||||||||||||||
188 | expressions << ExpressionChange(propertyName, binding, id, expression, url, line, column); | - | ||||||||||||||||||
189 | return; executed 68 times by 11 tests: return; Executed by:
| 68 | ||||||||||||||||||
190 | } | - | ||||||||||||||||||
191 | - | |||||||||||||||||||
192 | QVariant var; | - | ||||||||||||||||||
193 | switch (binding->type) { | - | ||||||||||||||||||
194 | case never executed: QV4::CompiledData::Binding::Type_Script:case QV4::CompiledData::Binding::Type_Script: never executed: case QV4::CompiledData::Binding::Type_Script: | 0 | ||||||||||||||||||
195 | case never executed: QV4::CompiledData::Binding::Type_Translation:case QV4::CompiledData::Binding::Type_Translation: never executed: case QV4::CompiledData::Binding::Type_Translation: | 0 | ||||||||||||||||||
196 | case never executed: QV4::CompiledData::Binding::Type_TranslationById:case QV4::CompiledData::Binding::Type_TranslationById: never executed: case QV4::CompiledData::Binding::Type_TranslationById: | 0 | ||||||||||||||||||
197 | do { ((false) ? static_cast<void>(0) : qt_assert_x("Q_UNREACHABLE()", "Q_UNREACHABLE was reached", __FILE__, 329)); __builtin_unreachable(); } while (false); | - | ||||||||||||||||||
198 | case executed 218 times by 6 tests: case QV4::CompiledData::Binding::Type_String: Executed by:
code before this statement never executed: case QV4::CompiledData::Binding::Type_String: executed 218 times by 6 tests: QV4::CompiledData::Binding::Type_String:case QV4::CompiledData::Binding::Type_String: Executed by:
code before this statement never executed: case QV4::CompiledData::Binding::Type_String: executed 218 times by 6 tests: case QV4::CompiledData::Binding::Type_String: Executed by:
| 0-218 | ||||||||||||||||||
199 | var = binding->valueAsString(qmlUnit); | - | ||||||||||||||||||
200 | break; executed 218 times by 6 tests: break; Executed by:
| 218 | ||||||||||||||||||
201 | case executed 100 times by 8 tests: QV4::CompiledData::Binding::Type_Number:case QV4::CompiledData::Binding::Type_Number: Executed by:
executed 100 times by 8 tests: case QV4::CompiledData::Binding::Type_Number: Executed by:
| 100 | ||||||||||||||||||
202 | var = binding->valueAsNumber(); | - | ||||||||||||||||||
203 | break; executed 100 times by 8 tests: break; Executed by:
| 100 | ||||||||||||||||||
204 | case executed 78 times by 3 tests: QV4::CompiledData::Binding::Type_Boolean:case QV4::CompiledData::Binding::Type_Boolean: Executed by:
executed 78 times by 3 tests: case QV4::CompiledData::Binding::Type_Boolean: Executed by:
| 78 | ||||||||||||||||||
205 | var = binding->valueAsBoolean(); | - | ||||||||||||||||||
206 | break; executed 78 times by 3 tests: break; Executed by:
| 78 | ||||||||||||||||||
207 | default never executed: :default: never executed: default: | 0 | ||||||||||||||||||
208 | break; never executed: break; | 0 | ||||||||||||||||||
209 | } | - | ||||||||||||||||||
210 | - | |||||||||||||||||||
211 | properties << qMakePair(propertyName, var); | - | ||||||||||||||||||
212 | } executed 396 times by 10 tests: end of block Executed by:
| 396 | ||||||||||||||||||
213 | - | |||||||||||||||||||
214 | void QQuickPropertyChangesParser::verifyBindings(const QV4::CompiledData::Unit *qmlUnit, const QList<const QV4::CompiledData::Binding *> &props) | - | ||||||||||||||||||
215 | { | - | ||||||||||||||||||
216 | for (int ii = 0; ii < props.count()
| 398-462 | ||||||||||||||||||
217 | verifyList(qmlUnit, props.at(ii)); executed 462 times by 17 tests: verifyList(qmlUnit, props.at(ii)); Executed by:
| 462 | ||||||||||||||||||
218 | } executed 398 times by 17 tests: end of block Executed by:
| 398 | ||||||||||||||||||
219 | - | |||||||||||||||||||
220 | void QQuickPropertyChangesParser::applyBindings(QObject *obj, QV4::CompiledData::CompilationUnit *compilationUnit, const QList<const QV4::CompiledData::Binding *> &bindings) | - | ||||||||||||||||||
221 | { | - | ||||||||||||||||||
222 | QQuickPropertyChangesPrivate *p = | - | ||||||||||||||||||
223 | static_cast<QQuickPropertyChangesPrivate *>(QObjectPrivate::get(obj)); | - | ||||||||||||||||||
224 | p->bindings = bindings; | - | ||||||||||||||||||
225 | p->compilationUnit = compilationUnit; | - | ||||||||||||||||||
226 | p->decoded = false; | - | ||||||||||||||||||
227 | } executed 454 times by 17 tests: end of block Executed by:
| 454 | ||||||||||||||||||
228 | - | |||||||||||||||||||
229 | QQuickPropertyChanges::QQuickPropertyChanges() | - | ||||||||||||||||||
230 | : QQuickStateOperation(*(new QQuickPropertyChangesPrivate)) | - | ||||||||||||||||||
231 | { | - | ||||||||||||||||||
232 | } executed 456 times by 17 tests: end of block Executed by:
| 456 | ||||||||||||||||||
233 | - | |||||||||||||||||||
234 | QQuickPropertyChanges::~QQuickPropertyChanges() | - | ||||||||||||||||||
235 | { | - | ||||||||||||||||||
236 | QQuickPropertyChangesPrivate * const d = d_func(); | - | ||||||||||||||||||
237 | for(int ii = 0; ii < d->signalReplacements.count()
| 14-352 | ||||||||||||||||||
238 | delete d->signalReplacements.at(ii); executed 14 times by 1 test: delete d->signalReplacements.at(ii); Executed by:
| 14 | ||||||||||||||||||
239 | } executed 352 times by 17 tests: end of block Executed by:
| 352 | ||||||||||||||||||
240 | - | |||||||||||||||||||
241 | QObject *QQuickPropertyChanges::object() const | - | ||||||||||||||||||
242 | { | - | ||||||||||||||||||
243 | const QQuickPropertyChangesPrivate * const d = d_func(); | - | ||||||||||||||||||
244 | return executed 198 times by 13 tests: d->object;return d->object; Executed by:
executed 198 times by 13 tests: return d->object; Executed by:
| 198 | ||||||||||||||||||
245 | } | - | ||||||||||||||||||
246 | - | |||||||||||||||||||
247 | void QQuickPropertyChanges::setObject(QObject *o) | - | ||||||||||||||||||
248 | { | - | ||||||||||||||||||
249 | QQuickPropertyChangesPrivate * const d = d_func(); | - | ||||||||||||||||||
250 | d->object = o; | - | ||||||||||||||||||
251 | } executed 458 times by 17 tests: end of block Executed by:
| 458 | ||||||||||||||||||
252 | bool QQuickPropertyChanges::restoreEntryValues() const | - | ||||||||||||||||||
253 | { | - | ||||||||||||||||||
254 | const QQuickPropertyChangesPrivate * const d = d_func(); | - | ||||||||||||||||||
255 | return executed 580 times by 17 tests: d->restore;return d->restore; Executed by:
executed 580 times by 17 tests: return d->restore; Executed by:
| 580 | ||||||||||||||||||
256 | } | - | ||||||||||||||||||
257 | - | |||||||||||||||||||
258 | void QQuickPropertyChanges::setRestoreEntryValues(bool v) | - | ||||||||||||||||||
259 | { | - | ||||||||||||||||||
260 | QQuickPropertyChangesPrivate * const d = d_func(); | - | ||||||||||||||||||
261 | d->restore = v; | - | ||||||||||||||||||
262 | } executed 4 times by 2 tests: end of block Executed by:
| 4 | ||||||||||||||||||
263 | - | |||||||||||||||||||
264 | QQmlProperty | - | ||||||||||||||||||
265 | QQuickPropertyChangesPrivate::property(const QString &property) | - | ||||||||||||||||||
266 | { | - | ||||||||||||||||||
267 | QQuickPropertyChanges * const q = q_func(); | - | ||||||||||||||||||
268 | QQmlContextData *context = nullptr; | - | ||||||||||||||||||
269 | if (QQmlData *ddata = QQmlData::get(q)
| 0-612 | ||||||||||||||||||
270 | context = ddata->outerContext; executed 612 times by 17 tests: context = ddata->outerContext; Executed by:
| 612 | ||||||||||||||||||
271 | QQmlProperty prop = QQmlPropertyPrivate::create(object, property, context); | - | ||||||||||||||||||
272 | if (!prop.isValid()
| 4-608 | ||||||||||||||||||
273 | qmlWarning(q) << QQuickPropertyChanges::tr("Cannot assign to non-existent property \"%1\"").arg(property); | - | ||||||||||||||||||
274 | return executed 4 times by 1 test: QQmlProperty();return QQmlProperty(); Executed by:
executed 4 times by 1 test: return QQmlProperty(); Executed by:
| 4 | ||||||||||||||||||
275 | } else if (!(prop.type() & QQmlProperty::SignalProperty)
| 2-590 | ||||||||||||||||||
276 | qmlWarning(q) << QQuickPropertyChanges::tr("Cannot assign to read-only property \"%1\"").arg(property); | - | ||||||||||||||||||
277 | return executed 2 times by 1 test: QQmlProperty();return QQmlProperty(); Executed by:
executed 2 times by 1 test: return QQmlProperty(); Executed by:
| 2 | ||||||||||||||||||
278 | } | - | ||||||||||||||||||
279 | return executed 606 times by 17 tests: prop;return prop; Executed by:
executed 606 times by 17 tests: return prop; Executed by:
| 606 | ||||||||||||||||||
280 | } | - | ||||||||||||||||||
281 | - | |||||||||||||||||||
282 | QQuickPropertyChanges::ActionList QQuickPropertyChanges::actions() | - | ||||||||||||||||||
283 | { | - | ||||||||||||||||||
284 | QQuickPropertyChangesPrivate * const d = d_func(); | - | ||||||||||||||||||
285 | - | |||||||||||||||||||
286 | d->decode(); | - | ||||||||||||||||||
287 | - | |||||||||||||||||||
288 | ActionList list; | - | ||||||||||||||||||
289 | - | |||||||||||||||||||
290 | for (int ii = 0; ii < d->properties.count()
| 486-556 | ||||||||||||||||||
291 | QQmlProperty prop = d->property(d->properties.at(ii).first); | - | ||||||||||||||||||
292 | - | |||||||||||||||||||
293 | QQuickStateAction a(d->object, prop, d->properties.at(ii).first, | - | ||||||||||||||||||
294 | d->properties.at(ii).second); | - | ||||||||||||||||||
295 | - | |||||||||||||||||||
296 | if (a.property.isValid()
| 6-480 | ||||||||||||||||||
297 | a.restore = restoreEntryValues(); | - | ||||||||||||||||||
298 | list << a; | - | ||||||||||||||||||
299 | } executed 480 times by 10 tests: end of block Executed by:
| 480 | ||||||||||||||||||
300 | } executed 486 times by 10 tests: end of block Executed by:
| 486 | ||||||||||||||||||
301 | - | |||||||||||||||||||
302 | for (int ii = 0; ii < d->signalReplacements.count()
| 26-556 | ||||||||||||||||||
303 | QQuickReplaceSignalHandler *handler = d->signalReplacements.at(ii); | - | ||||||||||||||||||
304 | - | |||||||||||||||||||
305 | if (handler->property.isValid()
| 0-26 | ||||||||||||||||||
306 | QQuickStateAction a; | - | ||||||||||||||||||
307 | a.event = handler; | - | ||||||||||||||||||
308 | list << a; | - | ||||||||||||||||||
309 | } executed 26 times by 1 test: end of block Executed by:
| 26 | ||||||||||||||||||
310 | } executed 26 times by 1 test: end of block Executed by:
| 26 | ||||||||||||||||||
311 | - | |||||||||||||||||||
312 | for (int ii = 0; ii < d->expressions.count()
| 92-556 | ||||||||||||||||||
313 | - | |||||||||||||||||||
314 | QQuickPropertyChangesPrivate::ExpressionChange e = d->expressions.at(ii); | - | ||||||||||||||||||
315 | const QString &property = e.name; | - | ||||||||||||||||||
316 | QQmlProperty prop = d->property(property); | - | ||||||||||||||||||
317 | - | |||||||||||||||||||
318 | if (prop.isValid()
| 0-92 | ||||||||||||||||||
319 | QQuickStateAction a; | - | ||||||||||||||||||
320 | a.restore = restoreEntryValues(); | - | ||||||||||||||||||
321 | a.property = prop; | - | ||||||||||||||||||
322 | a.fromValue = a.property.read(); | - | ||||||||||||||||||
323 | a.specifiedObject = d->object; | - | ||||||||||||||||||
324 | a.specifiedProperty = property; | - | ||||||||||||||||||
325 | - | |||||||||||||||||||
326 | QQmlContextData *context = QQmlContextData::get(qmlContext(this)); | - | ||||||||||||||||||
327 | - | |||||||||||||||||||
328 | QQmlBinding *newBinding = nullptr; | - | ||||||||||||||||||
329 | if (e.binding
| 4-88 | ||||||||||||||||||
330 | newBinding = QQmlBinding::createTranslationBinding(d->compilationUnit, e.binding, object(), context); | - | ||||||||||||||||||
331 | } executed 4 times by 2 tests: else if (e.id != QQmlBinding::Invalidend of block Executed by:
| 4-84 | ||||||||||||||||||
332 | QV4::Scope scope(qmlEngine(this)->handle()); | - | ||||||||||||||||||
333 | QV4::Scoped<QV4::QmlContext> qmlContext(scope, QV4::QmlContext::create(scope.engine->rootContext(), context, object())); | - | ||||||||||||||||||
334 | newBinding = QQmlBinding::create(&QQmlPropertyPrivate::get(prop)->core, | - | ||||||||||||||||||
335 | d->compilationUnit->runtimeFunctions.at(e.id), object(), context, qmlContext); | - | ||||||||||||||||||
336 | } executed 84 times by 10 tests: end of block Executed by:
| 84 | ||||||||||||||||||
337 | if (!newBinding
| 4-88 | ||||||||||||||||||
338 | newBinding = QQmlBinding::create(&QQmlPropertyPrivate::get(prop)->core, executed 4 times by 1 test: newBinding = QQmlBinding::create(&QQmlPropertyPrivate::get(prop)->core, e.expression, object(), context, e.url.toString(), e.line); Executed by:
| 4 | ||||||||||||||||||
339 | e.expression, object(), context, e.url.toString(), e.line); executed 4 times by 1 test: newBinding = QQmlBinding::create(&QQmlPropertyPrivate::get(prop)->core, e.expression, object(), context, e.url.toString(), e.line); Executed by:
| 4 | ||||||||||||||||||
340 | - | |||||||||||||||||||
341 | if (d->isExplicit
| 4-88 | ||||||||||||||||||
342 | - | |||||||||||||||||||
343 | - | |||||||||||||||||||
344 | - | |||||||||||||||||||
345 | - | |||||||||||||||||||
346 | a.toValue = newBinding->evaluate(); | - | ||||||||||||||||||
347 | delete newBinding; | - | ||||||||||||||||||
348 | } executed 4 times by 1 test: else {end of block Executed by:
| 4 | ||||||||||||||||||
349 | newBinding->setTarget(prop); | - | ||||||||||||||||||
350 | a.toBinding = newBinding; | - | ||||||||||||||||||
351 | a.deletableToBinding = true; | - | ||||||||||||||||||
352 | } executed 88 times by 11 tests: end of block Executed by:
| 88 | ||||||||||||||||||
353 | - | |||||||||||||||||||
354 | list << a; | - | ||||||||||||||||||
355 | } executed 92 times by 11 tests: end of block Executed by:
| 92 | ||||||||||||||||||
356 | } executed 92 times by 11 tests: end of block Executed by:
| 92 | ||||||||||||||||||
357 | - | |||||||||||||||||||
358 | return executed 556 times by 17 tests: list;return list; Executed by:
executed 556 times by 17 tests: return list; Executed by:
| 556 | ||||||||||||||||||
359 | } | - | ||||||||||||||||||
360 | bool QQuickPropertyChanges::isExplicit() const | - | ||||||||||||||||||
361 | { | - | ||||||||||||||||||
362 | const QQuickPropertyChangesPrivate * const d = d_func(); | - | ||||||||||||||||||
363 | return executed 6 times by 2 tests: d->isExplicit;return d->isExplicit; Executed by:
executed 6 times by 2 tests: return d->isExplicit; Executed by:
| 6 | ||||||||||||||||||
364 | } | - | ||||||||||||||||||
365 | - | |||||||||||||||||||
366 | void QQuickPropertyChanges::setIsExplicit(bool e) | - | ||||||||||||||||||
367 | { | - | ||||||||||||||||||
368 | QQuickPropertyChangesPrivate * const d = d_func(); | - | ||||||||||||||||||
369 | d->isExplicit = e; | - | ||||||||||||||||||
370 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||
371 | - | |||||||||||||||||||
372 | bool QQuickPropertyChanges::containsValue(const QString &name) const | - | ||||||||||||||||||
373 | { | - | ||||||||||||||||||
374 | const QQuickPropertyChangesPrivate * const d = d_func(); | - | ||||||||||||||||||
375 | typedef QPair<QString, QVariant> PropertyEntry; | - | ||||||||||||||||||
376 | - | |||||||||||||||||||
377 | QListIterator<PropertyEntry> propertyIterator(d->properties); | - | ||||||||||||||||||
378 | while (propertyIterator.hasNext()
| 6-16 | ||||||||||||||||||
379 | const PropertyEntry &entry = propertyIterator.next(); | - | ||||||||||||||||||
380 | if (entry.first == name
| 4-12 | ||||||||||||||||||
381 | return executed 4 times by 1 test: true;return true; Executed by:
executed 4 times by 1 test: return true; Executed by:
| 4 | ||||||||||||||||||
382 | } | - | ||||||||||||||||||
383 | } executed 12 times by 1 test: end of block Executed by:
| 12 | ||||||||||||||||||
384 | - | |||||||||||||||||||
385 | return executed 6 times by 1 test: false;return false; Executed by:
executed 6 times by 1 test: return false; Executed by:
| 6 | ||||||||||||||||||
386 | } | - | ||||||||||||||||||
387 | - | |||||||||||||||||||
388 | bool QQuickPropertyChanges::containsExpression(const QString &name) const | - | ||||||||||||||||||
389 | { | - | ||||||||||||||||||
390 | const QQuickPropertyChangesPrivate * const d = d_func(); | - | ||||||||||||||||||
391 | typedef QQuickPropertyChangesPrivate::ExpressionChange ExpressionEntry; | - | ||||||||||||||||||
392 | - | |||||||||||||||||||
393 | QListIterator<ExpressionEntry> expressionIterator(d->expressions); | - | ||||||||||||||||||
394 | while (expressionIterator.hasNext()
| 4 | ||||||||||||||||||
395 | const ExpressionEntry &entry = expressionIterator.next(); | - | ||||||||||||||||||
396 | if (entry.name == name
| 0-4 | ||||||||||||||||||
397 | return executed 4 times by 1 test: true;return true; Executed by:
executed 4 times by 1 test: return true; Executed by:
| 4 | ||||||||||||||||||
398 | } | - | ||||||||||||||||||
399 | } never executed: end of block | 0 | ||||||||||||||||||
400 | - | |||||||||||||||||||
401 | return executed 4 times by 1 test: false;return false; Executed by:
executed 4 times by 1 test: return false; Executed by:
| 4 | ||||||||||||||||||
402 | } | - | ||||||||||||||||||
403 | - | |||||||||||||||||||
404 | bool QQuickPropertyChanges::containsProperty(const QString &name) const | - | ||||||||||||||||||
405 | { | - | ||||||||||||||||||
406 | return executed 2 times by 1 test: containsValue(name) || containsExpression(name);return containsValue(name) || containsExpression(name); Executed by:
executed 2 times by 1 test: return containsValue(name) || containsExpression(name); Executed by:
| 2 | ||||||||||||||||||
407 | } | - | ||||||||||||||||||
408 | - | |||||||||||||||||||
409 | void QQuickPropertyChanges::changeValue(const QString &name, const QVariant &value) | - | ||||||||||||||||||
410 | { | - | ||||||||||||||||||
411 | QQuickPropertyChangesPrivate * const d = d_func(); | - | ||||||||||||||||||
412 | typedef QPair<QString, QVariant> PropertyEntry; | - | ||||||||||||||||||
413 | typedef QQuickPropertyChangesPrivate::ExpressionChange ExpressionEntry; | - | ||||||||||||||||||
414 | - | |||||||||||||||||||
415 | QMutableListIterator<ExpressionEntry> expressionIterator(d->expressions); | - | ||||||||||||||||||
416 | while (expressionIterator.hasNext()
| 4-12 | ||||||||||||||||||
417 | const ExpressionEntry &entry = expressionIterator.next(); | - | ||||||||||||||||||
418 | if (entry.name == name
| 0-4 | ||||||||||||||||||
419 | expressionIterator.remove(); | - | ||||||||||||||||||
420 | if (state()
| 0-4 | ||||||||||||||||||
421 | QQmlPropertyPrivate::removeBinding(d->property(name)); | - | ||||||||||||||||||
422 | d->property(name).write(value); | - | ||||||||||||||||||
423 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||
424 | - | |||||||||||||||||||
425 | d->properties.append(PropertyEntry(name, value)); | - | ||||||||||||||||||
426 | return; executed 4 times by 1 test: return; Executed by:
| 4 | ||||||||||||||||||
427 | } | - | ||||||||||||||||||
428 | } never executed: end of block | 0 | ||||||||||||||||||
429 | - | |||||||||||||||||||
430 | QMutableListIterator<PropertyEntry> propertyIterator(d->properties); | - | ||||||||||||||||||
431 | while (propertyIterator.hasNext()
| 4-12 | ||||||||||||||||||
432 | PropertyEntry &entry = propertyIterator.next(); | - | ||||||||||||||||||
433 | if (entry.first == name
| 4-8 | ||||||||||||||||||
434 | entry.second = value; | - | ||||||||||||||||||
435 | if (state()
| 0-8 | ||||||||||||||||||
436 | d->property(name).write(value); executed 2 times by 1 test: d->property(name).write(value); Executed by:
| 2 | ||||||||||||||||||
437 | return; executed 8 times by 3 tests: return; Executed by:
| 8 | ||||||||||||||||||
438 | } | - | ||||||||||||||||||
439 | } executed 4 times by 1 test: end of block Executed by:
| 4 | ||||||||||||||||||
440 | - | |||||||||||||||||||
441 | QQuickStateAction action; | - | ||||||||||||||||||
442 | action.restore = restoreEntryValues(); | - | ||||||||||||||||||
443 | action.property = d->property(name); | - | ||||||||||||||||||
444 | action.fromValue = action.property.read(); | - | ||||||||||||||||||
445 | action.specifiedObject = object(); | - | ||||||||||||||||||
446 | action.specifiedProperty = name; | - | ||||||||||||||||||
447 | action.toValue = value; | - | ||||||||||||||||||
448 | - | |||||||||||||||||||
449 | propertyIterator.insert(PropertyEntry(name, value)); | - | ||||||||||||||||||
450 | if (state()
| 0-4 | ||||||||||||||||||
451 | state()->addEntryToRevertList(action); | - | ||||||||||||||||||
452 | QQmlAbstractBinding *oldBinding = QQmlPropertyPrivate::binding(action.property); | - | ||||||||||||||||||
453 | if (oldBinding
| 0-2 | ||||||||||||||||||
454 | oldBinding->setEnabled(false, QQmlPropertyData::DontRemoveBinding | QQmlPropertyData::BypassInterceptor); executed 2 times by 1 test: oldBinding->setEnabled(false, QQmlPropertyData::DontRemoveBinding | QQmlPropertyData::BypassInterceptor); Executed by:
| 2 | ||||||||||||||||||
455 | d->property(name).write(value); | - | ||||||||||||||||||
456 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||
457 | } executed 4 times by 2 tests: end of block Executed by:
| 4 | ||||||||||||||||||
458 | - | |||||||||||||||||||
459 | void QQuickPropertyChanges::changeExpression(const QString &name, const QString &expression) | - | ||||||||||||||||||
460 | { | - | ||||||||||||||||||
461 | QQuickPropertyChangesPrivate * const d = d_func(); | - | ||||||||||||||||||
462 | typedef QPair<QString, QVariant> PropertyEntry; | - | ||||||||||||||||||
463 | typedef QQuickPropertyChangesPrivate::ExpressionChange ExpressionEntry; | - | ||||||||||||||||||
464 | - | |||||||||||||||||||
465 | bool hadValue = false; | - | ||||||||||||||||||
466 | - | |||||||||||||||||||
467 | QMutableListIterator<PropertyEntry> propertyIterator(d->properties); | - | ||||||||||||||||||
468 | while (propertyIterator.hasNext()
| 0-8 | ||||||||||||||||||
469 | PropertyEntry &entry = propertyIterator.next(); | - | ||||||||||||||||||
470 | if (entry.first == name
| 4 | ||||||||||||||||||
471 | propertyIterator.remove(); | - | ||||||||||||||||||
472 | hadValue = true; | - | ||||||||||||||||||
473 | break; executed 4 times by 1 test: break; Executed by:
| 4 | ||||||||||||||||||
474 | } | - | ||||||||||||||||||
475 | } executed 4 times by 1 test: end of block Executed by:
| 4 | ||||||||||||||||||
476 | - | |||||||||||||||||||
477 | QMutableListIterator<ExpressionEntry> expressionIterator(d->expressions); | - | ||||||||||||||||||
478 | while (expressionIterator.hasNext()
| 0-4 | ||||||||||||||||||
479 | ExpressionEntry &entry = expressionIterator.next(); | - | ||||||||||||||||||
480 | if (entry.name == name
| 0 | ||||||||||||||||||
481 | entry.expression = expression; | - | ||||||||||||||||||
482 | if (state()
| 0 | ||||||||||||||||||
483 | auto prop = d->property(name); | - | ||||||||||||||||||
484 | QQmlBinding *newBinding = QQmlBinding::create( | - | ||||||||||||||||||
485 | &QQmlPropertyPrivate::get(prop)->core, expression, object(), | - | ||||||||||||||||||
486 | QQmlContextData::get(qmlContext(this))); | - | ||||||||||||||||||
487 | newBinding->setTarget(prop); | - | ||||||||||||||||||
488 | QQmlPropertyPrivate::setBinding(newBinding, QQmlPropertyPrivate::None, QQmlPropertyData::DontRemoveBinding | QQmlPropertyData::BypassInterceptor); | - | ||||||||||||||||||
489 | } never executed: end of block | 0 | ||||||||||||||||||
490 | return; never executed: return; | 0 | ||||||||||||||||||
491 | } | - | ||||||||||||||||||
492 | } never executed: end of block | 0 | ||||||||||||||||||
493 | - | |||||||||||||||||||
494 | - | |||||||||||||||||||
495 | expressionIterator.insert(ExpressionEntry(name, nullptr, QQmlBinding::Invalid, expression, QUrl(), -1, -1)); | - | ||||||||||||||||||
496 | - | |||||||||||||||||||
497 | if (state()
| 0-4 | ||||||||||||||||||
498 | if (hadValue
| 0-2 | ||||||||||||||||||
499 | QQmlAbstractBinding *oldBinding = QQmlPropertyPrivate::binding(d->property(name)); | - | ||||||||||||||||||
500 | if (oldBinding
| 0-2 | ||||||||||||||||||
501 | oldBinding->setEnabled(false, QQmlPropertyData::DontRemoveBinding | QQmlPropertyData::BypassInterceptor); | - | ||||||||||||||||||
502 | state()->changeBindingInRevertList(object(), name, oldBinding); | - | ||||||||||||||||||
503 | } never executed: end of block | 0 | ||||||||||||||||||
504 | - | |||||||||||||||||||
505 | auto prop = d->property(name); | - | ||||||||||||||||||
506 | QQmlBinding *newBinding = QQmlBinding::create( | - | ||||||||||||||||||
507 | &QQmlPropertyPrivate::get(prop)->core, expression, object(), | - | ||||||||||||||||||
508 | QQmlContextData::get(qmlContext(this))); | - | ||||||||||||||||||
509 | newBinding->setTarget(prop); | - | ||||||||||||||||||
510 | QQmlPropertyPrivate::setBinding(newBinding, QQmlPropertyPrivate::None, QQmlPropertyData::DontRemoveBinding | QQmlPropertyData::BypassInterceptor); | - | ||||||||||||||||||
511 | } executed 2 times by 1 test: else {end of block Executed by:
| 2 | ||||||||||||||||||
512 | QQuickStateAction action; | - | ||||||||||||||||||
513 | action.restore = restoreEntryValues(); | - | ||||||||||||||||||
514 | action.property = d->property(name); | - | ||||||||||||||||||
515 | action.fromValue = action.property.read(); | - | ||||||||||||||||||
516 | action.specifiedObject = object(); | - | ||||||||||||||||||
517 | action.specifiedProperty = name; | - | ||||||||||||||||||
518 | - | |||||||||||||||||||
519 | QQmlBinding *newBinding = QQmlBinding::create( | - | ||||||||||||||||||
520 | &QQmlPropertyPrivate::get(action.property)->core, expression, | - | ||||||||||||||||||
521 | object(), QQmlContextData::get(qmlContext(this))); | - | ||||||||||||||||||
522 | if (d->isExplicit
| 0 | ||||||||||||||||||
523 | - | |||||||||||||||||||
524 | - | |||||||||||||||||||
525 | - | |||||||||||||||||||
526 | action.toValue = newBinding->evaluate(); | - | ||||||||||||||||||
527 | delete newBinding; | - | ||||||||||||||||||
528 | } never executed: else {end of block | 0 | ||||||||||||||||||
529 | newBinding->setTarget(action.property); | - | ||||||||||||||||||
530 | action.toBinding = newBinding; | - | ||||||||||||||||||
531 | action.deletableToBinding = true; | - | ||||||||||||||||||
532 | - | |||||||||||||||||||
533 | state()->addEntryToRevertList(action); | - | ||||||||||||||||||
534 | QQmlAbstractBinding *oldBinding = QQmlPropertyPrivate::binding(action.property); | - | ||||||||||||||||||
535 | if (oldBinding
| 0 | ||||||||||||||||||
536 | oldBinding->setEnabled(false, QQmlPropertyData::DontRemoveBinding | QQmlPropertyData::BypassInterceptor); never executed: oldBinding->setEnabled(false, QQmlPropertyData::DontRemoveBinding | QQmlPropertyData::BypassInterceptor); | 0 | ||||||||||||||||||
537 | - | |||||||||||||||||||
538 | QQmlPropertyPrivate::setBinding(newBinding, QQmlPropertyPrivate::None, QQmlPropertyData::DontRemoveBinding | QQmlPropertyData::BypassInterceptor); | - | ||||||||||||||||||
539 | } never executed: end of block | 0 | ||||||||||||||||||
540 | } | - | ||||||||||||||||||
541 | } | - | ||||||||||||||||||
542 | - | |||||||||||||||||||
543 | } executed 4 times by 1 test: end of block Executed by:
| 4 | ||||||||||||||||||
544 | - | |||||||||||||||||||
545 | QVariant QQuickPropertyChanges::property(const QString &name) const | - | ||||||||||||||||||
546 | { | - | ||||||||||||||||||
547 | const QQuickPropertyChangesPrivate * const d = d_func(); | - | ||||||||||||||||||
548 | typedef QPair<QString, QVariant> PropertyEntry; | - | ||||||||||||||||||
549 | typedef QQuickPropertyChangesPrivate::ExpressionChange ExpressionEntry; | - | ||||||||||||||||||
550 | - | |||||||||||||||||||
551 | QListIterator<PropertyEntry> propertyIterator(d->properties); | - | ||||||||||||||||||
552 | while (propertyIterator.hasNext()
| 0 | ||||||||||||||||||
553 | const PropertyEntry &entry = propertyIterator.next(); | - | ||||||||||||||||||
554 | if (entry.first == name
| 0 | ||||||||||||||||||
555 | return never executed: entry.second;return entry.second; never executed: return entry.second; | 0 | ||||||||||||||||||
556 | } | - | ||||||||||||||||||
557 | } never executed: end of block | 0 | ||||||||||||||||||
558 | - | |||||||||||||||||||
559 | QListIterator<ExpressionEntry> expressionIterator(d->expressions); | - | ||||||||||||||||||
560 | while (expressionIterator.hasNext()
| 0 | ||||||||||||||||||
561 | const ExpressionEntry &entry = expressionIterator.next(); | - | ||||||||||||||||||
562 | if (entry.name == name
| 0 | ||||||||||||||||||
563 | return never executed: QVariant(entry.expression);return QVariant(entry.expression); never executed: return QVariant(entry.expression); | 0 | ||||||||||||||||||
564 | } | - | ||||||||||||||||||
565 | } never executed: end of block | 0 | ||||||||||||||||||
566 | - | |||||||||||||||||||
567 | return never executed: QVariant();return QVariant(); never executed: return QVariant(); | 0 | ||||||||||||||||||
568 | } | - | ||||||||||||||||||
569 | - | |||||||||||||||||||
570 | void QQuickPropertyChanges::removeProperty(const QString &name) | - | ||||||||||||||||||
571 | { | - | ||||||||||||||||||
572 | QQuickPropertyChangesPrivate * const d = d_func(); | - | ||||||||||||||||||
573 | typedef QPair<QString, QVariant> PropertyEntry; | - | ||||||||||||||||||
574 | typedef QQuickPropertyChangesPrivate::ExpressionChange ExpressionEntry; | - | ||||||||||||||||||
575 | - | |||||||||||||||||||
576 | QMutableListIterator<ExpressionEntry> expressionIterator(d->expressions); | - | ||||||||||||||||||
577 | while (expressionIterator.hasNext()
| 4-6 | ||||||||||||||||||
578 | const ExpressionEntry &entry = expressionIterator.next(); | - | ||||||||||||||||||
579 | if (entry.name == name
| 0-4 | ||||||||||||||||||
580 | expressionIterator.remove(); | - | ||||||||||||||||||
581 | state()->removeEntryFromRevertList(object(), name); | - | ||||||||||||||||||
582 | return; executed 4 times by 1 test: return; Executed by:
| 4 | ||||||||||||||||||
583 | } | - | ||||||||||||||||||
584 | } never executed: end of block | 0 | ||||||||||||||||||
585 | - | |||||||||||||||||||
586 | QMutableListIterator<PropertyEntry> propertyIterator(d->properties); | - | ||||||||||||||||||
587 | while (propertyIterator.hasNext()
| 0-8 | ||||||||||||||||||
588 | const PropertyEntry &entry = propertyIterator.next(); | - | ||||||||||||||||||
589 | if (entry.first == name
| 2-6 | ||||||||||||||||||
590 | propertyIterator.remove(); | - | ||||||||||||||||||
591 | state()->removeEntryFromRevertList(object(), name); | - | ||||||||||||||||||
592 | return; executed 6 times by 3 tests: return; Executed by:
| 6 | ||||||||||||||||||
593 | } | - | ||||||||||||||||||
594 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||
595 | } never executed: end of block | 0 | ||||||||||||||||||
596 | - | |||||||||||||||||||
597 | QVariant QQuickPropertyChanges::value(const QString &name) const | - | ||||||||||||||||||
598 | { | - | ||||||||||||||||||
599 | const QQuickPropertyChangesPrivate * const d = d_func(); | - | ||||||||||||||||||
600 | typedef QPair<QString, QVariant> PropertyEntry; | - | ||||||||||||||||||
601 | - | |||||||||||||||||||
602 | QListIterator<PropertyEntry> propertyIterator(d->properties); | - | ||||||||||||||||||
603 | while (propertyIterator.hasNext()
| 6-24 | ||||||||||||||||||
604 | const PropertyEntry &entry = propertyIterator.next(); | - | ||||||||||||||||||
605 | if (entry.first == name
| 8-16 | ||||||||||||||||||
606 | return executed 8 times by 1 test: entry.second;return entry.second; Executed by:
executed 8 times by 1 test: return entry.second; Executed by:
| 8 | ||||||||||||||||||
607 | } | - | ||||||||||||||||||
608 | } executed 16 times by 1 test: end of block Executed by:
| 16 | ||||||||||||||||||
609 | - | |||||||||||||||||||
610 | return executed 6 times by 1 test: QVariant();return QVariant(); Executed by:
executed 6 times by 1 test: return QVariant(); Executed by:
| 6 | ||||||||||||||||||
611 | } | - | ||||||||||||||||||
612 | - | |||||||||||||||||||
613 | QString QQuickPropertyChanges::expression(const QString &name) const | - | ||||||||||||||||||
614 | { | - | ||||||||||||||||||
615 | const QQuickPropertyChangesPrivate * const d = d_func(); | - | ||||||||||||||||||
616 | typedef QQuickPropertyChangesPrivate::ExpressionChange ExpressionEntry; | - | ||||||||||||||||||
617 | - | |||||||||||||||||||
618 | QListIterator<ExpressionEntry> expressionIterator(d->expressions); | - | ||||||||||||||||||
619 | while (expressionIterator.hasNext()
| 0 | ||||||||||||||||||
620 | const ExpressionEntry &entry = expressionIterator.next(); | - | ||||||||||||||||||
621 | if (entry.name == name
| 0 | ||||||||||||||||||
622 | return never executed: entry.expression;return entry.expression; never executed: return entry.expression; | 0 | ||||||||||||||||||
623 | } | - | ||||||||||||||||||
624 | } never executed: end of block | 0 | ||||||||||||||||||
625 | - | |||||||||||||||||||
626 | return never executed: QString();return QString(); never executed: return QString(); | 0 | ||||||||||||||||||
627 | } | - | ||||||||||||||||||
628 | - | |||||||||||||||||||
629 | void QQuickPropertyChanges::detachFromState() | - | ||||||||||||||||||
630 | { | - | ||||||||||||||||||
631 | if (state()
| 0 | ||||||||||||||||||
632 | state()->removeAllEntriesFromRevertList(object()); never executed: state()->removeAllEntriesFromRevertList(object()); | 0 | ||||||||||||||||||
633 | } never executed: end of block | 0 | ||||||||||||||||||
634 | - | |||||||||||||||||||
635 | void QQuickPropertyChanges::attachToState() | - | ||||||||||||||||||
636 | { | - | ||||||||||||||||||
637 | if (state()
| 0-2 | ||||||||||||||||||
638 | state()->addEntriesToRevertList(actions()); executed 2 times by 1 test: state()->addEntriesToRevertList(actions()); Executed by:
| 2 | ||||||||||||||||||
639 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||
640 | - | |||||||||||||||||||
641 | - | |||||||||||||||||||
642 | - | |||||||||||||||||||
Switch to Source code | Preprocessed file |