kernel/qwidgetwindow.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3 -
4 -
5 -
6 -
7QWidget *qt_button_down = 0; -
8static QWidget *qt_tablet_target = 0; -
9 -
10 -
11QWidget *qt_popup_down = 0; -
12extern int openPopupCount; -
13bool qt_replay_popup_mouse_event = false; -
14extern bool qt_try_modal(QWidget *widget, QEvent::Type type); -
15 -
16class QWidgetWindowPrivate : public QWindowPrivate -
17{ -
18 inline QWidgetWindow* q_func() { return static_cast<QWidgetWindow *>(q_ptr); } inline const QWidgetWindow* q_func() const { return static_cast<const QWidgetWindow *>(q_ptr); } friend class QWidgetWindow; -
19public: -
20 QWindow *eventReceiver() { -
21 QWidgetWindow * const q = q_func(); -
22 QWindow *w = q; -
23 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
24 w = w->parent(); -
25 }
never executed: }
0
26 return w;
executed: return w;
Execution Count:1812
1812
27 } -
28}; -
29 -
30QWidgetWindow::QWidgetWindow(QWidget *widget) -
31 : QWindow(*new QWidgetWindowPrivate(), 0) -
32 , m_widget(widget) -
33{ -
34 updateObjectName(); -
35 connect(m_widget, &QObject::objectNameChanged, this, &QWidgetWindow::updateObjectName); -
36}
executed: }
Execution Count:3470
3470
37 -
38 -
39QAccessibleInterface *QWidgetWindow::accessibleRoot() const -
40{ -
41 if (m_widget)
never evaluated: m_widget
0
42 return QAccessible::queryAccessibleInterface(m_widget);
never executed: return QAccessible::queryAccessibleInterface(m_widget);
0
43 return 0;
never executed: return 0;
0
44} -
45 -
46 -
47QObject *QWidgetWindow::focusObject() const -
48{ -
49 QWidget *widget = m_widget->focusWidget(); -
50 -
51 if (!widget)
evaluated: !widget
TRUEFALSE
yes
Evaluation Count:9962
yes
Evaluation Count:6906
6906-9962
52 widget = m_widget;
executed: widget = m_widget;
Execution Count:9962
9962
53 -
54 return widget;
executed: return widget;
Execution Count:16868
16868
55} -
56 -
57bool QWidgetWindow::event(QEvent *event) -
58{ -
59 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
60 -
61 -
62 return m_widget->event(event);
never executed: return m_widget->event(event);
0
63 } -
64 -
65 switch (event->type()) { -
66 case QEvent::Close: -
67 handleCloseEvent(static_cast<QCloseEvent *>(event)); -
68 return true;
never executed: return true;
0
69 -
70 case QEvent::Enter: -
71 case QEvent::Leave: -
72 handleEnterLeaveEvent(event); -
73 return true;
executed: return true;
Execution Count:2136
2136
74 -
75 -
76 -
77 case QEvent::FocusIn: -
78 case QEvent::FocusOut: { -
79 -
80 QAccessible::State state; -
81 state.active = true; -
82 QAccessibleStateChangeEvent ev(widget(), state); -
83 QAccessible::updateAccessibility(&ev); -
84 -
85 return false; }
executed: return false;
Execution Count:2196
2196
86 -
87 case QEvent::FocusAboutToChange: -
88 if (QApplicationPrivate::focus_widget) {
evaluated: QApplicationPrivate::focus_widget
TRUEFALSE
yes
Evaluation Count:215
yes
Evaluation Count:235
215-235
89 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
90 (static_cast<QApplication *>(QCoreApplication::instance()))->inputMethod()->commit();
executed: (static_cast<QApplication *>(QCoreApplication::instance()))->inputMethod()->commit();
Execution Count:149
149
91 -
92 QGuiApplication::sendSpontaneousEvent(QApplicationPrivate::focus_widget, event); -
93 }
executed: }
Execution Count:215
215
94 return true;
executed: return true;
Execution Count:450
450
95 -
96 case QEvent::KeyPress: -
97 case QEvent::KeyRelease: -
98 case QEvent::ShortcutOverride: -
99 handleKeyEvent(static_cast<QKeyEvent *>(event)); -
100 return true;
executed: return true;
Execution Count:58
58
101 -
102 case QEvent::MouseMove: -
103 case QEvent::MouseButtonPress: -
104 case QEvent::MouseButtonRelease: -
105 case QEvent::MouseButtonDblClick: -
106 handleMouseEvent(static_cast<QMouseEvent *>(event)); -
107 return true;
executed: return true;
Execution Count:436
436
108 -
109 case QEvent::NonClientAreaMouseMove: -
110 case QEvent::NonClientAreaMouseButtonPress: -
111 case QEvent::NonClientAreaMouseButtonRelease: -
112 case QEvent::NonClientAreaMouseButtonDblClick: -
113 handleNonClientAreaMouseEvent(static_cast<QMouseEvent *>(event)); -
114 return true;
never executed: return true;
0
115 -
116 case QEvent::TouchBegin: -
117 case QEvent::TouchUpdate: -
118 case QEvent::TouchEnd: -
119 case QEvent::TouchCancel: -
120 handleTouchEvent(static_cast<QTouchEvent *>(event)); -
121 return true;
executed: return true;
Execution Count:29
29
122 -
123 case QEvent::Move: -
124 handleMoveEvent(static_cast<QMoveEvent *>(event)); -
125 return true;
executed: return true;
Execution Count:1433
1433
126 -
127 case QEvent::Resize: -
128 handleResizeEvent(static_cast<QResizeEvent *>(event)); -
129 return true;
executed: return true;
Execution Count:1583
1583
130 -
131 -
132 case QEvent::Wheel: -
133 handleWheelEvent(static_cast<QWheelEvent *>(event)); -
134 return true;
never executed: return true;
0
135 -
136 -
137 -
138 case QEvent::DragEnter: -
139 case QEvent::DragMove: -
140 handleDragEnterMoveEvent(static_cast<QDragMoveEvent *>(event)); -
141 return true;
executed: return true;
Execution Count:15
15
142 case QEvent::DragLeave: -
143 handleDragLeaveEvent(static_cast<QDragLeaveEvent *>(event)); -
144 return true;
never executed: return true;
0
145 case QEvent::Drop: -
146 handleDropEvent(static_cast<QDropEvent *>(event)); -
147 return true;
executed: return true;
Execution Count:2
2
148 -
149 -
150 case QEvent::Expose: -
151 handleExposeEvent(static_cast<QExposeEvent *>(event)); -
152 return true;
executed: return true;
Execution Count:3482
3482
153 -
154 case QEvent::WindowStateChange: -
155 handleWindowStateChangedEvent(static_cast<QWindowStateChangeEvent *>(event)); -
156 return true;
executed: return true;
Execution Count:1447
1447
157 -
158 case QEvent::ThemeChange: { -
159 QEvent widgetEvent(QEvent::ThemeChange); -
160 QGuiApplication::sendSpontaneousEvent(m_widget, &widgetEvent); -
161 } -
162 return true;
never executed: return true;
0
163 -
164 -
165 case QEvent::TabletPress: -
166 case QEvent::TabletMove: -
167 case QEvent::TabletRelease: -
168 handleTabletEvent(static_cast<QTabletEvent *>(event)); -
169 return true;
never executed: return true;
0
170 -
171 -
172 case QEvent::ContextMenu: -
173 handleContextMenuEvent(static_cast<QContextMenuEvent *>(event)); -
174 return true;
never executed: return true;
0
175 -
176 -
177 -
178 case QEvent::Show: -
179 case QEvent::Hide: -
180 return QWindow::event(event);
executed: return QWindow::event(event);
Execution Count:5085
5085
181 -
182 default: -
183 break;
executed: break;
Execution Count:4419
4419
184 } -
185 -
186 return m_widget->event(event) || QWindow::event(event);
executed: return m_widget->event(event) || QWindow::event(event);
Execution Count:4419
4419
187} -
188 -
189QPointer<QWidget> qt_last_mouse_receiver = 0; -
190 -
191void QWidgetWindow::handleEnterLeaveEvent(QEvent *event) -
192{ -
193 if (event->type() == QEvent::Leave) {
evaluated: event->type() == QEvent::Leave
TRUEFALSE
yes
Evaluation Count:702
yes
Evaluation Count:1434
702-1434
194 QWidget *enter = 0; -
195 -
196 -
197 -
198 QWindowSystemInterfacePrivate::EnterEvent *systemEvent = -
199 static_cast<QWindowSystemInterfacePrivate::EnterEvent *> -
200 (QWindowSystemInterfacePrivate::peekWindowSystemEvent(QWindowSystemInterfacePrivate::Enter)); -
201 const QPointF globalPosF = systemEvent ? systemEvent->globalPos : QGuiApplicationPrivate::lastCursorPosition;
evaluated: systemEvent
TRUEFALSE
yes
Evaluation Count:636
yes
Evaluation Count:66
66-636
202 if (systemEvent) {
evaluated: systemEvent
TRUEFALSE
yes
Evaluation Count:636
yes
Evaluation Count:66
66-636
203 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
204 { -
205 QWindow *thisParent = this; -
206 QWindow *enterParent = enterWindow; -
207 while (thisParent->parent())
partially evaluated: thisParent->parent()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:636
0-636
208 thisParent = thisParent->parent();
never executed: thisParent = thisParent->parent();
0
209 while (enterParent->parent())
partially evaluated: enterParent->parent()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:636
0-636
210 enterParent = enterParent->parent();
never executed: enterParent = enterParent->parent();
0
211 if (thisParent == enterParent) {
evaluated: thisParent == enterParent
TRUEFALSE
yes
Evaluation Count:184
yes
Evaluation Count:452
184-452
212 QGuiApplicationPrivate::currentMouseWindow = enterWindow; -
213 enter = enterWindow->widget(); -
214 QWindowSystemInterfacePrivate::removeWindowSystemEvent(systemEvent); -
215 }
executed: }
Execution Count:184
184
216 }
executed: }
Execution Count:636
636
217 }
executed: }
Execution Count:636
636
218 -
219 -
220 -
221 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
222 -
223 -
224 QWidget *leave = m_widget; -
225 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
226 leave = qt_last_mouse_receiver.data();
executed: leave = qt_last_mouse_receiver.data();
Execution Count:73
73
227 QApplicationPrivate::dispatchEnterLeave(enter, leave, globalPosF); -
228 qt_last_mouse_receiver = enter; -
229 }
executed: }
Execution Count:702
702
230 } else {
executed: }
Execution Count:702
702
231 const QEnterEvent *ee = static_cast<QEnterEvent *>(event); -
232 QWidget *child = m_widget->childAt(ee->pos()); -
233 QWidget *receiver = child ? child : m_widget;
evaluated: child
TRUEFALSE
yes
Evaluation Count:923
yes
Evaluation Count:511
511-923
234 QApplicationPrivate::dispatchEnterLeave(receiver, 0, ee->screenPos()); -
235 qt_last_mouse_receiver = receiver; -
236 }
executed: }
Execution Count:1434
1434
237} -
238 -
239void QWidgetWindow::handleNonClientAreaMouseEvent(QMouseEvent *e) -
240{ -
241 QApplication::sendSpontaneousEvent(m_widget, e); -
242}
never executed: }
0
243 -
244void QWidgetWindow::handleMouseEvent(QMouseEvent *event) -
245{ -
246 if ((static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->inPopupMode()) {
evaluated: (static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->inPopupMode()
TRUEFALSE
yes
Evaluation Count:15
yes
Evaluation Count:421
15-421
247 QWidget *activePopupWidget = (static_cast<QApplication *>(QCoreApplication::instance()))->activePopupWidget(); -
248 QWidget *popup = activePopupWidget; -
249 QPoint mapped = event->pos(); -
250 if (popup != m_widget)
partially evaluated: popup != m_widget
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:15
0-15
251 mapped = popup->mapFromGlobal(event->globalPos());
never executed: mapped = popup->mapFromGlobal(event->globalPos());
0
252 bool releaseAfter = false; -
253 QWidget *popupChild = popup->childAt(mapped); -
254 -
255 if (popup != qt_popup_down) {
evaluated: popup != qt_popup_down
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:2
2-13
256 qt_button_down = 0; -
257 qt_popup_down = 0; -
258 }
executed: }
Execution Count:13
13
259 -
260 switch (event->type()) { -
261 case QEvent::MouseButtonPress: -
262 case QEvent::MouseButtonDblClick: -
263 qt_button_down = popupChild; -
264 qt_popup_down = popup; -
265 break;
executed: break;
Execution Count:2
2
266 case QEvent::MouseButtonRelease: -
267 releaseAfter = true; -
268 break;
executed: break;
Execution Count:1
1
269 default: -
270 break;
executed: break;
Execution Count:12
12
271 } -
272 -
273 int oldOpenPopupCount = openPopupCount; -
274 -
275 if (popup->isEnabled()) {
partially evaluated: popup->isEnabled()
TRUEFALSE
yes
Evaluation Count:15
no
Evaluation Count:0
0-15
276 -
277 qt_replay_popup_mouse_event = false; -
278 QWidget *receiver = popup; -
279 QPoint widgetPos = mapped; -
280 if (qt_button_down)
partially evaluated: qt_button_down
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:15
0-15
281 receiver = qt_button_down;
never executed: receiver = qt_button_down;
0
282 else if (popupChild)
evaluated: popupChild
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:13
2-13
283 receiver = popupChild;
executed: receiver = popupChild;
Execution Count:2
2
284 if (receiver != popup)
evaluated: receiver != popup
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:13
2-13
285 widgetPos = receiver->mapFromGlobal(event->globalPos());
executed: widgetPos = receiver->mapFromGlobal(event->globalPos());
Execution Count:2
2
286 QWidget *alien = m_widget->childAt(m_widget->mapFromGlobal(event->globalPos())); -
287 QMouseEvent e(event->type(), widgetPos, event->windowPos(), event->screenPos(), event->button(), event->buttons(), event->modifiers()); -
288 e.setTimestamp(event->timestamp()); -
289 QApplicationPrivate::sendMouseEvent(receiver, &e, alien, m_widget, &qt_button_down, qt_last_mouse_receiver); -
290 } else {
executed: }
Execution Count:15
15
291 -
292 switch (event->type()) { -
293 case QEvent::MouseButtonPress: -
294 case QEvent::MouseButtonDblClick: -
295 case QEvent::MouseButtonRelease: -
296 popup->close(); -
297 break;
never executed: break;
0
298 default: -
299 break;
never executed: break;
0
300 } -
301 }
never executed: }
0
302 -
303 if ((static_cast<QApplication *>(QCoreApplication::instance()))->activePopupWidget() != activePopupWidget
partially evaluated: (static_cast<QApplication *>(QCoreApplication::instance()))->activePopupWidget() != activePopupWidget
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:15
0-15
304 && qt_replay_popup_mouse_event) {
never evaluated: qt_replay_popup_mouse_event
0
305 if (m_widget->windowType() != Qt::Popup)
never evaluated: m_widget->windowType() != Qt::Popup
0
306 qt_button_down = 0;
never executed: qt_button_down = 0;
0
307 qt_replay_popup_mouse_event = false; -
308 -
309 } else if (event->type() == QEvent::MouseButtonPress
evaluated: event->type() == QEvent::MouseButtonPress
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:14
never executed: }
0-14
310 && event->button() == Qt::RightButton
partially evaluated: event->button() == Qt::RightButton
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
311 && (openPopupCount == oldOpenPopupCount)) {
never evaluated: (openPopupCount == oldOpenPopupCount)
0
312 QWidget *popupEvent = popup; -
313 if (qt_button_down)
never evaluated: qt_button_down
0
314 popupEvent = qt_button_down;
never executed: popupEvent = qt_button_down;
0
315 else if(popupChild)
never evaluated: popupChild
0
316 popupEvent = popupChild;
never executed: popupEvent = popupChild;
0
317 QContextMenuEvent e(QContextMenuEvent::Mouse, mapped, event->globalPos(), event->modifiers()); -
318 QApplication::sendSpontaneousEvent(popupEvent, &e); -
319 -
320 }
never executed: }
0
321 -
322 if (releaseAfter) {
evaluated: releaseAfter
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:14
1-14
323 qt_button_down = 0; -
324 qt_popup_down = 0; -
325 }
executed: }
Execution Count:1
1
326 return;
executed: return;
Execution Count:15
15
327 } -
328 -
329 -
330 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
331 return;
never executed: return;
0
332 -
333 -
334 QWidget *widget = m_widget->childAt(event->pos()); -
335 QPoint mapped = event->pos(); -
336 -
337 if (!widget)
evaluated: !widget
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:413
8-413
338 widget = m_widget;
executed: widget = m_widget;
Execution Count:8
8
339 -
340 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
341 qt_button_down = widget;
executed: qt_button_down = widget;
Execution Count:7
7
342 -
343 QWidget *receiver = QApplicationPrivate::pickMouseReceiver(m_widget, event->windowPos().toPoint(), &mapped, event->type(), event->buttons(), -
344 qt_button_down, widget); -
345 -
346 if (!receiver) {
partially evaluated: !receiver
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:421
0-421
347 if (event->type() == QEvent::MouseButtonRelease)
never evaluated: event->type() == QEvent::MouseButtonRelease
0
348 QApplicationPrivate::mouse_buttons &= ~event->button();
never executed: QApplicationPrivate::mouse_buttons &= ~event->button();
0
349 return;
never executed: return;
0
350 } -
351 -
352 QMouseEvent translated(event->type(), mapped, event->windowPos(), event->screenPos(), event->button(), event->buttons(), event->modifiers()); -
353 translated.setTimestamp(event->timestamp()); -
354 QApplicationPrivate::sendMouseEvent(receiver, &translated, widget, m_widget, &qt_button_down, -
355 qt_last_mouse_receiver); -
356 -
357 -
358 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
359 QContextMenuEvent e(QContextMenuEvent::Mouse, mapped, event->globalPos(), event->modifiers()); -
360 QGuiApplication::sendSpontaneousEvent(receiver, &e); -
361 }
never executed: }
0
362 -
363}
executed: }
Execution Count:421
421
364 -
365void QWidgetWindow::handleTouchEvent(QTouchEvent *event) -
366{ -
367 if (event->type() == QEvent::TouchCancel)
partially evaluated: event->type() == QEvent::TouchCancel
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:29
0-29
368 QApplicationPrivate::translateTouchCancel(event->device(), event->timestamp());
never executed: QApplicationPrivate::translateTouchCancel(event->device(), event->timestamp());
0
369 else -
370 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
371} -
372 -
373void QWidgetWindow::handleKeyEvent(QKeyEvent *event) -
374{ -
375 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
376 return;
never executed: return;
0
377 -
378 QObject *receiver = 0; -
379 if (QApplicationPrivate::inPopupMode()) {
evaluated: QApplicationPrivate::inPopupMode()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:56
2-56
380 QWidget *popup = QApplication::activePopupWidget(); -
381 QWidget *popupFocusWidget = popup->focusWidget(); -
382 receiver = popupFocusWidget ? popupFocusWidget : popup;
partially evaluated: popupFocusWidget
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
383 }
executed: }
Execution Count:2
2
384 if (!receiver)
evaluated: !receiver
TRUEFALSE
yes
Evaluation Count:56
yes
Evaluation Count:2
2-56
385 receiver = QWidget::keyboardGrabber();
executed: receiver = QWidget::keyboardGrabber();
Execution Count:56
56
386 if (!receiver)
evaluated: !receiver
TRUEFALSE
yes
Evaluation Count:54
yes
Evaluation Count:4
4-54
387 receiver = focusObject();
executed: receiver = focusObject();
Execution Count:54
54
388 QGuiApplication::sendSpontaneousEvent(receiver, event); -
389}
executed: }
Execution Count:58
58
390 -
391void QWidgetWindow::updateGeometry() -
392{ -
393 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
394 return;
executed: return;
Execution Count:4
4
395 -
396 const QMargins margins = frameMargins(); -
397 -
398 m_widget->data->crect = geometry(); -
399 QTLWExtra *te = m_widget->d_func()->topData(); -
400 te->posIncludesFrame= false; -
401 te->frameStrut.setCoords(margins.left(), margins.top(), margins.right(), margins.bottom()); -
402 m_widget->data->fstrut_dirty = false; -
403}
executed: }
Execution Count:3012
3012
404 -
405void QWidgetWindow::handleMoveEvent(QMoveEvent *event) -
406{ -
407 updateGeometry(); -
408 QGuiApplication::sendSpontaneousEvent(m_widget, event); -
409}
executed: }
Execution Count:1433
1433
410 -
411void QWidgetWindow::handleResizeEvent(QResizeEvent *event) -
412{ -
413 QSize oldSize = m_widget->data->crect.size(); -
414 -
415 updateGeometry(); -
416 QGuiApplication::sendSpontaneousEvent(m_widget, event); -
417 -
418 if (m_widget->d_func()->paintOnScreen()) {
evaluated: m_widget->d_func()->paintOnScreen()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1581
2-1581
419 QRegion updateRegion(geometry()); -
420 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
421 updateRegion -= QRect(0, 0, oldSize.width(), oldSize.height());
never executed: updateRegion -= QRect(0, 0, oldSize.width(), oldSize.height());
0
422 m_widget->d_func()->syncBackingStore(updateRegion); -
423 } else {
executed: }
Execution Count:2
2
424 m_widget->d_func()->syncBackingStore(); -
425 }
executed: }
Execution Count:1581
1581
426} -
427 -
428void QWidgetWindow::handleCloseEvent(QCloseEvent *) -
429{ -
430 m_widget->d_func()->close_helper(QWidgetPrivate::CloseWithSpontaneousEvent); -
431}
never executed: }
0
432 -
433 -
434 -
435void QWidgetWindow::handleWheelEvent(QWheelEvent *event) -
436{ -
437 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
438 return;
never executed: return;
0
439 -
440 -
441 QWidget *widget = m_widget->childAt(event->pos()); -
442 -
443 if (!widget)
never evaluated: !widget
0
444 widget = m_widget;
never executed: widget = m_widget;
0
445 -
446 QPoint mapped = widget->mapFrom(m_widget, event->pos()); -
447 -
448 QWheelEvent translated(mapped, event->globalPos(), event->pixelDelta(), event->angleDelta(), event->delta(), event->orientation(), event->buttons(), event->modifiers()); -
449 QGuiApplication::sendSpontaneousEvent(widget, &translated); -
450}
never executed: }
0
451 -
452 -
453 -
454 -
455 -
456void QWidgetWindow::handleDragEnterMoveEvent(QDragMoveEvent *event) -
457{ -
458 qt_noop(); -
459 -
460 QWidget *widget = m_widget->childAt(event->pos()); -
461 if (!widget)
evaluated: !widget
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:10
5-10
462 widget = m_widget;
executed: widget = m_widget;
Execution Count:5
5
463 for ( ; widget && !widget->isWindow() && !widget->acceptDrops(); widget = widget->parentWidget()) ;
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
executed: ;
Execution Count:6
0-21
464 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
465 widget = 0;
executed: widget = 0;
Execution Count:7
7
466 -
467 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
468 qt_noop(); -
469 const QPoint mapped = widget->mapFromGlobal(m_widget->mapToGlobal(event->pos())); -
470 QDragMoveEvent translated(mapped, event->possibleActions(), event->mimeData(), event->mouseButtons(), event->keyboardModifiers()); -
471 translated.setDropAction(event->dropAction()); -
472 if (event->isAccepted()) {
partially evaluated: event->isAccepted()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-5
473 translated.accept(); -
474 translated.setDropAction(event->dropAction()); -
475 }
never executed: }
0
476 QGuiApplication::sendSpontaneousEvent(widget, &translated); -
477 if (translated.isAccepted()) {
partially evaluated: translated.isAccepted()
TRUEFALSE
yes
Evaluation Count:5
no
Evaluation Count:0
0-5
478 event->accept(); -
479 } else {
executed: }
Execution Count:5
5
480 event->ignore(); -
481 }
never executed: }
0
482 event->setDropAction(translated.dropAction()); -
483 return;
executed: return;
Execution Count:5
5
484 } -
485 -
486 if (m_dragTarget.data()) {
evaluated: m_dragTarget.data()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:9
1-9
487 QDragLeaveEvent le; -
488 QGuiApplication::sendSpontaneousEvent(m_dragTarget.data(), &le); -
489 m_dragTarget = 0; -
490 }
executed: }
Execution Count:1
1
491 if (!widget) {
evaluated: !widget
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:3
3-7
492 event->ignore(); -
493 return;
executed: return;
Execution Count:7
7
494 } -
495 m_dragTarget = widget; -
496 const QPoint mapped = widget->mapFromGlobal(m_widget->mapToGlobal(event->pos())); -
497 QDragEnterEvent translated(mapped, event->possibleActions(), event->mimeData(), event->mouseButtons(), event->keyboardModifiers()); -
498 QGuiApplication::sendSpontaneousEvent(widget, &translated); -
499 if (translated.isAccepted()) {
partially evaluated: translated.isAccepted()
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
500 event->accept(); -
501 } else {
executed: }
Execution Count:3
3
502 event->ignore(); -
503 }
never executed: }
0
504 event->setDropAction(translated.dropAction()); -
505}
executed: }
Execution Count:3
3
506 -
507void QWidgetWindow::handleDragLeaveEvent(QDragLeaveEvent *event) -
508{ -
509 if (m_dragTarget)
never evaluated: m_dragTarget
0
510 QGuiApplication::sendSpontaneousEvent(m_dragTarget.data(), event);
never executed: QGuiApplication::sendSpontaneousEvent(m_dragTarget.data(), event);
0
511 m_dragTarget = 0; -
512}
never executed: }
0
513 -
514void QWidgetWindow::handleDropEvent(QDropEvent *event) -
515{ -
516 const QPoint mapped = m_dragTarget.data()->mapFromGlobal(m_widget->mapToGlobal(event->pos())); -
517 QDropEvent translated(mapped, event->possibleActions(), event->mimeData(), event->mouseButtons(), event->keyboardModifiers()); -
518 QGuiApplication::sendSpontaneousEvent(m_dragTarget.data(), &translated); -
519 if (translated.isAccepted())
partially evaluated: translated.isAccepted()
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
520 event->accept();
executed: event->accept();
Execution Count:2
2
521 event->setDropAction(translated.dropAction()); -
522 m_dragTarget = 0; -
523}
executed: }
Execution Count:2
2
524 -
525 -
526 -
527void QWidgetWindow::handleExposeEvent(QExposeEvent *event) -
528{ -
529 if (isExposed()) {
evaluated: isExposed()
TRUEFALSE
yes
Evaluation Count:3363
yes
Evaluation Count:119
119-3363
530 m_widget->setAttribute(Qt::WA_Mapped); -
531 if (!event->region().isNull()) {
partially evaluated: !event->region().isNull()
TRUEFALSE
yes
Evaluation Count:3363
no
Evaluation Count:0
0-3363
532 -
533 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
534 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
535 bs->markDirty(event->region(), m_widget);
executed: bs->markDirty(event->region(), m_widget);
Execution Count:12
12
536 }
executed: }
Execution Count:12
12
537 m_widget->d_func()->syncBackingStore(event->region()); -
538 }
executed: }
Execution Count:3363
3363
539 } else {
executed: }
Execution Count:3363
3363
540 m_widget->setAttribute(Qt::WA_Mapped, false); -
541 }
executed: }
Execution Count:119
119
542} -
543 -
544Qt::WindowState effectiveState(Qt::WindowStates state); -
545 -
546void QWidgetWindow::handleWindowStateChangedEvent(QWindowStateChangeEvent *event) -
547{ -
548 -
549 Qt::WindowStates eventState = event->oldState(); -
550 Qt::WindowStates widgetState = m_widget->windowState(); -
551 if (widgetState & Qt::WindowActive)
partially evaluated: widgetState & Qt::WindowActive
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1447
0-1447
552 eventState |= Qt::WindowActive;
never executed: eventState |= Qt::WindowActive;
0
553 -
554 -
555 -
556 switch (windowState()) { -
557 case Qt::WindowNoState: -
558 widgetState &= ~(Qt::WindowMinimized | Qt::WindowMaximized | Qt::WindowFullScreen); -
559 break;
executed: break;
Execution Count:1423
1423
560 case Qt::WindowMinimized: -
561 widgetState |= Qt::WindowMinimized; -
562 break;
executed: break;
Execution Count:3
3
563 case Qt::WindowMaximized: -
564 if (effectiveState(widgetState) == Qt::WindowNoState)
evaluated: effectiveState(widgetState) == Qt::WindowNoState
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:12
1-12
565 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
566 tle->normalGeometry = m_widget->geometry();
executed: tle->normalGeometry = m_widget->geometry();
Execution Count:1
1
567 widgetState |= Qt::WindowMaximized; -
568 widgetState &= ~(Qt::WindowMinimized | Qt::WindowFullScreen); -
569 break;
executed: break;
Execution Count:13
13
570 case Qt::WindowFullScreen: -
571 if (effectiveState(widgetState) == Qt::WindowNoState)
partially evaluated: effectiveState(widgetState) == Qt::WindowNoState
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
572 if (QTLWExtra *tle = m_widget->d_func()->maybeTopData())
never evaluated: QTLWExtra *tle = m_widget->d_func()->maybeTopData()
0
573 tle->normalGeometry = m_widget->geometry();
never executed: tle->normalGeometry = m_widget->geometry();
0
574 widgetState |= Qt::WindowFullScreen; -
575 widgetState &= ~(Qt::WindowMinimized); -
576 break;
executed: break;
Execution Count:8
8
577 case Qt::WindowActive: -
578 break;
never executed: break;
0
579 } -
580 -
581 -
582 -
583 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
584 m_widget->data->window_state = widgetState; -
585 QWindowStateChangeEvent widgetEvent(eventState); -
586 QGuiApplication::sendSpontaneousEvent(m_widget, &widgetEvent); -
587 }
executed: }
Execution Count:2
2
588}
executed: }
Execution Count:1447
1447
589 -
590bool QWidgetWindow::nativeEvent(const QByteArray &eventType, void *message, long *result) -
591{ -
592 return m_widget->nativeEvent(eventType, message, result);
executed: return m_widget->nativeEvent(eventType, message, result);
Execution Count:67499
67499
593} -
594 -
595 -
596void QWidgetWindow::handleTabletEvent(QTabletEvent *event) -
597{ -
598 if (event->type() == QEvent::TabletPress) {
never evaluated: event->type() == QEvent::TabletPress
0
599 QWidget *widget = m_widget->childAt(event->pos()); -
600 if (!widget)
never evaluated: !widget
0
601 widget = m_widget;
never executed: widget = m_widget;
0
602 -
603 qt_tablet_target = widget; -
604 }
never executed: }
0
605 -
606 if (qt_tablet_target) {
never evaluated: qt_tablet_target
0
607 QPointF delta = event->globalPosF() - event->globalPos(); -
608 QPointF mapped = qt_tablet_target->mapFromGlobal(event->globalPos()) + delta; -
609 QTabletEvent ev(event->type(), mapped, event->globalPosF(), event->device(), event->pointerType(), -
610 event->pressure(), event->xTilt(), event->yTilt(), event->tangentialPressure(), -
611 event->rotation(), event->z(), event->modifiers(), event->uniqueId()); -
612 ev.setTimestamp(event->timestamp()); -
613 QGuiApplication::sendSpontaneousEvent(qt_tablet_target, &ev); -
614 }
never executed: }
0
615 -
616 if (event->type() == QEvent::TabletRelease)
never evaluated: event->type() == QEvent::TabletRelease
0
617 qt_tablet_target = 0;
never executed: qt_tablet_target = 0;
0
618}
never executed: }
0
619 -
620 -
621 -
622void QWidgetWindow::handleContextMenuEvent(QContextMenuEvent *e) -
623{ -
624 -
625 -
626 if (e->reason() != QContextMenuEvent::Keyboard)
never evaluated: e->reason() != QContextMenuEvent::Keyboard
0
627 return;
never executed: return;
0
628 -
629 QWidget *fw = QWidget::keyboardGrabber(); -
630 if (!fw) {
never evaluated: !fw
0
631 if (QApplication::activePopupWidget()) {
never evaluated: QApplication::activePopupWidget()
0
632 fw = (QApplication::activePopupWidget()->focusWidget()
never evaluated: QApplication::activePopupWidget()->focusWidget()
0
633 ? QApplication::activePopupWidget()->focusWidget() -
634 : QApplication::activePopupWidget()); -
635 } else if (QApplication::focusWidget()) {
never executed: }
never evaluated: QApplication::focusWidget()
0
636 fw = QApplication::focusWidget(); -
637 } else {
never executed: }
0
638 fw = m_widget; -
639 }
never executed: }
0
640 } -
641 if (fw && fw->isEnabled()) {
never evaluated: fw
never evaluated: fw->isEnabled()
0
642 QPoint pos = fw->inputMethodQuery(Qt::ImMicroFocus).toRect().center(); -
643 QContextMenuEvent widgetEvent(QContextMenuEvent::Keyboard, pos, fw->mapToGlobal(pos), -
644 e->modifiers()); -
645 QGuiApplication::sendSpontaneousEvent(fw, &widgetEvent); -
646 }
never executed: }
0
647}
never executed: }
0
648 -
649 -
650void QWidgetWindow::updateObjectName() -
651{ -
652 QString name = m_widget->objectName(); -
653 if (name.isEmpty())
evaluated: name.isEmpty()
TRUEFALSE
yes
Evaluation Count:3126
yes
Evaluation Count:514
514-3126
654 name = QString::fromUtf8(m_widget->metaObject()->className()) + QString::fromUtf8("" "Class" "", sizeof("Class") - 1);
executed: name = QString::fromUtf8(m_widget->metaObject()->className()) + QString::fromUtf8("" "Class" "", sizeof("Class") - 1);
Execution Count:3126
3126
655 name += QString::fromUtf8("" "Window" "", sizeof("Window") - 1); -
656 setObjectName(name); -
657}
executed: }
Execution Count:3640
3640
658 -
659 -
660 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial