Line | Source Code | Coverage |
---|
1 | /**************************************************************************** | - |
2 | ** | - |
3 | ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). | - |
4 | ** Contact: http://www.qt-project.org/legal | - |
5 | ** | - |
6 | ** This file is part of the QtGui 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 Digia. For licensing terms and | - |
14 | ** conditions see http://qt.digia.com/licensing. For further information | - |
15 | ** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software | - |
20 | ** Foundation and appearing in the file LICENSE.LGPL included in the | - |
21 | ** packaging of this file. Please review the following information to | - |
22 | ** ensure the GNU Lesser General Public License version 2.1 requirements | - |
23 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | - |
24 | ** | - |
25 | ** In addition, as a special exception, Digia gives you certain additional | - |
26 | ** rights. These rights are described in the Digia Qt LGPL Exception | - |
27 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | - |
28 | ** | - |
29 | ** GNU General Public License Usage | - |
30 | ** Alternatively, this file may be used under the terms of the GNU | - |
31 | ** General Public License version 3.0 as published by the Free Software | - |
32 | ** Foundation and appearing in the file LICENSE.GPL included in the | - |
33 | ** packaging of this file. Please review the following information to | - |
34 | ** ensure the GNU General Public License version 3.0 requirements will be | - |
35 | ** met: http://www.gnu.org/copyleft/gpl.html. | - |
36 | ** | - |
37 | ** | - |
38 | ** $QT_END_LICENSE$ | - |
39 | ** | - |
40 | ****************************************************************************/ | - |
41 | | - |
42 | #include "qwidgetwindow_qpa_p.h" | - |
43 | | - |
44 | #include "private/qwidget_p.h" | - |
45 | #include "private/qapplication_p.h" | - |
46 | #ifndef QT_NO_ACCESSIBILITY | - |
47 | #include <QtGui/qaccessible.h> | - |
48 | #endif | - |
49 | #include <private/qwidgetbackingstore_p.h> | - |
50 | #include <qpa/qwindowsysteminterface_p.h> | - |
51 | | - |
52 | QT_BEGIN_NAMESPACE | - |
53 | | - |
54 | QWidget *qt_button_down = 0; // widget got last button-down | - |
55 | static QWidget *qt_tablet_target = 0; | - |
56 | | - |
57 | // popup control | - |
58 | QWidget *qt_popup_down = 0; // popup that contains the pressed widget | - |
59 | extern int openPopupCount; | - |
60 | bool qt_replay_popup_mouse_event = false; | - |
61 | extern bool qt_try_modal(QWidget *widget, QEvent::Type type); | - |
62 | | - |
63 | QWidgetWindow::QWidgetWindow(QWidget *widget) | - |
64 | : m_widget(widget) | - |
65 | { | - |
66 | updateObjectName(); executed (the execution status of this line is deduced): updateObjectName(); | - |
67 | connect(m_widget, &QObject::objectNameChanged, this, &QWidgetWindow::updateObjectName); executed (the execution status of this line is deduced): connect(m_widget, &QObject::objectNameChanged, this, &QWidgetWindow::updateObjectName); | - |
68 | } executed: } Execution Count:2220 | 2220 |
69 | | - |
70 | #ifndef QT_NO_ACCESSIBILITY | - |
71 | QAccessibleInterface *QWidgetWindow::accessibleRoot() const | - |
72 | { | - |
73 | if (m_widget) partially evaluated: m_widget yes Evaluation Count:20 | no Evaluation Count:0 |
| 0-20 |
74 | return QAccessible::queryAccessibleInterface(m_widget); executed: return QAccessible::queryAccessibleInterface(m_widget); Execution Count:20 | 20 |
75 | return 0; never executed: return 0; | 0 |
76 | } | - |
77 | #endif | - |
78 | | - |
79 | QObject *QWidgetWindow::focusObject() const | - |
80 | { | - |
81 | QWidget *widget = m_widget->focusWidget(); executed (the execution status of this line is deduced): QWidget *widget = m_widget->focusWidget(); | - |
82 | | - |
83 | if (!widget) evaluated: !widget yes Evaluation Count:3679 | yes Evaluation Count:4397 |
| 3679-4397 |
84 | widget = m_widget; executed: widget = m_widget; Execution Count:3679 | 3679 |
85 | | - |
86 | return widget; executed: return widget; Execution Count:8076 | 8076 |
87 | } | - |
88 | | - |
89 | bool QWidgetWindow::event(QEvent *event) | - |
90 | { | - |
91 | if (m_widget->testAttribute(Qt::WA_DontShowOnScreen)) { partially evaluated: m_widget->testAttribute(Qt::WA_DontShowOnScreen) no Evaluation Count:0 | yes Evaluation Count:12271 |
| 0-12271 |
92 | // \a event is uninteresting for QWidgetWindow, the event was probably | - |
93 | // generated before WA_DontShowOnScreen was set | - |
94 | return m_widget->event(event); never executed: return m_widget->event(event); | 0 |
95 | } | - |
96 | | - |
97 | switch (event->type()) { | - |
98 | case QEvent::Close: | - |
99 | handleCloseEvent(static_cast<QCloseEvent *>(event)); never executed (the execution status of this line is deduced): handleCloseEvent(static_cast<QCloseEvent *>(event)); | - |
100 | return true; never executed: return true; | 0 |
101 | | - |
102 | case QEvent::Enter: | - |
103 | case QEvent::Leave: | - |
104 | handleEnterLeaveEvent(event); executed (the execution status of this line is deduced): handleEnterLeaveEvent(event); | - |
105 | return true; executed: return true; Execution Count:1183 | 1183 |
106 | | - |
107 | // these should not be sent to QWidget, the corresponding events | - |
108 | // are sent by QApplicationPrivate::notifyActiveWindowChange() | - |
109 | case QEvent::FocusIn: | - |
110 | case QEvent::FocusOut: { | - |
111 | #ifndef QT_NO_ACCESSIBILITY | - |
112 | QAccessible::State state; executed (the execution status of this line is deduced): QAccessible::State state; | - |
113 | state.active = true; executed (the execution status of this line is deduced): state.active = true; | - |
114 | QAccessibleStateChangeEvent ev(widget(), state); executed (the execution status of this line is deduced): QAccessibleStateChangeEvent ev(widget(), state); | - |
115 | QAccessible::updateAccessibility(&ev); executed (the execution status of this line is deduced): QAccessible::updateAccessibility(&ev); | - |
116 | #endif | - |
117 | return false; } executed: return false; Execution Count:1166 | 1166 |
118 | | - |
119 | case QEvent::FocusAboutToChange: | - |
120 | if (QApplicationPrivate::focus_widget) { evaluated: QApplicationPrivate::focus_widget yes Evaluation Count:107 | yes Evaluation Count:184 |
| 107-184 |
121 | if (QApplicationPrivate::focus_widget->testAttribute(Qt::WA_InputMethodEnabled)) evaluated: QApplicationPrivate::focus_widget->testAttribute(Qt::WA_InputMethodEnabled) yes Evaluation Count:49 | yes Evaluation Count:58 |
| 49-58 |
122 | qApp->inputMethod()->commit(); executed: (static_cast<QApplication *>(QCoreApplication::instance()))->inputMethod()->commit(); Execution Count:49 | 49 |
123 | | - |
124 | QGuiApplication::sendSpontaneousEvent(QApplicationPrivate::focus_widget, event); executed (the execution status of this line is deduced): QGuiApplication::sendSpontaneousEvent(QApplicationPrivate::focus_widget, event); | - |
125 | } executed: } Execution Count:107 | 107 |
126 | return true; executed: return true; Execution Count:291 | 291 |
127 | | - |
128 | case QEvent::KeyPress: | - |
129 | case QEvent::KeyRelease: | - |
130 | case QEvent::ShortcutOverride: | - |
131 | handleKeyEvent(static_cast<QKeyEvent *>(event)); executed (the execution status of this line is deduced): handleKeyEvent(static_cast<QKeyEvent *>(event)); | - |
132 | return true; executed: return true; Execution Count:48 | 48 |
133 | | - |
134 | case QEvent::MouseMove: | - |
135 | case QEvent::MouseButtonPress: | - |
136 | case QEvent::MouseButtonRelease: | - |
137 | case QEvent::MouseButtonDblClick: | - |
138 | handleMouseEvent(static_cast<QMouseEvent *>(event)); executed (the execution status of this line is deduced): handleMouseEvent(static_cast<QMouseEvent *>(event)); | - |
139 | return true; executed: return true; Execution Count:115 | 115 |
140 | | - |
141 | case QEvent::NonClientAreaMouseMove: | - |
142 | case QEvent::NonClientAreaMouseButtonPress: | - |
143 | case QEvent::NonClientAreaMouseButtonRelease: | - |
144 | case QEvent::NonClientAreaMouseButtonDblClick: | - |
145 | handleNonClientAreaMouseEvent(static_cast<QMouseEvent *>(event)); never executed (the execution status of this line is deduced): handleNonClientAreaMouseEvent(static_cast<QMouseEvent *>(event)); | - |
146 | return true; never executed: return true; | 0 |
147 | | - |
148 | case QEvent::TouchBegin: | - |
149 | case QEvent::TouchUpdate: | - |
150 | case QEvent::TouchEnd: | - |
151 | case QEvent::TouchCancel: | - |
152 | handleTouchEvent(static_cast<QTouchEvent *>(event)); executed (the execution status of this line is deduced): handleTouchEvent(static_cast<QTouchEvent *>(event)); | - |
153 | return true; executed: return true; Execution Count:1 | 1 |
154 | | - |
155 | case QEvent::Move: | - |
156 | handleMoveEvent(static_cast<QMoveEvent *>(event)); executed (the execution status of this line is deduced): handleMoveEvent(static_cast<QMoveEvent *>(event)); | - |
157 | return true; executed: return true; Execution Count:686 | 686 |
158 | | - |
159 | case QEvent::Resize: | - |
160 | handleResizeEvent(static_cast<QResizeEvent *>(event)); executed (the execution status of this line is deduced): handleResizeEvent(static_cast<QResizeEvent *>(event)); | - |
161 | return true; executed: return true; Execution Count:745 | 745 |
162 | | - |
163 | #ifndef QT_NO_WHEELEVENT | - |
164 | case QEvent::Wheel: | - |
165 | handleWheelEvent(static_cast<QWheelEvent *>(event)); never executed (the execution status of this line is deduced): handleWheelEvent(static_cast<QWheelEvent *>(event)); | - |
166 | return true; never executed: return true; | 0 |
167 | #endif | - |
168 | | - |
169 | #ifndef QT_NO_DRAGANDDROP | - |
170 | case QEvent::DragEnter: | - |
171 | case QEvent::DragMove: | - |
172 | handleDragEnterMoveEvent(static_cast<QDragMoveEvent *>(event)); executed (the execution status of this line is deduced): handleDragEnterMoveEvent(static_cast<QDragMoveEvent *>(event)); | - |
173 | return true; executed: return true; Execution Count:15 | 15 |
174 | case QEvent::DragLeave: | - |
175 | handleDragLeaveEvent(static_cast<QDragLeaveEvent *>(event)); never executed (the execution status of this line is deduced): handleDragLeaveEvent(static_cast<QDragLeaveEvent *>(event)); | - |
176 | return true; never executed: return true; | 0 |
177 | case QEvent::Drop: | - |
178 | handleDropEvent(static_cast<QDropEvent *>(event)); executed (the execution status of this line is deduced): handleDropEvent(static_cast<QDropEvent *>(event)); | - |
179 | return true; executed: return true; Execution Count:2 | 2 |
180 | #endif | - |
181 | | - |
182 | case QEvent::Expose: | - |
183 | handleExposeEvent(static_cast<QExposeEvent *>(event)); executed (the execution status of this line is deduced): handleExposeEvent(static_cast<QExposeEvent *>(event)); | - |
184 | return true; executed: return true; Execution Count:1742 | 1742 |
185 | | - |
186 | case QEvent::WindowStateChange: | - |
187 | handleWindowStateChangedEvent(static_cast<QWindowStateChangeEvent *>(event)); executed (the execution status of this line is deduced): handleWindowStateChangedEvent(static_cast<QWindowStateChangeEvent *>(event)); | - |
188 | return true; executed: return true; Execution Count:687 | 687 |
189 | | - |
190 | case QEvent::ThemeChange: { | - |
191 | QEvent widgetEvent(QEvent::ThemeChange); never executed (the execution status of this line is deduced): QEvent widgetEvent(QEvent::ThemeChange); | - |
192 | QGuiApplication::sendSpontaneousEvent(m_widget, &widgetEvent); never executed (the execution status of this line is deduced): QGuiApplication::sendSpontaneousEvent(m_widget, &widgetEvent); | - |
193 | } | - |
194 | return true; never executed: return true; | 0 |
195 | | - |
196 | #ifndef QT_NO_TABLETEVENT | - |
197 | case QEvent::TabletPress: | - |
198 | case QEvent::TabletMove: | - |
199 | case QEvent::TabletRelease: | - |
200 | handleTabletEvent(static_cast<QTabletEvent *>(event)); never executed (the execution status of this line is deduced): handleTabletEvent(static_cast<QTabletEvent *>(event)); | - |
201 | return true; never executed: return true; | 0 |
202 | #endif | - |
203 | #ifndef QT_NO_CONTEXTMENU | - |
204 | case QEvent::ContextMenu: | - |
205 | handleContextMenuEvent(static_cast<QContextMenuEvent *>(event)); never executed (the execution status of this line is deduced): handleContextMenuEvent(static_cast<QContextMenuEvent *>(event)); | - |
206 | return true; never executed: return true; | 0 |
207 | #endif | - |
208 | | - |
209 | // Handing show events to widgets (see below) here would cause them to be triggered twice | - |
210 | case QEvent::Show: | - |
211 | case QEvent::Hide: | - |
212 | return QWindow::event(event); executed: return QWindow::event(event); Execution Count:3023 | 3023 |
213 | | - |
214 | default: | - |
215 | break; executed: break; Execution Count:2567 | 2567 |
216 | } | - |
217 | | - |
218 | return m_widget->event(event) || QWindow::event(event); executed: return m_widget->event(event) || QWindow::event(event); Execution Count:2567 | 2567 |
219 | } | - |
220 | | - |
221 | QPointer<QWidget> qt_last_mouse_receiver = 0; | - |
222 | | - |
223 | void QWidgetWindow::handleEnterLeaveEvent(QEvent *event) | - |
224 | { | - |
225 | if (event->type() == QEvent::Leave) { evaluated: event->type() == QEvent::Leave yes Evaluation Count:488 | yes Evaluation Count:695 |
| 488-695 |
226 | QWidget *enter = 0; executed (the execution status of this line is deduced): QWidget *enter = 0; | - |
227 | // Check from window system event queue if the next queued enter targets a window | - |
228 | // in the same window hierarchy (e.g. enter a child of this window). If so, | - |
229 | // remove the enter event from queue and handle both in single dispatch. | - |
230 | QWindowSystemInterfacePrivate::EnterEvent *systemEvent = executed (the execution status of this line is deduced): QWindowSystemInterfacePrivate::EnterEvent *systemEvent = | - |
231 | static_cast<QWindowSystemInterfacePrivate::EnterEvent *> executed (the execution status of this line is deduced): static_cast<QWindowSystemInterfacePrivate::EnterEvent *> | - |
232 | (QWindowSystemInterfacePrivate::peekWindowSystemEvent(QWindowSystemInterfacePrivate::Enter)); executed (the execution status of this line is deduced): (QWindowSystemInterfacePrivate::peekWindowSystemEvent(QWindowSystemInterfacePrivate::Enter)); | - |
233 | const QPointF globalPosF = systemEvent ? systemEvent->globalPos : QGuiApplicationPrivate::lastCursorPosition; evaluated: systemEvent yes Evaluation Count:442 | yes Evaluation Count:46 |
| 46-442 |
234 | if (systemEvent) { evaluated: systemEvent yes Evaluation Count:442 | yes Evaluation Count:46 |
| 46-442 |
235 | if (QWidgetWindow *enterWindow = qobject_cast<QWidgetWindow *>(systemEvent->enter)) partially evaluated: QWidgetWindow *enterWindow = qobject_cast<QWidgetWindow *>(systemEvent->enter) yes Evaluation Count:442 | no Evaluation Count:0 |
| 0-442 |
236 | { | - |
237 | QWindow *thisParent = this; executed (the execution status of this line is deduced): QWindow *thisParent = this; | - |
238 | QWindow *enterParent = enterWindow; executed (the execution status of this line is deduced): QWindow *enterParent = enterWindow; | - |
239 | while (thisParent->parent()) partially evaluated: thisParent->parent() no Evaluation Count:0 | yes Evaluation Count:442 |
| 0-442 |
240 | thisParent = thisParent->parent(); never executed: thisParent = thisParent->parent(); | 0 |
241 | while (enterParent->parent()) partially evaluated: enterParent->parent() no Evaluation Count:0 | yes Evaluation Count:442 |
| 0-442 |
242 | enterParent = enterParent->parent(); never executed: enterParent = enterParent->parent(); | 0 |
243 | if (thisParent == enterParent) { evaluated: thisParent == enterParent yes Evaluation Count:143 | yes Evaluation Count:299 |
| 143-299 |
244 | QGuiApplicationPrivate::currentMouseWindow = enterWindow; executed (the execution status of this line is deduced): QGuiApplicationPrivate::currentMouseWindow = enterWindow; | - |
245 | enter = enterWindow->widget(); executed (the execution status of this line is deduced): enter = enterWindow->widget(); | - |
246 | QWindowSystemInterfacePrivate::removeWindowSystemEvent(systemEvent); executed (the execution status of this line is deduced): QWindowSystemInterfacePrivate::removeWindowSystemEvent(systemEvent); | - |
247 | } executed: } Execution Count:143 | 143 |
248 | } executed: } Execution Count:442 | 442 |
249 | } executed: } Execution Count:442 | 442 |
250 | // Enter-leave between sibling widgets is ignored when there is a mousegrabber - this makes | - |
251 | // both native and non-native widgets work similarly. | - |
252 | // When mousegrabbing, leaves are only generated if leaving the parent window. | - |
253 | if (!enter || !QWidget::mouseGrabber()) { evaluated: !enter yes Evaluation Count:345 | yes Evaluation Count:143 |
partially evaluated: !QWidget::mouseGrabber() yes Evaluation Count:143 | no Evaluation Count:0 |
| 0-345 |
254 | // Preferred leave target is the last mouse receiver, unless it has native window, | - |
255 | // in which case it is assumed to receive it's own leave event when relevant. | - |
256 | QWidget *leave = m_widget; executed (the execution status of this line is deduced): QWidget *leave = m_widget; | - |
257 | if (qt_last_mouse_receiver && !qt_last_mouse_receiver->internalWinId()) evaluated: qt_last_mouse_receiver yes Evaluation Count:451 | yes Evaluation Count:37 |
evaluated: !qt_last_mouse_receiver->internalWinId() yes Evaluation Count:61 | yes Evaluation Count:390 |
| 37-451 |
258 | leave = qt_last_mouse_receiver.data(); executed: leave = qt_last_mouse_receiver.data(); Execution Count:61 | 61 |
259 | QApplicationPrivate::dispatchEnterLeave(enter, leave, globalPosF); executed (the execution status of this line is deduced): QApplicationPrivate::dispatchEnterLeave(enter, leave, globalPosF); | - |
260 | qt_last_mouse_receiver = enter; executed (the execution status of this line is deduced): qt_last_mouse_receiver = enter; | - |
261 | } executed: } Execution Count:488 | 488 |
262 | } else { executed: } Execution Count:488 | 488 |
263 | const QEnterEvent *ee = static_cast<QEnterEvent *>(event); executed (the execution status of this line is deduced): const QEnterEvent *ee = static_cast<QEnterEvent *>(event); | - |
264 | QWidget *child = m_widget->childAt(ee->pos()); executed (the execution status of this line is deduced): QWidget *child = m_widget->childAt(ee->pos()); | - |
265 | QWidget *receiver = child ? child : m_widget; evaluated: child yes Evaluation Count:373 | yes Evaluation Count:322 |
| 322-373 |
266 | QApplicationPrivate::dispatchEnterLeave(receiver, 0, ee->screenPos()); executed (the execution status of this line is deduced): QApplicationPrivate::dispatchEnterLeave(receiver, 0, ee->screenPos()); | - |
267 | qt_last_mouse_receiver = receiver; executed (the execution status of this line is deduced): qt_last_mouse_receiver = receiver; | - |
268 | } executed: } Execution Count:695 | 695 |
269 | } | - |
270 | | - |
271 | void QWidgetWindow::handleNonClientAreaMouseEvent(QMouseEvent *e) | - |
272 | { | - |
273 | QApplication::sendSpontaneousEvent(m_widget, e); never executed (the execution status of this line is deduced): QApplication::sendSpontaneousEvent(m_widget, e); | - |
274 | } | 0 |
275 | | - |
276 | void QWidgetWindow::handleMouseEvent(QMouseEvent *event) | - |
277 | { | - |
278 | if (qApp->d_func()->inPopupMode()) { evaluated: (static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->inPopupMode() yes Evaluation Count:2 | yes Evaluation Count:113 |
| 2-113 |
279 | QWidget *activePopupWidget = qApp->activePopupWidget(); executed (the execution status of this line is deduced): QWidget *activePopupWidget = (static_cast<QApplication *>(QCoreApplication::instance()))->activePopupWidget(); | - |
280 | QWidget *popup = activePopupWidget; executed (the execution status of this line is deduced): QWidget *popup = activePopupWidget; | - |
281 | QPoint mapped = event->pos(); executed (the execution status of this line is deduced): QPoint mapped = event->pos(); | - |
282 | if (popup != m_widget) partially evaluated: popup != m_widget no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
283 | mapped = popup->mapFromGlobal(event->globalPos()); never executed: mapped = popup->mapFromGlobal(event->globalPos()); | 0 |
284 | bool releaseAfter = false; executed (the execution status of this line is deduced): bool releaseAfter = false; | - |
285 | QWidget *popupChild = popup->childAt(mapped); executed (the execution status of this line is deduced): QWidget *popupChild = popup->childAt(mapped); | - |
286 | | - |
287 | if (popup != qt_popup_down) { partially evaluated: popup != qt_popup_down yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
288 | qt_button_down = 0; executed (the execution status of this line is deduced): qt_button_down = 0; | - |
289 | qt_popup_down = 0; executed (the execution status of this line is deduced): qt_popup_down = 0; | - |
290 | } executed: } Execution Count:2 | 2 |
291 | | - |
292 | switch (event->type()) { | - |
293 | case QEvent::MouseButtonPress: | - |
294 | case QEvent::MouseButtonDblClick: | - |
295 | qt_button_down = popupChild; never executed (the execution status of this line is deduced): qt_button_down = popupChild; | - |
296 | qt_popup_down = popup; never executed (the execution status of this line is deduced): qt_popup_down = popup; | - |
297 | break; | 0 |
298 | case QEvent::MouseButtonRelease: | - |
299 | releaseAfter = true; never executed (the execution status of this line is deduced): releaseAfter = true; | - |
300 | break; | 0 |
301 | default: | - |
302 | break; // nothing for mouse move executed: break; Execution Count:2 | 2 |
303 | } | - |
304 | | - |
305 | int oldOpenPopupCount = openPopupCount; executed (the execution status of this line is deduced): int oldOpenPopupCount = openPopupCount; | - |
306 | | - |
307 | if (popup->isEnabled()) { partially evaluated: popup->isEnabled() yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
308 | // deliver event | - |
309 | qt_replay_popup_mouse_event = false; executed (the execution status of this line is deduced): qt_replay_popup_mouse_event = false; | - |
310 | QWidget *receiver = popup; executed (the execution status of this line is deduced): QWidget *receiver = popup; | - |
311 | QPoint widgetPos = mapped; executed (the execution status of this line is deduced): QPoint widgetPos = mapped; | - |
312 | if (qt_button_down) partially evaluated: qt_button_down no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
313 | receiver = qt_button_down; never executed: receiver = qt_button_down; | 0 |
314 | else if (popupChild) partially evaluated: popupChild no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
315 | receiver = popupChild; never executed: receiver = popupChild; | 0 |
316 | if (receiver != popup) partially evaluated: receiver != popup no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
317 | widgetPos = receiver->mapFromGlobal(event->globalPos()); never executed: widgetPos = receiver->mapFromGlobal(event->globalPos()); | 0 |
318 | QWidget *alien = m_widget->childAt(m_widget->mapFromGlobal(event->globalPos())); executed (the execution status of this line is deduced): QWidget *alien = m_widget->childAt(m_widget->mapFromGlobal(event->globalPos())); | - |
319 | QMouseEvent e(event->type(), widgetPos, event->windowPos(), event->screenPos(), event->button(), event->buttons(), event->modifiers()); executed (the execution status of this line is deduced): QMouseEvent e(event->type(), widgetPos, event->windowPos(), event->screenPos(), event->button(), event->buttons(), event->modifiers()); | - |
320 | e.setTimestamp(event->timestamp()); executed (the execution status of this line is deduced): e.setTimestamp(event->timestamp()); | - |
321 | QApplicationPrivate::sendMouseEvent(receiver, &e, alien, m_widget, &qt_button_down, qt_last_mouse_receiver); executed (the execution status of this line is deduced): QApplicationPrivate::sendMouseEvent(receiver, &e, alien, m_widget, &qt_button_down, qt_last_mouse_receiver); | - |
322 | } else { executed: } Execution Count:2 | 2 |
323 | // close disabled popups when a mouse button is pressed or released | - |
324 | switch (event->type()) { | - |
325 | case QEvent::MouseButtonPress: | - |
326 | case QEvent::MouseButtonDblClick: | - |
327 | case QEvent::MouseButtonRelease: | - |
328 | popup->close(); never executed (the execution status of this line is deduced): popup->close(); | - |
329 | break; | 0 |
330 | default: | - |
331 | break; | 0 |
332 | } | - |
333 | } | 0 |
334 | | - |
335 | if (qApp->activePopupWidget() != activePopupWidget partially evaluated: (static_cast<QApplication *>(QCoreApplication::instance()))->activePopupWidget() != activePopupWidget no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
336 | && qt_replay_popup_mouse_event) { never evaluated: qt_replay_popup_mouse_event | 0 |
337 | if (m_widget->windowType() != Qt::Popup) never evaluated: m_widget->windowType() != Qt::Popup | 0 |
338 | qt_button_down = 0; never executed: qt_button_down = 0; | 0 |
339 | qt_replay_popup_mouse_event = false; never executed (the execution status of this line is deduced): qt_replay_popup_mouse_event = false; | - |
340 | #ifndef QT_NO_CONTEXTMENU | - |
341 | } else if (event->type() == QEvent::MouseButtonPress never executed: } partially evaluated: event->type() == QEvent::MouseButtonPress no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
342 | && event->button() == Qt::RightButton never evaluated: event->button() == Qt::RightButton | 0 |
343 | && (openPopupCount == oldOpenPopupCount)) { never evaluated: (openPopupCount == oldOpenPopupCount) | 0 |
344 | QWidget *popupEvent = popup; never executed (the execution status of this line is deduced): QWidget *popupEvent = popup; | - |
345 | if (qt_button_down) never evaluated: qt_button_down | 0 |
346 | popupEvent = qt_button_down; never executed: popupEvent = qt_button_down; | 0 |
347 | else if(popupChild) never evaluated: popupChild | 0 |
348 | popupEvent = popupChild; never executed: popupEvent = popupChild; | 0 |
349 | QContextMenuEvent e(QContextMenuEvent::Mouse, mapped, event->globalPos(), event->modifiers()); never executed (the execution status of this line is deduced): QContextMenuEvent e(QContextMenuEvent::Mouse, mapped, event->globalPos(), event->modifiers()); | - |
350 | QApplication::sendSpontaneousEvent(popupEvent, &e); never executed (the execution status of this line is deduced): QApplication::sendSpontaneousEvent(popupEvent, &e); | - |
351 | #endif | - |
352 | } | 0 |
353 | | - |
354 | if (releaseAfter) { partially evaluated: releaseAfter no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
355 | qt_button_down = 0; never executed (the execution status of this line is deduced): qt_button_down = 0; | - |
356 | qt_popup_down = 0; never executed (the execution status of this line is deduced): qt_popup_down = 0; | - |
357 | } | 0 |
358 | return; executed: return; Execution Count:2 | 2 |
359 | } | - |
360 | | - |
361 | // modal event handling | - |
362 | if (QApplicationPrivate::instance()->modalState() && !qt_try_modal(m_widget, event->type())) partially evaluated: QApplicationPrivate::instance()->modalState() no Evaluation Count:0 | yes Evaluation Count:113 |
never evaluated: !qt_try_modal(m_widget, event->type()) | 0-113 |
363 | return; | 0 |
364 | | - |
365 | // which child should have it? | - |
366 | QWidget *widget = m_widget->childAt(event->pos()); executed (the execution status of this line is deduced): QWidget *widget = m_widget->childAt(event->pos()); | - |
367 | QPoint mapped = event->pos(); executed (the execution status of this line is deduced): QPoint mapped = event->pos(); | - |
368 | | - |
369 | if (!widget) partially evaluated: !widget no Evaluation Count:0 | yes Evaluation Count:113 |
| 0-113 |
370 | widget = m_widget; never executed: widget = m_widget; | 0 |
371 | | - |
372 | if (event->type() == QEvent::MouseButtonPress && !qt_button_down) evaluated: event->type() == QEvent::MouseButtonPress yes Evaluation Count:1 | yes Evaluation Count:112 |
partially evaluated: !qt_button_down yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-112 |
373 | qt_button_down = widget; executed: qt_button_down = widget; Execution Count:1 | 1 |
374 | | - |
375 | QWidget *receiver = QApplicationPrivate::pickMouseReceiver(m_widget, event->windowPos().toPoint(), &mapped, event->type(), event->buttons(), executed (the execution status of this line is deduced): QWidget *receiver = QApplicationPrivate::pickMouseReceiver(m_widget, event->windowPos().toPoint(), &mapped, event->type(), event->buttons(), | - |
376 | qt_button_down, widget); executed (the execution status of this line is deduced): qt_button_down, widget); | - |
377 | | - |
378 | if (!receiver) { partially evaluated: !receiver no Evaluation Count:0 | yes Evaluation Count:113 |
| 0-113 |
379 | if (event->type() == QEvent::MouseButtonRelease) never evaluated: event->type() == QEvent::MouseButtonRelease | 0 |
380 | QApplicationPrivate::mouse_buttons &= ~event->button(); never executed: QApplicationPrivate::mouse_buttons &= ~event->button(); | 0 |
381 | return; | 0 |
382 | } | - |
383 | | - |
384 | QMouseEvent translated(event->type(), mapped, event->windowPos(), event->screenPos(), event->button(), event->buttons(), event->modifiers()); executed (the execution status of this line is deduced): QMouseEvent translated(event->type(), mapped, event->windowPos(), event->screenPos(), event->button(), event->buttons(), event->modifiers()); | - |
385 | translated.setTimestamp(event->timestamp()); executed (the execution status of this line is deduced): translated.setTimestamp(event->timestamp()); | - |
386 | QApplicationPrivate::sendMouseEvent(receiver, &translated, widget, m_widget, &qt_button_down, executed (the execution status of this line is deduced): QApplicationPrivate::sendMouseEvent(receiver, &translated, widget, m_widget, &qt_button_down, | - |
387 | qt_last_mouse_receiver); executed (the execution status of this line is deduced): qt_last_mouse_receiver); | - |
388 | | - |
389 | #ifndef QT_NO_CONTEXTMENU | - |
390 | if (event->type() == QEvent::MouseButtonPress && event->button() == Qt::RightButton) { evaluated: event->type() == QEvent::MouseButtonPress yes Evaluation Count:1 | yes Evaluation Count:112 |
partially evaluated: event->button() == Qt::RightButton no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-112 |
391 | QContextMenuEvent e(QContextMenuEvent::Mouse, mapped, event->globalPos(), event->modifiers()); never executed (the execution status of this line is deduced): QContextMenuEvent e(QContextMenuEvent::Mouse, mapped, event->globalPos(), event->modifiers()); | - |
392 | QGuiApplication::sendSpontaneousEvent(receiver, &e); never executed (the execution status of this line is deduced): QGuiApplication::sendSpontaneousEvent(receiver, &e); | - |
393 | } | 0 |
394 | #endif | - |
395 | } executed: } Execution Count:113 | 113 |
396 | | - |
397 | void QWidgetWindow::handleTouchEvent(QTouchEvent *event) | - |
398 | { | - |
399 | if (event->type() == QEvent::TouchCancel) partially evaluated: event->type() == QEvent::TouchCancel no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
400 | QApplicationPrivate::translateTouchCancel(event->device(), event->timestamp()); never executed: QApplicationPrivate::translateTouchCancel(event->device(), event->timestamp()); | 0 |
401 | else | - |
402 | QApplicationPrivate::translateRawTouchEvent(m_widget, event->device(), event->touchPoints(), event->timestamp()); executed: QApplicationPrivate::translateRawTouchEvent(m_widget, event->device(), event->touchPoints(), event->timestamp()); Execution Count:1 | 1 |
403 | } | - |
404 | | - |
405 | void QWidgetWindow::handleKeyEvent(QKeyEvent *event) | - |
406 | { | - |
407 | if (QApplicationPrivate::instance()->modalState() && !qt_try_modal(m_widget, event->type())) partially evaluated: QApplicationPrivate::instance()->modalState() no Evaluation Count:0 | yes Evaluation Count:48 |
never evaluated: !qt_try_modal(m_widget, event->type()) | 0-48 |
408 | return; | 0 |
409 | | - |
410 | QObject *receiver = 0; executed (the execution status of this line is deduced): QObject *receiver = 0; | - |
411 | if (QApplicationPrivate::inPopupMode()) { evaluated: QApplicationPrivate::inPopupMode() yes Evaluation Count:2 | yes Evaluation Count:46 |
| 2-46 |
412 | QWidget *popup = QApplication::activePopupWidget(); executed (the execution status of this line is deduced): QWidget *popup = QApplication::activePopupWidget(); | - |
413 | QWidget *popupFocusWidget = popup->focusWidget(); executed (the execution status of this line is deduced): QWidget *popupFocusWidget = popup->focusWidget(); | - |
414 | receiver = popupFocusWidget ? popupFocusWidget : popup; partially evaluated: popupFocusWidget no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
415 | } executed: } Execution Count:2 | 2 |
416 | if (!receiver) evaluated: !receiver yes Evaluation Count:46 | yes Evaluation Count:2 |
| 2-46 |
417 | receiver = QWidget::keyboardGrabber(); executed: receiver = QWidget::keyboardGrabber(); Execution Count:46 | 46 |
418 | if (!receiver) evaluated: !receiver yes Evaluation Count:46 | yes Evaluation Count:2 |
| 2-46 |
419 | receiver = focusObject(); executed: receiver = focusObject(); Execution Count:46 | 46 |
420 | QGuiApplication::sendSpontaneousEvent(receiver, event); executed (the execution status of this line is deduced): QGuiApplication::sendSpontaneousEvent(receiver, event); | - |
421 | } executed: } Execution Count:48 | 48 |
422 | | - |
423 | void QWidgetWindow::updateGeometry() | - |
424 | { | - |
425 | if (m_widget->testAttribute(Qt::WA_OutsideWSRange)) evaluated: m_widget->testAttribute(Qt::WA_OutsideWSRange) yes Evaluation Count:4 | yes Evaluation Count:1427 |
| 4-1427 |
426 | return; executed: return; Execution Count:4 | 4 |
427 | | - |
428 | const QMargins margins = frameMargins(); executed (the execution status of this line is deduced): const QMargins margins = frameMargins(); | - |
429 | | - |
430 | m_widget->data->crect = geometry(); executed (the execution status of this line is deduced): m_widget->data->crect = geometry(); | - |
431 | QTLWExtra *te = m_widget->d_func()->topData(); executed (the execution status of this line is deduced): QTLWExtra *te = m_widget->d_func()->topData(); | - |
432 | te->posIncludesFrame= false; executed (the execution status of this line is deduced): te->posIncludesFrame= false; | - |
433 | te->frameStrut.setCoords(margins.left(), margins.top(), margins.right(), margins.bottom()); executed (the execution status of this line is deduced): te->frameStrut.setCoords(margins.left(), margins.top(), margins.right(), margins.bottom()); | - |
434 | m_widget->data->fstrut_dirty = false; executed (the execution status of this line is deduced): m_widget->data->fstrut_dirty = false; | - |
435 | } executed: } Execution Count:1427 | 1427 |
436 | | - |
437 | void QWidgetWindow::handleMoveEvent(QMoveEvent *event) | - |
438 | { | - |
439 | updateGeometry(); executed (the execution status of this line is deduced): updateGeometry(); | - |
440 | QGuiApplication::sendSpontaneousEvent(m_widget, event); executed (the execution status of this line is deduced): QGuiApplication::sendSpontaneousEvent(m_widget, event); | - |
441 | } executed: } Execution Count:686 | 686 |
442 | | - |
443 | void QWidgetWindow::handleResizeEvent(QResizeEvent *event) | - |
444 | { | - |
445 | QSize oldSize = m_widget->data->crect.size(); executed (the execution status of this line is deduced): QSize oldSize = m_widget->data->crect.size(); | - |
446 | | - |
447 | updateGeometry(); executed (the execution status of this line is deduced): updateGeometry(); | - |
448 | QGuiApplication::sendSpontaneousEvent(m_widget, event); executed (the execution status of this line is deduced): QGuiApplication::sendSpontaneousEvent(m_widget, event); | - |
449 | | - |
450 | if (m_widget->d_func()->paintOnScreen()) { partially evaluated: m_widget->d_func()->paintOnScreen() no Evaluation Count:0 | yes Evaluation Count:745 |
| 0-745 |
451 | QRegion updateRegion(geometry()); never executed (the execution status of this line is deduced): QRegion updateRegion(geometry()); | - |
452 | if (m_widget->testAttribute(Qt::WA_StaticContents)) never evaluated: m_widget->testAttribute(Qt::WA_StaticContents) | 0 |
453 | updateRegion -= QRect(0, 0, oldSize.width(), oldSize.height()); never executed: updateRegion -= QRect(0, 0, oldSize.width(), oldSize.height()); | 0 |
454 | m_widget->d_func()->syncBackingStore(updateRegion); never executed (the execution status of this line is deduced): m_widget->d_func()->syncBackingStore(updateRegion); | - |
455 | } else { | 0 |
456 | m_widget->d_func()->syncBackingStore(); executed (the execution status of this line is deduced): m_widget->d_func()->syncBackingStore(); | - |
457 | } executed: } Execution Count:745 | 745 |
458 | } | - |
459 | | - |
460 | void QWidgetWindow::handleCloseEvent(QCloseEvent *) | - |
461 | { | - |
462 | m_widget->d_func()->close_helper(QWidgetPrivate::CloseWithSpontaneousEvent); never executed (the execution status of this line is deduced): m_widget->d_func()->close_helper(QWidgetPrivate::CloseWithSpontaneousEvent); | - |
463 | } | 0 |
464 | | - |
465 | #ifndef QT_NO_WHEELEVENT | - |
466 | | - |
467 | void QWidgetWindow::handleWheelEvent(QWheelEvent *event) | - |
468 | { | - |
469 | if (QApplicationPrivate::instance()->modalState() && !qt_try_modal(m_widget, event->type())) never evaluated: QApplicationPrivate::instance()->modalState() never evaluated: !qt_try_modal(m_widget, event->type()) | 0 |
470 | return; | 0 |
471 | | - |
472 | // which child should have it? | - |
473 | QWidget *widget = m_widget->childAt(event->pos()); never executed (the execution status of this line is deduced): QWidget *widget = m_widget->childAt(event->pos()); | - |
474 | | - |
475 | if (!widget) | 0 |
476 | widget = m_widget; never executed: widget = m_widget; | 0 |
477 | | - |
478 | QPoint mapped = widget->mapFrom(m_widget, event->pos()); never executed (the execution status of this line is deduced): QPoint mapped = widget->mapFrom(m_widget, event->pos()); | - |
479 | | - |
480 | QWheelEvent translated(mapped, event->globalPos(), event->pixelDelta(), event->angleDelta(), event->delta(), event->orientation(), event->buttons(), event->modifiers()); never executed (the execution status of this line is deduced): QWheelEvent translated(mapped, event->globalPos(), event->pixelDelta(), event->angleDelta(), event->delta(), event->orientation(), event->buttons(), event->modifiers()); | - |
481 | QGuiApplication::sendSpontaneousEvent(widget, &translated); never executed (the execution status of this line is deduced): QGuiApplication::sendSpontaneousEvent(widget, &translated); | - |
482 | } | 0 |
483 | | - |
484 | #endif // QT_NO_WHEELEVENT | - |
485 | | - |
486 | #ifndef QT_NO_DRAGANDDROP | - |
487 | | - |
488 | void QWidgetWindow::handleDragEnterMoveEvent(QDragMoveEvent *event) | - |
489 | { | - |
490 | Q_ASSERT(event->type() ==QEvent::DragMove || !m_dragTarget); executed (the execution status of this line is deduced): qt_noop(); | - |
491 | // Find a target widget under mouse that accepts drops (QTBUG-22987). | - |
492 | QWidget *widget = m_widget->childAt(event->pos()); executed (the execution status of this line is deduced): QWidget *widget = m_widget->childAt(event->pos()); | - |
493 | if (!widget) evaluated: !widget yes Evaluation Count:5 | yes Evaluation Count:10 |
| 5-10 |
494 | widget = m_widget; executed: widget = m_widget; Execution Count:5 | 5 |
495 | for ( ; widget && !widget->isWindow() && !widget->acceptDrops(); widget = widget->parentWidget()) ; executed: ; Execution Count:6 partially evaluated: widget yes Evaluation Count:21 | no Evaluation Count:0 |
evaluated: !widget->isWindow() yes Evaluation Count:14 | yes Evaluation Count:7 |
evaluated: !widget->acceptDrops() yes Evaluation Count:6 | yes Evaluation Count:8 |
| 0-21 |
496 | if (widget && !widget->acceptDrops()) partially evaluated: widget yes Evaluation Count:15 | no Evaluation Count:0 |
evaluated: !widget->acceptDrops() yes Evaluation Count:7 | yes Evaluation Count:8 |
| 0-15 |
497 | widget = 0; executed: widget = 0; Execution Count:7 | 7 |
498 | // Target widget unchanged: DragMove | - |
499 | if (widget && widget == m_dragTarget.data()) { evaluated: widget yes Evaluation Count:8 | yes Evaluation Count:7 |
evaluated: widget == m_dragTarget.data() yes Evaluation Count:5 | yes Evaluation Count:3 |
| 3-8 |
500 | Q_ASSERT(event->type() == QEvent::DragMove); executed (the execution status of this line is deduced): qt_noop(); | - |
501 | const QPoint mapped = widget->mapFromGlobal(m_widget->mapToGlobal(event->pos())); executed (the execution status of this line is deduced): const QPoint mapped = widget->mapFromGlobal(m_widget->mapToGlobal(event->pos())); | - |
502 | QDragMoveEvent translated(mapped, event->possibleActions(), event->mimeData(), event->mouseButtons(), event->keyboardModifiers()); executed (the execution status of this line is deduced): QDragMoveEvent translated(mapped, event->possibleActions(), event->mimeData(), event->mouseButtons(), event->keyboardModifiers()); | - |
503 | translated.setDropAction(event->dropAction()); executed (the execution status of this line is deduced): translated.setDropAction(event->dropAction()); | - |
504 | if (event->isAccepted()) { // Handling 'DragEnter' should suffice for the application. partially evaluated: event->isAccepted() no Evaluation Count:0 | yes Evaluation Count:5 |
| 0-5 |
505 | translated.accept(); never executed (the execution status of this line is deduced): translated.accept(); | - |
506 | translated.setDropAction(event->dropAction()); never executed (the execution status of this line is deduced): translated.setDropAction(event->dropAction()); | - |
507 | } | 0 |
508 | QGuiApplication::sendSpontaneousEvent(widget, &translated); executed (the execution status of this line is deduced): QGuiApplication::sendSpontaneousEvent(widget, &translated); | - |
509 | if (translated.isAccepted()) { partially evaluated: translated.isAccepted() yes Evaluation Count:5 | no Evaluation Count:0 |
| 0-5 |
510 | event->accept(); executed (the execution status of this line is deduced): event->accept(); | - |
511 | } else { executed: } Execution Count:5 | 5 |
512 | event->ignore(); never executed (the execution status of this line is deduced): event->ignore(); | - |
513 | } | 0 |
514 | event->setDropAction(translated.dropAction()); executed (the execution status of this line is deduced): event->setDropAction(translated.dropAction()); | - |
515 | return; executed: return; Execution Count:5 | 5 |
516 | } | - |
517 | // Target widget changed: Send DragLeave to previous, DragEnter to new if there is any | - |
518 | if (m_dragTarget.data()) { evaluated: m_dragTarget.data() yes Evaluation Count:1 | yes Evaluation Count:9 |
| 1-9 |
519 | QDragLeaveEvent le; executed (the execution status of this line is deduced): QDragLeaveEvent le; | - |
520 | QGuiApplication::sendSpontaneousEvent(m_dragTarget.data(), &le); executed (the execution status of this line is deduced): QGuiApplication::sendSpontaneousEvent(m_dragTarget.data(), &le); | - |
521 | m_dragTarget = 0; executed (the execution status of this line is deduced): m_dragTarget = 0; | - |
522 | } executed: } Execution Count:1 | 1 |
523 | if (!widget) { evaluated: !widget yes Evaluation Count:7 | yes Evaluation Count:3 |
| 3-7 |
524 | event->ignore(); executed (the execution status of this line is deduced): event->ignore(); | - |
525 | return; executed: return; Execution Count:7 | 7 |
526 | } | - |
527 | m_dragTarget = widget; executed (the execution status of this line is deduced): m_dragTarget = widget; | - |
528 | const QPoint mapped = widget->mapFromGlobal(m_widget->mapToGlobal(event->pos())); executed (the execution status of this line is deduced): const QPoint mapped = widget->mapFromGlobal(m_widget->mapToGlobal(event->pos())); | - |
529 | QDragEnterEvent translated(mapped, event->possibleActions(), event->mimeData(), event->mouseButtons(), event->keyboardModifiers()); executed (the execution status of this line is deduced): QDragEnterEvent translated(mapped, event->possibleActions(), event->mimeData(), event->mouseButtons(), event->keyboardModifiers()); | - |
530 | QGuiApplication::sendSpontaneousEvent(widget, &translated); executed (the execution status of this line is deduced): QGuiApplication::sendSpontaneousEvent(widget, &translated); | - |
531 | if (translated.isAccepted()) { partially evaluated: translated.isAccepted() yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
532 | event->accept(); executed (the execution status of this line is deduced): event->accept(); | - |
533 | } else { executed: } Execution Count:3 | 3 |
534 | event->ignore(); never executed (the execution status of this line is deduced): event->ignore(); | - |
535 | } | 0 |
536 | event->setDropAction(translated.dropAction()); executed (the execution status of this line is deduced): event->setDropAction(translated.dropAction()); | - |
537 | } executed: } Execution Count:3 | 3 |
538 | | - |
539 | void QWidgetWindow::handleDragLeaveEvent(QDragLeaveEvent *event) | - |
540 | { | - |
541 | if (m_dragTarget) never evaluated: m_dragTarget | 0 |
542 | QGuiApplication::sendSpontaneousEvent(m_dragTarget.data(), event); never executed: QGuiApplication::sendSpontaneousEvent(m_dragTarget.data(), event); | 0 |
543 | m_dragTarget = 0; never executed (the execution status of this line is deduced): m_dragTarget = 0; | - |
544 | } | 0 |
545 | | - |
546 | void QWidgetWindow::handleDropEvent(QDropEvent *event) | - |
547 | { | - |
548 | const QPoint mapped = m_dragTarget.data()->mapFromGlobal(m_widget->mapToGlobal(event->pos())); executed (the execution status of this line is deduced): const QPoint mapped = m_dragTarget.data()->mapFromGlobal(m_widget->mapToGlobal(event->pos())); | - |
549 | QDropEvent translated(mapped, event->possibleActions(), event->mimeData(), event->mouseButtons(), event->keyboardModifiers()); executed (the execution status of this line is deduced): QDropEvent translated(mapped, event->possibleActions(), event->mimeData(), event->mouseButtons(), event->keyboardModifiers()); | - |
550 | QGuiApplication::sendSpontaneousEvent(m_dragTarget.data(), &translated); executed (the execution status of this line is deduced): QGuiApplication::sendSpontaneousEvent(m_dragTarget.data(), &translated); | - |
551 | if (translated.isAccepted()) partially evaluated: translated.isAccepted() yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
552 | event->accept(); executed: event->accept(); Execution Count:2 | 2 |
553 | event->setDropAction(translated.dropAction()); executed (the execution status of this line is deduced): event->setDropAction(translated.dropAction()); | - |
554 | m_dragTarget = 0; executed (the execution status of this line is deduced): m_dragTarget = 0; | - |
555 | } executed: } Execution Count:2 | 2 |
556 | | - |
557 | #endif // QT_NO_DRAGANDDROP | - |
558 | | - |
559 | void QWidgetWindow::handleExposeEvent(QExposeEvent *event) | - |
560 | { | - |
561 | if (isExposed()) { evaluated: isExposed() yes Evaluation Count:1659 | yes Evaluation Count:83 |
| 83-1659 |
562 | m_widget->setAttribute(Qt::WA_Mapped); executed (the execution status of this line is deduced): m_widget->setAttribute(Qt::WA_Mapped); | - |
563 | if (!event->region().isNull()) { partially evaluated: !event->region().isNull() yes Evaluation Count:1659 | no Evaluation Count:0 |
| 0-1659 |
564 | // Exposed native widgets need to be marked dirty to get them repainted correctly. | - |
565 | if (m_widget->internalWinId() && !m_widget->isWindow() && m_widget->isVisible() && m_widget->updatesEnabled()) { partially evaluated: m_widget->internalWinId() yes Evaluation Count:1659 | no Evaluation Count:0 |
evaluated: !m_widget->isWindow() yes Evaluation Count:4 | yes Evaluation Count:1655 |
partially evaluated: m_widget->isVisible() yes Evaluation Count:4 | no Evaluation Count:0 |
partially evaluated: m_widget->updatesEnabled() yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-1659 |
566 | if (QWidgetBackingStore *bs = m_widget->d_func()->maybeBackingStore()) partially evaluated: QWidgetBackingStore *bs = m_widget->d_func()->maybeBackingStore() yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
567 | bs->markDirty(event->region(), m_widget); executed: bs->markDirty(event->region(), m_widget); Execution Count:4 | 4 |
568 | } executed: } Execution Count:4 | 4 |
569 | m_widget->d_func()->syncBackingStore(event->region()); executed (the execution status of this line is deduced): m_widget->d_func()->syncBackingStore(event->region()); | - |
570 | } executed: } Execution Count:1659 | 1659 |
571 | } else { executed: } Execution Count:1659 | 1659 |
572 | m_widget->setAttribute(Qt::WA_Mapped, false); executed (the execution status of this line is deduced): m_widget->setAttribute(Qt::WA_Mapped, false); | - |
573 | } executed: } Execution Count:83 | 83 |
574 | } | - |
575 | | - |
576 | Qt::WindowState effectiveState(Qt::WindowStates state); | - |
577 | | - |
578 | void QWidgetWindow::handleWindowStateChangedEvent(QWindowStateChangeEvent *event) | - |
579 | { | - |
580 | // QWindow does currently not know 'active'. | - |
581 | Qt::WindowStates eventState = event->oldState(); executed (the execution status of this line is deduced): Qt::WindowStates eventState = event->oldState(); | - |
582 | Qt::WindowStates widgetState = m_widget->windowState(); executed (the execution status of this line is deduced): Qt::WindowStates widgetState = m_widget->windowState(); | - |
583 | if (widgetState & Qt::WindowActive) partially evaluated: widgetState & Qt::WindowActive no Evaluation Count:0 | yes Evaluation Count:687 |
| 0-687 |
584 | eventState |= Qt::WindowActive; never executed: eventState |= Qt::WindowActive; | 0 |
585 | | - |
586 | // Determine the new widget state, remember maximized/full screen | - |
587 | // during minimized. | - |
588 | switch (windowState()) { | - |
589 | case Qt::WindowNoState: | - |
590 | widgetState &= ~(Qt::WindowMinimized | Qt::WindowMaximized | Qt::WindowFullScreen); executed (the execution status of this line is deduced): widgetState &= ~(Qt::WindowMinimized | Qt::WindowMaximized | Qt::WindowFullScreen); | - |
591 | break; executed: break; Execution Count:679 | 679 |
592 | case Qt::WindowMinimized: | - |
593 | widgetState |= Qt::WindowMinimized; executed (the execution status of this line is deduced): widgetState |= Qt::WindowMinimized; | - |
594 | break; executed: break; Execution Count:2 | 2 |
595 | case Qt::WindowMaximized: | - |
596 | if (effectiveState(widgetState) == Qt::WindowNoState) partially evaluated: effectiveState(widgetState) == Qt::WindowNoState no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
597 | if (QTLWExtra *tle = m_widget->d_func()->maybeTopData()) never evaluated: QTLWExtra *tle = m_widget->d_func()->maybeTopData() | 0 |
598 | tle->normalGeometry = m_widget->geometry(); never executed: tle->normalGeometry = m_widget->geometry(); | 0 |
599 | widgetState |= Qt::WindowMaximized; executed (the execution status of this line is deduced): widgetState |= Qt::WindowMaximized; | - |
600 | widgetState &= ~(Qt::WindowMinimized | Qt::WindowFullScreen); executed (the execution status of this line is deduced): widgetState &= ~(Qt::WindowMinimized | Qt::WindowFullScreen); | - |
601 | break; executed: break; Execution Count:4 | 4 |
602 | case Qt::WindowFullScreen: | - |
603 | if (effectiveState(widgetState) == Qt::WindowNoState) evaluated: effectiveState(widgetState) == Qt::WindowNoState yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
604 | if (QTLWExtra *tle = m_widget->d_func()->maybeTopData()) partially evaluated: QTLWExtra *tle = m_widget->d_func()->maybeTopData() yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
605 | tle->normalGeometry = m_widget->geometry(); executed: tle->normalGeometry = m_widget->geometry(); Execution Count:1 | 1 |
606 | widgetState |= Qt::WindowFullScreen; executed (the execution status of this line is deduced): widgetState |= Qt::WindowFullScreen; | - |
607 | widgetState &= ~(Qt::WindowMinimized); executed (the execution status of this line is deduced): widgetState &= ~(Qt::WindowMinimized); | - |
608 | break; executed: break; Execution Count:2 | 2 |
609 | case Qt::WindowActive: // Not handled by QWindow | - |
610 | break; | 0 |
611 | } | - |
612 | | - |
613 | // Sent event if the state changed (that is, it is not triggered by | - |
614 | // QWidget::setWindowState(), which also sends an event to the widget). | - |
615 | if (widgetState != int(m_widget->data->window_state)) { evaluated: widgetState != int(m_widget->data->window_state) yes Evaluation Count:2 | yes Evaluation Count:685 |
| 2-685 |
616 | m_widget->data->window_state = widgetState; executed (the execution status of this line is deduced): m_widget->data->window_state = widgetState; | - |
617 | QWindowStateChangeEvent widgetEvent(eventState); executed (the execution status of this line is deduced): QWindowStateChangeEvent widgetEvent(eventState); | - |
618 | QGuiApplication::sendSpontaneousEvent(m_widget, &widgetEvent); executed (the execution status of this line is deduced): QGuiApplication::sendSpontaneousEvent(m_widget, &widgetEvent); | - |
619 | } executed: } Execution Count:2 | 2 |
620 | } executed: } Execution Count:687 | 687 |
621 | | - |
622 | bool QWidgetWindow::nativeEvent(const QByteArray &eventType, void *message, long *result) | - |
623 | { | - |
624 | return m_widget->nativeEvent(eventType, message, result); executed: return m_widget->nativeEvent(eventType, message, result); Execution Count:38625 | 38625 |
625 | } | - |
626 | | - |
627 | #ifndef QT_NO_TABLETEVENT | - |
628 | void QWidgetWindow::handleTabletEvent(QTabletEvent *event) | - |
629 | { | - |
630 | if (event->type() == QEvent::TabletPress) { never evaluated: event->type() == QEvent::TabletPress | 0 |
631 | QWidget *widget = m_widget->childAt(event->pos()); never executed (the execution status of this line is deduced): QWidget *widget = m_widget->childAt(event->pos()); | - |
632 | if (!widget) | 0 |
633 | widget = m_widget; never executed: widget = m_widget; | 0 |
634 | | - |
635 | qt_tablet_target = widget; never executed (the execution status of this line is deduced): qt_tablet_target = widget; | - |
636 | } | 0 |
637 | | - |
638 | if (qt_tablet_target) { never evaluated: qt_tablet_target | 0 |
639 | QPointF delta = event->globalPosF() - event->globalPos(); never executed (the execution status of this line is deduced): QPointF delta = event->globalPosF() - event->globalPos(); | - |
640 | QPointF mapped = qt_tablet_target->mapFromGlobal(event->globalPos()) + delta; never executed (the execution status of this line is deduced): QPointF mapped = qt_tablet_target->mapFromGlobal(event->globalPos()) + delta; | - |
641 | QTabletEvent ev(event->type(), mapped, event->globalPosF(), event->device(), event->pointerType(), never executed (the execution status of this line is deduced): QTabletEvent ev(event->type(), mapped, event->globalPosF(), event->device(), event->pointerType(), | - |
642 | event->pressure(), event->xTilt(), event->yTilt(), event->tangentialPressure(), never executed (the execution status of this line is deduced): event->pressure(), event->xTilt(), event->yTilt(), event->tangentialPressure(), | - |
643 | event->rotation(), event->z(), event->modifiers(), event->uniqueId()); never executed (the execution status of this line is deduced): event->rotation(), event->z(), event->modifiers(), event->uniqueId()); | - |
644 | ev.setTimestamp(event->timestamp()); never executed (the execution status of this line is deduced): ev.setTimestamp(event->timestamp()); | - |
645 | QGuiApplication::sendSpontaneousEvent(qt_tablet_target, &ev); never executed (the execution status of this line is deduced): QGuiApplication::sendSpontaneousEvent(qt_tablet_target, &ev); | - |
646 | } | 0 |
647 | | - |
648 | if (event->type() == QEvent::TabletRelease) never evaluated: event->type() == QEvent::TabletRelease | 0 |
649 | qt_tablet_target = 0; never executed: qt_tablet_target = 0; | 0 |
650 | } | 0 |
651 | #endif // QT_NO_TABLETEVENT | - |
652 | | - |
653 | #ifndef QT_NO_CONTEXTMENU | - |
654 | void QWidgetWindow::handleContextMenuEvent(QContextMenuEvent *e) | - |
655 | { | - |
656 | // We are only interested in keyboard originating context menu events here, | - |
657 | // mouse originated context menu events for widgets are generated in mouse handling methods. | - |
658 | if (e->reason() != QContextMenuEvent::Keyboard) never evaluated: e->reason() != QContextMenuEvent::Keyboard | 0 |
659 | return; | 0 |
660 | | - |
661 | QWidget *fw = QWidget::keyboardGrabber(); never executed (the execution status of this line is deduced): QWidget *fw = QWidget::keyboardGrabber(); | - |
662 | if (!fw) { | 0 |
663 | if (QApplication::activePopupWidget()) { never evaluated: QApplication::activePopupWidget() | 0 |
664 | fw = (QApplication::activePopupWidget()->focusWidget() never evaluated: QApplication::activePopupWidget()->focusWidget() | 0 |
665 | ? QApplication::activePopupWidget()->focusWidget() never executed (the execution status of this line is deduced): ? QApplication::activePopupWidget()->focusWidget() | - |
666 | : QApplication::activePopupWidget()); never executed (the execution status of this line is deduced): : QApplication::activePopupWidget()); | - |
667 | } else if (QApplication::focusWidget()) { never executed: } never evaluated: QApplication::focusWidget() | 0 |
668 | fw = QApplication::focusWidget(); never executed (the execution status of this line is deduced): fw = QApplication::focusWidget(); | - |
669 | } else { | 0 |
670 | fw = m_widget; never executed (the execution status of this line is deduced): fw = m_widget; | - |
671 | } | 0 |
672 | } | - |
673 | if (fw && fw->isEnabled()) { never evaluated: fw never evaluated: fw->isEnabled() | 0 |
674 | QPoint pos = fw->inputMethodQuery(Qt::ImMicroFocus).toRect().center(); never executed (the execution status of this line is deduced): QPoint pos = fw->inputMethodQuery(Qt::ImMicroFocus).toRect().center(); | - |
675 | QContextMenuEvent widgetEvent(QContextMenuEvent::Keyboard, pos, fw->mapToGlobal(pos), never executed (the execution status of this line is deduced): QContextMenuEvent widgetEvent(QContextMenuEvent::Keyboard, pos, fw->mapToGlobal(pos), | - |
676 | e->modifiers()); never executed (the execution status of this line is deduced): e->modifiers()); | - |
677 | QGuiApplication::sendSpontaneousEvent(fw, &widgetEvent); never executed (the execution status of this line is deduced): QGuiApplication::sendSpontaneousEvent(fw, &widgetEvent); | - |
678 | } | 0 |
679 | } | 0 |
680 | #endif // QT_NO_CONTEXTMENU | - |
681 | | - |
682 | void QWidgetWindow::updateObjectName() | - |
683 | { | - |
684 | QString name = m_widget->objectName(); executed (the execution status of this line is deduced): QString name = m_widget->objectName(); | - |
685 | if (name.isEmpty()) evaluated: name.isEmpty() yes Evaluation Count:2094 | yes Evaluation Count:256 |
| 256-2094 |
686 | name = QString::fromUtf8(m_widget->metaObject()->className()) + QStringLiteral("Class"); executed: name = QString::fromUtf8(m_widget->metaObject()->className()) + QString::fromUtf8("" "Class" "", sizeof("Class") - 1); Execution Count:2094 | 2094 |
687 | name += QStringLiteral("Window"); executed (the execution status of this line is deduced): name += QString::fromUtf8("" "Window" "", sizeof("Window") - 1); | - |
688 | setObjectName(name); executed (the execution status of this line is deduced): setObjectName(name); | - |
689 | } executed: } Execution Count:2350 | 2350 |
690 | | - |
691 | QT_END_NAMESPACE | - |
692 | | - |
| | |