OpenCoverage

qquickwidget.cpp

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quickwidgets/qquickwidget.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8-
9-
10-
11-
12-
13-
14-
15-
16-
17-
18class QQuickWidgetRenderControl : public QQuickRenderControl-
19{-
20public:-
21 QQuickWidgetRenderControl(QQuickWidget *quickwidget) : m_quickWidget(quickwidget) {}
executed 118 times by 2 tests: end of block
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
118
22 QWindow *renderWindow(QPoint *offset) override {-
23 if (offset
offsetDescription
TRUEnever evaluated
FALSEevaluated 694 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
)
0-694
24 *
never executed: *offset = m_quickWidget->mapTo(m_quickWidget->window(), QPoint());
offset = m_quickWidget->mapTo(m_quickWidget->window(), QPoint());
never executed: *offset = m_quickWidget->mapTo(m_quickWidget->window(), QPoint());
0
25 return
executed 694 times by 2 tests: return m_quickWidget->window()->windowHandle();
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
m_quickWidget->window()->windowHandle();
executed 694 times by 2 tests: return m_quickWidget->window()->windowHandle();
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
694
26 }-
27private:-
28 QQuickWidget *m_quickWidget;-
29};-
30-
31void QQuickWidgetPrivate::init(QQmlEngine* e)-
32{-
33 QQuickWidget * const q = q_func();-
34-
35 renderControl = new QQuickWidgetRenderControl(q);-
36 offscreenWindow = new QQuickWindow(renderControl);-
37 offscreenWindow->setTitle(QString::fromLatin1("Offscreen"));-
38-
39-
40-
41 auto sgRendererInterface = offscreenWindow->rendererInterface();-
42 if (sgRendererInterface
sgRendererInterfaceDescription
TRUEevaluated 118 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
FALSEnever evaluated
&& sgRendererInterface->graphicsApi() == QSGRendererInterface::Software
sgRendererInte...face::SoftwareDescription
TRUEnever evaluated
FALSEevaluated 118 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
)
0-118
43 useSoftwareRenderer = true;
never executed: useSoftwareRenderer = true;
0
44-
45 if (!useSoftwareRenderer
!useSoftwareRendererDescription
TRUEevaluated 118 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
FALSEnever evaluated
) {
0-118
46-
47 if (QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::RasterGLSurface)
QGuiApplicatio...sterGLSurface)Description
TRUEevaluated 118 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
FALSEnever evaluated
)
0-118
48 setRenderToTexture();
executed 118 times by 2 tests: setRenderToTexture();
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
118
49 else-
50-
51 QMessageLogger(__FILE__, 112, __PRETTY_FUNCTION__).warning("QQuickWidget is not supported on this platform.");
never executed: QMessageLogger(__FILE__, 112, __PRETTY_FUNCTION__).warning("QQuickWidget is not supported on this platform.");
0
52 }-
53-
54 engine = e;-
55-
56 if (!engine.isNull()
!engine.isNull()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickwidget
FALSEevaluated 114 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
&& !engine.data()->incubationController()
!engine.data()...onController()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickwidget
FALSEnever evaluated
)
0-114
57 engine.data()->setIncubationController(offscreenWindow->incubationController());
executed 4 times by 1 test: engine.data()->setIncubationController(offscreenWindow->incubationController());
Executed by:
  • tst_qquickwidget
4
58-
59-
60 q->setAcceptDrops(true);-
61-
62-
63 QWidget::connect(offscreenWindow, qFlagLocation("2""sceneGraphInitialized()" "\0" __FILE__ ":" "124"), q, qFlagLocation("1""createFramebufferObject()" "\0" __FILE__ ":" "124"));-
64 QWidget::connect(offscreenWindow, qFlagLocation("2""sceneGraphInvalidated()" "\0" __FILE__ ":" "125"), q, qFlagLocation("1""destroyFramebufferObject()" "\0" __FILE__ ":" "125"));-
65 QObject::connect(renderControl, qFlagLocation("2""renderRequested()" "\0" __FILE__ ":" "126"), q, qFlagLocation("1""triggerUpdate()" "\0" __FILE__ ":" "126"));-
66 QObject::connect(renderControl, qFlagLocation("2""sceneChanged()" "\0" __FILE__ ":" "127"), q, qFlagLocation("1""triggerUpdate()" "\0" __FILE__ ":" "127"));-
67}
executed 118 times by 2 tests: end of block
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
118
68-
69void QQuickWidgetPrivate::ensureEngine() const-
70{-
71 const QQuickWidget * const q = q_func();-
72 if (!engine.isNull()
!engine.isNull()Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquickwidget
FALSEevaluated 104 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
)
12-104
73 return;
executed 12 times by 1 test: return;
Executed by:
  • tst_qquickwidget
12
74-
75 engine = new QQmlEngine(const_cast<QQuickWidget*>(q));-
76 engine.data()->setIncubationController(offscreenWindow->incubationController());-
77}
executed 104 times by 2 tests: end of block
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
104
78-
79void QQuickWidgetPrivate::invalidateRenderControl()-
80{-
81-
82 if (!useSoftwareRenderer
!useSoftwareRendererDescription
TRUEevaluated 126 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
FALSEnever evaluated
) {
0-126
83 if (!context
!contextDescription
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_qquickwidget
FALSEevaluated 112 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
)
14-112
84 return;
executed 14 times by 1 test: return;
Executed by:
  • tst_qquickwidget
14
85-
86 bool success = context->makeCurrent(offscreenSurface);-
87 if (!success
!successDescription
TRUEnever evaluated
FALSEevaluated 112 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
) {
0-112
88 QMessageLogger(__FILE__, 149, __PRETTY_FUNCTION__).warning("QQuickWidget::invalidateRenderControl could not make context current");-
89 return;
never executed: return;
0
90 }-
91 }
executed 112 times by 2 tests: end of block
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
112
92-
93-
94 renderControl->invalidate();-
95-
96-
97-
98-
99-
100 if (!useSoftwareRenderer
!useSoftwareRendererDescription
TRUEevaluated 112 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
FALSEnever evaluated
&& context
contextDescription
TRUEevaluated 112 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
FALSEnever evaluated
) {
0-112
101 if (QOpenGLContext::currentContext() != context
QOpenGLContext...t() != contextDescription
TRUEnever evaluated
FALSEevaluated 112 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
)
0-112
102 context->makeCurrent(offscreenSurface);
never executed: context->makeCurrent(offscreenSurface);
0
103 }
executed 112 times by 2 tests: end of block
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
112
104-
105}
executed 112 times by 2 tests: end of block
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
112
106-
107void QQuickWidgetPrivate::handleWindowChange()-
108{-
109 if (offscreenWindow->isPersistentSceneGraph()
offscreenWindo...ntSceneGraph()Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickwidget
FALSEnever evaluated
&& (static_cast<
(static_cast<Q...penGLContexts)Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickwidget
QGuiApplication *>(QCoreApplication::instance()))->testAttribute(Qt::AA_ShareOpenGLContexts)
(static_cast<Q...penGLContexts)Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickwidget
)
0-8
110 return;
never executed: return;
0
111 invalidateRenderControl();-
112-
113 if (!useSoftwareRenderer
!useSoftwareRendererDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickwidget
FALSEnever evaluated
)
0-8
114 destroyContext();
executed 8 times by 1 test: destroyContext();
Executed by:
  • tst_qquickwidget
8
115}
executed 8 times by 1 test: end of block
Executed by:
  • tst_qquickwidget
8
116-
117QQuickWidgetPrivate::QQuickWidgetPrivate()-
118 : root(nullptr)-
119 , component(nullptr)-
120 , offscreenWindow(nullptr)-
121 , offscreenSurface(nullptr)-
122 , renderControl(nullptr)-
123-
124 , fbo(nullptr)-
125 , resolvedFbo(nullptr)-
126 , context(nullptr)-
127-
128 , resizeMode(QQuickWidget::SizeViewToRootObject)-
129 , initialSize(0,0)-
130 , eventPending(false)-
131 , updatePending(false)-
132 , fakeHidden(false)-
133 , requestedSamples(0)-
134 , useSoftwareRenderer(false)-
135 , forceFullUpdate(false)-
136{-
137}
executed 118 times by 2 tests: end of block
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
118
138-
139QQuickWidgetPrivate::~QQuickWidgetPrivate()-
140{-
141 invalidateRenderControl();-
142-
143 if (useSoftwareRenderer
useSoftwareRendererDescription
TRUEnever evaluated
FALSEevaluated 118 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
) {
0-118
144 delete renderControl;-
145 delete offscreenWindow;-
146 }
never executed: end of block
else {
0
147-
148-
149 ((!context || (QOpenGLContext::currentContext() == context && context->surface() == offscreenSurface)) ? static_cast<void>(0) : qt_assert("!context || (QOpenGLContext::currentContext() == context && context->surface() == offscreenSurface)", __FILE__, 218));-
150 delete renderControl;-
151 delete offscreenWindow;-
152 delete resolvedFbo;-
153 delete fbo;-
154-
155 destroyContext();-
156-
157 }
executed 118 times by 2 tests: end of block
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
118
158}-
159-
160void QQuickWidgetPrivate::execute()-
161{-
162 QQuickWidget * const q = q_func();-
163 ensureEngine();-
164-
165 if (root
rootDescription
TRUEnever evaluated
FALSEevaluated 102 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
) {
0-102
166 delete root;-
167 root = nullptr;-
168 }
never executed: end of block
0
169 if (component
componentDescription
TRUEnever evaluated
FALSEevaluated 102 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
) {
0-102
170 delete component;-
171 component = nullptr;-
172 }
never executed: end of block
0
173 if (!source.isEmpty()
!source.isEmpty()Description
TRUEevaluated 102 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
FALSEnever evaluated
) {
0-102
174 QQmlMemoryScope _qml_memory_scope(engine.data()->baseUrl().resolved(source));-
175 component = new QQmlComponent(engine.data(), source, q);-
176 if (!component->isLoading()
!component->isLoading()Description
TRUEevaluated 102 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
FALSEnever evaluated
) {
0-102
177 q->continueExecute();-
178 }
executed 102 times by 2 tests: end of block
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
else {
102
179 QObject::connect(component, qFlagLocation("2""statusChanged(QQmlComponent::Status)" "\0" __FILE__ ":" "248"),-
180 q, qFlagLocation("1""continueExecute()" "\0" __FILE__ ":" "249"));-
181 }
never executed: end of block
0
182 }-
183}
executed 102 times by 2 tests: end of block
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
102
184-
185void QQuickWidgetPrivate::itemGeometryChanged(QQuickItem *resizeItem, QQuickGeometryChange change,-
186 const QRectF &oldGeometry)-
187{-
188 QQuickWidget * const q = q_func();-
189 if (resizeItem == root
resizeItem == rootDescription
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquickwidget
FALSEnever evaluated
&& resizeMode == QQuickWidget::SizeViewToRootObject
resizeMode == ...ewToRootObjectDescription
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquickwidget
FALSEnever evaluated
) {
0-10
190-
191 resizetimer.start(0,q);-
192 }
executed 10 times by 1 test: end of block
Executed by:
  • tst_qquickwidget
10
193 QQuickItemChangeListener::itemGeometryChanged(resizeItem, change, oldGeometry);-
194}
executed 10 times by 1 test: end of block
Executed by:
  • tst_qquickwidget
