OpenCoverage

qqmlconnections.cpp

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/types/qqmlconnections.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7class QQmlConnectionsPrivate : public QObjectPrivate-
8{-
9public:-
10 QQmlConnectionsPrivate() : target(nullptr), enabled(true), targetSet(false), ignoreUnknownSignals(false), componentcomplete(true) {}
executed 136 times by 10 tests: end of block
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlapplicationengine
  • tst_qqmlconnections
  • tst_qqmllistmodel
  • tst_qquickapplication
  • tst_qquickgridview
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qtqmlmodules
136
11-
12 QList<QQmlBoundSignal*> boundsignals;-
13 QObject *target;-
14-
15 bool enabled;-
16 bool targetSet;-
17 bool ignoreUnknownSignals;-
18 bool componentcomplete;-
19-
20 QQmlRefPointer<QV4::CompiledData::CompilationUnit> compilationUnit;-
21 QList<const QV4::CompiledData::Binding *> bindings;-
22};-
23QQmlConnections::QQmlConnections(QObject *parent) :-
24 QObject(*(new QQmlConnectionsPrivate), parent)-
25{-
26}
executed 136 times by 10 tests: end of block
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlapplicationengine
  • tst_qqmlconnections
  • tst_qqmllistmodel
  • tst_qquickapplication
  • tst_qquickgridview
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qtqmlmodules
136
27-
28QQmlConnections::~QQmlConnections()-
29{-
30}-
31QObject *QQmlConnections::target() const-
32{-
33 const QQmlConnectionsPrivate * const d = d_func();-
34 return
executed 266 times by 9 tests: return d->targetSet ? d->target : parent();
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlapplicationengine
  • tst_qqmlconnections
  • tst_qqmllistmodel
  • tst_qquickapplication
  • tst_qquickgridview
  • tst_qquickitem2
  • tst_qquicklistview
d->targetSet ? d->target : parent();
executed 266 times by 9 tests: return d->targetSet ? d->target : parent();
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlapplicationengine
  • tst_qqmlconnections
  • tst_qqmllistmodel
  • tst_qquickapplication
  • tst_qquickgridview
  • tst_qquickitem2
  • tst_qquicklistview
266
35}-
36-
37class QQmlBoundSignalDeleter : public QObject-
38{-
39public:-
40 QQmlBoundSignalDeleter(QQmlBoundSignal *signal) : m_signal(signal) { m_signal->removeFromObject(); }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qqmlconnections
2
41 ~QQmlBoundSignalDeleter() { delete m_signal; }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qqmlconnections
2
42-
43private:-
44 QQmlBoundSignal *m_signal;-
45};-
46-
47void QQmlConnections::setTarget(QObject *obj)-
48{-
49 QQmlConnectionsPrivate * const d = d_func();-
50 if (d->targetSet
d->targetSetDescription
TRUEevaluated 6 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qqmlconnections
FALSEevaluated 122 times by 9 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlapplicationengine
  • tst_qqmlconnections
  • tst_qqmllistmodel
  • tst_qquickapplication
  • tst_qquickgridview
  • tst_qquickitem2
  • tst_qquicklistview
&& d->target == obj
d->target == objDescription
TRUEnever evaluated
FALSEevaluated 6 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qqmlconnections
)
0-122
51 return;
never executed: return;
0
52 d->targetSet = true;-
53 for (QQmlBoundSignal *s : qAsConst(d->boundsignals)) {-
54-
55-
56 if (s->isNotifying()
s->isNotifying()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qqmlconnections
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qqmlconnections
)
2
57 (new
executed 2 times by 1 test: (new QQmlBoundSignalDeleter(s))->deleteLater();
Executed by:
  • tst_qqmlconnections
QQmlBoundSignalDeleter(s))->deleteLater();
executed 2 times by 1 test: (new QQmlBoundSignalDeleter(s))->deleteLater();
Executed by:
  • tst_qqmlconnections
2
58 else-
59 delete s;
executed 2 times by 1 test: delete s;
Executed by:
  • tst_qqmlconnections
2
60 }-
61 d->boundsignals.clear();-
62 d->target = obj;-
63 connectSignals();-
64 targetChanged();-
65}
executed 128 times by 9 tests: end of block
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlapplicationengine
  • tst_qqmlconnections
  • tst_qqmllistmodel
  • tst_qquickapplication
  • tst_qquickgridview
  • tst_qquickitem2
  • tst_qquicklistview
