OpenCoverage

qquickloader.cpp

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/items/qquickloader.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 "qquickloader_p_p.h"-
41-
42#include <QtQml/qqmlinfo.h>-
43-
44#include <private/qqmlengine_p.h>-
45#include <private/qqmlglobal_p.h>-
46-
47#include <private/qqmlcomponent_p.h>-
48-
49QT_BEGIN_NAMESPACE-
50-
51Q_DECLARE_LOGGING_CATEGORY(lcTransient)-
52-
53static const QQuickItemPrivate::ChangeTypes watchedChanges-
54 = QQuickItemPrivate::Geometry | QQuickItemPrivate::ImplicitWidth | QQuickItemPrivate::ImplicitHeight;-
55-
56QQuickLoaderPrivate::QQuickLoaderPrivate()-
57 : item(nullptr), object(nullptr), itemContext(nullptr), incubator(nullptr), updatingSize(false),-
58 active(true), loadingFromSource(false), asynchronous(false)-
59{-
60}
executed 320 times by 14 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
320
61-
62QQuickLoaderPrivate::~QQuickLoaderPrivate()-
63{-
64 delete itemContext;-
65 itemContext = nullptr;-
66 delete incubator;-
67 disposeInitialPropertyValues();-
68}
executed 314 times by 13 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
314
69-
70void QQuickLoaderPrivate::itemGeometryChanged(QQuickItem *resizeItem, QQuickGeometryChange change,-
71 const QRectF &oldGeometry)-
72{-
73 if (resizeItem == item)
resizeItem == itemDescription
TRUEevaluated 118 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qquickanimations
  • tst_qquickloader
  • tst_qquickrepeater
FALSEnever evaluated
0-118
74 _q_updateSize(false);
executed 118 times by 5 tests: _q_updateSize(false);
Executed by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qquickanimations
  • tst_qquickloader
  • tst_qquickrepeater
118
75 QQuickItemChangeListener::itemGeometryChanged(resizeItem, change, oldGeometry);-
76}
executed 118 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qquickanimations
  • tst_qquickloader
  • tst_qquickrepeater
118
77-
78void QQuickLoaderPrivate::itemImplicitWidthChanged(QQuickItem *)-
79{-
80 Q_Q(QQuickLoader);-
81 q->setImplicitWidth(getImplicitWidth());-
82}
executed 10 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickloader
10
83-
84void QQuickLoaderPrivate::itemImplicitHeightChanged(QQuickItem *)-
85{-
86 Q_Q(QQuickLoader);-
87 q->setImplicitHeight(getImplicitHeight());-
88}
executed 8 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickloader
  • tst_qquickrepeater
