OpenCoverage

qqmlbind.cpp

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/types/qqmlbind.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8class QQmlBindPrivate : public QObjectPrivate-
9{-
10public:-
11 QQmlBindPrivate() : obj(nullptr), componentComplete(true), delayed(false), pendingEval(false) {}
executed 36 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmlbinding
  • tst_qqmlpropertymap
  • tst_qtqmlmodules
36
12 ~QQmlBindPrivate() { }-
13-
14 QQmlNullableValue<bool> when;-
15 QPointer<QObject> obj;-
16 QString propName;-
17 QQmlNullableValue<QVariant> value;-
18 QQmlProperty prop;-
19 QQmlAbstractBinding::Ptr prevBind;-
20 bool componentComplete:1;-
21 bool delayed:1;-
22 bool pendingEval:1;-
23-
24 void validate(QObject *binding) const;-
25};-
26-
27void QQmlBindPrivate::validate(QObject *binding) const-
28{-
29 if (!obj
!objDescription
TRUEevaluated 10 times by 2 tests
Evaluated by:
  • tst_qqmlbinding
  • tst_qtqmlmodules
FALSEevaluated 30 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qqmlbinding
  • tst_qqmlpropertymap
|| (when.isValid()
when.isValid()Description
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_qqmlbinding
FALSEevaluated 16 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qqmlbinding
  • tst_qqmlpropertymap
&& !when
!whenDescription
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_qqmlbinding
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qqmlbinding
))
4-30
30 return;
executed 20 times by 2 tests: return;
Executed by:
  • tst_qqmlbinding
  • tst_qtqmlmodules
20
31-
32 if (!prop.isValid()
!prop.isValid()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qqmlbinding
FALSEevaluated 18 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qqmlbinding
  • tst_qqmlpropertymap
) {
2-18
33 qmlWarning(binding) << "Property '" << propName << "' does not exist on " << QQmlMetaType::prettyTypeName(obj) << ".";-
34 return;
executed 2 times by 1 test: return;
Executed by:
  • tst_qqmlbinding
2
35 }-
36-
37 if (!prop.isWritable()
!prop.isWritable()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qqmlbinding
FALSEevaluated 16 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qqmlbinding
  • tst_qqmlpropertymap
) {
2-16
38 qmlWarning(binding) << "Property '" << propName << "' on " << QQmlMetaType::prettyTypeName(obj) << " is read-only.";-
39 return;
executed 2 times by 1 test: return;
Executed by:
  • tst_qqmlbinding
2
40 }-
41}
executed 16 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmlbinding
  • tst_qqmlpropertymap
16
42QQmlBind::QQmlBind(QObject *parent)-
43 : QObject(*(new QQmlBindPrivate), parent)-
44{-
45}
executed 36 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmlbinding
  • tst_qqmlpropertymap
  • tst_qtqmlmodules
36
46-
47QQmlBind::~QQmlBind()-
48{-
49}-
50bool QQmlBind::when() const-
51{-
52 const QQmlBindPrivate * const d = d_func();-
53 return
executed 4 times by 1 test: return d->when;
Executed by:
  • tst_qqmlbinding
d->when;
executed 4 times by 1 test: return d->when;
Executed by:
  • tst_qqmlbinding
4
54}-
55-
56void QQmlBind::setWhen(bool v)-
57{-
58 QQmlBindPrivate * const d = d_func();-
59 if (!d->when.isNull
!d->when.isNullDescription
TRUEevaluated 32 times by 1 test
Evaluated by:
  • tst_qqmlbinding
FALSEevaluated 16 times by 1 test
Evaluated by:
  • tst_qqmlbinding
&& d->when == v
d->when == vDescription
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_qqmlbinding
FALSEevaluated 18 times by 1 test
Evaluated by:
  • tst_qqmlbinding
)
14-32
60 return;
executed 14 times by 1 test: return;
Executed by:
  • tst_qqmlbinding
14
61-
62 d->when = v;-
63 if (v
vDescription
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_qqmlbinding
FALSEevaluated 22 times by 1 test
Evaluated by:
  • tst_qqmlbinding
&& d->componentComplete
d->componentCompleteDescription
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_qqmlbinding
FALSEnever evaluated
)
0-22
64 d->validate(this);
executed 12 times by 1 test: d->validate(this);
Executed by:
  • tst_qqmlbinding
12
65 eval();-
66}
executed 34 times by 1 test: end of block
Executed by:
  • tst_qqmlbinding