128
66bool QQmlConnections::isEnabled() const-
67{-
68 const QQmlConnectionsPrivate * const d = d_func();-
69 return
never executed: return d->enabled;
d->enabled;
never executed: return d->enabled;
0
70}-
71-
72void QQmlConnections::setEnabled(bool enabled)-
73{-
74 QQmlConnectionsPrivate * const d = d_func();-
75 if (d->enabled == enabled
d->enabled == enabledDescription
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qqmlconnections
)
0-6
76 return;
never executed: return;
0
77-
78 d->enabled = enabled;-
79-
80 for (QQmlBoundSignal *s : qAsConst(d->boundsignals))-
81 s->setEnabled(d->enabled);
executed 4 times by 1 test: s->setEnabled(d->enabled);
Executed by:
  • tst_qqmlconnections
4
82-
83 enabledChanged();-
84}
executed 6 times by 1 test: end of block
Executed by:
  • tst_qqmlconnections
6
85bool QQmlConnections::ignoreUnknownSignals() const-
86{-
87 const QQmlConnectionsPrivate * const d = d_func();-
88 return
executed 2 times by 1 test: return d->ignoreUnknownSignals;
Executed by:
  • tst_qqmlconnections
d->ignoreUnknownSignals;
executed 2 times by 1 test: return d->ignoreUnknownSignals;
Executed by:
  • tst_qqmlconnections
2
89}-
90-
91void QQmlConnections::setIgnoreUnknownSignals(bool ignore)-
92{-
93 QQmlConnectionsPrivate * const d = d_func();-
94 d->ignoreUnknownSignals = ignore;-
95}
executed 4 times by 1 test: end of block
Executed by:
  • tst_qqmlconnections
4
96-
97void QQmlConnectionsParser::verifyBindings(const QV4::CompiledData::Unit *qmlUnit, const QList<const QV4::CompiledData::Binding *> &props)-
98{-
99 for (int ii = 0; ii < props.count()
ii < props.count()Description
TRUEevaluated 146 times by 9 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlapplicationengine
  • tst_qqmlconnections
  • tst_qqmllistmodel
  • tst_qquickapplication
  • tst_qquickgridview
  • tst_qquickitem2
  • tst_qquicklistview
FALSEevaluated 130 times by 9 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlapplicationengine
  • tst_qqmlconnections
  • tst_qqmllistmodel
  • tst_qquickapplication
  • tst_qquickgridview
  • tst_qquickitem2
  • tst_qquicklistview
; ++ii) {
130-146
100 const QV4::CompiledData::Binding *binding = props.at(ii);-
101 const QString &propName = qmlUnit->stringAt(binding->propertyNameIndex);-
102-
103 if (!propName.startsWith(QLatin1String("on"))
!propName.star...1String("on"))Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qqmlconnections
FALSEevaluated 144 times by 9 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlapplicationengine
  • tst_qqmlconnections
  • tst_qqmllistmodel
  • tst_qquickapplication
  • tst_qquickgridview
  • tst_qquickitem2
  • tst_qquicklistview
|| (propName.length() < 3
propName.length() < 3Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qqmlconnections
FALSEevaluated 142 times by 9 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlapplicationengine
  • tst_qqmlconnections
  • tst_qqmllistmodel
  • tst_qquickapplication
  • tst_qquickgridview
  • tst_qquickitem2
  • tst_qquicklistview
|| !propName.at(2).isUpper()
!propName.at(2).isUpper()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qqmlconnections
FALSEevaluated 140 times by 9 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlapplicationengine
  • tst_qqmlconnections
  • tst_qqmllistmodel
  • tst_qquickapplication
  • tst_qquickgridview
  • tst_qquickitem2
  • tst_qquicklistview
)) {
2-144
104 error(props.at(ii), QQmlConnections::tr("Cannot assign to non-existent property \"%1\"").arg(propName));-
105 return;
executed 6 times by 1 test: return;
Executed by:
  • tst_qqmlconnections
6
106 }-
107-
108 if (binding->type >= QV4::CompiledData::Binding::Type_Object
binding->type ...g::Type_ObjectDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qqmlconnections
FALSEevaluated 136 times by 9 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlapplicationengine
  • tst_qqmlconnections
  • tst_qqmllistmodel
  • tst_qquickapplication
  • tst_qquickgridview
  • tst_qquickitem2
  • tst_qquicklistview
) {
4-136
109 const QV4::CompiledData::Object *target = qmlUnit->objectAt(binding->value.objectIndex);-
110 if (!qmlUnit->stringAt(target->inheritedTypeNameIndex).isEmpty()
!qmlUnit->stri...dex).isEmpty()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qqmlconnections
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qqmlconnections
)
2
111 error(binding, QQmlConnections::tr("Connections: nested objects not allowed"));
executed 2 times by 1 test: error(binding, QQmlConnections::tr("Connections: nested objects not allowed"));
Executed by:
  • tst_qqmlconnections
2
112 else-
113 error(binding, QQmlConnections::tr("Connections: syntax error"));
executed 2 times by 1 test: error(binding, QQmlConnections::tr("Connections: syntax error"));
Executed by:
  • tst_qqmlconnections
2
114 return;
executed 4 times by 1 test: return;
Executed by:
  • tst_qqmlconnections
4
115 } if (binding->type != QV4::CompiledData::Binding::Type_Script
binding->type ...g::Type_ScriptDescription
TRUEnever evaluated
FALSEevaluated 136 times by 9 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlapplicationengine
  • tst_qqmlconnections
  • tst_qqmllistmodel
  • tst_qquickapplication
  • tst_qquickgridview
  • tst_qquickitem2
  • tst_qquicklistview
) {
0-136
116 error(binding, QQmlConnections::tr("Connections: script expected"));-
117 return;
never executed: return;
0
118 }-
119 }
executed 136 times by 9 tests: end of block
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlapplicationengine
  • tst_qqmlconnections
  • tst_qqmllistmodel
  • tst_qquickapplication
  • tst_qquickgridview
  • tst_qquickitem2
  • tst_qquicklistview