8
89-
90void QQuickLoaderPrivate::clear()-
91{-
92 Q_Q(QQuickLoader);-
93 disposeInitialPropertyValues();-
94-
95 if (incubator)
incubatorDescription
TRUEevaluated 318 times by 13 tests
Evaluated by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
FALSEevaluated 348 times by 14 tests
Evaluated by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
318-348
96 incubator->clear();
executed 318 times by 13 tests: incubator->clear();
Executed by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
318
97-
98 delete itemContext;-
99 itemContext = nullptr;-
100-
101 // Prevent any bindings from running while waiting for deletion. Without-
102 // this we may get transient errors from use of 'parent', for example.-
103 QQmlContext *context = qmlContext(object);-
104 if (context)
contextDescription
TRUEevaluated 182 times by 11 tests
Evaluated by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
FALSEevaluated 484 times by 14 tests
Evaluated by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
182-484
105 QQmlContextData::get(context)->clearContextRecursively();
executed 182 times by 11 tests: QQmlContextData::get(context)->clearContextRecursively();
Executed by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
182
106-
107 if (loadingFromSource && component) {
loadingFromSourceDescription
TRUEevaluated 170 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickloader
FALSEevaluated 496 times by 14 tests
Evaluated by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
170-496
108 // disconnect since we deleteLater-
109 QObject::disconnect(component, SIGNAL(statusChanged(QQmlComponent::Status)),-
110 q, SLOT(_q_sourceLoaded()));-
111 QObject::disconnect(component, SIGNAL(progressChanged(qreal)),-
112 q, SIGNAL(progressChanged()));-
113 component->deleteLater();-
114 component.setObject(nullptr, q);-
115 }
executed 158 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickloader
158
116 source = QUrl();-
117-
118 if (item) {
itemDescription
TRUEevaluated 268 times by 12 tests
Evaluated by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
FALSEevaluated 398 times by 14 tests
Evaluated by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
268-398
119 QQuickItemPrivate *p = QQuickItemPrivate::get(item);-
120 p->removeItemChangeListener(this, watchedChanges);-
121-
122 // We can't delete immediately because our item may have triggered-
123 // the Loader to load a different item.-
124 item->setParentItem(nullptr);-
125 item->setVisible(false);-
126 item = nullptr;-
127 }
executed 268 times by 12 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
268
128 if (object) {
objectDescription
TRUEevaluated 272 times by 12 tests
Evaluated by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
FALSEevaluated 394 times by 14 tests
Evaluated by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
272-394
129 object->deleteLater();-
130 object = nullptr;-
131 }
executed 272 times by 12 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
272
132}
executed 666 times by 14 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
666
133-
134void QQuickLoaderPrivate::initResize()-
135{-
136 if (!item)
!itemDescription
TRUEevaluated 8 times by 2 tests
Evaluated by:
  • tst_qqmltypeloader
  • tst_qquickloader
FALSEevaluated 286 times by 14 tests
Evaluated by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
8-286
137 return;
executed 8 times by 2 tests: return;
Executed by:
  • tst_qqmltypeloader
  • tst_qquickloader
8
138 QQuickItemPrivate *p = QQuickItemPrivate::get(item);-
139 p->addItemChangeListener(this, watchedChanges);-
140 _q_updateSize();-
141}
executed 286 times by 14 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
286
142-
143qreal QQuickLoaderPrivate::getImplicitWidth() const-
144{-
145 Q_Q(const QQuickLoader);-
146 // If the Loader has a valid width then Loader has set an explicit width on the-
147 // item, and we want the item's implicitWidth. If the Loader's width has-
148 // not been set then its implicitWidth is the width of the item.-
149 if (item)
itemDescription
TRUEevaluated 556 times by 14 tests
Evaluated by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickloader
6-556
150 return q->widthValid() ? item->implicitWidth() : item->width();
executed 556 times by 14 tests: return q->widthValid() ? item->implicitWidth() : item->width();
Executed by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
556
151 return QQuickImplicitSizeItemPrivate::getImplicitWidth();
executed 6 times by 1 test: return QQuickImplicitSizeItemPrivate::getImplicitWidth();
Executed by:
  • tst_qquickloader
6
152}-
153-
154qreal QQuickLoaderPrivate::getImplicitHeight() const-
155{-
156 Q_Q(const QQuickLoader);-
157 // If the Loader has a valid height then Loader has set an explicit height on the-
158 // item, and we want the item's implicitHeight. If the Loader's height has-
159 // not been set then its implicitHeight is the height of the item.-
160 if (item)
itemDescription
TRUEevaluated 554 times by 14 tests
Evaluated by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickloader
6-554
161 return q->heightValid() ? item->implicitHeight() : item->height();
executed 554 times by 14 tests: return q->heightValid() ? item->implicitHeight() : item->height();
Executed by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
554
162 return QQuickImplicitSizeItemPrivate::getImplicitHeight();
executed 6 times by 1 test: return QQuickImplicitSizeItemPrivate::getImplicitHeight();
Executed by:
  • tst_qquickloader
6
163}-
164-
165/*!-
166 \qmltype Loader-
167 \instantiates QQuickLoader-
168 \inqmlmodule QtQuick-
169 \ingroup qtquick-dynamic-
170 \inherits Item-
171-
172 \brief Allows dynamic loading of a subtree from a URL or Component.-
173-
174 Loader is used to dynamically load QML components.-
175-
176 Loader can load a-
177 QML file (using the \l source property) or a \l Component object (using-
178 the \l sourceComponent property). It is useful for delaying the creation-
179 of a component until it is required: for example, when a component should-
180 be created on demand, or when a component should not be created-
181 unnecessarily for performance reasons.-
182-
183 Here is a Loader that loads "Page1.qml" as a component when the-
184 \l MouseArea is clicked:-
185-
186 \snippet qml/loader/simple.qml 0-
187-
188 The loaded object can be accessed using the \l item property.-
189-
190 If the \l source or \l sourceComponent changes, any previously instantiated-
191 items are destroyed. Setting \l source to an empty string or setting-
192 \l sourceComponent to \c undefined destroys the currently loaded object,-
193 freeing resources and leaving the Loader empty.-
194-
195 \section2 Loader Sizing Behavior-
196-
197 If the source component is not an Item type, Loader does not-
198 apply any special sizing rules. When used to load visual types,-
199 Loader applies the following sizing rules:-
200-
201 \list-
202 \li If an explicit size is not specified for the Loader, the Loader-
203 is automatically resized to the size of the loaded item once the-
204 component is loaded.-
205 \li If the size of the Loader is specified explicitly by setting-
206 the width, height or by anchoring, the loaded item will be resized-
207 to the size of the Loader.-
208 \endlist-
209-
210 In both scenarios the size of the item and the Loader are identical.-
211 This ensures that anchoring to the Loader is equivalent to anchoring-
212 to the loaded item.-
213-
214 \table-
215 \row-
216 \li sizeloader.qml-
217 \li sizeitem.qml-
218 \row-
219 \li \snippet qml/loader/sizeloader.qml 0-
220 \li \snippet qml/loader/sizeitem.qml 0-
221 \row-
222 \li The red rectangle will be sized to the size of the root item.-
223 \li The red rectangle will be 50x50, centered in the root item.-
224 \endtable-
225-
226-
227 \section2 Receiving Signals from Loaded Objects-
228-
229 Any signals emitted from the loaded object can be received using the-
230 \l Connections type. For example, the following \c application.qml-
231 loads \c MyItem.qml, and is able to receive the \c message signal from-
232 the loaded item through a \l Connections object:-
233-
234 \table 70%-
235 \row-
236 \li application.qml-
237 \li MyItem.qml-
238 \row-
239 \li \snippet qml/loader/connections.qml 0-
240 \li \snippet qml/loader/MyItem.qml 0-
241 \endtable-
242-
243 Alternatively, since \c MyItem.qml is loaded within the scope of the-
244 Loader, it could also directly call any function defined in the Loader or-
245 its parent \l Item.-
246-
247-
248 \section2 Focus and Key Events-
249-
250 Loader is a focus scope. Its \l {Item::}{focus} property must be set to-
251 \c true for any of its children to get the \e {active focus}. (See-
252 \l{Keyboard Focus in Qt Quick}-
253 for more details.) Any key events received in the loaded item should likely-
254 also be \l {KeyEvent::}{accepted} so they are not propagated to the Loader.-
255-
256 For example, the following \c application.qml loads \c KeyReader.qml when-
257 the \l MouseArea is clicked. Notice the \l {Item::}{focus} property is-
258 set to \c true for the Loader as well as the \l Item in the dynamically-
259 loaded object:-
260-
261 \table-
262 \row-
263 \li application.qml-
264 \li KeyReader.qml-
265 \row-
266 \li \snippet qml/loader/focus.qml 0-
267 \li \snippet qml/loader/KeyReader.qml 0-
268 \endtable-
269-
270 Once \c KeyReader.qml is loaded, it accepts key events and sets-
271 \c event.accepted to \c true so that the event is not propagated to the-
272 parent \l Rectangle.-
273-
274 Since \c {QtQuick 2.0}, Loader can also load non-visual components.-
275-
276 \section2 Using a Loader within a View Delegate-
277-
278 In some cases you may wish to use a Loader within a view delegate to improve delegate-
279 loading performance. This works well in most cases, but there is one important issue to-
280 be aware of related to the \l{QtQml::Component#Creation Context}{creation context} of a Component.-
281-
282 In the following example, the \c index context property inserted by the ListView into \c delegateComponent's-
283 context will be inaccessible to Text, as the Loader will use the creation context of \c myComponent as the parent-
284 context when instantiating it, and \c index does not refer to anything within that context chain.-
285-
286 \snippet qml/loader/creationContext1.qml 0-
287-
288 In this situation we can either move the component inline,-
289-
290 \snippet qml/loader/creationContext2.qml 0-
291-
292 into a separate file,-
293-
294 \snippet qml/loader/creationContext3.qml 0-
295-
296 or explicitly set the required information as a property of the Loader (this works because the-
297 Loader sets itself as the context object for the component it is loading).-
298-
299 \snippet qml/loader/creationContext4.qml 0-
300-
301 \sa {dynamic-object-creation}{Dynamic Object Creation}-
302*/-
303-
304QQuickLoader::QQuickLoader(QQuickItem *parent)-
305 : QQuickImplicitSizeItem(*(new QQuickLoaderPrivate), parent)-
306{-
307 setFlag(ItemIsFocusScope);-
308}
executed 320 times by 14 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
320
309-
310QQuickLoader::~QQuickLoader()-
311{-
312 Q_D(QQuickLoader);-
313 d->clear();-
314}
executed 314 times by 13 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
314
315-
316/*!-
317 \qmlproperty bool QtQuick::Loader::active-
318 This property is \c true if the Loader is currently active.-
319 The default value for this property is \c true.-
320-
321 If the Loader is inactive, changing the \l source or \l sourceComponent-
322 will not cause the item to be instantiated until the Loader is made active.-
323-
324 Setting the value to inactive will cause any \l item loaded by the loader-
325 to be released, but will not affect the \l source or \l sourceComponent.-
326-
327 The \l status of an inactive loader is always \c Null.-
328-
329 \sa source, sourceComponent-
330 */-
331bool QQuickLoader::active() const-
332{-
333 Q_D(const QQuickLoader);-
334 return d->active;
executed 348 times by 14 tests: return d->active;
Executed by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
348
335}-
336-
337void QQuickLoader::setActive(bool newVal)-
338{-
339 Q_D(QQuickLoader);-
340 if (d->active == newVal)
d->active == newValDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickloader
FALSEevaluated 66 times by 2 tests
Evaluated by:
  • tst_qquickanimations
  • tst_qquickloader
8-66
341 return;
executed 8 times by 1 test: return;
Executed by:
  • tst_qquickloader
8
342-
343 d->active = newVal;-
344 if (newVal == true) {
newVal == trueDescription
TRUEevaluated 22 times by 1 test
Evaluated by:
  • tst_qquickloader
FALSEevaluated 44 times by 2 tests
Evaluated by:
  • tst_qquickanimations
  • tst_qquickloader
22-44
345 if (d->loadingFromSource) {
d->loadingFromSourceDescription
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquickloader
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquickloader
10-12
346 loadFromSource();-
347 } else {
executed 12 times by 1 test: end of block
Executed by:
  • tst_qquickloader
12
348 loadFromSourceComponent();-
349 }
executed 10 times by 1 test: end of block
Executed by:
  • tst_qquickloader
10
350 } else {-
351 // cancel any current incubation-
352 if (d->incubator) {
d->incubatorDescription
TRUEevaluated 18 times by 2 tests
Evaluated by:
  • tst_qquickanimations
  • tst_qquickloader
FALSEevaluated 26 times by 1 test
Evaluated by:
  • tst_qquickloader
18-26
353 d->incubator->clear();-
354 delete d->itemContext;-
355 d->itemContext = nullptr;-
356 }
executed 18 times by 2 tests: end of block
Executed by:
  • tst_qquickanimations
  • tst_qquickloader
18
357-
358 // Prevent any bindings from running while waiting for deletion. Without-
359 // this we may get transient errors from use of 'parent', for example.-
360 QQmlContext *context = qmlContext(d->object);-
361 if (context)
contextDescription
TRUEevaluated 16 times by 2 tests
Evaluated by:
  • tst_qquickanimations
  • tst_qquickloader
FALSEevaluated 28 times by 1 test
Evaluated by:
  • tst_qquickloader
16-28
362 QQmlContextData::get(context)->clearContextRecursively();
executed 16 times by 2 tests: QQmlContextData::get(context)->clearContextRecursively();
Executed by:
  • tst_qquickanimations
  • tst_qquickloader
16
363-
364 if (d->item) {
d->itemDescription
TRUEevaluated 14 times by 2 tests
Evaluated by:
  • tst_qquickanimations
  • tst_qquickloader
FALSEevaluated 30 times by 1 test
Evaluated by:
  • tst_qquickloader
14-30
365 QQuickItemPrivate *p = QQuickItemPrivate::get(d->item);-
366 p->removeItemChangeListener(d, watchedChanges);-
367-
368 // We can't delete immediately because our item may have triggered-
369 // the Loader to load a different item.-
370 d->item->setParentItem(nullptr);-
371 d->item->setVisible(false);-
372 d->item = nullptr;-
373 }
executed 14 times by 2 tests: end of block
Executed by:
  • tst_qquickanimations
  • tst_qquickloader
14
374 if (d->object) {
d->objectDescription
TRUEevaluated 16 times by 2 tests
Evaluated by:
  • tst_qquickanimations
  • tst_qquickloader
FALSEevaluated 28 times by 1 test
Evaluated by:
  • tst_qquickloader
16-28
375 d->object->deleteLater();-
376 d->object = nullptr;-
377 emit itemChanged();-
378 }
executed 16 times by 2 tests: end of block
Executed by:
  • tst_qquickanimations
  • tst_qquickloader
16
379 emit statusChanged();-
380 }
executed 44 times by 2 tests: end of block
Executed by:
  • tst_qquickanimations
  • tst_qquickloader
44
381 emit activeChanged();-
382}
executed 66 times by 2 tests: end of block
Executed by:
  • tst_qquickanimations
  • tst_qquickloader
