OpenCoverage

qquickwindowattached.cpp

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/items/qquickwindowattached.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 "qquickwindow.h"-
41#include "qquickitem.h"-
42#include "qquickwindowattached_p.h"-
43-
44QT_BEGIN_NAMESPACE-
45-
46// QDoc comments must go in qquickwindow.cpp to avoid overwriting the Window docs-
47-
48QQuickWindowAttached::QQuickWindowAttached(QObject* attachee)-
49 : QObject(attachee)-
50 , m_window(nullptr)-
51{-
52 m_attachee = qobject_cast<QQuickItem*>(attachee);-
53 if (m_attachee && m_attachee->window()) // It might not be in a window yet
m_attacheeDescription
TRUEnever evaluated
FALSEnever evaluated
m_attachee->window()Description
TRUEnever evaluated
FALSEnever evaluated
0
54 windowChange(m_attachee->window());
never executed: windowChange(m_attachee->window());
0
55 if (m_attachee)
m_attacheeDescription
TRUEnever evaluated
FALSEnever evaluated
0
56 connect(m_attachee, &QQuickItem::windowChanged, this, &QQuickWindowAttached::windowChange);
never executed: connect(m_attachee, &QQuickItem::windowChanged, this, &QQuickWindowAttached::windowChange);
0
57}
never executed: end of block
0
58-
59QWindow::Visibility QQuickWindowAttached::visibility() const-
60{-
61 return (m_window ? m_window->visibility() : QWindow::Hidden);
never executed: return (m_window ? m_window->visibility() : QWindow::Hidden);
0
62}-
63-
64bool QQuickWindowAttached::isActive() const-
65{-
66 return (m_window ? m_window->isActive() : false);
never executed: return (m_window ? m_window->isActive() : false);
0
67}-
68-
69QQuickItem *QQuickWindowAttached::activeFocusItem() const-
70{-
71 return (m_window ? m_window->activeFocusItem() : nullptr);
never executed: return (m_window ? m_window->activeFocusItem() : nullptr);
0
72}-
73-
74QQuickItem *QQuickWindowAttached::contentItem() const-
75{-
76 return (m_window ? m_window->contentItem() : nullptr);
never executed: return (m_window ? m_window->contentItem() : nullptr);
0
77}-
78-
79int QQuickWindowAttached::width() const-
80{-
81 return (m_window ? m_window->width() : 0);
never executed: return (m_window ? m_window->width() : 0);
0
82}-
83-
84int QQuickWindowAttached::height() const-
85{-
86 return (m_window ? m_window->height() : 0);
never executed: return (m_window ? m_window->height() : 0);
0
87}-
88-
89QQuickWindow *QQuickWindowAttached::window() const-
90{-
91 return m_window;
never executed: return m_window;
0
92}-
93-
94void QQuickWindowAttached::windowChange(QQuickWindow *window)-
95{-
96 if (window != m_window) {
window != m_windowDescription
TRUEnever evaluated
FALSEnever evaluated
0
97 QQuickWindow* oldWindow = m_window;-
98 m_window = window;-
99-
100 if (oldWindow)
oldWindowDescription
TRUEnever evaluated
FALSEnever evaluated
0
101 oldWindow->disconnect(this);
never executed: oldWindow->disconnect(this);
0
102-
103 emit windowChanged();-
104-
105 if (!oldWindow || !window || window->visibility() != oldWindow->visibility())
!oldWindowDescription
TRUEnever evaluated
FALSEnever evaluated
!windowDescription
TRUEnever evaluated
FALSEnever evaluated
window->visibi...->visibility()Description
TRUEnever evaluated
FALSEnever evaluated
0
106 emit visibilityChanged();
never executed: visibilityChanged();
0
107 if (!oldWindow || !window || window->isActive() != oldWindow->isActive())
!oldWindowDescription
TRUEnever evaluated
FALSEnever evaluated
!windowDescription
TRUEnever evaluated
FALSEnever evaluated
window->isActi...ow->isActive()Description
TRUEnever evaluated
FALSEnever evaluated
0
108 emit activeChanged();
never executed: activeChanged();
0
109 if (!oldWindow || !window || window->activeFocusItem() != oldWindow->activeFocusItem())
!oldWindowDescription
TRUEnever evaluated
FALSEnever evaluated
!windowDescription
TRUEnever evaluated
FALSEnever evaluated
window->active...iveFocusItem()Description
TRUEnever evaluated
FALSEnever evaluated
0
110 emit activeFocusItemChanged();
never executed: activeFocusItemChanged();
0
111 emit contentItemChanged();-
112 if (!oldWindow || !window || window->width() != oldWindow->width())
!oldWindowDescription
TRUEnever evaluated
FALSEnever evaluated
!windowDescription
TRUEnever evaluated
FALSEnever evaluated
window->width(...indow->width()Description
TRUEnever evaluated
FALSEnever evaluated
0
113 emit widthChanged();
never executed: widthChanged();
0
114 if (!oldWindow || !window || window->height() != oldWindow->height())
!oldWindowDescription
TRUEnever evaluated
FALSEnever evaluated
!windowDescription
TRUEnever evaluated
FALSEnever evaluated
window->height...ndow->height()Description
TRUEnever evaluated
FALSEnever evaluated
0
115 emit heightChanged();
never executed: heightChanged();
0
116-
117 if (!window)
!windowDescription
TRUEnever evaluated
FALSEnever evaluated
0
118 return;
never executed: return;
0
119-
120 // QQuickWindowQmlImpl::visibilityChanged also exists, and window might even-
121 // be QQuickWindowQmlImpl, but that's not what we are connecting to.-
122 // So this is actual window state rather than a buffered or as-requested one.-
123 // If we used the metaobject connect syntax there would be a warning:-
124 // QMetaObjectPrivate::indexOfSignalRelative - QMetaObject::indexOfSignal:-
125 // signal visibilityChanged(QWindow::Visibility) from QQuickWindow redefined in QQuickWindowQmlImpl-
126 connect(window, &QQuickWindow::visibilityChanged,-
127 this, &QQuickWindowAttached::visibilityChanged);-
128 connect(window, &QQuickWindow::activeChanged,-
129 this, &QQuickWindowAttached::activeChanged);-
130 connect(window, &QQuickWindow::activeFocusItemChanged,-
131 this, &QQuickWindowAttached::activeFocusItemChanged);-
132 connect(window, &QQuickWindow::widthChanged,-
133 this, &QQuickWindowAttached::widthChanged);-
134 connect(window, &QQuickWindow::heightChanged,-
135 this, &QQuickWindowAttached::heightChanged);-
136 }
never executed: end of block
0
137}
never executed: end of block
0
138-
139QT_END_NAMESPACE-
140-
141#include "moc_qquickwindowattached_p.cpp"-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.2.0