kernel/qwidgetwindow.cpp

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

Generated by Squish Coco Non-Commercial