66
383-
384-
385/*!-
386 \qmlproperty url QtQuick::Loader::source-
387 This property holds the URL of the QML component to instantiate.-
388-
389 Since \c {QtQuick 2.0}, Loader is able to load any type of object; it-
390 is not restricted to Item types.-
391-
392 To unload the currently loaded object, set this property to an empty string,-
393 or set \l sourceComponent to \c undefined. Setting \c source to a-
394 new URL will also cause the item created by the previous URL to be unloaded.-
395-
396 \sa sourceComponent, status, progress-
397*/-
398QUrl QQuickLoader::source() const-
399{-
400 Q_D(const QQuickLoader);-
401 return d->source;
executed 20 times by 1 test: return d->source;
Executed by:
  • tst_qquickloader
20
402}-
403-
404void QQuickLoader::setSource(const QUrl &url)-
405{-
406 setSource(url, true); // clear previous values-
407}
executed 144 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickloader
144
408-
409void QQuickLoader::setSource(const QUrl &url, bool needsClear)-
410{-
411 Q_D(QQuickLoader);-
412 if (d->source == url)
d->source == urlDescription
TRUEnever evaluated
FALSEevaluated 170 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickloader
0-170
413 return;
never executed: return;
0
414-
415 if (needsClear)
needsClearDescription
TRUEevaluated 144 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickloader
FALSEevaluated 26 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qquickloader
26-144
416 d->clear();
executed 144 times by 5 tests: d->clear();
Executed by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickloader
144
417-
418 d->source = url;-
419 d->loadingFromSource = true;-
420-
421 if (d->active)
d->activeDescription
TRUEevaluated 158 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickloader
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquickloader
12-158
422 loadFromSource();
executed 158 times by 5 tests: loadFromSource();
Executed by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickloader
158
423 else-
424 emit sourceChanged();
executed 12 times by 1 test: sourceChanged();
Executed by:
  • tst_qquickloader
12
425}-
426-
427void QQuickLoader::loadFromSource()-
428{-
429 Q_D(QQuickLoader);-
430 if (d->source.isEmpty()) {
d->source.isEmpty()Description
TRUEevaluated 6 times by 2 tests
Evaluated by:
  • tst_qqmltypeloader
  • tst_qquickloader
FALSEevaluated 166 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickloader
6-166
431 emit sourceChanged();-
432 emit statusChanged();-
433 emit progressChanged();-
434 emit itemChanged();-
435 return;
executed 6 times by 2 tests: return;
Executed by:
  • tst_qqmltypeloader
  • tst_qquickloader
6
436 }-
437-
438 if (isComponentComplete()) {
isComponentComplete()Description
TRUEevaluated 66 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qqmlxmlhttprequest
  • tst_qquickloader
FALSEevaluated 100 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qquickloader
66-100
439 QQmlComponent::CompilationMode mode = d->asynchronous ? QQmlComponent::Asynchronous : QQmlComponent::PreferSynchronous;
d->asynchronousDescription
TRUEevaluated 24 times by 1 test
Evaluated by:
  • tst_qquickloader
FALSEevaluated 42 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qqmlxmlhttprequest
  • tst_qquickloader
24-42
440 d->component.setObject(new QQmlComponent(qmlEngine(this), d->source, mode, this), this);-
441 d->load();-
442 }
executed 66 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qqmlxmlhttprequest
  • tst_qquickloader
66
443}
executed 166 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickloader
166
444-
445/*!-
446 \qmlproperty Component QtQuick::Loader::sourceComponent-
447 This property holds the \l{Component} to instantiate.-
448-
449 \qml-
450 Item {-
451 Component {-
452 id: redSquare-
453 Rectangle { color: "red"; width: 10; height: 10 }-
454 }-
455-
456 Loader { sourceComponent: redSquare }-
457 Loader { sourceComponent: redSquare; x: 10 }-
458 }-
459 \endqml-
460-
461 To unload the currently loaded object, set this property to \c undefined.-
462-
463 Since \c {QtQuick 2.0}, Loader is able to load any type of object; it-
464 is not restricted to Item types.-
465-
466 \sa source, progress-
467*/-
468-
469QQmlComponent *QQuickLoader::sourceComponent() const-
470{-
471 Q_D(const QQuickLoader);-
472 return d->component;
executed 44 times by 3 tests: return d->component;
Executed by:
  • tst_qqmlecmascript
  • tst_qquickitem2
  • tst_qquickloader
44
473}-
474-
475void QQuickLoader::setSourceComponent(QQmlComponent *comp)-
476{-
477 Q_D(QQuickLoader);-
478 if (comp == d->component)
comp == d->componentDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qqmlecmascript
FALSEevaluated 180 times by 12 tests
Evaluated by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
4-180
479 return;
executed 4 times by 1 test: return;
Executed by:
  • tst_qqmlecmascript
4
480-
481 d->clear();-
482-
483 d->component.setObject(comp, this);-
484 d->loadingFromSource = false;-
485-
486 if (d->active)
d->activeDescription
TRUEevaluated 176 times by 12 tests
Evaluated by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickloader
4-176
487 loadFromSourceComponent();
executed 176 times by 12 tests: loadFromSourceComponent();
Executed by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
176
488 else-
489 emit sourceComponentChanged();
executed 4 times by 1 test: sourceComponentChanged();
Executed by:
  • tst_qquickloader
4
490}-
491-
492void QQuickLoader::resetSourceComponent()-
493{-
494 setSourceComponent(nullptr);-
495}
executed 10 times by 2 tests: end of block
Executed by:
  • tst_qqmlecmascript
  • tst_qquickloader
