OpenCoverage

qtquick2.cpp

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/qtquick2.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
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#include "qtquick2_p.h"-
41#include <private/qqmlengine_p.h>-
42#include <private/qquickutilmodule_p.h>-
43#include <private/qquickvaluetypes_p.h>-
44#include <private/qquickitemsmodule_p.h>-
45#include <private/qquickaccessiblefactory_p.h>-
46-
47#include <private/qqmldebugconnector_p.h>-
48#include <private/qqmldebugserviceinterfaces_p.h>-
49#include <private/qqmldebugstatesdelegate_p.h>-
50#include <private/qqmlbinding_p.h>-
51#include <private/qqmlcontext_p.h>-
52#include <private/qquickapplication_p.h>-
53#include <QtQuick/private/qquickpropertychanges_p.h>-
54#include <QtQuick/private/qquickstate_p.h>-
55#include <qqmlproperty.h>-
56#include <QtCore/QPointer>-
57-
58static void initResources()-
59{-
60 Q_INIT_RESOURCE(scenegraph);-
61}
executed 374 times by 132 tests: end of block
Executed by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_parserstress
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • tst_qqmlenginedebugservice
  • tst_qqmlexpression
  • tst_qqmlimport
  • tst_qqmlincubator
  • tst_qqmlinfo
  • tst_qqmlinstantiator
  • tst_qqmllistmodel
  • tst_qqmllistmodelworkerscript
  • tst_qqmllistreference
  • ...
374
62-
63QT_BEGIN_NAMESPACE-
64-
65#if !QT_CONFIG(qml_debug)-
66-
67class QQmlQtQuick2DebugStatesDelegate : public QQmlDebugStatesDelegate {};-
68-
69#else-
70-
71class QQmlQtQuick2DebugStatesDelegate : public QQmlDebugStatesDelegate-
72{-
73public:-
74 QQmlQtQuick2DebugStatesDelegate();-
75 ~QQmlQtQuick2DebugStatesDelegate();-
76 void buildStatesList(bool cleanList, const QList<QPointer<QObject> > &instances) override;-
77 void updateBinding(QQmlContext *context,-
78 const QQmlProperty &property,-
79 const QVariant &expression, bool isLiteralValue,-
80 const QString &fileName, int line, int column,-
81 bool *isBaseState) override;-
82 bool setBindingForInvalidProperty(QObject *object,-
83 const QString &propertyName,-
84 const QVariant &expression,-
85 bool isLiteralValue) override;-
86 void resetBindingForInvalidProperty(QObject *object,-
87 const QString &propertyName) override;-
88-
89private:-
90 void buildStatesList(QObject *obj);-
91-
92 QList<QPointer<QQuickState> > m_allStates;-
93};-
94-
95QQmlQtQuick2DebugStatesDelegate::QQmlQtQuick2DebugStatesDelegate()-
96{-
97}-
98-
99QQmlQtQuick2DebugStatesDelegate::~QQmlQtQuick2DebugStatesDelegate()-
100{-
101}-
102-
103void QQmlQtQuick2DebugStatesDelegate::buildStatesList(bool cleanList,-
104 const QList<QPointer<QObject> > &instances)-
105{-
106 if (cleanList)
cleanListDescription
TRUEevaluated 102 times by 1 test
Evaluated by:
  • tst_qqmlenginedebugservice
FALSEnever evaluated
0-102
107 m_allStates.clear();
executed 102 times by 1 test: m_allStates.clear();
Executed by:
  • tst_qqmlenginedebugservice
102
108-
109 //only root context has all instances-
110 for (int ii = 0; ii < instances.count(); ++ii) {
ii < instances.count()Description
TRUEevaluated 622 times by 1 test
Evaluated by:
  • tst_qqmlenginedebugservice
FALSEevaluated 102 times by 1 test
Evaluated by:
  • tst_qqmlenginedebugservice
102-622
111 buildStatesList(instances.at(ii));-
112 }
executed 622 times by 1 test: end of block
Executed by:
  • tst_qqmlenginedebugservice
622
113}
executed 102 times by 1 test: end of block
Executed by:
  • tst_qqmlenginedebugservice