136
120}
executed 130 times by 9 tests: end of block
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlapplicationengine
  • tst_qqmlconnections
  • tst_qqmllistmodel
  • tst_qquickapplication
  • tst_qquickgridview
  • tst_qquickitem2
  • tst_qquicklistview
130
121-
122void QQmlConnectionsParser::applyBindings(QObject *object, QV4::CompiledData::CompilationUnit *compilationUnit, const QList<const QV4::CompiledData::Binding *> &bindings)-
123{-
124 QQmlConnectionsPrivate *p =-
125 static_cast<QQmlConnectionsPrivate *>(QObjectPrivate::get(object));-
126 p->compilationUnit = compilationUnit;-
127 p->bindings = bindings;-
128}
executed 132 times by 9 tests: end of block
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlapplicationengine
  • tst_qqmlconnections
  • tst_qqmllistmodel
  • tst_qquickapplication
  • tst_qquickgridview
  • tst_qquickitem2
  • tst_qquicklistview
132
129-
130void QQmlConnections::connectSignals()-
131{-
132 QQmlConnectionsPrivate * const d = d_func();-
133 if (!d->componentcomplete
!d->componentcompleteDescription
TRUEevaluated 120 times by 9 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlapplicationengine
  • tst_qqmlconnections
  • tst_qqmllistmodel
  • tst_qquickapplication
  • tst_qquickgridview
  • tst_qquickitem2
  • tst_qquicklistview
FALSEevaluated 144 times by 10 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlapplicationengine
  • tst_qqmlconnections
  • tst_qqmllistmodel
  • tst_qquickapplication
  • tst_qquickgridview
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qtqmlmodules
|| (d->targetSet
d->targetSetDescription
TRUEevaluated 128 times by 9 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlapplicationengine
  • tst_qqmlconnections
  • tst_qqmllistmodel
  • tst_qquickapplication
  • tst_qquickgridview
  • tst_qquickitem2
  • tst_qquicklistview
FALSEevaluated 16 times by 3 tests
Evaluated by:
  • tst_qqmlconnections
  • tst_qquickitem2
  • tst_qtqmlmodules
&& !target()
!target()Description
TRUEevaluated 8 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qqmlconnections
FALSEevaluated 120 times by 9 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlapplicationengine
  • tst_qqmlconnections
  • tst_qqmllistmodel
  • tst_qquickapplication
  • tst_qquickgridview
  • tst_qquickitem2
  • tst_qquicklistview
))
8-144
134 return;
executed 128 times by 9 tests: return;
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlapplicationengine
  • tst_qqmlconnections
  • tst_qqmllistmodel
  • tst_qquickapplication
  • tst_qquickgridview
  • tst_qquickitem2
  • tst_qquicklistview
128
135-
136 if (d->bindings.isEmpty()
d->bindings.isEmpty()Description
TRUEevaluated 4 times by 2 tests
Evaluated by:
  • tst_qqmlconnections
  • tst_qtqmlmodules
FALSEevaluated 132 times by 9 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlapplicationengine
  • tst_qqmlconnections
  • tst_qqmllistmodel
  • tst_qquickapplication
  • tst_qquickgridview
  • tst_qquickitem2
  • tst_qquicklistview
)
4-132
137 return;
executed 4 times by 2 tests: return;
Executed by:
  • tst_qqmlconnections
  • tst_qtqmlmodules
4
138 QObject *target = this->target();-
139 QQmlData *ddata = QQmlData::get(this);-
140 QQmlContextData *ctxtdata = ddata
ddataDescription
TRUEevaluated 132 times by 9 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlapplicationengine
  • tst_qqmlconnections
  • tst_qqmllistmodel
  • tst_qquickapplication
  • tst_qquickgridview
  • tst_qquickitem2
  • tst_qquicklistview
FALSEnever evaluated
? ddata->outerContext : nullptr;
0-132
141-
142 const QV4::CompiledData::Unit *qmlUnit = d->compilationUnit->data;-
143 for (const QV4::CompiledData::Binding *binding : qAsConst(d->bindings)) {-
144 ((binding->type == QV4::CompiledData::Binding::Type_Script) ? static_cast<void>(0) : qt_assert("binding->type == QV4::CompiledData::Binding::Type_Script", __FILE__, 281));-
145 QString propName = qmlUnit->stringAt(binding->propertyNameIndex);-
146-
147 QQmlProperty prop(target, propName);-
148 if (prop.isValid()
prop.isValid()Description
TRUEevaluated 130 times by 9 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlapplicationengine
  • tst_qqmlconnections
  • tst_qqmllistmodel
  • tst_qquickapplication
  • tst_qquickgridview
  • tst_qquickitem2
  • tst_qquicklistview
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_qqmlconnections
&& (
(prop.type() &...ignalProperty)Description
TRUEevaluated 130 times by 9 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlapplicationengine
  • tst_qqmlconnections
  • tst_qqmllistmodel
  • tst_qquickapplication
  • tst_qquickgridview
  • tst_qquickitem2
  • tst_qquicklistview
FALSEnever evaluated
prop.type() & QQmlProperty::SignalProperty)
(prop.type() &...ignalProperty)Description
TRUEevaluated 130 times by 9 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlapplicationengine
  • tst_qqmlconnections
  • tst_qqmllistmodel
  • tst_qquickapplication
  • tst_qquickgridview
  • tst_qquickitem2
  • tst_qquicklistview
FALSEnever evaluated
) {
0-130
149 int signalIndex = QQmlPropertyPrivate::get(prop)->signalIndex();-
150 QQmlBoundSignal *signal =-
151 new QQmlBoundSignal(target, signalIndex, this, qmlEngine(this));-
152 signal->setEnabled(d->enabled);-
153-
154 auto f = d->compilationUnit->runtimeFunctions[binding->value.compiledScriptIndex];-
155 QQmlBoundSignalExpression *expression =-
156 ctxtdata
ctxtdataDescription
TRUEevaluated 130 times by 9 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlapplicationengine
  • tst_qqmlconnections
  • tst_qqmllistmodel
  • tst_qquickapplication
  • tst_qquickgridview
  • tst_qquickitem2
  • tst_qquicklistview
FALSEnever evaluated
? new QQmlBoundSignalExpression(target, signalIndex, ctxtdata, this, f)
0-130
157 : nullptr;-
158 signal->takeExpression(expression);-
159 d->boundsignals += signal;-
160 }
executed 130 times by 9 tests: end of block
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlapplicationengine
  • tst_qqmlconnections
  • tst_qqmllistmodel
  • tst_qquickapplication
  • tst_qquickgridview
  • tst_qquickitem2
  • tst_qquicklistview
else {
130
161 if (!d->ignoreUnknownSignals
!d->ignoreUnknownSignalsDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qqmlconnections
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qqmlconnections
)
4
162 qmlWarning(this) << tr("Cannot assign to non-existent property \"%1\"").arg(propName);
executed 4 times by 1 test: qmlWarning(this) << tr("Cannot assign to non-existent property \"%1\"").arg(propName);
Executed by:
  • tst_qqmlconnections
4
163 }
executed 8 times by 1 test: end of block
Executed by:
  • tst_qqmlconnections
8
164 }-
165}
executed 132 times by 9 tests: end of block
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlapplicationengine
  • tst_qqmlconnections
  • tst_qqmllistmodel
  • tst_qquickapplication
  • tst_qquickgridview
  • tst_qquickitem2
  • tst_qquicklistview
132
166-
167void QQmlConnections::classBegin()-
168{-
169 QQmlConnectionsPrivate * const d = d_func();-
170 d->componentcomplete=false;-
171}
executed 136 times by 10 tests: end of block
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlapplicationengine
  • tst_qqmlconnections
  • tst_qqmllistmodel
  • tst_qquickapplication
  • tst_qquickgridview
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qtqmlmodules
136
172-
173void QQmlConnections::componentComplete()-
174{-
175 QQmlConnectionsPrivate * const d = d_func();-
176 d->componentcomplete=true;-
177 connectSignals();-
178}
executed 136 times by 10 tests: end of block
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlapplicationengine
  • tst_qqmlconnections
  • tst_qqmllistmodel
  • tst_qquickapplication
  • tst_qquickgridview
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qtqmlmodules
136
179-
180-
181-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.0