10
195-
196void QQuickWidgetPrivate::render(bool needsSync)-
197{-
198 if (!useSoftwareRenderer
!useSoftwareRendererDescription
TRUEevaluated 332 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
FALSEnever evaluated
) {
0-332
199-
200-
201-
202 if (!fbo
!fboDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickwidget
FALSEevaluated 328 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
)
4-328
203 return;
executed 4 times by 1 test: return;
Executed by:
  • tst_qquickwidget
4
204-
205 ((context) ? static_cast<void>(0) : qt_assert("context", __FILE__, 274));-
206-
207 if (!context->makeCurrent(offscreenSurface)
!context->make...screenSurface)Description
TRUEnever evaluated
FALSEevaluated 328 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
) {
0-328
208 QMessageLogger(__FILE__, 277, __PRETTY_FUNCTION__).warning("QQuickWidget: Cannot render due to failing makeCurrent()");-
209 return;
never executed: return;
0
210 }-
211-
212 QOpenGLContextPrivate::get(context)->defaultFboRedirect = fbo->handle();-
213-
214 if (needsSync
needsSyncDescription
TRUEevaluated 324 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickwidget
) {
4-324
215 renderControl->polishItems();-
216 renderControl->sync();-
217 }
executed 324 times by 2 tests: end of block
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
324
218-
219 renderControl->render();-
220-
221 if (resolvedFbo
resolvedFboDescription
TRUEnever evaluated
FALSEevaluated 328 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
) {
0-328
222 QRect rect(QPoint(0, 0), fbo->size());-
223 QOpenGLFramebufferObject::blitFramebuffer(resolvedFbo, rect, fbo, rect);-
224 }
never executed: end of block
0
225-
226 static_cast<QOpenGLExtensions *>(context->functions())->flushShared();-
227-
228 QOpenGLContextPrivate::get(context)->defaultFboRedirect = 0;-
229-
230 }
executed 328 times by 2 tests: end of block
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
else {
328
231-
232 if (needsSync
needsSyncDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
233 renderControl->polishItems();-
234 renderControl->sync();-
235 }
never executed: end of block
0
236-
237 QQuickWindowPrivate *cd = QQuickWindowPrivate::get(offscreenWindow);-
238 auto softwareRenderer = static_cast<QSGSoftwareRenderer*>(cd->renderer);-
239 if (softwareRenderer
softwareRendererDescription
TRUEnever evaluated
FALSEnever evaluated
&& !softwareImage.isNull()
!softwareImage.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
240 softwareRenderer->setCurrentPaintDevice(&softwareImage);-
241 if (forceFullUpdate
forceFullUpdateDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
242 softwareRenderer->markDirty();-
243 forceFullUpdate = false;-
244 }
never executed: end of block
0
245 renderControl->render();-
246-
247 updateRegion += softwareRenderer->flushRegion();-
248 }
never executed: end of block
0
249 }
never executed: end of block
0
250}-
251-
252void QQuickWidgetPrivate::renderSceneGraph()-
253{-
254 QQuickWidget * const q = q_func();-
255 updatePending = false;-
256-
257 if (!q->isVisible()
!q->isVisible()Description
TRUEnever evaluated
FALSEevaluated 102 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
|| fakeHidden
fakeHiddenDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickwidget
FALSEevaluated 98 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
)
0-102
258 return;
executed 4 times by 1 test: return;
Executed by:
  • tst_qquickwidget
4
259-
260 if (!useSoftwareRenderer
!useSoftwareRendererDescription
TRUEevaluated 98 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
FALSEnever evaluated
) {
0-98
261 QOpenGLContext *context = offscreenWindow->openglContext();-
262 if (!context
!contextDescription
TRUEnever evaluated
FALSEevaluated 98 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
) {
0-98
263 QMessageLogger(__FILE__, 332, __PRETTY_FUNCTION__).warning("QQuickWidget: Attempted to render scene with no context");-
264 return;
never executed: return;
0
265 }-
266-
267 ((offscreenSurface) ? static_cast<void>(0) : qt_assert("offscreenSurface", __FILE__, 336));-
268 }
executed 98 times by 2 tests: end of block
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
98
269-
270 render(true);-
271-
272-
273 if (q->window()->graphicsProxyWidget()
q->window()->g...sProxyWidget()Description
TRUEnever evaluated
FALSEevaluated 98 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
)
0-98
274 QWidgetPrivate::nearestGraphicsProxyWidget(q)->update();
never executed: QWidgetPrivate::nearestGraphicsProxyWidget(q)->update();
0
275 else-
276-
277 {-
278 if (!useSoftwareRenderer
!useSoftwareRendererDescription
TRUEevaluated 98 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
FALSEnever evaluated
)
0-98
279 q->update();
executed 98 times by 2 tests: q->update();
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
98
280 else if (!updateRegion.isEmpty()
!updateRegion.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
281 q->update(updateRegion);
never executed: q->update(updateRegion);
0
282 }
executed 98 times by 2 tests: end of block
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
98
283}-
284-
285QImage QQuickWidgetPrivate::grabFramebuffer()-
286{-
287 if (!useSoftwareRenderer
!useSoftwareRendererDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickwidget
FALSEnever evaluated
) {
0-8
288-
289 if (!context
!contextDescription
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickwidget
)
0-8
290 return
never executed: return QImage();
QImage();
never executed: return QImage();
0
291-
292 context->makeCurrent(offscreenSurface);-
293-
294 }
executed 8 times by 1 test: end of block
Executed by:
  • tst_qquickwidget
8
295 return
executed 8 times by 1 test: return renderControl->grab();
Executed by:
  • tst_qquickwidget
renderControl->grab();
executed 8 times by 1 test: return renderControl->grab();
Executed by:
  • tst_qquickwidget
8
296}-
297QQuickWidget::QQuickWidget(QWidget *parent)-
298: QWidget(*(new QQuickWidgetPrivate), parent, nullptr)-
299{-
300 setMouseTracking(true);-
301 setFocusPolicy(Qt::StrongFocus);-
302 d_func()->init();-
303}
executed 114 times by 2 tests: end of block
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
114
304-
305-
306-
307-
308-
309-
310QQuickWidget::QQuickWidget(const QUrl &source, QWidget *parent)-
311 : QQuickWidget(parent)-
312{-
313 setSource(source);-
314}
never executed: end of block
0
315QQuickWidget::QQuickWidget(QQmlEngine* engine, QWidget *parent)-
316 : QWidget(*(new QQuickWidgetPrivate), parent, nullptr)-
317{-
318 setMouseTracking(true);-
319 setFocusPolicy(Qt::StrongFocus);-
320 d_func()->init(engine);-
321}
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquickwidget
4
322-
323-
324-
325-
326QQuickWidget::~QQuickWidget()-
327{-
328-
329-
330 QQuickWidgetPrivate * const d = d_func();-
331 delete d->root;-
332 d->root = nullptr;-
333}
executed 118 times by 2 tests: end of block
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
118
334void QQuickWidget::setSource(const QUrl& url)-
335{-
336 QQuickWidgetPrivate * const d = d_func();-
337 d->source = url;-
338 d->execute();-
339}
executed 102 times by 2 tests: end of block
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
102
340-
341-
342-
343-
344-
345-
346void QQuickWidget::setContent(const QUrl& url, QQmlComponent *component, QObject* item)-
347{-
348 QQuickWidgetPrivate * const d = d_func();-
349 d->source = url;-
350 d->component = component;-
351-
352 if (d->component
d->componentDescription
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickwidget
&& d->component->isError()
d->component->isError()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0-8
353 const QList<QQmlError> errorList = d->component->errors();-
354 for (const QQmlError &error : errorList) {-
355 QMessageLogger(error.url().toString().toLatin1().constData(), error.line(), nullptr).warning()-
356 << error;-
357 }
never executed: end of block
0
358 statusChanged(status());-
359 return;
never executed: return;
0
360 }-
361-
362 d->setRootObject(item);-
363 statusChanged(status());-
364}
executed 8 times by 1 test: end of block
Executed by:
  • tst_qquickwidget
8
365-
366-
367-
368-
369-
370-
371QUrl QQuickWidget::source() const-
372{-
373 const QQuickWidgetPrivate * const d = d_func();-
374 return
never executed: return d->source;
d->source;
never executed: return d->source;
0
375}-
376-
377-
378-
379-
380-
381QQmlEngine* QQuickWidget::engine() const-
382{-
383 const QQuickWidgetPrivate * const d = d_func();-
384 d->ensureEngine();-
385 return
executed 12 times by 1 test: return const_cast<QQmlEngine *>(d->engine.data());
Executed by:
  • tst_qquickwidget
const_cast<QQmlEngine *>(d->engine.data());
executed 12 times by 1 test: return const_cast<QQmlEngine *>(d->engine.data());
Executed by:
  • tst_qquickwidget
12
386}-
387QQmlContext* QQuickWidget::rootContext() const-
388{-
389 const QQuickWidgetPrivate * const d = d_func();-
390 d->ensureEngine();-
391 return
executed 2 times by 1 test: return d->engine.data()->rootContext();
Executed by:
  • tst_qquickwidget
d->engine.data()->rootContext();
executed 2 times by 1 test: return d->engine.data()->rootContext();
Executed by:
  • tst_qquickwidget
2
392}-
393QQuickWidget::Status QQuickWidget::status() const-
394{-
395 const QQuickWidgetPrivate * const d = d_func();-
396 if (!d->engine
!d->engineDescription
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquickwidget
FALSEevaluated 104 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
&& !d->source.isEmpty()
!d->source.isEmpty()Description
TRUEnever evaluated
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquickwidget
)
0-104
397 return
never executed: return QQuickWidget::Error;
QQuickWidget::Error;
never executed: return QQuickWidget::Error;
0
398-
399 if (!d->component
!d->componentDescription
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquickwidget
FALSEevaluated 104 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
)
10-104
400 return
executed 10 times by 1 test: return QQuickWidget::Null;
Executed by:
  • tst_qquickwidget
QQuickWidget::Null;
executed 10 times by 1 test: return QQuickWidget::Null;
Executed by:
  • tst_qquickwidget
10
401-
402 if (d->component->status() == QQmlComponent::Ready
d->component->...mponent::ReadyDescription
TRUEevaluated 100 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickwidget
&& !d->root
!d->rootDescription
TRUEnever evaluated
FALSEevaluated 100 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
)
0-100
403 return
never executed: return QQuickWidget::Error;
QQuickWidget::Error;
never executed: return QQuickWidget::Error;
0
404-
405 return
executed 104 times by 2 tests: return QQuickWidget::Status(d->component->status());
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
QQuickWidget::Status(d->component->status());
executed 104 times by 2 tests: return QQuickWidget::Status(d->component->status());
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
104
406}-
407-
408-
409-
410-
411-
412-
413-
414QList<QQmlError> QQuickWidget::errors() const-
415{-
416 const QQuickWidgetPrivate * const d = d_func();-
417 QList<QQmlError> errs;-
418-
419 if (d->component
d->componentDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickwidget
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickwidget
)
2-4
420 errs = d->component->errors();
executed 2 times by 1 test: errs = d->component->errors();
Executed by:
  • tst_qquickwidget
2
421-
422 if (!d->engine
!d->engineDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickwidget
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickwidget
&& !d->source.isEmpty()
!d->source.isEmpty()Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickwidget
) {
0-4
423 QQmlError error;-
424 error.setDescription(QLatin1String("QQuickWidget: invalid qml engine."));-
425 errs << error;-
426 }
never executed: end of block
0
427 if (d->component
d->componentDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickwidget
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickwidget
&& d->component->status() == QQmlComponent::Ready
d->component->...mponent::ReadyDescription
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickwidget
&& !d->root
!d->rootDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0-4
428 QQmlError error;-
429 error.setDescription(QLatin1String("QQuickWidget: invalid root object."));-
430 errs << error;-
431 }
never executed: end of block
0
432-
433 return
executed 6 times by 1 test: return errs;
Executed by:
  • tst_qquickwidget
errs;
executed 6 times by 1 test: return errs;
Executed by:
  • tst_qquickwidget
6
434}-
435void QQuickWidget::setResizeMode(ResizeMode mode)-
436{-
437 QQuickWidgetPrivate * const d = d_func();-
438 if (d->resizeMode == mode
d->resizeMode == modeDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickwidget
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickwidget
)
4-8
439 return;
executed 4 times by 1 test: return;
Executed by:
  • tst_qquickwidget
4
440-
441 if (d->root
d->rootDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickwidget
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickwidget
) {
4
442 if (d->resizeMode == SizeViewToRootObject
d->resizeMode ...ewToRootObjectDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickwidget
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickwidget
) {
2
443 QQuickItemPrivate *p = QQuickItemPrivate::get(d->root);-
444 p->removeItemChangeListener(d, QQuickItemPrivate::Geometry);-
445 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquickwidget
2
446 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquickwidget
4
447-
448 d->resizeMode = mode;-
449 if (d->root
d->rootDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickwidget
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickwidget
) {
4
450 d->initResize();-
451 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquickwidget
4
452}
executed 8 times by 1 test: end of block
Executed by:
  • tst_qquickwidget
8
453-
454void QQuickWidgetPrivate::initResize()-
455{-
456 if (root
rootDescription
TRUEevaluated 112 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
FALSEnever evaluated
) {
0-112
457 if (resizeMode == QQuickWidget::SizeViewToRootObject
resizeMode == ...ewToRootObjectDescription
TRUEevaluated 106 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickwidget
) {
6-106
458 QQuickItemPrivate *p = QQuickItemPrivate::get(root);-
459 p->addItemChangeListener(this, QQuickItemPrivate::Geometry);-
460 }
executed 106 times by 2 tests: end of block
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
106
461 }
executed 112 times by 2 tests: end of block
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
112
462 updateSize();-
463}
executed 112 times by 2 tests: end of block
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
112
464-
465void QQuickWidgetPrivate::updateSize()-
466{-
467 QQuickWidget * const q = q_func();-
468 if (!root
!rootDescription
TRUEnever evaluated
FALSEevaluated 126 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
)
0-126
469 return;
never executed: return;
0
470-
471 if (resizeMode == QQuickWidget::SizeViewToRootObject
resizeMode == ...ewToRootObjectDescription
TRUEevaluated 112 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
FALSEevaluated 14 times by 1 test
Evaluated by:
  • tst_qquickwidget
) {
14-112
472 QSize newSize = QSize(root->width(), root->height());-
473 if (newSize.isValid()
newSize.isValid()Description
TRUEevaluated 112 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
FALSEnever evaluated
&& newSize != q->size()
newSize != q->size()Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickwidget
FALSEevaluated 106 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
) {
0-112
474 q->resize(newSize);-
475 q->updateGeometry();-
476 }
executed 6 times by 1 test: end of block
Executed by:
  • tst_qquickwidget
6
477 }
executed 112 times by 2 tests: end of block
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
else if (resizeMode == QQuickWidget::SizeRootObjectToView
resizeMode == ...otObjectToViewDescription
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_qquickwidget
FALSEnever evaluated
) {
0-112
478 bool needToUpdateWidth = !qFuzzyCompare(q->width(), root->width());-
479 bool needToUpdateHeight = !qFuzzyCompare(q->height(), root->height());-
480-
481 if (needToUpdateWidth
needToUpdateWidthDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickwidget
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickwidget
&& needToUpdateHeight
needToUpdateHeightDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickwidget
FALSEnever evaluated
)
0-8
482 root->setSize(QSizeF(q->width(), q->height()));
executed 6 times by 1 test: root->setSize(QSizeF(q->width(), q->height()));
Executed by:
  • tst_qquickwidget
6
483 else if (needToUpdateWidth
needToUpdateWidthDescription
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickwidget
)
0-8
484 root->setWidth(q->width());
never executed: root->setWidth(q->width());
0
485 else if (needToUpdateHeight
needToUpdateHeightDescription
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickwidget
)
0-8
486 root->setHeight(q->height());
never executed: root->setHeight(q->height());
0
487 }
executed 14 times by 1 test: end of block
Executed by:
  • tst_qquickwidget
14
488}
executed 126 times by 2 tests: end of block
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
126
489-
490-
491-
492-
493-
494-
495void QQuickWidgetPrivate::updatePosition()-
496{-
497 QQuickWidget * const q = q_func();-
498 if (offscreenWindow == nullptr
offscreenWindow == nullptrDescription
TRUEnever evaluated
FALSEevaluated 222 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
)
0-222
499 return;
never executed: return;
0
500-
501 const QPoint &pos = q->mapToGlobal(QPoint(0, 0));-
502 if (offscreenWindow->position() != pos
offscreenWindo...ition() != posDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickwidget
FALSEevaluated 214 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
)
8-214
503 offscreenWindow->setPosition(pos);
executed 8 times by 1 test: offscreenWindow->setPosition(pos);
Executed by:
  • tst_qquickwidget
8
504}
executed 222 times by 2 tests: end of block
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
222
505-
506QSize QQuickWidgetPrivate::rootObjectSize() const-
507{-
508 QSize rootObjectSize(0,0);-
509 int widthCandidate = -1;-
510 int heightCandidate = -1;-
511 if (root
rootDescription
TRUEevaluated 128 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickwidget
) {
2-128
512 widthCandidate = root->width();-
513 heightCandidate = root->height();-
514 }
executed 128 times by 2 tests: end of block
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
128
515 if (widthCandidate > 0
widthCandidate > 0Description
TRUEevaluated 124 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickwidget
) {
6-124
516 rootObjectSize.setWidth(widthCandidate);-
517 }
executed 124 times by 2 tests: end of block
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
124
518 if (heightCandidate > 0
heightCandidate > 0Description
TRUEevaluated 124 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickwidget
) {
6-124
519 rootObjectSize.setHeight(heightCandidate);-
520 }
executed 124 times by 2 tests: end of block
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
124
521 return
executed 130 times by 2 tests: return rootObjectSize;
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
rootObjectSize;
executed 130 times by 2 tests: return rootObjectSize;
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
130
522}-
523-
524void QQuickWidgetPrivate::handleContextCreationFailure(const QSurfaceFormat &format, bool isEs)-
525{-
526 QQuickWidget * const q = q_func();-
527-
528 QString translatedMessage;-
529 QString untranslatedMessage;-
530 QQuickWindowPrivate::contextCreationFailureMessage(format, &translatedMessage, &untranslatedMessage, isEs);-
531-
532 static const QMetaMethod errorSignal = QMetaMethod::fromSignal(&QQuickWidget::sceneGraphError);-
533 const bool signalConnected = q->isSignalConnected(errorSignal);-
534 if (signalConnected
signalConnectedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
535 q->sceneGraphError(QQuickWindow::ContextNotAvailable, translatedMessage);
never executed: q->sceneGraphError(QQuickWindow::ContextNotAvailable, translatedMessage);
0
536-
537-
538-
539-
540-
541 if (!signalConnected
!signalConnectedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
542 QMessageLogger(__FILE__, 850, __PRETTY_FUNCTION__).fatal("%s", QtPrivate::asString(untranslatedMessage).toLocal8Bit().constData());
never executed: QMessageLogger(__FILE__, 850, __PRETTY_FUNCTION__).fatal("%s", QtPrivate::asString(untranslatedMessage).toLocal8Bit().constData());
0
543}
never executed: end of block
0
544-
545-
546void QQuickWidgetPrivate::createContext()-
547{-
548-
549 QQuickWidget * const q = q_func();-
550-
551-
552-
553 const bool reinit = context
contextDescription
TRUEevaluated 102 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
FALSEevaluated 112 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
&& !offscreenWindow->openglContext()
!offscreenWind...penglContext()Description
TRUEnever evaluated
FALSEevaluated 102 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
;
0-112
554-
555 if (!reinit
!reinitDescription
TRUEevaluated 214 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
FALSEnever evaluated
) {
0-214
556 if (context
contextDescription
TRUEevaluated 102 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
FALSEevaluated 112 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
)
102-112
557 return;
executed 102 times by 2 tests: return;
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
102
558-
559 context = new QOpenGLContext;-
560 context->setFormat(offscreenWindow->requestedFormat());-
561-
562 QOpenGLContext *shareContext = qt_gl_global_share_context();-
563 if (!shareContext
!shareContextDescription
TRUEevaluated 112 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
FALSEnever evaluated
)
0-112
564 shareContext = QWidgetPrivate::get(q->window())->shareContext();
executed 112 times by 2 tests: shareContext = QWidgetPrivate::get(q->window())->shareContext();
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
112
565 if (shareContext
shareContextDescription
TRUEevaluated 108 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickwidget
) {
4-108
566 context->setShareContext(shareContext);-
567 context->setScreen(shareContext->screen());-
568 }
executed 108 times by 2 tests: end of block
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
108
569 if (!context->create()
!context->create()Description
TRUEnever evaluated
FALSEevaluated 112 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
) {
0-112
570 const bool isEs = context->isOpenGLES();-
571 delete context;-
572 context = nullptr;-
573 handleContextCreationFailure(offscreenWindow->requestedFormat(), isEs);-
574 return;
never executed: return;
0
575 }-
576-
577 offscreenSurface = new QOffscreenSurface;-
578-
579-
580-
581 offscreenSurface->setFormat(context->format());-
582 offscreenSurface->setScreen(context->screen());-
583 offscreenSurface->create();-
584 }
executed 112 times by 2 tests: end of block
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
112
585-
586 if (context->makeCurrent(offscreenSurface)
context->makeC...screenSurface)Description
TRUEevaluated 112 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
FALSEnever evaluated
) {
0-112
587 if (!offscreenWindow->openglContext()
!offscreenWind...penglContext()Description
TRUEevaluated 112 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
FALSEnever evaluated
)
0-112
588 renderControl->initialize(context);
executed 112 times by 2 tests: renderControl->initialize(context);
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
112
589 }
executed 112 times by 2 tests: end of block
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
else
112
590-
591 QMessageLogger(__FILE__, 899, __PRETTY_FUNCTION__).warning("QQuickWidget: Failed to make context current");
never executed: QMessageLogger(__FILE__, 899, __PRETTY_FUNCTION__).warning("QQuickWidget: Failed to make context current");
0
592}-
593-
594-
595void QQuickWidgetPrivate::destroyContext()-
596{-
597 delete offscreenSurface;-
598 offscreenSurface = nullptr;-
599-
600 delete context;-
601 context = nullptr;-
602-
603}
executed 126 times by 2 tests: end of block
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
126
604-
605void QQuickWidget::createFramebufferObject()-
606{-
607 QQuickWidgetPrivate * const d = d_func();-
608-
609-
610-
611 if (size().isEmpty()
size().isEmpty()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickwidget
FALSEevaluated 124 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
)
4-124
612 return;
executed 4 times by 1 test: return;
Executed by:
  • tst_qquickwidget
4
613-
614-
615-
616-
617 const QPoint &globalPos = mapToGlobal(QPoint(0, 0));-
618 d->offscreenWindow->setGeometry(globalPos.x(), globalPos.y(), width(), height());-
619-
620 if (d->useSoftwareRenderer
d->useSoftwareRendererDescription
TRUEnever evaluated
FALSEevaluated 124 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
) {
0-124
621 const QSize imageSize = size() * devicePixelRatioF();-
622 d->softwareImage = QImage(imageSize, QImage::Format_ARGB32_Premultiplied);-
623 d->softwareImage.setDevicePixelRatio(devicePixelRatioF());-
624 d->forceFullUpdate = true;-
625 return;
never executed: return;
0
626 }-
627-
628-
629 QOpenGLContext *context = d->offscreenWindow->openglContext();-
630-
631 if (!context
!contextDescription
TRUEnever evaluated
FALSEevaluated 124 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
) {
0-124
632 QMessageLogger(__FILE__, 940, __PRETTY_FUNCTION__).warning("QQuickWidget: Attempted to create FBO with no context");-
633 return;
never executed: return;
0
634 }-
635-
636 QOpenGLContext *shareWindowContext = QWidgetPrivate::get(window())->shareContext();-
637 if (shareWindowContext
shareWindowContextDescription
TRUEevaluated 120 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickwidget
&& context->shareContext() != shareWindowContext
context->share...eWindowContextDescription
TRUEnever evaluated
FALSEevaluated 120 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
&& !(static_cast<QGuiApplication *>(QCoreApplication::instance()))->testAttribute(Qt::AA_ShareOpenGLContexts)
!(static_cast<...penGLContexts)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0-120
638 context->setShareContext(shareWindowContext);-
639 context->setScreen(shareWindowContext->screen());-
640 if (!context->create()
!context->create()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
641 QMessageLogger(__FILE__, 949, __PRETTY_FUNCTION__).warning("QQuickWidget: Failed to recreate context");
never executed: QMessageLogger(__FILE__, 949, __PRETTY_FUNCTION__).warning("QQuickWidget: Failed to recreate context");
0
642-
643-
644 d->offscreenSurface->destroy();-
645 d->offscreenSurface->setScreen(context->screen());-
646 d->offscreenSurface->create();-
647 }
never executed: end of block
0
648-
649 context->makeCurrent(d->offscreenSurface);-
650-
651 int samples = d->requestedSamples;-
652 if (!QOpenGLExtensions(context).hasOpenGLExtension(QOpenGLExtensions::FramebufferMultisample)
!QOpenGLExtens...erMultisample)Description
TRUEnever evaluated
FALSEevaluated 124 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
)
0-124
653 samples = 0;
never executed: samples = 0;
0
654-
655 QOpenGLFramebufferObjectFormat format;-
656 format.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil);-
657 format.setSamples(samples);-
658 const QSize fboSize = size() * devicePixelRatioF();-
659-
660-
661 if (!d->fbo
!d->fboDescription
TRUEevaluated 108 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
FALSEevaluated 16 times by 1 test
Evaluated by:
  • tst_qquickwidget
|| d->fbo->size() != fboSize
d->fbo->size() != fboSizeDescription
TRUEevaluated 16 times by 1 test
Evaluated by:
  • tst_qquickwidget
FALSEnever evaluated
) {
0-108
662 delete d->fbo;-
663 d->fbo = new QOpenGLFramebufferObject(fboSize, format);-
664 }
executed 124 times by 2 tests: end of block
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
124
665 d->offscreenWindow->setRenderTarget(d->fbo);-
666-
667 if (samples > 0
samples > 0Description
TRUEnever evaluated
FALSEevaluated 124 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
)
0-124
668 d->resolvedFbo = new QOpenGLFramebufferObject(fboSize);
never executed: d->resolvedFbo = new QOpenGLFramebufferObject(fboSize);
0
669-
670-
671-
672-
673 ((!d->offscreenWindow->handle()) ? static_cast<void>(0) : qt_assert("!d->offscreenWindow->handle()", __FILE__, 1004));-
674-
675}
executed 124 times by 2 tests: end of block
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
124
676-
677void QQuickWidget::destroyFramebufferObject()-
678{-
679 QQuickWidgetPrivate * const d = d_func();-
680-
681 if (d->useSoftwareRenderer
d->useSoftwareRendererDescription
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickwidget
) {
0-2
682 d->softwareImage = QImage();-
683 return;
never executed: return;
0
684 }-
685-
686-
687 delete d->fbo;-
688 d->fbo = nullptr;-
689 delete d->resolvedFbo;-
690 d->resolvedFbo = nullptr;-
691-
692}
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquickwidget
2
693-
694QQuickWidget::ResizeMode QQuickWidget::resizeMode() const-
695{-
696 const QQuickWidgetPrivate * const d = d_func();-
697 return
never executed: return d->resizeMode;
d->resizeMode;
never executed: return d->resizeMode;
0
698}-
699-
700-
701-
702-
703void QQuickWidget::continueExecute()-
704{-
705 QQuickWidgetPrivate * const d = d_func();-
706 disconnect(d->component, qFlagLocation("2""statusChanged(QQmlComponent::Status)" "\0" __FILE__ ":" "1037"), this, qFlagLocation("1""continueExecute()" "\0" __FILE__ ":" "1037"));-
707-
708 if (d->component->isError()
d->component->isError()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickwidget
FALSEevaluated 100 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
) {
2-100
709 const QList<QQmlError> errorList = d->component->errors();-
710 for (const QQmlError &error : errorList) {-
711 QMessageLogger(error.url().toString().toLatin1().constData(), error.line(), nullptr).warning()-
712 << error;-
713 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquickwidget
2
714 statusChanged(status());-
715 return;
executed 2 times by 1 test: return;
Executed by:
  • tst_qquickwidget
2
716 }-
717-
718 QObject *obj = d->component->create();-
719-
720 if (d->component->isError()
d->component->isError()Description
TRUEnever evaluated
FALSEevaluated 100 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
) {
0-100
721 const QList<QQmlError> errorList = d->component->errors();-
722 for (const QQmlError &error : errorList) {-
723 QMessageLogger(error.url().toString().toLatin1().constData(), error.line(), nullptr).warning()-
724 << error;-
725 }
never executed: end of block
0
726 statusChanged(status());-
727 return;
never executed: return;
0
728 }-
729-
730 d->setRootObject(obj);-
731 statusChanged(status());-
732}
executed 100 times by 2 tests: end of block
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
100
733-
734-
735-
736-
737-
738void QQuickWidgetPrivate::setRootObject(QObject *obj)-
739{-
740 QQuickWidget * const q = q_func();-
741 if (root == obj
root == objDescription
TRUEnever evaluated
FALSEevaluated 108 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
)
0-108
742 return;
never executed: return;
0
743 if (QQuickItem *sgItem = qobject_cast<QQuickItem *>(obj)
QQuickItem *sg...ckItem *>(obj)Description
TRUEevaluated 108 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
FALSEnever evaluated
) {
0-108
744 root = sgItem;-
745 sgItem->setParentItem(offscreenWindow->contentItem());-
746 }
executed 108 times by 2 tests: end of block
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
else if (qobject_cast<QWindow *>(obj)
qobject_cast<QWindow *>(obj)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0-108
747 QMessageLogger(__FILE__, 1078, __PRETTY_FUNCTION__).warning() << "QQuickWidget does not support using windows as a root item." << endl-
748 << endl-
749 << "If you wish to create your root window from QML, consider using QQmlApplicationEngine instead." << endl;-
750 }
never executed: end of block
else {
0
751 QMessageLogger(__FILE__, 1082, __PRETTY_FUNCTION__).warning() << "QQuickWidget only supports loading of root objects that derive from QQuickItem." << endl-
752 << endl-
753 << "Ensure your QML code is written for QtQuick 2, and uses a root that is or" << endl-
754 << "inherits from QtQuick's Item (not a Timer, QtObject, etc)." << endl;-
755 delete obj;-
756 root = nullptr;-
757 }
never executed: end of block
0
758 if (root
rootDescription
TRUEevaluated 108 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
FALSEnever evaluated
) {
0-108
759 initialSize = rootObjectSize();-
760 bool resized = q->testAttribute(Qt::WA_Resized);-
761 if ((resizeMode == QQuickWidget::SizeViewToRootObject
resizeMode == ...ewToRootObjectDescription
TRUEevaluated 104 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickwidget
|| !resized
!resizedDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickwidget
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickwidget
) &&
2-104
762 initialSize != q->size()
initialSize != q->size()Description
TRUEevaluated 42 times by 1 test
Evaluated by:
  • tst_qquickwidget
FALSEevaluated 64 times by 1 test
Evaluated by:
  • tst_qquickshortcut
) {
42-64
763 q->resize(initialSize);-
764 }
executed 42 times by 1 test: end of block
Executed by:
  • tst_qquickwidget
42
765 initResize();-
766 }
executed 108 times by 2 tests: end of block
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
108
767}
executed 108 times by 2 tests: end of block
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
108
768-
769-
770uint QQuickWidgetPrivate::textureId() const-
771{-
772 const QQuickWidget * const q = q_func();-
773 if (!q->isWindow()
!q->isWindow()Description
TRUEevaluated 50 times by 1 test
Evaluated by:
  • tst_qquickwidget
FALSEevaluated 148 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
&& q->internalWinId()
q->internalWinId()Description
TRUEnever evaluated
FALSEevaluated 50 times by 1 test
Evaluated by:
  • tst_qquickwidget
) {
0-148
774 QMessageLogger(__FILE__, 1105, __PRETTY_FUNCTION__).warning() << "QQuickWidget cannot be used as a native child widget."-
775 << "Consider setting Qt::AA_DontCreateNativeWidgetSiblings";-
776 return
never executed: return 0;
0;
never executed: return 0;
0
777 }-
778 return
executed 198 times by 2 tests: return resolvedFbo ? resolvedFbo->texture() : (fbo ? fbo->texture() : 0);
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
resolvedFbo ? resolvedFbo->texture()
executed 198 times by 2 tests: return resolvedFbo ? resolvedFbo->texture() : (fbo ? fbo->texture() : 0);
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
198
779 : (fbo ? fbo->texture() : 0);
executed 198 times by 2 tests: return resolvedFbo ? resolvedFbo->texture() : (fbo ? fbo->texture() : 0);
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
198
780}-
781-
782-
783-
784-
785-
786-
787void QQuickWidget::timerEvent(QTimerEvent* e)-
788{-
789 QQuickWidgetPrivate * const d = d_func();-
790 if (!e
!eDescription
TRUEnever evaluated
FALSEevaluated 108 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
|| e->timerId() == d->resizetimer.timerId()
e->timerId() =...imer.timerId()Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickwidget
FALSEevaluated 102 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
) {
0-108
791 d->updateSize();-
792 d->resizetimer.stop();-
793 }
executed 6 times by 1 test: end of block
Executed by:
  • tst_qquickwidget
else if (e->timerId() == d->updateTimer.timerId()
e->timerId() =...imer.timerId()Description
TRUEevaluated 102 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
FALSEnever evaluated
) {
0-102
794 d->eventPending = false;-
795 d->updateTimer.stop();-
796 if (d->updatePending
d->updatePendingDescription
TRUEevaluated 102 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
FALSEnever evaluated
)
0-102
797 d->renderSceneGraph();
executed 102 times by 2 tests: d->renderSceneGraph();
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
102
798 }
executed 102 times by 2 tests: end of block
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
102
799}
executed 108 times by 2 tests: end of block
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
108
800-
801-
802-
803-
804-
805QSize QQuickWidget::sizeHint() const-
806{-
807 const QQuickWidgetPrivate * const d = d_func();-
808 QSize rootObjectSize = d->rootObjectSize();-
809 if (rootObjectSize.isEmpty()
rootObjectSize.isEmpty()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickwidget
FALSEevaluated 20 times by 1 test
Evaluated by:
  • tst_qquickwidget
) {
2-20
810 return
executed 2 times by 1 test: return size();
Executed by:
  • tst_qquickwidget
size();
executed 2 times by 1 test: return size();
Executed by:
  • tst_qquickwidget
2
811 } else {-
812 return
executed 20 times by 1 test: return rootObjectSize;
Executed by:
  • tst_qquickwidget
rootObjectSize;
executed 20 times by 1 test: return rootObjectSize;
Executed by:
  • tst_qquickwidget
20
813 }-
814}-
815QSize QQuickWidget::initialSize() const-
816{-
817 const QQuickWidgetPrivate * const d = d_func();-
818 return
executed 12 times by 1 test: return d->initialSize;
Executed by:
  • tst_qquickwidget
d->initialSize;
executed 12 times by 1 test: return d->initialSize;
Executed by:
  • tst_qquickwidget
12
819}-
820-
821-
822-
823-
824-
825-
826QQuickItem *QQuickWidget::rootObject() const-
827{-
828 const QQuickWidgetPrivate * const d = d_func();-
829 return
executed 12 times by 1 test: return d->root;
Executed by:
  • tst_qquickwidget
d->root;
executed 12 times by 1 test: return d->root;
Executed by:
  • tst_qquickwidget
12
830}-
831-
832-
833-
834-
835-
836-
837void QQuickWidget::resizeEvent(QResizeEvent *e)-
838{-
839 QQuickWidgetPrivate * const d = d_func();-
840 if (d->resizeMode == SizeRootObjectToView
d->resizeMode ...otObjectToViewDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickwidget
FALSEevaluated 122 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
)
8-122
841 d->updateSize();
executed 8 times by 1 test: d->updateSize();
Executed by:
  • tst_qquickwidget
8
842-
843 if (e->size().isEmpty()
e->size().isEmpty()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickwidget
FALSEevaluated 126 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
) {
4-126
844-
845 d->fakeHidden = true;-
846 return;
executed 4 times by 1 test: return;
Executed by:
  • tst_qquickwidget
4
847 }-
848-
849 bool needsSync = false;-
850 if (d->fakeHidden
d->fakeHiddenDescription
TRUEnever evaluated
FALSEevaluated 126 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
) {
0-126
851-
852 d->fakeHidden = false;-
853 needsSync = true;-
854 }
never executed: end of block
0
855-
856-
857 if (d->useSoftwareRenderer
d->useSoftwareRendererDescription
TRUEnever evaluated
FALSEevaluated 126 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
) {
0-126
858 needsSync = true;-
859 if (d->softwareImage.size() != size() * devicePixelRatioF()
d->softwareIma...ePixelRatioF()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
860 createFramebufferObject();-
861 }
never executed: end of block
0
862 }
never executed: end of block
else {
0
863-
864 if (d->context
d->contextDescription
TRUEevaluated 20 times by 1 test
Evaluated by:
  • tst_qquickwidget
FALSEevaluated 106 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
) {
20-106
865-
866-
867 if (!d->fbo
!d->fboDescription
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • tst_qquickwidget
&& !d->offscreenWindow->openglContext()
!d->offscreenW...penglContext()Description
TRUEnever evaluated
FALSEnever evaluated
)
0-20
868 return;
never executed: return;
0
869 if (!d->fbo
!d->fboDescription
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • tst_qquickwidget
|| d->fbo->size() != size() * devicePixelRatioF()
d->fbo->size()...ePixelRatioF()Description
TRUEevaluated 16 times by 1 test
Evaluated by:
  • tst_qquickwidget
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickwidget
) {
0-20
870 needsSync = true;-
871 createFramebufferObject();-
872 }
executed 16 times by 1 test: end of block
Executed by:
  • tst_qquickwidget
16
873 }
executed 20 times by 1 test: end of block
Executed by:
  • tst_qquickwidget
else {
20
874-
875-
876 needsSync = true;-
877 d->createContext();-
878 }
executed 106 times by 2 tests: end of block
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
106
879-
880 QOpenGLContext *context = d->offscreenWindow->openglContext();-
881 if (!context
!contextDescription
TRUEnever evaluated
FALSEevaluated 126 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
) {
0-126
882 QMessageLogger(__FILE__, 1221, __PRETTY_FUNCTION__).warning("QQuickWidget::resizeEvent() no OpenGL context");-
883 return;
never executed: return;
0
884 }-
885-
886 }
executed 126 times by 2 tests: end of block
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
126
887-
888 d->render(needsSync);-
889}
executed 126 times by 2 tests: end of block
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
126
890-
891-
892bool QQuickWidget::focusNextPrevChild(bool next)-
893{-
894 QQuickWidgetPrivate * const d = d_func();-
895 QKeyEvent event(QEvent::KeyPress, next ? Qt::Key_Tab : Qt::Key_Backtab, Qt::NoModifier);-
896 if (QQuickProfiler::featuresEnabled & (1 << QQuickProfiler::ProfileInputEvents)
QQuickProfiler...leInputEvents)Description
TRUEnever evaluated
FALSEnever evaluated
) { (QQuickProfiler::inputEvent<QQuickProfiler::Key, QQuickProfiler::InputKeyPress>(event.key(), Qt::NoModifier)); }
never executed: end of block
else (
never executed: (void)0 ;
void)0
never executed: (void)0 ;
0
897 ;
never executed: (void)0 ;
0
898 QCoreApplication::sendEvent(d->offscreenWindow, &event);-
899-
900 QKeyEvent releaseEvent(QEvent::KeyRelease, next ? Qt::Key_Tab : Qt::Key_Backtab, Qt::NoModifier);-
901 if (QQuickProfiler::featuresEnabled & (1 << QQuickProfiler::ProfileInputEvents)
QQuickProfiler...leInputEvents)Description
TRUEnever evaluated
FALSEnever evaluated
) { (QQuickProfiler::inputEvent<QQuickProfiler::Key, QQuickProfiler::InputKeyRelease>(releaseEvent.key(), Qt::NoModifier)); }
never executed: end of block
else (
never executed: (void)0 ;
void)0
never executed: (void)0 ;
0
902 ;
never executed: (void)0 ;
0
903 QCoreApplication::sendEvent(d->offscreenWindow, &releaseEvent);-
904 return
never executed: return event.isAccepted();
event.isAccepted();
never executed: return event.isAccepted();
0
905}-
906-
907-
908void QQuickWidget::keyPressEvent(QKeyEvent *e)-
909{-
910 QQuickWidgetPrivate * const d = d_func();-
911 if (QQuickProfiler::featuresEnabled & (1 << QQuickProfiler::ProfileInputEvents)
QQuickProfiler...leInputEvents)Description
TRUEnever evaluated
FALSEnever evaluated
) { (QQuickProfiler::inputEvent<QQuickProfiler::Key, QQuickProfiler::InputKeyPress>(e->key(), e->modifiers())); }
never executed: end of block
else (
never executed: (void)0 ;
void)0
never executed: (void)0 ;
0
912 ;
never executed: (void)0 ;
0
913-
914 QCoreApplication::sendEvent(d->offscreenWindow, e);-
915}
never executed: end of block
0
916-
917-
918void QQuickWidget::keyReleaseEvent(QKeyEvent *e)-
919{-
920 QQuickWidgetPrivate * const d = d_func();-
921 if (QQuickProfiler::featuresEnabled & (1 << QQuickProfiler::ProfileInputEvents)
QQuickProfiler...leInputEvents)Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickwidget
) { (QQuickProfiler::inputEvent<QQuickProfiler::Key, QQuickProfiler::InputKeyRelease>(e->key(), e->modifiers())); }
never executed: end of block
else (
executed 2 times by 1 test: (void)0 ;
Executed by:
  • tst_qquickwidget
void)0
executed 2 times by 1 test: (void)0 ;
Executed by:
  • tst_qquickwidget
0-2
922 ;
executed 2 times by 1 test: (void)0 ;
Executed by:
  • tst_qquickwidget
2
923-
924 QCoreApplication::sendEvent(d->offscreenWindow, e);-
925}
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquickwidget
2
926-
927-
928void QQuickWidget::mouseMoveEvent(QMouseEvent *e)-
929{-
930 QQuickWidgetPrivate * const d = d_func();-
931 if (QQuickProfiler::featuresEnabled & (1 << QQuickProfiler::ProfileInputEvents)
QQuickProfiler...leInputEvents)Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickwidget
) { (QQuickProfiler::inputEvent<QQuickProfiler::Mouse, QQuickProfiler::InputMouseMove>(e->localPos().x(), e->localPos().y())); }
never executed: end of block
else (
executed 2 times by 1 test: (void)0 ;
Executed by:
  • tst_qquickwidget
void)0
executed 2 times by 1 test: (void)0 ;
Executed by:
  • tst_qquickwidget
0-2
932 ;
executed 2 times by 1 test: (void)0 ;
Executed by:
  • tst_qquickwidget
2
933-
934-
935-
936-
937-
938 QMouseEvent mappedEvent(e->type(), e->localPos(), e->localPos(), e->screenPos(),-
939 e->button(), e->buttons(), e->modifiers(), e->source());-
940 QCoreApplication::sendEvent(d->offscreenWindow, &mappedEvent);-
941 e->setAccepted(mappedEvent.isAccepted());-
942}
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquickwidget
2
943-
944-
945void QQuickWidget::mouseDoubleClickEvent(QMouseEvent *e)-
946{-
947 QQuickWidgetPrivate * const d = d_func();-
948 if (QQuickProfiler::featuresEnabled & (1 << QQuickProfiler::ProfileInputEvents)
QQuickProfiler...leInputEvents)Description
TRUEnever evaluated
FALSEnever evaluated
) { (QQuickProfiler::inputEvent<QQuickProfiler::Mouse, QQuickProfiler::InputMouseDoubleClick>(e->button(), e->buttons())); }
never executed: end of block
else (
never executed: (void)0 ;
void)0
never executed: (void)0 ;
0
949 ;
never executed: (void)0 ;
0
950-
951-
952-
953 QMouseEvent pressEvent(QEvent::MouseButtonPress, e->localPos(), e->localPos(), e->screenPos(),-
954 e->button(), e->buttons(), e->modifiers(), e->source());-
955 QCoreApplication::sendEvent(d->offscreenWindow, &pressEvent);-
956 e->setAccepted(pressEvent.isAccepted());-
957 QMouseEvent mappedEvent(e->type(), e->localPos(), e->localPos(), e->screenPos(),-
958 e->button(), e->buttons(), e->modifiers(), e->source());-
959 QCoreApplication::sendEvent(d->offscreenWindow, &mappedEvent);-
960}
never executed: end of block
0
961-
962-
963void QQuickWidget::showEvent(QShowEvent *)-
964{-
965 QQuickWidgetPrivate * const d = d_func();-
966 if (!d->useSoftwareRenderer
!d->useSoftwareRendererDescription
TRUEevaluated 108 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
FALSEnever evaluated
) {
0-108
967 d->createContext();-
968 if (d->offscreenWindow->openglContext()
d->offscreenWi...penglContext()Description
TRUEevaluated 108 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
FALSEnever evaluated
) {
0-108
969 d->render(true);-
970-
971-
972-
973-
974-
975-
976-
977 if (!d->eventPending
!d->eventPendingDescription
TRUEnever evaluated
FALSEevaluated 108 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
&& d->updatePending
d->updatePendingDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0-108
978 d->updatePending = false;-
979 update();-
980 }
never executed: end of block
0
981 }
executed 108 times by 2 tests: end of block
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
else {
108
982 triggerUpdate();-
983 }
never executed: end of block
0
984 }-
985 QWindowPrivate *offscreenPrivate = QWindowPrivate::get(d->offscreenWindow);-
986 if (!offscreenPrivate->visible
!offscreenPrivate->visibleDescription
TRUEevaluated 108 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
FALSEnever evaluated
) {
0-108
987 offscreenPrivate->visible = true;-
988 d->offscreenWindow->visibleChanged(true);-
989 offscreenPrivate->updateVisibility();-
990 }
executed 108 times by 2 tests: end of block
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
108
991 if (QQmlInspectorService *service = QQmlDebugConnector::service<QQmlInspectorService>()
QQmlInspectorS...ctorService>()Description
TRUEnever evaluated
FALSEevaluated 108 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
)
0-108
992 service->setParentWindow(d->offscreenWindow, window()->windowHandle());
never executed: service->setParentWindow(d->offscreenWindow, window()->windowHandle());
0
993}
executed 108 times by 2 tests: end of block
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
108
994-
995-
996void QQuickWidget::hideEvent(QHideEvent *)-
997{-
998 QQuickWidgetPrivate * const d = d_func();-
999 if (!d->offscreenWindow->isPersistentSceneGraph()
!d->offscreenW...ntSceneGraph()Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • tst_qquickwidget
)
0-20
1000 d->invalidateRenderControl();
never executed: d->invalidateRenderControl();
0
1001 QWindowPrivate *offscreenPrivate = QWindowPrivate::get(d->offscreenWindow);-
1002 if (offscreenPrivate->visible
offscreenPrivate->visibleDescription
TRUEevaluated 20 times by 1 test
Evaluated by:
  • tst_qquickwidget
FALSEnever evaluated
) {
0-20
1003 offscreenPrivate->visible = false;-
1004 d->offscreenWindow->visibleChanged(false);-
1005 offscreenPrivate->updateVisibility();-
1006 }
executed 20 times by 1 test: end of block
Executed by:
  • tst_qquickwidget
20
1007 if (QQmlInspectorService *service = QQmlDebugConnector::service<QQmlInspectorService>()
QQmlInspectorS...ctorService>()Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • tst_qquickwidget
)
0-20
1008 service->setParentWindow(d->offscreenWindow, d->offscreenWindow);
never executed: service->setParentWindow(d->offscreenWindow, d->offscreenWindow);
0
1009}
executed 20 times by 1 test: end of block
Executed by:
  • tst_qquickwidget