34
67-
68-
69-
70-
71-
72-
73QObject *QQmlBind::object()-
74{-
75 const QQmlBindPrivate * const d = d_func();-
76 return
executed 4 times by 1 test: return d->obj;
Executed by:
  • tst_qqmlbinding
d->obj;
executed 4 times by 1 test: return d->obj;
Executed by:
  • tst_qqmlbinding
4
77}-
78-
79void QQmlBind::setObject(QObject *obj)-
80{-
81 QQmlBindPrivate * const d = d_func();-
82 if (d->obj && d->when.isValid()
d->when.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
&& d->when
d->whenDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
83-
84-
85 d->when = false;-
86 eval();-
87 d->when = true;-
88 }
never executed: end of block
0
89 d->obj = obj;-
90 if (d->componentComplete
d->componentCompleteDescription
TRUEnever evaluated
FALSEevaluated 26 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qqmlbinding
  • tst_qqmlpropertymap
) {
0-26
91 d->prop = QQmlProperty(d->obj, d->propName);-
92 d->validate(this);-
93 }
never executed: end of block
0
94 eval();-
95}
executed 26 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmlbinding
  • tst_qqmlpropertymap
26
96QString QQmlBind::property() const-
97{-
98 const QQmlBindPrivate * const d = d_func();-
99 return
executed 2 times by 1 test: return d->propName;
Executed by:
  • tst_qqmlbinding
d->propName;
executed 2 times by 1 test: return d->propName;
Executed by:
  • tst_qqmlbinding
2
100}-
101-
102void QQmlBind::setProperty(const QString &p)-
103{-
104 QQmlBindPrivate * const d = d_func();-
105 if (!d->propName.isEmpty()
!d->propName.isEmpty()Description
TRUEnever evaluated
FALSEevaluated 26 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qqmlbinding
  • tst_qqmlpropertymap
&& d->when.isValid()
d->when.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
&& d->when
d->whenDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0-26
106-
107-
108 d->when = false;-
109 eval();-
110 d->when = true;-
111 }
never executed: end of block
0
112 d->propName = p;-
113 if (d->componentComplete
d->componentCompleteDescription
TRUEnever evaluated
FALSEevaluated 26 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qqmlbinding
  • tst_qqmlpropertymap
) {
0-26
114 d->prop = QQmlProperty(d->obj, d->propName);-
115 d->validate(this);-
116 }
never executed: end of block
0
117 eval();-
118}
executed 26 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmlbinding
  • tst_qqmlpropertymap
26
119-
120-
121-
122-
123-
124-
125-
126QVariant QQmlBind::value() const-
127{-
128 const QQmlBindPrivate * const d = d_func();-
129 return
executed 2 times by 1 test: return d->value.value;
Executed by:
  • tst_qqmlbinding
d->value.value;
executed 2 times by 1 test: return d->value.value;
Executed by:
  • tst_qqmlbinding
2
130}-
131-
132void QQmlBind::setValue(const QVariant &v)-
133{-
134 QQmlBindPrivate * const d = d_func();-
135 d->value = v;-
136 prepareEval();-
137}
executed 72 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmlbinding
  • tst_qqmlpropertymap
72
138bool QQmlBind::delayed() const-
139{-
140 const QQmlBindPrivate * const d = d_func();-
141 return
never executed: return d->delayed;
d->delayed;
never executed: return d->delayed;
0
142}-
143-
144void QQmlBind::setDelayed(bool delayed)-
145{-
146 QQmlBindPrivate * const d = d_func();-
147 if (d->delayed == delayed
d->delayed == delayedDescription
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qqmlbinding
)
0-2
148 return;
never executed: return;
0
149-
150 d->delayed = delayed;-
151-
152 if (!d->delayed
!d->delayedDescription
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qqmlbinding
)
0-2
153 eval();
never executed: eval();
0
154}
executed 2 times by 1 test: end of block
Executed by:
  • tst_qqmlbinding
2
155-
156void QQmlBind::setTarget(const QQmlProperty &p)-
157{-
158 QQmlBindPrivate * const d = d_func();-
159 d->prop = p;-
160}
executed 8 times by 1 test: end of block
Executed by:
  • tst_qqmlbinding
8
161-
162void QQmlBind::classBegin()-
163{-
164 QQmlBindPrivate * const d = d_func();-
165 d->componentComplete = false;-
166}
executed 36 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmlbinding
  • tst_qqmlpropertymap
  • tst_qtqmlmodules