10
496-
497void QQuickLoader::loadFromSourceComponent()-
498{-
499 Q_D(QQuickLoader);-
500 if (!d->component) {
!d->componentDescription
TRUEevaluated 20 times by 2 tests
Evaluated by:
  • tst_qqmlecmascript
  • tst_qquickloader
FALSEevaluated 166 times by 12 tests
Evaluated by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
20-166
501 emit sourceComponentChanged();-
502 emit statusChanged();-
503 emit progressChanged();-
504 emit itemChanged();-
505 return;
executed 20 times by 2 tests: return;
Executed by:
  • tst_qqmlecmascript
  • tst_qquickloader
20
506 }-
507-
508 if (isComponentComplete())
isComponentComplete()Description
TRUEevaluated 18 times by 4 tests
Evaluated by:
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qquickitem2
  • tst_qquickloader
FALSEevaluated 148 times by 11 tests
Evaluated by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
18-148
509 d->load();
executed 18 times by 4 tests: d->load();
Executed by:
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qquickitem2
  • tst_qquickloader
18
510}
executed 166 times by 12 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
166
511-
512/*!-
513 \qmlmethod object QtQuick::Loader::setSource(url source, object properties)-
514-
515 Creates an object instance of the given \a source component that will have-
516 the given \a properties. The \a properties argument is optional. The instance-
517 will be accessible via the \l item property once loading and instantiation-
518 is complete.-
519-
520 If the \l active property is \c false at the time when this function is called,-
521 the given \a source component will not be loaded but the \a source and initial-
522 \a properties will be cached. When the loader is made \l active, an instance of-
523 the \a source component will be created with the initial \a properties set.-
524-
525 Setting the initial property values of an instance of a component in this manner-
526 will \b{not} trigger any associated \l{Behavior}s.-
527-
528 Note that the cached \a properties will be cleared if the \l source or \l sourceComponent-
529 is changed after calling this function but prior to setting the loader \l active.-
530-
531 Example:-
532 \table 70%-
533 \row-
534 \li-
535 \qml-
536 // ExampleComponent.qml-
537 import QtQuick 2.0-
538 Rectangle {-
539 id: rect-
540 color: "red"-
541 width: 10-
542 height: 10-
543-
544 Behavior on color {-
545 NumberAnimation {-
546 target: rect-
547 property: "width"-
548 to: (rect.width + 20)-
549 duration: 0-
550 }-
551 }-
552 }-
553 \endqml-
554 \li-
555 \qml-
556 // example.qml-
557 import QtQuick 2.0-
558 Item {-
559 Loader {-
560 id: squareLoader-
561 onLoaded: console.log(squareLoader.item.width);-
562 // prints [10], not [30]-
563 }-
564-
565 Component.onCompleted: {-
566 squareLoader.setSource("ExampleComponent.qml",-
567 { "color": "blue" });-
568 // will trigger the onLoaded code when complete.-
569 }-
570 }-
571 \endqml-
572 \endtable-
573-
574 \sa source, active-
575*/-
576void QQuickLoader::setSource(QQmlV4Function *args)-
577{-
578 Q_ASSERT(args);-
579 Q_D(QQuickLoader);-
580-
581 bool ipvError = false;-
582 args->setReturnValue(QV4::Encode::undefined());-
583 QV4::Scope scope(args->v4engine());-
584 QV4::ScopedValue ipv(scope, d->extractInitialPropertyValues(args, this, &ipvError));-
585 if (ipvError)
ipvErrorDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickloader
FALSEevaluated 26 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qquickloader
4-26
586 return;
executed 4 times by 1 test: return;
Executed by:
  • tst_qquickloader
4
587-
588 d->clear();-
589 QUrl sourceUrl = d->resolveSourceUrl(args);-
590 if (!ipv->isUndefined()) {
!ipv->isUndefined()Description
TRUEevaluated 24 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qquickloader
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickloader
2-24
591 d->disposeInitialPropertyValues();-
592 d->initialPropertyValues.set(args->v4engine(), ipv);-
593 }
executed 24 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qquickloader
24
594 d->qmlCallingContext.set(scope.engine, scope.engine->qmlContext());-
595-
596 setSource(sourceUrl, false); // already cleared and set ipv above.-
597}
executed 26 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qquickloader
26
598-
599void QQuickLoaderPrivate::disposeInitialPropertyValues()-
600{-
601}-
602-
603void QQuickLoaderPrivate::load()-
604{-
605 Q_Q(QQuickLoader);-
606-
607 if (!q->isComponentComplete() || !component)
!q->isComponentComplete()Description
TRUEnever evaluated
FALSEevaluated 386 times by 14 tests
Evaluated by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
!componentDescription
TRUEevaluated 62 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qqmlxmlhttprequest
  • tst_qquickitem2
  • tst_qquickloader
FALSEevaluated 324 times by 14 tests
Evaluated by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
0-386
608 return;
executed 62 times by 5 tests: return;
Executed by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qqmlxmlhttprequest
  • tst_qquickitem2
  • tst_qquickloader
62
609-
610 if (!component->isLoading()) {
!component->isLoading()Description
TRUEevaluated 284 times by 14 tests
Evaluated by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
FALSEevaluated 40 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qqmltypeloader
  • tst_qquickloader
40-284
611 _q_sourceLoaded();-
612 } else {
executed 284 times by 14 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
284
613 QObject::connect(component, SIGNAL(statusChanged(QQmlComponent::Status)),-
614 q, SLOT(_q_sourceLoaded()));-
615 QObject::connect(component, SIGNAL(progressChanged(qreal)),-
616 q, SIGNAL(progressChanged()));-
617 emit q->statusChanged();-
618 emit q->progressChanged();-
619 if (loadingFromSource)
loadingFromSourceDescription
TRUEevaluated 40 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qqmltypeloader
  • tst_qquickloader
FALSEnever evaluated
0-40
620 emit q->sourceChanged();
executed 40 times by 3 tests: q->sourceChanged();
Executed by:
  • tst_examples
  • tst_qqmltypeloader
  • tst_qquickloader
40
621 else-
622 emit q->sourceComponentChanged();
never executed: q->sourceComponentChanged();
0
623 emit q->itemChanged();-
624 }
executed 40 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmltypeloader
  • tst_qquickloader
40
625}-
626-
627void QQuickLoaderIncubator::setInitialState(QObject *o)-
628{-
629 loader->setInitialState(o);-
630}
executed 296 times by 14 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
296
631-
632void QQuickLoaderPrivate::setInitialState(QObject *obj)-
633{-
634 Q_Q(QQuickLoader);-
635-
636 QQuickItem *item = qmlobject_cast<QQuickItem*>(obj);-
637 if (item) {
itemDescription
TRUEevaluated 288 times by 14 tests
Evaluated by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
FALSEevaluated 8 times by 2 tests
Evaluated by:
  • tst_qqmltypeloader
  • tst_qquickloader
8-288
638 // If the item doesn't have an explicit size, but the Loader-
639 // does, then set the item's size now before bindings are-
640 // evaluated, otherwise we will end up resizing the item-
641 // later and triggering any affected bindings/anchors.-
642 if (widthValid && !QQuickItemPrivate::get(item)->widthValid)
widthValidDescription
TRUEevaluated 76 times by 9 tests
Evaluated by:
  • tst_examples
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
FALSEevaluated 212 times by 8 tests
Evaluated by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qquickanimations
  • tst_qquickitem2
  • tst_qquickloader
  • tst_qquickrepeater
!QQuickItemPri...m)->widthValidDescription
TRUEevaluated 60 times by 7 tests
Evaluated by:
  • tst_examples
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickflickable
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickloader
FALSEevaluated 16 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
16-212
643 item->setWidth(q->width());
executed 60 times by 7 tests: item->setWidth(q->width());
Executed by:
  • tst_examples
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickflickable
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickloader
60
644 if (heightValid && !QQuickItemPrivate::get(item)->heightValid)
heightValidDescription
TRUEevaluated 80 times by 9 tests
Evaluated by:
  • tst_examples
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
FALSEevaluated 208 times by 8 tests
Evaluated by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qquickanimations
  • tst_qquickitem2
  • tst_qquickloader
  • tst_qquickrepeater
!QQuickItemPri...)->heightValidDescription
TRUEevaluated 60 times by 7 tests
Evaluated by:
  • tst_examples
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickflickable
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickloader
FALSEevaluated 20 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
20-208
645 item->setHeight(q->height());
executed 60 times by 7 tests: item->setHeight(q->height());
Executed by:
  • tst_examples
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickflickable
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickloader
60
646 item->setParentItem(q);-
647 }
executed 288 times by 14 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
288
648 if (obj) {
objDescription
TRUEevaluated 296 times by 14 tests
Evaluated by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
FALSEnever evaluated
0-296
649 QQml_setParent_noEvent(itemContext, obj);-
650 QQml_setParent_noEvent(obj, q);-
651 itemContext = nullptr;-
652 }
executed 296 times by 14 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
296
653-
654 if (initialPropertyValues.isUndefined())
initialPropert....isUndefined()Description
TRUEevaluated 278 times by 14 tests
Evaluated by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
FALSEevaluated 18 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qquickloader
18-278
655 return;
executed 278 times by 14 tests: return;
Executed by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
278
656-
657 QQmlComponentPrivate *d = QQmlComponentPrivate::get(component);-
658 Q_ASSERT(d && d->engine);-
659 QV4::ExecutionEngine *v4 = d->engine->handle();-
660 Q_ASSERT(v4);-
661 QV4::Scope scope(v4);-
662 QV4::ScopedValue ipv(scope, initialPropertyValues.value());-
663 QV4::Scoped<QV4::QmlContext> qmlContext(scope, qmlCallingContext.value());-
664 d->initializeObjectWithInitialProperties(qmlContext, ipv, obj);-
665}
executed 18 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qquickloader
18
666-
667void QQuickLoaderIncubator::statusChanged(Status status)-
668{-
669 loader->incubatorStateChanged(status);-
670}
executed 902 times by 14 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
902
671-
672void QQuickLoaderPrivate::incubatorStateChanged(QQmlIncubator::Status status)-
673{-
674 Q_Q(QQuickLoader);-
675 if (status == QQmlIncubator::Loading || status == QQmlIncubator::Null)
status == QQml...bator::LoadingDescription
TRUEevaluated 304 times by 14 tests
Evaluated by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
FALSEevaluated 598 times by 14 tests
Evaluated by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
status == QQmlIncubator::NullDescription
TRUEevaluated 302 times by 14 tests
Evaluated by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
FALSEevaluated 296 times by 14 tests
Evaluated by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
296-598
676 return;
executed 606 times by 14 tests: return;
Executed by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
606
677-
678 if (status == QQmlIncubator::Ready) {
status == QQmlIncubator::ReadyDescription
TRUEevaluated 294 times by 14 tests
Evaluated by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickloader
2-294
679 object = incubator->object();-
680 item = qmlobject_cast<QQuickItem*>(object);-
681 if (!item) {
!itemDescription
TRUEevaluated 8 times by 2 tests
Evaluated by:
  • tst_qqmltypeloader
  • tst_qquickloader
FALSEevaluated 286 times by 14 tests
Evaluated by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
8-286
682 QQuickWindow *window = qmlobject_cast<QQuickWindow*>(object);-
683 if (window) {
windowDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickloader
FALSEevaluated 6 times by 2 tests
Evaluated by:
  • tst_qqmltypeloader
  • tst_qquickloader
2-6
684 qCDebug(lcTransient) << window << "is transient for" << q->window();
never executed: QMessageLogger(__FILE__, 684, __PRETTY_FUNCTION__, lcTransient().categoryName()).debug() << window << "is transient for" << q->window();
qt_category_enabledDescription
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickloader
0-2
685 window->setTransientParent(q->window());-
686 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquickloader
2
687 }
executed 8 times by 2 tests: end of block
Executed by:
  • tst_qqmltypeloader
  • tst_qquickloader
8
688 emit q->itemChanged();-
689 initResize();-
690 incubator->clear();-
691 } else if (status == QQmlIncubator::Error) {
executed 294 times by 14 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
status == QQmlIncubator::ErrorDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickloader
FALSEnever evaluated
0-294
692 if (!incubator->errors().isEmpty())
!incubator->errors().isEmpty()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickloader
FALSEnever evaluated
0-2
693 QQmlEnginePrivate::warning(qmlEngine(q), incubator->errors());
executed 2 times by 1 test: QQmlEnginePrivate::warning(qmlEngine(q), incubator->errors());
Executed by:
  • tst_qquickloader
2
694 delete itemContext;-
695 itemContext = nullptr;-
696 delete incubator->object();-
697 source = QUrl();-
698 emit q->itemChanged();-
699 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquickloader
2
700 if (loadingFromSource)
loadingFromSourceDescription
TRUEevaluated 134 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickloader
FALSEevaluated 162 times by 12 tests
Evaluated by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
134-162
701 emit q->sourceChanged();
executed 134 times by 5 tests: q->sourceChanged();
Executed by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickloader
134
702 else-
703 emit q->sourceComponentChanged();
executed 162 times by 12 tests: q->sourceComponentChanged();
Executed by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
162
704 emit q->statusChanged();-
705 emit q->progressChanged();-
706 if (status == QQmlIncubator::Ready)
status == QQmlIncubator::ReadyDescription
TRUEevaluated 294 times by 14 tests
Evaluated by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickloader
2-294
707 emit q->loaded();
executed 294 times by 14 tests: q->loaded();
Executed by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
294
708 disposeInitialPropertyValues(); // cleanup-
709}
executed 296 times by 14 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
296
710-
711void QQuickLoaderPrivate::_q_sourceLoaded()-
712{-
713 Q_Q(QQuickLoader);-
714 if (!component || !component->errors().isEmpty()) {
!componentDescription
TRUEnever evaluated
FALSEevaluated 316 times by 14 tests
Evaluated by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
!component->errors().isEmpty()Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquickloader
FALSEevaluated 304 times by 14 tests
Evaluated by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
0-316
715 if (component)
componentDescription
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquickloader
FALSEnever evaluated
0-12
716 QQmlEnginePrivate::warning(qmlEngine(q), component->errors());
executed 12 times by 1 test: QQmlEnginePrivate::warning(qmlEngine(q), component->errors());
Executed by:
  • tst_qquickloader
12
717 if (loadingFromSource)
loadingFromSourceDescription
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquickloader
FALSEnever evaluated
0-12
718 emit q->sourceChanged();
executed 12 times by 1 test: q->sourceChanged();
Executed by:
  • tst_qquickloader
12
719 else-
720 emit q->sourceComponentChanged();
never executed: q->sourceComponentChanged();
0
721 emit q->statusChanged();-
722 emit q->progressChanged();-
723 emit q->itemChanged(); //Like clearing source, emit itemChanged even if previous item was also null-
724 disposeInitialPropertyValues(); // cleanup-
725 return;
executed 12 times by 1 test: return;
Executed by:
  • tst_qquickloader
12
726 }-
727-
728 QQmlContext *creationContext = component->creationContext();-
729 if (!creationContext) creationContext = qmlContext(q);
executed 142 times by 5 tests: creationContext = qmlContext(q);
Executed by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickloader
!creationContextDescription
TRUEevaluated 142 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickloader
FALSEevaluated 162 times by 12 tests
Evaluated by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
142-162
730 itemContext = new QQmlContext(creationContext);-
731 itemContext->setContextObject(q);-
732-
733 delete incubator;-
734 incubator = new QQuickLoaderIncubator(this, asynchronous ? QQmlIncubator::Asynchronous : QQmlIncubator::AsynchronousIfNested);-
735-
736 component->create(*incubator, itemContext);-
737-
738 if (incubator && incubator->status() == QQmlIncubator::Loading)
incubatorDescription
TRUEevaluated 304 times by 14 tests
Evaluated by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
FALSEnever evaluated
incubator->sta...bator::LoadingDescription
TRUEevaluated 32 times by 6 tests
Evaluated by:
  • tst_qqmltypeloader
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
FALSEevaluated 272 times by 10 tests
Evaluated by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquickloader
0-304
739 emit q->statusChanged();
executed 32 times by 6 tests: q->statusChanged();
Executed by:
  • tst_qqmltypeloader
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
32
740}
executed 304 times by 14 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
304
741-
742/*!-
743 \qmlproperty enumeration QtQuick::Loader::status-
744-
745 This property holds the status of QML loading. It can be one of:-
746 \list-
747 \li Loader.Null - the loader is inactive or no QML source has been set-
748 \li Loader.Ready - the QML source has been loaded-
749 \li Loader.Loading - the QML source is currently being loaded-
750 \li Loader.Error - an error occurred while loading the QML source-
751 \endlist-
752-
753 Use this status to provide an update or respond to the status change in some way.-
754 For example, you could:-
755-
756 \list-
757 \li Trigger a state change:-
758 \qml-
759 State { name: 'loaded'; when: loader.status == Loader.Ready }-
760 \endqml-
761-
762 \li Implement an \c onStatusChanged signal handler:-
763 \qml-
764 Loader {-
765 id: loader-
766 onStatusChanged: if (loader.status == Loader.Ready) console.log('Loaded')-
767 }-
768 \endqml-
769-
770 \li Bind to the status value:-
771 \qml-
772 Text { text: loader.status == Loader.Ready ? 'Loaded' : 'Not loaded' }-
773 \endqml-
774 \endlist-
775-
776 Note that if the source is a local file, the status will initially be Ready (or Error). While-
777 there will be no onStatusChanged signal in that case, the onLoaded will still be invoked.-
778-
779 \sa progress-
780*/-
781-
782QQuickLoader::Status QQuickLoader::status() const-
783{-
784 Q_D(const QQuickLoader);-
785-
786 if (!d->active)
!d->activeDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickloader
FALSEevaluated 150 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qqmlxmlhttprequest
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickrepeater
2-150
787 return Null;
executed 2 times by 1 test: return Null;
Executed by:
  • tst_qquickloader
2
788-
789 if (d->component) {
d->componentDescription
TRUEevaluated 132 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qqmlxmlhttprequest
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickrepeater
FALSEevaluated 18 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickloader
18-132
790 switch (d->component->status()) {-
791 case QQmlComponent::Loading:
executed 24 times by 2 tests: case QQmlComponent::Loading:
Executed by:
  • tst_examples
  • tst_qquickloader
24
792 return Loading;
executed 24 times by 2 tests: return Loading;
Executed by:
  • tst_examples
  • tst_qquickloader
24
793 case QQmlComponent::Error:
executed 24 times by 1 test: case QQmlComponent::Error:
Executed by:
  • tst_qquickloader
24
794 return Error;
executed 24 times by 1 test: return Error;
Executed by:
  • tst_qquickloader
24
795 case QQmlComponent::Null:
never executed: case QQmlComponent::Null:
0
796 return Null;
never executed: return Null;
0
797 default:
executed 84 times by 5 tests: default:
Executed by:
  • tst_examples
  • tst_qqmlxmlhttprequest
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickrepeater
84
798 break;
executed 84 times by 5 tests: break;
Executed by:
  • tst_examples
  • tst_qqmlxmlhttprequest
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickrepeater
84
799 }-
800 }-
801-
802 if (d->incubator) {
d->incubatorDescription
TRUEevaluated 90 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qqmlxmlhttprequest
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickrepeater
FALSEevaluated 12 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickrepeater
12-90
803 switch (d->incubator->status()) {-
804 case QQmlIncubator::Loading:
executed 6 times by 3 tests: case QQmlIncubator::Loading:
Executed by:
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickrepeater
6
805 return Loading;
executed 6 times by 3 tests: return Loading;
Executed by:
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickrepeater
6
806 case QQmlIncubator::Error:
never executed: case QQmlIncubator::Error:
0
807 return Error;
never executed: return Error;
0
808 default:
executed 84 times by 5 tests: default:
Executed by:
  • tst_examples
  • tst_qqmlxmlhttprequest
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickrepeater
84
809 break;
executed 84 times by 5 tests: break;
Executed by:
  • tst_examples
  • tst_qqmlxmlhttprequest
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickrepeater
84
810 }-
811 }-
812-
813 if (d->object)
d->objectDescription
TRUEevaluated 76 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qqmlxmlhttprequest
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickrepeater
FALSEevaluated 20 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickloader
  • tst_qquickrepeater
20-76
814 return Ready;
executed 76 times by 5 tests: return Ready;
Executed by:
  • tst_examples
  • tst_qqmlxmlhttprequest
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickrepeater
76
815-
816 return d->source.isEmpty() ? Null : Error;
executed 20 times by 3 tests: return d->source.isEmpty() ? Null : Error;
Executed by:
  • tst_examples
  • tst_qquickloader
  • tst_qquickrepeater
20
817}-
818-
819void QQuickLoader::componentComplete()-
820{-
821 Q_D(QQuickLoader);-
822 QQuickItem::componentComplete();-
823 if (active()) {
active()Description
TRUEevaluated 302 times by 14 tests
Evaluated by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
FALSEevaluated 18 times by 1 test
Evaluated by:
  • tst_qquickloader
18-302
824 if (d->loadingFromSource) {
d->loadingFromSourceDescription
TRUEevaluated 96 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qquickloader
FALSEevaluated 206 times by 13 tests
Evaluated by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmlxmlhttprequest
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
96-206
825 QQmlComponent::CompilationMode mode = d->asynchronous ? QQmlComponent::Asynchronous : QQmlComponent::PreferSynchronous;
d->asynchronousDescription
TRUEevaluated 16 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qqmltypeloader
FALSEevaluated 80 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qquickloader
16-80
826 d->component.setObject(new QQmlComponent(qmlEngine(this), d->source, mode, this), this);-
827 }
executed 96 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qquickloader
96
828 d->load();-
829 }
executed 302 times by 14 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
302
830}
executed 320 times by 14 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
320
831-
832void QQuickLoader::itemChange(QQuickItem::ItemChange change, const QQuickItem::ItemChangeData &value)-
833{-
834 if (change == ItemSceneChange) {
change == ItemSceneChangeDescription
TRUEevaluated 314 times by 11 tests
Evaluated by:
  • tst_examples
  • tst_qqmltypeloader
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
FALSEevaluated 1098 times by 14 tests
Evaluated by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
314-1098
835 QQuickWindow *loadedWindow = qmlobject_cast<QQuickWindow *>(item());-
836 if (loadedWindow) {
loadedWindowDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickloader
FALSEevaluated 310 times by 11 tests
Evaluated by:
  • tst_examples
  • tst_qqmltypeloader
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
4-310
837 qCDebug(lcTransient) << loadedWindow << "is transient for" << value.window;
never executed: QMessageLogger(__FILE__, 837, __PRETTY_FUNCTION__, lcTransient().categoryName()).debug() << loadedWindow << "is transient for" << value.window;
qt_category_enabledDescription
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickloader
0-4
838 loadedWindow->setTransientParent(value.window);-
839 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquickloader
4
840 }
executed 314 times by 11 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmltypeloader
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
314
841 QQuickItem::itemChange(change, value);-
842}
executed 1412 times by 14 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
1412
843-
844/*!-
845 \qmlsignal QtQuick::Loader::loaded()-
846-
847 This signal is emitted when the \l status becomes \c Loader.Ready, or on successful-
848 initial load.-
849-
850 The corresponding handler is \c onLoaded.-
851*/-
852-
853-
854/*!-
855\qmlproperty real QtQuick::Loader::progress-
856-
857This property holds the progress of loading QML data from the network, from-
8580.0 (nothing loaded) to 1.0 (finished). Most QML files are quite small, so-
859this value will rapidly change from 0 to 1.-
860-
861\sa status-
862*/-
863qreal QQuickLoader::progress() const-
864{-
865 Q_D(const QQuickLoader);-
866-
867 if (d->object)
d->objectDescription
TRUEevaluated 44 times by 2 tests
Evaluated by:
  • tst_qquickloader
  • tst_qquickrepeater
FALSEevaluated 38 times by 1 test
Evaluated by:
  • tst_qquickloader
38-44
868 return 1.0;
executed 44 times by 2 tests: return 1.0;
Executed by:
  • tst_qquickloader
  • tst_qquickrepeater
44
869-
870 if (d->component)
d->componentDescription
TRUEevaluated 24 times by 1 test
Evaluated by:
  • tst_qquickloader
FALSEevaluated 14 times by 1 test
Evaluated by:
  • tst_qquickloader
14-24
871 return d->component->progress();
executed 24 times by 1 test: return d->component->progress();
Executed by:
  • tst_qquickloader
24
872-
873 return 0.0;
executed 14 times by 1 test: return 0.0;
Executed by:
  • tst_qquickloader
14
874}-
875-
876/*!-
877\qmlproperty bool QtQuick::Loader::asynchronous-
878-
879This property holds whether the component will be instantiated asynchronously.-
880By default it is \c false.-
881-
882When used in conjunction with the \l source property, loading and compilation-
883will also be performed in a background thread.-
884-
885Loading asynchronously creates the objects declared by the component-
886across multiple frames, and reduces the-
887likelihood of glitches in animation. When loading asynchronously the status-
888will change to Loader.Loading. Once the entire component has been created, the-
889\l item will be available and the status will change to Loader.Ready.-
890-
891Changing the value of this property to \c false while an asynchronous load is in-
892progress will force immediate, synchronous completion. This allows beginning an-
893asynchronous load and then forcing completion if the Loader content must be-
894accessed before the asynchronous load has completed.-
895-
896To avoid seeing the items loading progressively set \c visible appropriately, e.g.-
897-
898\code-
899Loader {-
900 source: "mycomponent.qml"-
901 asynchronous: true-
902 visible: status == Loader.Ready-
903}-
904\endcode-
905-
906Note that this property affects object instantiation only; it is unrelated to-
907loading a component asynchronously via a network.-
908*/-
909bool QQuickLoader::asynchronous() const-
910{-
911 Q_D(const QQuickLoader);-
912 return d->asynchronous;
never executed: return d->asynchronous;
0
913}-
914-
915void QQuickLoader::setAsynchronous(bool a)-
916{-
917 Q_D(QQuickLoader);-
918 if (d->asynchronous == a)
d->asynchronous == aDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickloader
FALSEevaluated 50 times by 7 tests
Evaluated by:
  • tst_examples
  • tst_qqmltypeloader
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
2-50
919 return;
executed 2 times by 1 test: return;
Executed by:
  • tst_qquickloader
2
920-
921 d->asynchronous = a;-
922-
923 if (!d->asynchronous && isComponentComplete() && d->active) {
!d->asynchronousDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickloader
FALSEevaluated 46 times by 7 tests
Evaluated by:
  • tst_examples
  • tst_qqmltypeloader
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
isComponentComplete()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickloader
FALSEnever evaluated
d->activeDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickloader
FALSEnever evaluated
0-46
924 if (d->loadingFromSource && d->component && d->component->isLoading()) {
d->loadingFromSourceDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickloader
FALSEnever evaluated
d->component->isLoading()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickloader
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickloader
0-4
925 // Force a synchronous component load-
926 QUrl currentSource = d->source;-
927 d->clear();-
928 d->source = currentSource;-
929 loadFromSource();-
930 } else if (d->incubator && d->incubator->isLoading()) {
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquickloader
d->incubatorDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickloader
FALSEnever evaluated
d->incubator->isLoading()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickloader
FALSEnever evaluated
0-2
931 d->incubator->forceCompletion();-
932 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquickloader
2
933 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquickloader
4
934-
935 emit asynchronousChanged();-
936}
executed 50 times by 7 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmltypeloader
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
50
937-
938void QQuickLoaderPrivate::_q_updateSize(bool loaderGeometryChanged)-
939{-
940 Q_Q(QQuickLoader);-
941 if (!item)
!itemDescription
TRUEevaluated 114 times by 9 tests
Evaluated by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
FALSEevaluated 714 times by 14 tests
Evaluated by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
114-714
942 return;
executed 114 times by 9 tests: return;
Executed by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
114
943-
944 const bool needToUpdateWidth = loaderGeometryChanged && q->widthValid();
loaderGeometryChangedDescription
TRUEevaluated 596 times by 14 tests
Evaluated by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
FALSEevaluated 118 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qquickanimations
  • tst_qquickloader
  • tst_qquickrepeater
q->widthValid()Description
TRUEevaluated 160 times by 9 tests
Evaluated by:
  • tst_examples
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
FALSEevaluated 436 times by 8 tests
Evaluated by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qquickanimations
  • tst_qquickitem2
  • tst_qquickloader
  • tst_qquickrepeater
118-596
945 const bool needToUpdateHeight = loaderGeometryChanged && q->heightValid();
loaderGeometryChangedDescription
TRUEevaluated 596 times by 14 tests
Evaluated by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
FALSEevaluated 118 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qquickanimations
  • tst_qquickloader
  • tst_qquickrepeater
q->heightValid()Description
TRUEevaluated 170 times by 9 tests
Evaluated by:
  • tst_examples
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
FALSEevaluated 426 times by 8 tests
Evaluated by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qquickanimations
  • tst_qquickitem2
  • tst_qquickloader
  • tst_qquickrepeater
118-596
946-
947 if (needToUpdateWidth && needToUpdateHeight)
needToUpdateWidthDescription
TRUEevaluated 160 times by 9 tests
Evaluated by:
  • tst_examples
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
FALSEevaluated 554 times by 8 tests
Evaluated by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qquickanimations
  • tst_qquickitem2
  • tst_qquickloader
  • tst_qquickrepeater
needToUpdateHeightDescription
TRUEevaluated 158 times by 9 tests
Evaluated by:
  • tst_examples
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickloader
2-554
948 item->setSize(QSizeF(q->width(), q->height()));
executed 158 times by 9 tests: item->setSize(QSizeF(q->width(), q->height()));
Executed by:
  • tst_examples
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
158
949 else if (needToUpdateWidth)
needToUpdateWidthDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickloader
FALSEevaluated 554 times by 8 tests
Evaluated by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qquickanimations
  • tst_qquickitem2
  • tst_qquickloader
  • tst_qquickrepeater
2-554
950 item->setWidth(q->width());
executed 2 times by 1 test: item->setWidth(q->width());
Executed by:
  • tst_qquickloader
2
951 else if (needToUpdateHeight)
needToUpdateHeightDescription
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquickloader
FALSEevaluated 542 times by 8 tests
Evaluated by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qquickanimations
  • tst_qquickitem2
  • tst_qquickloader
  • tst_qquickrepeater
12-542
952 item->setHeight(q->height());
executed 12 times by 1 test: item->setHeight(q->height());
Executed by:
  • tst_qquickloader
12
953-
954 if (updatingSize)
updatingSizeDescription
TRUEevaluated 184 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qquickanimations
  • tst_qquickloader
  • tst_qquickrepeater
FALSEevaluated 530 times by 14 tests
Evaluated by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
184-530
955 return;
executed 184 times by 6 tests: return;
Executed by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qquickanimations
  • tst_qquickloader
  • tst_qquickrepeater
184
956-
957 updatingSize = true;-
958-
959 q->setImplicitSize(getImplicitWidth(), getImplicitHeight());-
960-
961 updatingSize = false;-
962}
executed 530 times by 14 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
530
963-
964/*!-
965 \qmlproperty object QtQuick::Loader::item-
966 This property holds the top-level object that is currently loaded.-
967-
968 Since \c {QtQuick 2.0}, Loader can load any object type.-
969*/-
970QObject *QQuickLoader::item() const-
971{-
972 Q_D(const QQuickLoader);-
973 return d->object;
executed 684 times by 13 tests: return d->object;
Executed by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
684
974}-
975-
976void QQuickLoader::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)-
977{-
978 Q_D(QQuickLoader);-
979 if (newGeometry != oldGeometry) {
newGeometry != oldGeometryDescription
TRUEevaluated 424 times by 12 tests
Evaluated by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
FALSEnever evaluated
0-424
980 d->_q_updateSize();-
981 }
executed 424 times by 12 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
424
982 QQuickItem::geometryChanged(newGeometry, oldGeometry);-
983}
executed 424 times by 12 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qquickanimations
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpathview
  • tst_qquickrepeater
424
984-
985QUrl QQuickLoaderPrivate::resolveSourceUrl(QQmlV4Function *args)-
986{-
987 QV4::Scope scope(args->v4engine());-
988 QV4::ScopedValue v(scope, (*args)[0]);-
989 QString arg = v->toQString();-
990 if (arg.isEmpty())
arg.isEmpty()Description
TRUEnever evaluated
FALSEevaluated 26 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qquickloader
0-26
991 return QUrl();
never executed: return QUrl();
0
992-
993 QQmlContextData *context = scope.engine->callingQmlContext();-
994 Q_ASSERT(context);-
995 return context->resolvedUrl(QUrl(arg));
executed 26 times by 3 tests: return context->resolvedUrl(QUrl(arg));
Executed by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qquickloader
26
996}-
997-
998QV4::ReturnedValue QQuickLoaderPrivate::extractInitialPropertyValues(QQmlV4Function *args, QObject *loader, bool *error)-
999{-
1000 QV4::Scope scope(args->v4engine());-
1001 QV4::ScopedValue valuemap(scope, QV4::Primitive::undefinedValue());-
1002 if (args->length() >= 2) {
args->length() >= 2Description
TRUEevaluated 28 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qquickloader
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickloader
2-28
1003 QV4::ScopedValue v(scope, (*args)[1]);-
1004 if (!v->isObject() || v->as<QV4::ArrayObject>()) {
!v->isObject()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickloader
FALSEevaluated 24 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qquickloader
v->as<QV4::ArrayObject>()Description
TRUEnever evaluated
FALSEevaluated 24 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qquickloader
0-24
1005 *error = true;-
1006 qmlWarning(loader) << QQuickLoader::tr("setSource: value is not an object");-
1007 } else {
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquickloader
4
1008 *error = false;-
1009 valuemap = v;-
1010 }
executed 24 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qquickloader
24
1011 }-
1012-
1013 return valuemap->asReturnedValue();
executed 30 times by 3 tests: return valuemap->asReturnedValue();
Executed by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qquickloader
30
1014}-
1015-
1016#include <moc_qquickloader_p.cpp>-
1017-
1018QT_END_NAMESPACE-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.2.0