20
1010-
1011-
1012void QQuickWidget::mousePressEvent(QMouseEvent *e)-
1013{-
1014 QQuickWidgetPrivate * const d = d_func();-
1015 if (QQuickProfiler::featuresEnabled & (1 << QQuickProfiler::ProfileInputEvents)
QQuickProfiler...leInputEvents)Description
TRUEnever evaluated
FALSEnever evaluated
) { (QQuickProfiler::inputEvent<QQuickProfiler::Mouse, QQuickProfiler::InputMousePress>(e->button(), e->buttons())); }
never executed: end of block
else (
never executed: (void)0 ;
void)0
never executed: (void)0 ;
0
1016 ;
never executed: (void)0 ;
0
1017-
1018 QMouseEvent mappedEvent(e->type(), e->localPos(), e->localPos(), e->screenPos(),-
1019 e->button(), e->buttons(), e->modifiers(), e->source());-
1020 QCoreApplication::sendEvent(d->offscreenWindow, &mappedEvent);-
1021 e->setAccepted(mappedEvent.isAccepted());-
1022}
never executed: end of block
0
1023-
1024-
1025void QQuickWidget::mouseReleaseEvent(QMouseEvent *e)-
1026{-
1027 QQuickWidgetPrivate * const d = d_func();-
1028 if (QQuickProfiler::featuresEnabled & (1 << QQuickProfiler::ProfileInputEvents)
QQuickProfiler...leInputEvents)Description
TRUEnever evaluated
FALSEnever evaluated
) { (QQuickProfiler::inputEvent<QQuickProfiler::Mouse, QQuickProfiler::InputMouseRelease>(e->button(), e->buttons())); }
never executed: end of block
else (
never executed: (void)0 ;
void)0
never executed: (void)0 ;
0
1029 ;
never executed: (void)0 ;
0
1030-
1031 QMouseEvent mappedEvent(e->type(), e->localPos(), e->localPos(), e->screenPos(),-
1032 e->button(), e->buttons(), e->modifiers(), e->source());-
1033 QCoreApplication::sendEvent(d->offscreenWindow, &mappedEvent);-
1034 e->setAccepted(mappedEvent.isAccepted());-
1035}
never executed: end of block
0
1036-
1037-
1038-
1039void QQuickWidget::wheelEvent(QWheelEvent *e)-
1040{-
1041 QQuickWidgetPrivate * const d = d_func();-
1042 if (QQuickProfiler::featuresEnabled & (1 << QQuickProfiler::ProfileInputEvents)
QQuickProfiler...leInputEvents)Description
TRUEnever evaluated
FALSEnever evaluated
) { (QQuickProfiler::inputEvent<QQuickProfiler::Mouse, QQuickProfiler::InputMouseWheel>(e->angleDelta().x(), e->angleDelta().y())); }
never executed: end of block
else (
never executed: (void)0 ;
void)0
never executed: (void)0 ;
0
1043 ;
never executed: (void)0 ;
0
1044-
1045-
1046 QCoreApplication::sendEvent(d->offscreenWindow, e);-
1047}
never executed: end of block
0
1048-
1049-
1050-
1051-
1052-
1053void QQuickWidget::focusInEvent(QFocusEvent * event)-
1054{-
1055 QQuickWidgetPrivate * const d = d_func();-
1056 d->offscreenWindow->focusInEvent(event);-
1057}
never executed: end of block
0
1058-
1059-
1060-
1061-
1062void QQuickWidget::focusOutEvent(QFocusEvent * event)-
1063{-
1064 QQuickWidgetPrivate * const d = d_func();-
1065 d->offscreenWindow->focusOutEvent(event);-
1066}
never executed: end of block
0
1067-
1068static Qt::WindowState resolveWindowState(Qt::WindowStates states)-
1069{-
1070-
1071 if (states & Qt::WindowMinimized
states & Qt::WindowMinimizedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1072 return
never executed: return Qt::WindowMinimized;
Qt::WindowMinimized;
never executed: return Qt::WindowMinimized;
0
1073 if (states & Qt::WindowMaximized
states & Qt::WindowMaximizedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1074 return
never executed: return Qt::WindowMaximized;
Qt::WindowMaximized;
never executed: return Qt::WindowMaximized;
0
1075 if (states & Qt::WindowFullScreen
states & Qt::WindowFullScreenDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1076 return
never executed: return Qt::WindowFullScreen;
Qt::WindowFullScreen;
never executed: return Qt::WindowFullScreen;
0
1077-
1078-
1079 return
never executed: return Qt::WindowNoState;
Qt::WindowNoState;
never executed: return Qt::WindowNoState;
0
1080}-
1081-
1082static void remapInputMethodQueryEvent(QObject *object, QInputMethodQueryEvent *e)-
1083{-
1084 auto item = qobject_cast<QQuickItem *>(object);-
1085 if (!item
!itemDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1086 return;
never executed: return;
0
1087-
1088-
1089 for (auto query : {Qt::ImCursorRectangle, Qt::ImAnchorRectangle, Qt::ImInputItemClipRectangle}) {-
1090 if (e->queries() & query
e->queries() & queryDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1091 auto value = e->value(query);-
1092 if (value.canConvert<QRectF>()
value.canConvert<QRectF>()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1093 e->setValue(query, item->mapRectToScene(value.toRectF()));
never executed: e->setValue(query, item->mapRectToScene(value.toRectF()));
0
1094 }
never executed: end of block
0
1095 }
never executed: end of block
0
1096-
1097 if (e->queries() & Qt::ImCursorPosition
e->queries() &...CursorPositionDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1098 auto value = e->value(Qt::ImCursorPosition);-
1099 if (value.canConvert<QPointF>()
value.canConvert<QPointF>()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1100 e->setValue(Qt::ImCursorPosition, item->mapToScene(value.toPointF()));
never executed: e->setValue(Qt::ImCursorPosition, item->mapToScene(value.toPointF()));
0
1101 }
never executed: end of block
0
1102}
never executed: end of block
0
1103-
1104-
1105bool QQuickWidget::event(QEvent *e)-
1106{-
1107 QQuickWidgetPrivate * const d = d_func();-
1108-
1109 switch (e->type()) {-
1110-
1111 case
executed 2 times by 1 test: case QEvent::Leave:
Executed by:
  • tst_qquickwidget
QEvent::Leave:
executed 2 times by 1 test: case QEvent::Leave:
Executed by:
  • tst_qquickwidget
2
1112 case
never executed: case QEvent::TouchBegin:
QEvent::TouchBegin:
never executed: case QEvent::TouchBegin:
0
1113 case
never executed: case QEvent::TouchEnd:
QEvent::TouchEnd:
never executed: case QEvent::TouchEnd:
0
1114 case
never executed: case QEvent::TouchUpdate:
QEvent::TouchUpdate:
never executed: case QEvent::TouchUpdate:
0
1115 case
never executed: case QEvent::TouchCancel:
QEvent::TouchCancel:
never executed: case QEvent::TouchCancel:
0
1116-
1117 return
executed 2 times by 1 test: return QCoreApplication::sendEvent(d->offscreenWindow, e);
Executed by:
  • tst_qquickwidget
QCoreApplication::sendEvent(d->offscreenWindow, e);
executed 2 times by 1 test: return QCoreApplication::sendEvent(d->offscreenWindow, e);
Executed by:
  • tst_qquickwidget
2
1118-
1119 case
never executed: case QEvent::InputMethod:
QEvent::InputMethod:
never executed: case QEvent::InputMethod:
0
1120 return
never executed: return QCoreApplication::sendEvent(d->offscreenWindow->focusObject(), e);
QCoreApplication::sendEvent(d->offscreenWindow->focusObject(), e);
never executed: return QCoreApplication::sendEvent(d->offscreenWindow->focusObject(), e);
0
1121 case
never executed: case QEvent::InputMethodQuery:
QEvent::InputMethodQuery:
never executed: case QEvent::InputMethodQuery:
0
1122 {-
1123 bool eventResult = QCoreApplication::sendEvent(d->offscreenWindow->focusObject(), e);-
1124-
1125-
1126-
1127-
1128 remapInputMethodQueryEvent(d->offscreenWindow->focusObject(), static_cast<QInputMethodQueryEvent *>(e));-
1129 return
never executed: return eventResult;
eventResult;
never executed: return eventResult;
0
1130 }-
1131-
1132 case
executed 8 times by 1 test: case QEvent::WindowChangeInternal:
Executed by:
  • tst_qquickwidget
QEvent::WindowChangeInternal:
executed 8 times by 1 test: case QEvent::WindowChangeInternal:
Executed by:
  • tst_qquickwidget
8
1133 d->handleWindowChange();-
1134 break;
executed 8 times by 1 test: break;
Executed by:
  • tst_qquickwidget
8
1135-
1136 case
never executed: case QEvent::ScreenChangeInternal:
QEvent::ScreenChangeInternal:
never executed: case QEvent::ScreenChangeInternal:
0
1137 if (QWindow *window = this->window()->windowHandle()
QWindow *windo...windowHandle()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1138 QScreen *newScreen = window->screen();-
1139-
1140 if (d->offscreenWindow
d->offscreenWindowDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1141 d->offscreenWindow->setScreen(newScreen);
never executed: d->offscreenWindow->setScreen(newScreen);
0
1142 if (d->offscreenSurface
d->offscreenSurfaceDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1143 d->offscreenSurface->setScreen(newScreen);
never executed: d->offscreenSurface->setScreen(newScreen);
0
1144-
1145 if (d->context
d->contextDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1146 d->context->setScreen(newScreen);
never executed: d->context->setScreen(newScreen);
0
1147-
1148 }
never executed: end of block
0
1149-
1150 if (d->useSoftwareRenderer
d->useSoftwareRendererDescription
TRUEnever evaluated
FALSEnever evaluated
0
1151-
1152 || d->fbo
d->fboDescription
TRUEnever evaluated
FALSEnever evaluated
0
1153-
1154 ) {-
1155-
1156-
1157 createFramebufferObject();-
1158 d->render(true);-
1159 }
never executed: end of block
0
1160 break;
never executed: break;
0
1161-
1162 case
executed 108 times by 2 tests: case QEvent::Show:
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
QEvent::Show:
executed 108 times by 2 tests: case QEvent::Show:
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
108
1163 case
executed 114 times by 2 tests: case QEvent::Move:
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
QEvent::Move:
executed 114 times by 2 tests: case QEvent::Move:
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
114
1164 d->updatePosition();-
1165 break;
executed 222 times by 2 tests: break;
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
222
1166-
1167 case
never executed: case QEvent::WindowStateChange:
QEvent::WindowStateChange:
never executed: case QEvent::WindowStateChange:
0
1168 d->offscreenWindow->setWindowState(resolveWindowState(windowState()));-
1169 break;
never executed: break;
0
1170-
1171 case
executed 4 times by 1 test: case QEvent::ShortcutOverride:
Executed by:
  • tst_qquickwidget
QEvent::ShortcutOverride:
executed 4 times by 1 test: case QEvent::ShortcutOverride:
Executed by:
  • tst_qquickwidget
4
1172 return
executed 4 times by 1 test: return QCoreApplication::sendEvent(d->offscreenWindow, e);
Executed by:
  • tst_qquickwidget
QCoreApplication::sendEvent(d->offscreenWindow, e);
executed 4 times by 1 test: return QCoreApplication::sendEvent(d->offscreenWindow, e);
Executed by:
  • tst_qquickwidget
4
1173-
1174 case
executed 12 times by 1 test: case QEvent::Enter:
Executed by:
  • tst_qquickwidget
QEvent::Enter:
executed 12 times by 1 test: case QEvent::Enter:
Executed by:
  • tst_qquickwidget
{
12
1175 QEnterEvent *enterEvent = static_cast<QEnterEvent *>(e);-
1176 QEnterEvent mappedEvent(enterEvent->localPos(), enterEvent->windowPos(),-
1177 enterEvent->screenPos());-
1178 const bool ret = QCoreApplication::sendEvent(d->offscreenWindow, &mappedEvent);-
1179 e->setAccepted(mappedEvent.isAccepted());-
1180 return
executed 12 times by 1 test: return ret;
Executed by:
  • tst_qquickwidget
ret;
executed 12 times by 1 test: return ret;
Executed by:
  • tst_qquickwidget
12
1181 }-
1182 default
executed 1716 times by 2 tests: default:
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
:
executed 1716 times by 2 tests: default:
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
1716
1183 break;
executed 1716 times by 2 tests: break;
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
1716
1184 }-
1185-
1186 return
executed 1946 times by 2 tests: return QWidget::event(e);
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
QWidget::event(e);
executed 1946 times by 2 tests: return QWidget::event(e);
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
1946
1187}-
1188-
1189-
1190-
1191-
1192void QQuickWidget::dragEnterEvent(QDragEnterEvent *e)-
1193{-
1194 QQuickWidgetPrivate * const d = d_func();-
1195-
1196-
1197 d->offscreenWindow->event(e);-
1198 e->accept();-
1199}
never executed: end of block
0
1200-
1201-
1202void QQuickWidget::dragMoveEvent(QDragMoveEvent *e)-
1203{-
1204 QQuickWidgetPrivate * const d = d_func();-
1205-
1206-
1207 d->offscreenWindow->event(e);-
1208}
never executed: end of block
0
1209-
1210-
1211void QQuickWidget::dragLeaveEvent(QDragLeaveEvent *e)-
1212{-
1213 QQuickWidgetPrivate * const d = d_func();-
1214 d->offscreenWindow->event(e);-
1215}
never executed: end of block
0
1216-
1217-
1218void QQuickWidget::dropEvent(QDropEvent *e)-
1219{-
1220 QQuickWidgetPrivate * const d = d_func();-
1221 d->offscreenWindow->event(e);-
1222}
never executed: end of block
0
1223-
1224-
1225-
1226-
1227-
1228-
1229void QQuickWidget::triggerUpdate()-
1230{-
1231 QQuickWidgetPrivate * const d = d_func();-
1232 d->updatePending = true;-
1233 if (!d->eventPending
!d->eventPendingDescription
TRUEevaluated 208 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
FALSEevaluated 974 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
) {
208-974
1234 const int exhaustDelay = 5;-
1235 d->updateTimer.start(exhaustDelay, Qt::PreciseTimer, this);-
1236 d->eventPending = true;-
1237 }
executed 208 times by 2 tests: end of block
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
208
1238}
executed 1182 times by 2 tests: end of block
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
1182
1239void QQuickWidget::setFormat(const QSurfaceFormat &format)-
1240{-
1241 QQuickWidgetPrivate * const d = d_func();-
1242 QSurfaceFormat currentFormat = d->offscreenWindow->format();-
1243 QSurfaceFormat newFormat = format;-
1244 newFormat.setDepthBufferSize(qMax(newFormat.depthBufferSize(), currentFormat.depthBufferSize()));-
1245 newFormat.setStencilBufferSize(qMax(newFormat.stencilBufferSize(), currentFormat.stencilBufferSize()));-
1246 newFormat.setAlphaBufferSize(qMax(newFormat.alphaBufferSize(), currentFormat.alphaBufferSize()));-
1247-
1248-
1249-
1250-
1251-
1252 d->requestedSamples = newFormat.samples();-
1253 newFormat.setSamples(0);-
1254-
1255 d->offscreenWindow->setFormat(newFormat);-
1256}
never executed: end of block
0
1257QSurfaceFormat QQuickWidget::format() const-
1258{-
1259 const QQuickWidgetPrivate * const d = d_func();-
1260 return
never executed: return d->offscreenWindow->format();
d->offscreenWindow->format();
never executed: return d->offscreenWindow->format();
0
1261}-
1262-
1263-
1264-
1265-
1266-
1267-
1268QImage QQuickWidget::grabFramebuffer() const-
1269{-
1270 return
executed 4 times by 1 test: return const_cast<QQuickWidgetPrivate *>(d_func())->grabFramebuffer();
Executed by:
  • tst_qquickwidget
const_cast<QQuickWidgetPrivate *>(d_func())->grabFramebuffer();
executed 4 times by 1 test: return const_cast<QQuickWidgetPrivate *>(d_func())->grabFramebuffer();
Executed by:
  • tst_qquickwidget
4
1271}-
1272void QQuickWidget::setClearColor(const QColor &color)-
1273{-
1274 QQuickWidgetPrivate * const d = d_func();-
1275 d->offscreenWindow->setColor(color);-
1276}
never executed: end of block
0
1277QQuickWindow *QQuickWidget::quickWindow() const-
1278{-
1279 const QQuickWidgetPrivate * const d = d_func();-
1280 return
executed 14 times by 1 test: return d->offscreenWindow;
Executed by:
  • tst_qquickwidget
d->offscreenWindow;
executed 14 times by 1 test: return d->offscreenWindow;
Executed by:
  • tst_qquickwidget
14
1281}-
1282-
1283-
1284-
1285-
1286void QQuickWidget::paintEvent(QPaintEvent *event)-
1287{-
1288 QQuickWidgetPrivate * const d = d_func();-
1289 if (d->useSoftwareRenderer
d->useSoftwareRendererDescription
TRUEnever evaluated
FALSEevaluated 160 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
) {
0-160
1290 QPainter painter(this);-
1291 d->updateRegion = d->updateRegion.united(event->region());-
1292 if (d->updateRegion.isNull()
d->updateRegion.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1293-
1294 painter.drawImage(rect(), d->softwareImage);-
1295 }
never executed: end of block
else {
0
1296 QTransform transform;-
1297 transform.scale(devicePixelRatioF(), devicePixelRatioF());-
1298-
1299 QRegion targetRegion;-
1300 d->updateRegion.swap(targetRegion);-
1301 for (auto targetRect : targetRegion) {-
1302 auto sourceRect = transform.mapRect(QRectF(targetRect));-
1303 painter.drawImage(targetRect, d->softwareImage, sourceRect);-
1304 }
never executed: end of block
0
1305 }
never executed: end of block
0
1306 }-
1307}
executed 160 times by 2 tests: end of block
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
160
1308-
1309-
1310-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.0