36
167-
168void QQmlBind::componentComplete()-
169{-
170 QQmlBindPrivate * const d = d_func();-
171 d->componentComplete = true;-
172 if (!d->prop.isValid()
!d->prop.isValid()Description
TRUEevaluated 28 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qqmlbinding
  • tst_qqmlpropertymap
  • tst_qtqmlmodules
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_qqmlbinding
) {
8-28
173 d->prop = QQmlProperty(d->obj, d->propName);-
174 d->validate(this);-
175 }
executed 28 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmlbinding
  • tst_qqmlpropertymap
  • tst_qtqmlmodules
28
176 eval();-
177}
executed 36 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmlbinding
  • tst_qqmlpropertymap
  • tst_qtqmlmodules
36
178-
179void QQmlBind::prepareEval()-
180{-
181 QQmlBindPrivate * const d = d_func();-
182 if (d->delayed
d->delayedDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qqmlbinding
FALSEevaluated 66 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qqmlbinding
  • tst_qqmlpropertymap
) {
6-66
183 if (!d->pendingEval
!d->pendingEvalDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qqmlbinding
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qqmlbinding
)
2-4
184 QTimer::singleShot(0, this, &QQmlBind::eval);
executed 4 times by 1 test: QTimer::singleShot(0, this, &QQmlBind::eval);
Executed by:
  • tst_qqmlbinding
4
185 d->pendingEval = true;-
186 }
executed 6 times by 1 test: end of block
Executed by:
  • tst_qqmlbinding
else {
6
187 eval();-
188 }
executed 66 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmlbinding
  • tst_qqmlpropertymap
66
189}-
190-
191void QQmlBind::eval()-
192{-
193 QQmlBindPrivate * const d = d_func();-
194 d->pendingEval = false;-
195 if (!d->prop.isValid()
!d->prop.isValid()Description
TRUEevaluated 94 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qqmlbinding
  • tst_qqmlpropertymap
  • tst_qtqmlmodules
FALSEevaluated 98 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qqmlbinding
  • tst_qqmlpropertymap
|| d->value.isNull
d->value.isNullDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qqmlbinding
FALSEevaluated 92 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qqmlbinding
  • tst_qqmlpropertymap
|| !d->componentComplete
!d->componentCompleteDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qqmlbinding
FALSEevaluated 86 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qqmlbinding
  • tst_qqmlpropertymap
)
6-98
196 return;
executed 106 times by 4 tests: return;
Executed by:
  • tst_examples
  • tst_qqmlbinding
  • tst_qqmlpropertymap
  • tst_qtqmlmodules
106
197-
198 if (d->when.isValid()
d->when.isValid()Description
TRUEevaluated 66 times by 1 test
Evaluated by:
  • tst_qqmlbinding
FALSEevaluated 20 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qqmlbinding
  • tst_qqmlpropertymap
) {
20-66
199 if (!d->when
!d->whenDescription
TRUEevaluated 40 times by 1 test
Evaluated by:
  • tst_qqmlbinding
FALSEevaluated 26 times by 1 test
Evaluated by:
  • tst_qqmlbinding
) {
26-40
200-
201 if (d->prevBind
d->prevBindDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qqmlbinding
FALSEevaluated 34 times by 1 test
Evaluated by:
  • tst_qqmlbinding
) {
6-34
202 QQmlAbstractBinding::Ptr p = d->prevBind;-
203 d->prevBind = nullptr;-
204 QQmlPropertyPrivate::setBinding(p.data());-
205 }
executed 6 times by 1 test: end of block
Executed by:
  • tst_qqmlbinding
6
206 return;
executed 40 times by 1 test: return;
Executed by:
  • tst_qqmlbinding
40
207 }-
208-
209-
210 if (!d->prevBind
!d->prevBindDescription
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_qqmlbinding
FALSEevaluated 14 times by 1 test
Evaluated by:
  • tst_qqmlbinding
)
12-14
211 d->prevBind = QQmlPropertyPrivate::binding(d->prop);
executed 12 times by 1 test: d->prevBind = QQmlPropertyPrivate::binding(d->prop);
Executed by:
  • tst_qqmlbinding
12
212 QQmlPropertyPrivate::removeBinding(d->prop);-
213 }
executed 26 times by 1 test: end of block
Executed by:
  • tst_qqmlbinding
26
214-
215 d->prop.write(d->value.value);-
216}
executed 46 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmlbinding
  • tst_qqmlpropertymap
46
217-
218-
219-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.0