102
114-
115void QQmlQtQuick2DebugStatesDelegate::buildStatesList(QObject *obj)-
116{-
117 if (QQuickState *state = qobject_cast<QQuickState *>(obj)) {
QQuickState *s...kState *>(obj)Description
TRUEevaluated 102 times by 1 test
Evaluated by:
  • tst_qqmlenginedebugservice
FALSEevaluated 1440 times by 1 test
Evaluated by:
  • tst_qqmlenginedebugservice
102-1440
118 m_allStates.append(state);-
119 }
executed 102 times by 1 test: end of block
Executed by:
  • tst_qqmlenginedebugservice
102
120-
121 QObjectList children = obj->children();-
122 for (int ii = 0; ii < children.count(); ++ii) {
ii < children.count()Description
TRUEevaluated 920 times by 1 test
Evaluated by:
  • tst_qqmlenginedebugservice
FALSEevaluated 1542 times by 1 test
Evaluated by:
  • tst_qqmlenginedebugservice
920-1542
123 buildStatesList(children.at(ii));-
124 }
executed 920 times by 1 test: end of block
Executed by:
  • tst_qqmlenginedebugservice
920
125}
executed 1542 times by 1 test: end of block
Executed by:
  • tst_qqmlenginedebugservice
1542
126-
127void QQmlQtQuick2DebugStatesDelegate::updateBinding(QQmlContext *context,-
128 const QQmlProperty &property,-
129 const QVariant &expression, bool isLiteralValue,-
130 const QString &fileName, int line, int column,-
131 bool *inBaseState)-
132{-
133 Q_UNUSED(column);-
134 typedef QPointer<QQuickState> QuickStatePointer;-
135 QObject *object = property.object();-
136 QString propertyName = property.name();-
137 for (const QuickStatePointer& statePointer : qAsConst(m_allStates)) {-
138 if (QQuickState *state = statePointer.data()) {
QQuickState *s...Pointer.data()Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_qqmlenginedebugservice
FALSEnever evaluated
0-12
139 // here we assume that the revert list on itself defines the base state-
140 if (state->isStateActive() && state->containsPropertyInRevertList(object, propertyName)) {
state->isStateActive()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qqmlenginedebugservice
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_qqmlenginedebugservice
state->contain... propertyName)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qqmlenginedebugservice
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qqmlenginedebugservice
2-8
141 *inBaseState = false;-
142-
143 QQmlBinding *newBinding = nullptr;-
144 if (!isLiteralValue) {
!isLiteralValueDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qqmlenginedebugservice
FALSEnever evaluated
0-2
145 newBinding = QQmlBinding::create(&QQmlPropertyPrivate::get(property)->core,-
146 expression.toString(), object,-
147 QQmlContextData::get(context), fileName,-
148 line);-
149 newBinding->setTarget(property);-
150 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qqmlenginedebugservice
2
151-
152 state->changeBindingInRevertList(object, propertyName, newBinding);-
153-
154 if (isLiteralValue)
isLiteralValueDescription
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qqmlenginedebugservice
0-2
155 state->changeValueInRevertList(object, propertyName, expression);
never executed: state->changeValueInRevertList(object, propertyName, expression);
0
156 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qqmlenginedebugservice
2
157 }
executed 12 times by 1 test: end of block
Executed by:
  • tst_qqmlenginedebugservice
12
158 }
executed 12 times by 1 test: end of block
Executed by:
  • tst_qqmlenginedebugservice
12
159}
executed 12 times by 1 test: end of block
Executed by:
  • tst_qqmlenginedebugservice
12
160-
161bool QQmlQtQuick2DebugStatesDelegate::setBindingForInvalidProperty(QObject *object,-
162 const QString &propertyName,-
163 const QVariant &expression,-
164 bool isLiteralValue)-
165{-
166 if (QQuickPropertyChanges *propertyChanges = qobject_cast<QQuickPropertyChanges *>(object)) {
QQuickProperty...ges *>(object)Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qqmlenginedebugservice
FALSEnever evaluated
0-4
167 if (isLiteralValue)
isLiteralValueDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qqmlenginedebugservice
FALSEnever evaluated
0-4
168 propertyChanges->changeValue(propertyName, expression);
executed 4 times by 1 test: propertyChanges->changeValue(propertyName, expression);
Executed by:
  • tst_qqmlenginedebugservice
4
169 else-
170 propertyChanges->changeExpression(propertyName, expression.toString());
never executed: propertyChanges->changeExpression(propertyName, expression.toString());
0
171 return true;
executed 4 times by 1 test: return true;
Executed by:
  • tst_qqmlenginedebugservice
4
172 } else {-
173 return false;
never executed: return false;
0
174 }-
175}-
176-
177void QQmlQtQuick2DebugStatesDelegate::resetBindingForInvalidProperty(QObject *object, const QString &propertyName)-
178{-
179 if (QQuickPropertyChanges *propertyChanges = qobject_cast<QQuickPropertyChanges *>(object)) {
QQuickProperty...ges *>(object)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qqmlenginedebugservice
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qqmlenginedebugservice
2
180 propertyChanges->removeProperty(propertyName);-
181 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qqmlenginedebugservice
2
182}
executed 4 times by 1 test: end of block
Executed by:
  • tst_qqmlenginedebugservice
4
183-
184#endif // QT_CONFIG(qml_debug)-
185-
186void QQmlQtQuick2Module::defineModule()-
187{-
188 initResources();-
189-
190 QQuick_initializeProviders();-
191-
192 QQuickUtilModule::defineModule();-
193 QQmlEnginePrivate::defineQtQuick2Module();-
194 QQuickItemsModule::defineModule();-
195-
196 qmlRegisterUncreatableType<QQuickApplication>("QtQuick",2,0,"Application", QQuickApplication::tr("Application is an abstract class"));-
197-
198 QQuickValueTypes::registerValueTypes();-
199-
200#if QT_CONFIG(accessibility)-
201 QAccessible::installFactory(&qQuickAccessibleFactory);-
202#endif-
203-
204 QQmlEngineDebugService *debugService = QQmlDebugConnector::service<QQmlEngineDebugService>();-
205 if (debugService)
debugServiceDescription
TRUEevaluated 18 times by 2 tests
Evaluated by:
  • tst_qqmldebugjs
  • tst_qqmlenginedebugservice
FALSEevaluated 356 times by 130 tests
Evaluated by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_parserstress
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • tst_qqmlexpression
  • tst_qqmlimport
  • tst_qqmlincubator
  • tst_qqmlinfo
  • tst_qqmlinstantiator
  • tst_qqmllistmodel
  • tst_qqmllistmodelworkerscript
  • tst_qqmllistreference
  • tst_qqmllocale
  • tst_qqmlmetaobject
  • ...
18-356
206 debugService->setStatesDelegate(new QQmlQtQuick2DebugStatesDelegate);
executed 18 times by 2 tests: debugService->setStatesDelegate(new QQmlQtQuick2DebugStatesDelegate);
Executed by:
  • tst_qqmldebugjs
  • tst_qqmlenginedebugservice
18
207}
executed 374 times by 132 tests: end of block
Executed by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_parserstress
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • tst_qqmlenginedebugservice
  • tst_qqmlexpression
  • tst_qqmlimport
  • tst_qqmlincubator
  • tst_qqmlinfo
  • tst_qqmlinstantiator
  • tst_qqmllistmodel
  • tst_qqmllistmodelworkerscript
  • tst_qqmllistreference
  • ...
374
208-
209void QQmlQtQuick2Module::undefineModule()-
210{-
211 QQuick_deinitializeProviders();-
212}
executed 88 times by 3 tests: end of block
Executed by:
  • tst_qmldiskcache
  • tst_qqmlenginecleanup
  • tst_qqmltypeloader
88
213-
214QT_END_NAMESPACE-
215-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.2.0