qwidgetwindow.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/widgets/kernel/qwidgetwindow.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7__attribute__((visibility("default"))) extern bool qt_tab_all_widgets();-
8-
9QWidget *qt_button_down = 0;-
10-
11-
12QWidget *qt_popup_down = 0;-
13extern int openPopupCount;-
14bool qt_replay_popup_mouse_event = false;-
15extern bool qt_try_modal(QWidget *widget, QEvent::Type type);-
16-
17class QWidgetWindowPrivate : public QWindowPrivate-
18{-
19 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;-
20public:-
21 QWindow *eventReceiver() override {-
22 QWidgetWindow * const q = q_func();-
23 QWindow *w = q;-
24 while (w->parent()
w->parent()Description
TRUEnever evaluated
FALSEnever evaluated
&& qobject_cast<QWidgetWindow *>(w)
qobject_cast<Q...etWindow *>(w)Description
TRUEnever evaluated
FALSEnever evaluated
&& qobject_cast<QWidgetWindow *>(w->parent())
qobject_cast<Q...>(w->parent())Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
25 w = w->parent();-
26 }
never executed: end of block
0
27 return
never executed: return w;
w;
never executed: return w;
0
28 }-
29-
30 void clearFocusObject() override-
31 {-
32 QWidgetWindow * const q = q_func();-
33 QWidget *widget = q->widget();-
34 if (widget
widgetDescription
TRUEnever evaluated
FALSEnever evaluated
&& widget->focusWidget()
widget->focusWidget()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
35 widget->focusWidget()->clearFocus();
never executed: widget->focusWidget()->clearFocus();
0
36 }
never executed: end of block
0
37-
38 QRectF closestAcceptableGeometry(const QRectF &rect) const override;-
39};-
40-
41QRectF QWidgetWindowPrivate::closestAcceptableGeometry(const QRectF &rect) const-
42{-
43 const QWidgetWindow * const q = q_func();-
44 const QWidget *widget = q->widget();-
45 if (!widget
!widgetDescription
TRUEnever evaluated
FALSEnever evaluated
|| !widget->isWindow()
!widget->isWindow()Description
TRUEnever evaluated
FALSEnever evaluated
|| !widget->hasHeightForWidth()
!widget->hasHeightForWidth()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
46 return
never executed: return QRect();
QRect();
never executed: return QRect();
0
47 const QSize oldSize = rect.size().toSize();-
48 const QSize newSize = QLayout::closestAcceptableSize(widget, oldSize);-
49 if (newSize == oldSize
newSize == oldSizeDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
50 return
never executed: return QRectF();
QRectF();
never executed: return QRectF();
0
51 const int dw = newSize.width() - oldSize.width();-
52 const int dh = newSize.height() - oldSize.height();-
53 QRectF result = rect;-
54 const QRectF currentGeometry(widget->geometry());-
55 const qreal topOffset = result.top() - currentGeometry.top();-
56 const qreal bottomOffset = result.bottom() - currentGeometry.bottom();-
57 if (qAbs(topOffset) > qAbs(bottomOffset)
qAbs(topOffset...(bottomOffset)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
58 result.setTop(result.top() - dh);
never executed: result.setTop(result.top() - dh);
0
59 else-
60 result.setBottom(result.bottom() + dh);
never executed: result.setBottom(result.bottom() + dh);
0
61 const qreal leftOffset = result.left() - currentGeometry.left();-
62 const qreal rightOffset = result.right() - currentGeometry.right();-
63 if (qAbs(leftOffset) > qAbs(rightOffset)
qAbs(leftOffse...s(rightOffset)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
64 result.setLeft(result.left() - dw);
never executed: result.setLeft(result.left() - dw);
0
65 else-
66 result.setRight(result.right() + dw);
never executed: result.setRight(result.right() + dw);
0
67 return
never executed: return result;
result;
never executed: return result;
0
68}-
69-
70QWidgetWindow::QWidgetWindow(QWidget *widget)-
71 : QWindow(*new QWidgetWindowPrivate(), 0)-
72 , m_widget(widget)-
73{-
74 updateObjectName();-
75-
76-
77 if (QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::RasterGLSurface)
QGuiApplicatio...sterGLSurface)Description
TRUEnever evaluated
FALSEnever evaluated
0
78 && !QApplication::testAttribute(Qt::AA_ForceRasterWidgets)
!QApplication:...RasterWidgets)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
79 setSurfaceType(QSurface::RasterGLSurface);-
80 }
never executed: end of block
0
81 connect(widget, &QObject::objectNameChanged, this, &QWidgetWindow::updateObjectName);-
82 connect(this, qFlagLocation("2""screenChanged(QScreen*)" "\0" __FILE__ ":" "133"), this, qFlagLocation("1""handleScreenChange()" "\0" __FILE__ ":" "133"));-
83}
never executed: end of block
0
84-
85QWidgetWindow::~QWidgetWindow()-
86{-
87}-
88-
89-
90QAccessibleInterface *QWidgetWindow::accessibleRoot() const-
91{-
92 if (m_widget
m_widgetDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
93 return
never executed: return QAccessible::queryAccessibleInterface(m_widget);
QAccessible::queryAccessibleInterface(m_widget);
never executed: return QAccessible::queryAccessibleInterface(m_widget);
0
94 return
never executed: return 0;
0;
never executed: return 0;
0
95}-
96-
97-
98QObject *QWidgetWindow::focusObject() const-
99{-
100 QWidget *windowWidget = m_widget;-
101 if (!windowWidget
!windowWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
102 return
never executed: return nullptr;
nullptr;
never executed: return nullptr;
0
103-
104 QWidget *widget = windowWidget->focusWidget();-
105-
106 if (!widget
!widgetDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
107 widget = windowWidget;
never executed: widget = windowWidget;
0
108-
109 QObject *focusObj = QWidgetPrivate::get(widget)->focusObject();-
110 if (focusObj
focusObjDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
111 return
never executed: return focusObj;
focusObj;
never executed: return focusObj;
0
112-
113 return
never executed: return widget;
widget;
never executed: return widget;
0
114}-
115-
116static inline bool shouldBePropagatedToWidget(QEvent *event)-
117{-
118 switch (event->type()) {-
119-
120 case
never executed: case QEvent::Show:
QEvent::Show:
never executed: case QEvent::Show:
0
121 case
never executed: case QEvent::Hide:
QEvent::Hide:
never executed: case QEvent::Hide:
0
122 case
never executed: case QEvent::Timer:
QEvent::Timer:
never executed: case QEvent::Timer:
0
123 case
never executed: case QEvent::DynamicPropertyChange:
QEvent::DynamicPropertyChange:
never executed: case QEvent::DynamicPropertyChange:
0
124 case
never executed: case QEvent::ChildAdded:
QEvent::ChildAdded:
never executed: case QEvent::ChildAdded:
0
125 case
never executed: case QEvent::ChildRemoved:
QEvent::ChildRemoved:
never executed: case QEvent::ChildRemoved:
0
126 return
never executed: return false;
false;
never executed: return false;
0
127 default
never executed: default:
:
never executed: default:
0
128 return
never executed: return true;
true;
never executed: return true;
0
129 }-
130}-
131-
132bool QWidgetWindow::event(QEvent *event)-
133{-
134 if (!m_widget
!m_widgetDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
135 return
never executed: return QWindow::event(event);
QWindow::event(event);
never executed: return QWindow::event(event);
0
136-
137 if (m_widget->testAttribute(Qt::WA_DontShowOnScreen)
m_widget->test...tShowOnScreen)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
138-
139-
140 if (!shouldBePropagatedToWidget(event)
!shouldBePropa...oWidget(event)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
141 return
never executed: return true;
true;
never executed: return true;
0
142 return
never executed: return QCoreApplication::sendEvent(m_widget, event);
QCoreApplication::sendEvent(m_widget, event);
never executed: return QCoreApplication::sendEvent(m_widget, event);
0
143 }-
144-
145 switch (event->type()) {-
146 case
never executed: case QEvent::Close:
QEvent::Close:
never executed: case QEvent::Close:
0
147 handleCloseEvent(static_cast<QCloseEvent *>(event));-
148 return
never executed: return true;
true;
never executed: return true;
0
149-
150 case
never executed: case QEvent::Enter:
QEvent::Enter:
never executed: case QEvent::Enter:
0
151 case
never executed: case QEvent::Leave:
QEvent::Leave:
never executed: case QEvent::Leave:
0
152 handleEnterLeaveEvent(event);-
153 return
never executed: return true;
true;
never executed: return true;
0
154-
155-
156-
157 case
never executed: case QEvent::FocusIn:
QEvent::FocusIn:
never executed: case QEvent::FocusIn:
0
158 handleFocusInEvent(static_cast<QFocusEvent *>(event));-
159-
160 case
never executed: case QEvent::FocusOut:
QEvent::FocusOut:
never executed: case QEvent::FocusOut:
code before this statement never executed: case QEvent::FocusOut:
{
0
161-
162 QAccessible::State state;-
163 state.active = true;-
164 QAccessibleStateChangeEvent ev(m_widget, state);-
165 QAccessible::updateAccessibility(&ev);-
166-
167 return
never executed: return false;
false;
never executed: return false;
}
0
168-
169 case
never executed: case QEvent::FocusAboutToChange:
QEvent::FocusAboutToChange:
never executed: case QEvent::FocusAboutToChange:
0
170 if (QApplicationPrivate::focus_widget
QApplicationPr...::focus_widgetDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
171 if (QApplicationPrivate::focus_widget->testAttribute(Qt::WA_InputMethodEnabled)
QApplicationPr...MethodEnabled)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
172 QGuiApplication::inputMethod()->commit();
never executed: QGuiApplication::inputMethod()->commit();
0
173-
174 QGuiApplication::sendSpontaneousEvent(QApplicationPrivate::focus_widget, event);-
175 }
never executed: end of block
0
176 return
never executed: return true;
true;
never executed: return true;
0
177-
178 case
never executed: case QEvent::KeyPress:
QEvent::KeyPress:
never executed: case QEvent::KeyPress:
0
179 case
never executed: case QEvent::KeyRelease:
QEvent::KeyRelease:
never executed: case QEvent::KeyRelease:
0
180 case
never executed: case QEvent::ShortcutOverride:
QEvent::ShortcutOverride:
never executed: case QEvent::ShortcutOverride:
0
181 handleKeyEvent(static_cast<QKeyEvent *>(event));-
182 return
never executed: return true;
true;
never executed: return true;
0
183-
184 case
never executed: case QEvent::MouseMove:
QEvent::MouseMove:
never executed: case QEvent::MouseMove:
0
185 case
never executed: case QEvent::MouseButtonPress:
QEvent::MouseButtonPress:
never executed: case QEvent::MouseButtonPress:
0
186 case
never executed: case QEvent::MouseButtonRelease:
QEvent::MouseButtonRelease:
never executed: case QEvent::MouseButtonRelease:
0
187 case
never executed: case QEvent::MouseButtonDblClick:
QEvent::MouseButtonDblClick:
never executed: case QEvent::MouseButtonDblClick:
0
188 handleMouseEvent(static_cast<QMouseEvent *>(event));-
189 return
never executed: return true;
true;
never executed: return true;
0
190-
191 case
never executed: case QEvent::NonClientAreaMouseMove:
QEvent::NonClientAreaMouseMove:
never executed: case QEvent::NonClientAreaMouseMove:
0
192 case
never executed: case QEvent::NonClientAreaMouseButtonPress:
QEvent::NonClientAreaMouseButtonPress:
never executed: case QEvent::NonClientAreaMouseButtonPress:
0
193 case
never executed: case QEvent::NonClientAreaMouseButtonRelease:
QEvent::NonClientAreaMouseButtonRelease:
never executed: case QEvent::NonClientAreaMouseButtonRelease:
0
194 case
never executed: case QEvent::NonClientAreaMouseButtonDblClick:
QEvent::NonClientAreaMouseButtonDblClick:
never executed: case QEvent::NonClientAreaMouseButtonDblClick:
0
195 handleNonClientAreaMouseEvent(static_cast<QMouseEvent *>(event));-
196 return
never executed: return true;
true;
never executed: return true;
0
197-
198 case
never executed: case QEvent::TouchBegin:
QEvent::TouchBegin:
never executed: case QEvent::TouchBegin:
0
199 case
never executed: case QEvent::TouchUpdate:
QEvent::TouchUpdate:
never executed: case QEvent::TouchUpdate:
0
200 case
never executed: case QEvent::TouchEnd:
QEvent::TouchEnd:
never executed: case QEvent::TouchEnd:
0
201 case
never executed: case QEvent::TouchCancel:
QEvent::TouchCancel:
never executed: case QEvent::TouchCancel:
0
202 handleTouchEvent(static_cast<QTouchEvent *>(event));-
203 return
never executed: return true;
true;
never executed: return true;
0
204-
205 case
never executed: case QEvent::Move:
QEvent::Move:
never executed: case QEvent::Move:
0
206 handleMoveEvent(static_cast<QMoveEvent *>(event));-
207 return
never executed: return true;
true;
never executed: return true;
0
208-
209 case
never executed: case QEvent::Resize:
QEvent::Resize:
never executed: case QEvent::Resize:
0
210 handleResizeEvent(static_cast<QResizeEvent *>(event));-
211 return
never executed: return true;
true;
never executed: return true;
0
212-
213-
214 case
never executed: case QEvent::Wheel:
QEvent::Wheel:
never executed: case QEvent::Wheel:
0
215 handleWheelEvent(static_cast<QWheelEvent *>(event));-
216 return
never executed: return true;
true;
never executed: return true;
0
217-
218-
219-
220 case
never executed: case QEvent::DragEnter:
QEvent::DragEnter:
never executed: case QEvent::DragEnter:
0
221 case
never executed: case QEvent::DragMove:
QEvent::DragMove:
never executed: case QEvent::DragMove:
0
222 handleDragEnterMoveEvent(static_cast<QDragMoveEvent *>(event));-
223 return
never executed: return true;
true;
never executed: return true;
0
224 case
never executed: case QEvent::DragLeave:
QEvent::DragLeave:
never executed: case QEvent::DragLeave:
0
225 handleDragLeaveEvent(static_cast<QDragLeaveEvent *>(event));-
226 return
never executed: return true;
true;
never executed: return true;
0
227 case
never executed: case QEvent::Drop:
QEvent::Drop:
never executed: case QEvent::Drop:
0
228 handleDropEvent(static_cast<QDropEvent *>(event));-
229 return
never executed: return true;
true;
never executed: return true;
0
230-
231-
232 case
never executed: case QEvent::Expose:
QEvent::Expose:
never executed: case QEvent::Expose:
0
233 handleExposeEvent(static_cast<QExposeEvent *>(event));-
234 return
never executed: return true;
true;
never executed: return true;
0
235-
236 case
never executed: case QEvent::WindowStateChange:
QEvent::WindowStateChange:
never executed: case QEvent::WindowStateChange:
0
237 handleWindowStateChangedEvent(static_cast<QWindowStateChangeEvent *>(event));-
238 return
never executed: return true;
true;
never executed: return true;
0
239-
240 case
never executed: case QEvent::ThemeChange:
QEvent::ThemeChange:
never executed: case QEvent::ThemeChange:
{
0
241 QEvent widgetEvent(QEvent::ThemeChange);-
242 QGuiApplication::sendSpontaneousEvent(m_widget, &widgetEvent);-
243 }-
244 return
never executed: return true;
true;
never executed: return true;
0
245-
246-
247 case
never executed: case QEvent::TabletPress:
QEvent::TabletPress:
never executed: case QEvent::TabletPress:
0
248 case
never executed: case QEvent::TabletMove:
QEvent::TabletMove:
never executed: case QEvent::TabletMove:
0
249 case
never executed: case QEvent::TabletRelease:
QEvent::TabletRelease:
never executed: case QEvent::TabletRelease:
0
250 handleTabletEvent(static_cast<QTabletEvent *>(event));-
251 return
never executed: return true;
true;
never executed: return true;
0
252-
253-
254-
255 case
never executed: case QEvent::NativeGesture:
QEvent::NativeGesture:
never executed: case QEvent::NativeGesture:
0
256 handleGestureEvent(static_cast<QNativeGestureEvent *>(event));-
257 return
never executed: return true;
true;
never executed: return true;
0
258-
259-
260-
261 case
never executed: case QEvent::ContextMenu:
QEvent::ContextMenu:
never executed: case QEvent::ContextMenu:
0
262 handleContextMenuEvent(static_cast<QContextMenuEvent *>(event));-
263 return
never executed: return true;
true;
never executed: return true;
0
264-
265-
266 case
never executed: case QEvent::WindowBlocked:
QEvent::WindowBlocked:
never executed: case QEvent::WindowBlocked:
0
267 qt_button_down = 0;-
268 break;
never executed: break;
0
269-
270 case
never executed: case QEvent::UpdateRequest:
QEvent::UpdateRequest:
never executed: case QEvent::UpdateRequest:
0
271-
272-
273 m_widget->repaint();-
274 return
never executed: return true;
true;
never executed: return true;
0
275-
276 default
never executed: default:
:
never executed: default:
0
277 break;
never executed: break;
0
278 }-
279-
280 if (shouldBePropagatedToWidget(event)
shouldBePropag...oWidget(event)Description
TRUEnever evaluated
FALSEnever evaluated
&& QCoreApplication::sendEvent(m_widget, event)
QCoreApplicati...widget, event)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
281 return
never executed: return true;
true;
never executed: return true;
0
282-
283 return
never executed: return QWindow::event(event);
QWindow::event(event);
never executed: return QWindow::event(event);
0
284}-
285-
286QPointer<QWidget> qt_last_mouse_receiver = 0;-
287-
288void QWidgetWindow::handleEnterLeaveEvent(QEvent *event)-
289{-
290-
291-
292-
293-
294-
295 if (QApplicationPrivate::inPopupMode()
QApplicationPr...:inPopupMode()Description
TRUEnever evaluated
FALSEnever evaluated
&& m_widget != QApplication::activePopupWidget()
m_widget != QA...ePopupWidget()Description
TRUEnever evaluated
FALSEnever evaluated
&& !m_widget->underMouse()
!m_widget->underMouse()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
296 return;
never executed: return;
0
297-
298 if (event->type() == QEvent::Leave
event->type() == QEvent::LeaveDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
299 QWidget *enter = 0;-
300-
301-
302-
303 QWindowSystemInterfacePrivate::EnterEvent *systemEvent =-
304 static_cast<QWindowSystemInterfacePrivate::EnterEvent *>-
305 (QWindowSystemInterfacePrivate::peekWindowSystemEvent(QWindowSystemInterfacePrivate::Enter));-
306 const QPointF globalPosF = systemEvent
systemEventDescription
TRUEnever evaluated
FALSEnever evaluated
? systemEvent->globalPos : QGuiApplicationPrivate::lastCursorPosition;
0
307 if (systemEvent
systemEventDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
308 if (QWidgetWindow *enterWindow = qobject_cast<QWidgetWindow *>(systemEvent->enter)
QWidgetWindow ...mEvent->enter)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
309 {-
310 QWindow *thisParent = this;-
311 QWindow *enterParent = enterWindow;-
312 while (thisParent->parent()
thisParent->parent()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
313 thisParent = thisParent->parent();
never executed: thisParent = thisParent->parent();
0
314 while (enterParent->parent()
enterParent->parent()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
315 enterParent = enterParent->parent();
never executed: enterParent = enterParent->parent();
0
316 if (thisParent == enterParent
thisParent == enterParentDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
317 QGuiApplicationPrivate::currentMouseWindow = enterWindow;-
318 enter = enterWindow->widget();-
319 QWindowSystemInterfacePrivate::removeWindowSystemEvent(systemEvent);-
320 }
never executed: end of block
0
321 }
never executed: end of block
0
322 }
never executed: end of block
0
323-
324-
325-
326 if (!enter
!enterDescription
TRUEnever evaluated
FALSEnever evaluated
|| !QWidget::mouseGrabber()
!QWidget::mouseGrabber()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
327-
328-
329 QWidget *leave = m_widget;-
330 if (qt_last_mouse_receiver
qt_last_mouse_receiverDescription
TRUEnever evaluated
FALSEnever evaluated
&& !qt_last_mouse_receiver->internalWinId()
!qt_last_mouse...nternalWinId()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
331 leave = qt_last_mouse_receiver.data();
never executed: leave = qt_last_mouse_receiver.data();
0
332 QApplicationPrivate::dispatchEnterLeave(enter, leave, globalPosF);-
333 qt_last_mouse_receiver = enter;-
334 }
never executed: end of block
0
335 }
never executed: end of block
else {
0
336 const QEnterEvent *ee = static_cast<QEnterEvent *>(event);-
337 QWidget *child = m_widget->childAt(ee->pos());-
338 QWidget *receiver = child
childDescription
TRUEnever evaluated
FALSEnever evaluated
? child : m_widget.data();
0
339 QWidget *leave = nullptr;-
340 if (QApplicationPrivate::inPopupMode()
QApplicationPr...:inPopupMode()Description
TRUEnever evaluated
FALSEnever evaluated
&& receiver == m_widget
receiver == m_widgetDescription
TRUEnever evaluated
FALSEnever evaluated
0
341 && qt_last_mouse_receiver != m_widget
qt_last_mouse_...er != m_widgetDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
342-
343-
344 leave = qt_last_mouse_receiver;-
345 }
never executed: end of block
0
346 QApplicationPrivate::dispatchEnterLeave(receiver, leave, ee->screenPos());-
347 qt_last_mouse_receiver = receiver;-
348 }
never executed: end of block
0
349}-
350-
351QWidget *QWidgetWindow::getFocusWidget(FocusWidgets fw)-
352{-
353 QWidget *tlw = m_widget;-
354 QWidget *w = tlw->nextInFocusChain();-
355-
356 QWidget *last = tlw;-
357-
358 uint focus_flag = qt_tab_all_widgets()
qt_tab_all_widgets()Description
TRUEnever evaluated
FALSEnever evaluated
? Qt::TabFocus : Qt::StrongFocus;
0
359-
360 while (w != tlw
w != tlwDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
361 {-
362 if (((
((w->focusPoli...== focus_flag)Description
TRUEnever evaluated
FALSEnever evaluated
w->focusPolicy() & focus_flag) == focus_flag)
((w->focusPoli...== focus_flag)Description
TRUEnever evaluated
FALSEnever evaluated
0
363 && w->isVisibleTo(m_widget)
w->isVisibleTo(m_widget)Description
TRUEnever evaluated
FALSEnever evaluated
&& w->isEnabled()
w->isEnabled()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
364 {-
365 last = w;-
366 if (fw == FirstFocusWidget
fw == FirstFocusWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
367 break;
never executed: break;
0
368 }
never executed: end of block
0
369 w = w->nextInFocusChain();-
370 }
never executed: end of block
0
371-
372 return
never executed: return last;
last;
never executed: return last;
0
373}-
374-
375void QWidgetWindow::handleFocusInEvent(QFocusEvent *e)-
376{-
377 QWidget *focusWidget = 0;-
378 if (e->reason() == Qt::BacktabFocusReason
e->reason() ==...tabFocusReasonDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
379 focusWidget = getFocusWidget(LastFocusWidget);
never executed: focusWidget = getFocusWidget(LastFocusWidget);
0
380 else if (e->reason() == Qt::TabFocusReason
e->reason() ==...TabFocusReasonDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
381 focusWidget = getFocusWidget(FirstFocusWidget);
never executed: focusWidget = getFocusWidget(FirstFocusWidget);
0
382-
383 if (focusWidget != 0
focusWidget != 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
384 focusWidget->setFocus();
never executed: focusWidget->setFocus();
0
385}
never executed: end of block
0
386-
387void QWidgetWindow::handleNonClientAreaMouseEvent(QMouseEvent *e)-
388{-
389 QApplication::sendSpontaneousEvent(m_widget, e);-
390}
never executed: end of block
0
391-
392void QWidgetWindow::handleMouseEvent(QMouseEvent *event)-
393{-
394 static const QEvent::Type contextMenuTrigger =-
395 QGuiApplicationPrivate::platformTheme()->themeHint(QPlatformTheme::ContextMenuOnMouseRelease).toBool() ?-
396 QEvent::MouseButtonRelease : QEvent::MouseButtonPress;-
397 if ((static_cast<
(static_cast<Q...>inPopupMode()Description
TRUEnever evaluated
FALSEnever evaluated
QApplication *>(QCoreApplication::instance()))->d_func()->inPopupMode()
(static_cast<Q...>inPopupMode()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
398 QWidget *activePopupWidget = (static_cast<QApplication *>(QCoreApplication::instance()))->activePopupWidget();-
399 QPoint mapped = event->pos();-
400 if (activePopupWidget != m_widget
activePopupWidget != m_widgetDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
401 mapped = activePopupWidget->mapFromGlobal(event->globalPos());
never executed: mapped = activePopupWidget->mapFromGlobal(event->globalPos());
0
402 bool releaseAfter = false;-
403 QWidget *popupChild = activePopupWidget->childAt(mapped);-
404-
405 if (activePopupWidget != qt_popup_down
activePopupWid... qt_popup_downDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
406 qt_button_down = 0;-
407 qt_popup_down = 0;-
408 }
never executed: end of block
0
409-
410 switch (event->type()) {-
411 case
never executed: case QEvent::MouseButtonPress:
QEvent::MouseButtonPress:
never executed: case QEvent::MouseButtonPress:
0
412 case
never executed: case QEvent::MouseButtonDblClick:
QEvent::MouseButtonDblClick:
never executed: case QEvent::MouseButtonDblClick:
0
413 qt_button_down = popupChild;-
414 qt_popup_down = activePopupWidget;-
415 break;
never executed: break;
0
416 case
never executed: case QEvent::MouseButtonRelease:
QEvent::MouseButtonRelease:
never executed: case QEvent::MouseButtonRelease:
0
417 releaseAfter = true;-
418 break;
never executed: break;
0
419 default
never executed: default:
:
never executed: default:
0
420 break;
never executed: break;
0
421 }-
422-
423 int oldOpenPopupCount = openPopupCount;-
424-
425 if (activePopupWidget->isEnabled()
activePopupWidget->isEnabled()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
426-
427 qt_replay_popup_mouse_event = false;-
428 QWidget *receiver = activePopupWidget;-
429 QPoint widgetPos = mapped;-
430 if (qt_button_down
qt_button_downDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
431 receiver = qt_button_down;
never executed: receiver = qt_button_down;
0
432 else if (popupChild
popupChildDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
433 receiver = popupChild;
never executed: receiver = popupChild;
0
434 if (receiver != activePopupWidget
receiver != activePopupWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
435 widgetPos = receiver->mapFromGlobal(event->globalPos());
never executed: widgetPos = receiver->mapFromGlobal(event->globalPos());
0
436-
437-
438 const bool reallyUnderMouse = activePopupWidget->rect().contains(mapped);-
439 const bool underMouse = activePopupWidget->underMouse();-
440 if (underMouse != reallyUnderMouse
underMouse != reallyUnderMouseDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
441 if (reallyUnderMouse
reallyUnderMouseDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
442 const QPoint receiverMapped = receiver->mapFromGlobal(event->screenPos().toPoint());-
443-
444-
445 if (receiverMapped.x() >= 0
receiverMapped.x() >= 0Description
TRUEnever evaluated
FALSEnever evaluated
&& receiverMapped.y() >= 0
receiverMapped.y() >= 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
446 QApplicationPrivate::dispatchEnterLeave(receiver, nullptr, event->screenPos());-
447 qt_last_mouse_receiver = receiver;-
448 }
never executed: end of block
0
449 }
never executed: end of block
else {
0
450 QApplicationPrivate::dispatchEnterLeave(nullptr, qt_last_mouse_receiver, event->screenPos());-
451 qt_last_mouse_receiver = receiver;-
452 receiver = activePopupWidget;-
453 }
never executed: end of block
0
454 }-
455-
456-
457 QMouseEvent e(event->type(), widgetPos, event->windowPos(), event->screenPos(),-
458 event->button(), event->buttons(), event->modifiers(), event->source());-
459 e.setTimestamp(event->timestamp());-
460 QApplicationPrivate::sendMouseEvent(receiver, &e, receiver, receiver->window(), &qt_button_down, qt_last_mouse_receiver);-
461 qt_last_mouse_receiver = receiver;-
462 }
never executed: end of block
else {
0
463-
464 switch (event->type()) {-
465 case
never executed: case QEvent::MouseButtonPress:
QEvent::MouseButtonPress:
never executed: case QEvent::MouseButtonPress:
0
466 case
never executed: case QEvent::MouseButtonDblClick:
QEvent::MouseButtonDblClick:
never executed: case QEvent::MouseButtonDblClick:
0
467 case
never executed: case QEvent::MouseButtonRelease:
QEvent::MouseButtonRelease:
never executed: case QEvent::MouseButtonRelease:
0
468 activePopupWidget->close();-
469 break;
never executed: break;
0
470 default
never executed: default:
:
never executed: default:
0
471 break;
never executed: break;
0
472 }-
473 }-
474-
475 if ((static_cast<
(static_cast<Q...ivePopupWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
QApplication *>(QCoreApplication::instance()))->activePopupWidget() != activePopupWidget
(static_cast<Q...ivePopupWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
0
476 && qt_replay_popup_mouse_event
qt_replay_popup_mouse_eventDescription
TRUEnever evaluated
FALSEnever evaluated
0
477 && QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::ReplayMousePressOutsidePopup).toBool()
QGuiApplicatio...opup).toBool()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
478 if (m_widget->windowType() != Qt::Popup
m_widget->wind...) != Qt::PopupDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
479 qt_button_down = 0;
never executed: qt_button_down = 0;
0
480 if (event->type() == QEvent::MouseButtonPress
event->type() ...useButtonPressDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
481-
482 QWidget *w = QApplication::widgetAt(event->globalPos());-
483 if (w
wDescription
TRUEnever evaluated
FALSEnever evaluated
&& !QApplicationPrivate::isBlockedByModal(w)
!QApplicationP...ckedByModal(w)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
484-
485 if (!w->isActiveWindow()
!w->isActiveWindow()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
486 w->activateWindow();-
487 w->window()->raise();-
488 }
never executed: end of block
0
489-
490 QWindow *win = w->windowHandle();-
491 if (!win
!winDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
492 win = w->nativeParentWidget()->windowHandle();
never executed: win = w->nativeParentWidget()->windowHandle();
0
493 if (win
winDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
494 const QRect globalGeometry = win->isTopLevel()
win->isTopLevel()Description
TRUEnever evaluated
FALSEnever evaluated
0
495 ? win->geometry()-
496 : QRect(win->mapToGlobal(QPoint(0, 0)), win->size());-
497 if (globalGeometry.contains(event->globalPos())
globalGeometry...->globalPos())Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
498-
499 const QPoint localPos = win->mapFromGlobal(event->globalPos());-
500 QMouseEvent *e = new QMouseEvent(QEvent::MouseButtonPress, localPos, localPos, event->globalPos(),-
501 event->button(), event->buttons(), event->modifiers(), event->source());-
502 QCoreApplicationPrivate::setEventSpontaneous(e, true);-
503 e->setTimestamp(event->timestamp());-
504 QCoreApplication::postEvent(win, e);-
505 }
never executed: end of block
0
506 }
never executed: end of block
0
507 }
never executed: end of block
0
508 }
never executed: end of block
0
509 qt_replay_popup_mouse_event = false;-
510-
511 }
never executed: end of block
else if (event->type() == contextMenuTrigger
event->type() ...extMenuTriggerDescription
TRUEnever evaluated
FALSEnever evaluated
0
512 && event->button() == Qt::RightButton
event->button(...t::RightButtonDescription
TRUEnever evaluated
FALSEnever evaluated
0
513 && (
(openPopupCoun...penPopupCount)Description
TRUEnever evaluated
FALSEnever evaluated
openPopupCount == oldOpenPopupCount)
(openPopupCoun...penPopupCount)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
514 QWidget *popupEvent = activePopupWidget;-
515 if (qt_button_down
qt_button_downDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
516 popupEvent = qt_button_down;
never executed: popupEvent = qt_button_down;
0
517 else if(popupChild
popupChildDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
518 popupEvent = popupChild;
never executed: popupEvent = popupChild;
0
519 QContextMenuEvent e(QContextMenuEvent::Mouse, mapped, event->globalPos(), event->modifiers());-
520 QApplication::sendSpontaneousEvent(popupEvent, &e);-
521 }
never executed: end of block
0
522-
523-
524-
525-
526-
527-
528 if (releaseAfter
releaseAfterDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
529 qt_button_down = 0;-
530 qt_popup_down = 0;-
531 }
never executed: end of block
0
532 return;
never executed: return;
0
533 }-
534-
535-
536 if (QApplicationPrivate::instance()->modalState()
QApplicationPr...->modalState()Description
TRUEnever evaluated
FALSEnever evaluated
&& !qt_try_modal(m_widget, event->type())
!qt_try_modal(...event->type())Description
TRUEnever evaluated
FALSEnever evaluated
)
0
537 return;
never executed: return;
0
538-
539-
540 QWidget *widget = m_widget->childAt(event->pos());-
541 QPoint mapped = event->pos();-
542-
543 if (!widget
!widgetDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
544 widget = m_widget;
never executed: widget = m_widget;
0
545-
546 if (event->type() == QEvent::MouseButtonPress
event->type() ...useButtonPressDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
547 qt_button_down = widget;
never executed: qt_button_down = widget;
0
548-
549 QWidget *receiver = QApplicationPrivate::pickMouseReceiver(m_widget, event->windowPos().toPoint(), &mapped, event->type(), event->buttons(),-
550 qt_button_down, widget);-
551-
552 if (!receiver
!receiverDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
553 if (event->type() == QEvent::MouseButtonRelease
event->type() ...eButtonReleaseDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
554 QApplicationPrivate::mouse_buttons &= ~event->button();
never executed: QApplicationPrivate::mouse_buttons &= ~event->button();
0
555 return;
never executed: return;
0
556 }-
557 if ((
(event->type()...seButtonPress)Description
TRUEnever evaluated
FALSEnever evaluated
event->type() != QEvent::MouseButtonPress)
(event->type()...seButtonPress)Description
TRUEnever evaluated
FALSEnever evaluated
0
558 || !(event->flags().testFlag(Qt::MouseEventCreatedDoubleClick))
!(event->flags...dDoubleClick))Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
559-
560-
561-
562 QMouseEvent translated(event->type(), mapped, event->windowPos(), event->screenPos(),-
563 event->button(), event->buttons(), event->modifiers(), event->source());-
564 translated.setTimestamp(event->timestamp());-
565 QApplicationPrivate::sendMouseEvent(receiver, &translated, widget, m_widget,-
566 &qt_button_down, qt_last_mouse_receiver);-
567 event->setAccepted(translated.isAccepted());-
568 }
never executed: end of block
0
569-
570 if (event->type() == contextMenuTrigger
event->type() ...extMenuTriggerDescription
TRUEnever evaluated
FALSEnever evaluated
&& event->button() == Qt::RightButton
event->button(...t::RightButtonDescription
TRUEnever evaluated
FALSEnever evaluated
0
571 && m_widget->rect().contains(event->pos())
m_widget->rect...(event->pos())Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
572 QContextMenuEvent e(QContextMenuEvent::Mouse, mapped, event->globalPos(), event->modifiers());-
573 QGuiApplication::sendSpontaneousEvent(receiver, &e);-
574 }
never executed: end of block
0
575-
576}
never executed: end of block
0
577-
578void QWidgetWindow::handleTouchEvent(QTouchEvent *event)-
579{-
580 if (event->type() == QEvent::TouchCancel
event->type() ...t::TouchCancelDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
581 QApplicationPrivate::translateTouchCancel(event->device(), event->timestamp());-
582 event->accept();-
583 }
never executed: end of block
else if ((static_cast<
(static_cast<Q...>inPopupMode()Description
TRUEnever evaluated
FALSEnever evaluated
QApplication *>(QCoreApplication::instance()))->d_func()->inPopupMode()
(static_cast<Q...>inPopupMode()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
584-
585-
586 event->ignore();-
587 }
never executed: end of block
else {
0
588 event->setAccepted(QApplicationPrivate::translateRawTouchEvent(m_widget, event->device(), event->touchPoints(), event->timestamp()));-
589 }
never executed: end of block
0
590}-
591-
592void QWidgetWindow::handleKeyEvent(QKeyEvent *event)-
593{-
594 if (QApplicationPrivate::instance()->modalState()
QApplicationPr...->modalState()Description
TRUEnever evaluated
FALSEnever evaluated
&& !qt_try_modal(m_widget, event->type())
!qt_try_modal(...event->type())Description
TRUEnever evaluated
FALSEnever evaluated
)
0
595 return;
never executed: return;
0
596-
597 QObject *receiver = QWidget::keyboardGrabber();-
598 if (!receiver
!receiverDescription
TRUEnever evaluated
FALSEnever evaluated
&& QApplicationPrivate::inPopupMode()
QApplicationPr...:inPopupMode()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
599 QWidget *popup = QApplication::activePopupWidget();-
600 QWidget *popupFocusWidget = popup->focusWidget();-
601 receiver = popupFocusWidget
popupFocusWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
? popupFocusWidget : popup;
0
602 }
never executed: end of block
0
603 if (!receiver
!receiverDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
604 receiver = focusObject();
never executed: receiver = focusObject();
0
605 QGuiApplication::sendSpontaneousEvent(receiver, event);-
606}
never executed: end of block
0
607-
608bool QWidgetWindow::updateSize()-
609{-
610 bool changed = false;-
611 if (m_widget->testAttribute(Qt::WA_OutsideWSRange)
m_widget->test...utsideWSRange)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
612 return
never executed: return changed;
changed;
never executed: return changed;
0
613 if (m_widget->data->crect.size() != geometry().size()
m_widget->data...metry().size()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
614 changed = true;-
615 m_widget->data->crect.setSize(geometry().size());-
616 }
never executed: end of block
0
617-
618 updateMargins();-
619 return
never executed: return changed;
changed;
never executed: return changed;
0
620}-
621-
622bool QWidgetWindow::updatePos()-
623{-
624 bool changed = false;-
625 if (m_widget->testAttribute(Qt::WA_OutsideWSRange)
m_widget->test...utsideWSRange)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
626 return
never executed: return changed;
changed;
never executed: return changed;
0
627 if (m_widget->data->crect.topLeft() != geometry().topLeft()
m_widget->data...ry().topLeft()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
628 changed = true;-
629 m_widget->data->crect.moveTopLeft(geometry().topLeft());-
630 }
never executed: end of block
0
631 updateMargins();-
632 return
never executed: return changed;
changed;
never executed: return changed;
0
633}-
634-
635void QWidgetWindow::updateMargins()-
636{-
637 const QMargins margins = frameMargins();-
638 QTLWExtra *te = m_widget->d_func()->topData();-
639 te->posIncludesFrame= false;-
640 te->frameStrut.setCoords(margins.left(), margins.top(), margins.right(), margins.bottom());-
641 m_widget->data->fstrut_dirty = false;-
642}
never executed: end of block
0
643-
644static void sendScreenChangeRecursively(QWidget *widget)-
645{-
646 QEvent e(QEvent::ScreenChangeInternal);-
647 QApplication::sendEvent(widget, &e);-
648 QWidgetPrivate *d = QWidgetPrivate::get(widget);-
649 for (int i = 0; i < d->children.size()
i < d->children.size()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
650 QWidget *w = qobject_cast<QWidget *>(d->children.at(i));-
651 if (w
wDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
652 sendScreenChangeRecursively(w);
never executed: sendScreenChangeRecursively(w);
0
653 }
never executed: end of block
0
654}
never executed: end of block
0
655-
656void QWidgetWindow::handleScreenChange()-
657{-
658-
659 sendScreenChangeRecursively(m_widget);-
660-
661-
662 if (screen()
screen()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
663 repaintWindow();
never executed: repaintWindow();
0
664}
never executed: end of block
0
665-
666void QWidgetWindow::repaintWindow()-
667{-
668 if (!m_widget->isVisible()
!m_widget->isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
|| !m_widget->updatesEnabled()
!m_widget->updatesEnabled()Description
TRUEnever evaluated
FALSEnever evaluated
|| !m_widget->rect().isValid()
!m_widget->rect().isValid()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
669 return;
never executed: return;
0
670-
671 QTLWExtra *tlwExtra = m_widget->window()->d_func()->maybeTopData();-
672 if (tlwExtra
tlwExtraDescription
TRUEnever evaluated
FALSEnever evaluated
&& !tlwExtra->inTopLevelResize
!tlwExtra->inTopLevelResizeDescription
TRUEnever evaluated
FALSEnever evaluated
&& tlwExtra->backingStore
tlwExtra->backingStoreDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
673 tlwExtra->backingStoreTracker->markDirty(m_widget->rect(), m_widget,
never executed: tlwExtra->backingStoreTracker->markDirty(m_widget->rect(), m_widget, QWidgetBackingStore::UpdateNow, QWidgetBackingStore::BufferInvalid);
0
674 QWidgetBackingStore::UpdateNow, QWidgetBackingStore::BufferInvalid);
never executed: tlwExtra->backingStoreTracker->markDirty(m_widget->rect(), m_widget, QWidgetBackingStore::UpdateNow, QWidgetBackingStore::BufferInvalid);
0
675}
never executed: end of block
0
676-
677Qt::WindowState effectiveState(Qt::WindowStates state);-
678-
679-
680void QWidgetWindow::updateNormalGeometry()-
681{-
682 QTLWExtra *tle = m_widget->d_func()->maybeTopData();-
683 if (!tle
!tleDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
684 return;
never executed: return;
0
685-
686 QRect normalGeometry;-
687 if (const
const QPlatfor...*pw = handle()Description
TRUEnever evaluated
FALSEnever evaluated
QPlatformWindow *pw = handle()
const QPlatfor...*pw = handle()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
688 normalGeometry = QHighDpi::fromNativePixels(pw->normalGeometry(), this);
never executed: normalGeometry = QHighDpi::fromNativePixels(pw->normalGeometry(), this);
0
689 if (!normalGeometry.isValid()
!normalGeometry.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
&& effectiveState(m_widget->windowState()) == Qt::WindowNoState
effectiveState...:WindowNoStateDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
690 normalGeometry = m_widget->geometry();
never executed: normalGeometry = m_widget->geometry();
0
691 if (normalGeometry.isValid()
normalGeometry.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
692 tle->normalGeometry = normalGeometry;
never executed: tle->normalGeometry = normalGeometry;
0
693}
never executed: end of block
0
694-
695void QWidgetWindow::handleMoveEvent(QMoveEvent *event)-
696{-
697 if (updatePos()
updatePos()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
698 QGuiApplication::sendSpontaneousEvent(m_widget, event);
never executed: QGuiApplication::sendSpontaneousEvent(m_widget, event);
0
699}
never executed: end of block
0
700-
701void QWidgetWindow::handleResizeEvent(QResizeEvent *event)-
702{-
703 QSize oldSize = m_widget->data->crect.size();-
704-
705 if (updateSize()
updateSize()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
706 QGuiApplication::sendSpontaneousEvent(m_widget, event);-
707-
708 if (m_widget->d_func()->paintOnScreen()
m_widget->d_fu...aintOnScreen()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
709 QRegion updateRegion(geometry());-
710 if (m_widget->testAttribute(Qt::WA_StaticContents)
m_widget->test...taticContents)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
711 updateRegion -= QRect(0, 0, oldSize.width(), oldSize.height());
never executed: updateRegion -= QRect(0, 0, oldSize.width(), oldSize.height());
0
712 m_widget->d_func()->syncBackingStore(updateRegion);-
713 }
never executed: end of block
else {
0
714 m_widget->d_func()->syncBackingStore();-
715 }
never executed: end of block
0
716 }-
717}
never executed: end of block
0
718-
719void QWidgetWindow::handleCloseEvent(QCloseEvent *event)-
720{-
721 bool is_closing = m_widget->d_func()->close_helper(QWidgetPrivate::CloseWithSpontaneousEvent);-
722 event->setAccepted(is_closing);-
723}
never executed: end of block
0
724-
725-
726-
727void QWidgetWindow::handleWheelEvent(QWheelEvent *event)-
728{-
729 if (QApplicationPrivate::instance()->modalState()
QApplicationPr...->modalState()Description
TRUEnever evaluated
FALSEnever evaluated
&& !qt_try_modal(m_widget, event->type())
!qt_try_modal(...event->type())Description
TRUEnever evaluated
FALSEnever evaluated
)
0
730 return;
never executed: return;
0
731-
732 QWidget *rootWidget = m_widget;-
733 QPoint pos = event->pos();-
734-
735-
736-
737 QWidget *activePopupWidget = QApplication::activePopupWidget();-
738 if (activePopupWidget
activePopupWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
&& activePopupWidget != m_widget
activePopupWidget != m_widgetDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
739 rootWidget = activePopupWidget;-
740 pos = rootWidget->mapFromGlobal(event->globalPos());-
741 }
never executed: end of block
0
742-
743-
744 QWidget *widget = rootWidget->childAt(pos);-
745-
746 if (!widget
!widgetDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
747 widget = rootWidget;
never executed: widget = rootWidget;
0
748-
749 QPoint mapped = widget->mapFrom(rootWidget, pos);-
750-
751 QWheelEvent translated(mapped, event->globalPos(), event->pixelDelta(), event->angleDelta(), event->delta(), event->orientation(), event->buttons(), event->modifiers(), event->phase(), event->source(), event->inverted());-
752 QGuiApplication::sendSpontaneousEvent(widget, &translated);-
753}
never executed: end of block
0
754-
755-
756-
757-
758-
759void QWidgetWindow::handleDragEnterMoveEvent(QDragMoveEvent *event)-
760{-
761 ((!(event->type() ==QEvent::DragMove || !m_dragTarget)) ? qt_assert("event->type() ==QEvent::DragMove || !m_dragTarget",__FILE__,812) : qt_noop());-
762-
763 QWidget *widget = m_widget->childAt(event->pos());-
764 if (!widget
!widgetDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
765 widget = m_widget;
never executed: widget = m_widget;
0
766 for ( ; widget
widgetDescription
TRUEnever evaluated
FALSEnever evaluated
&& !widget->isWindow()
!widget->isWindow()Description
TRUEnever evaluated
FALSEnever evaluated
&& !widget->acceptDrops()
!widget->acceptDrops()Description
TRUEnever evaluated
FALSEnever evaluated
; widget = widget->parentWidget()) ;
never executed: ;
0
767 if (widget
widgetDescription
TRUEnever evaluated
FALSEnever evaluated
&& !widget->acceptDrops()
!widget->acceptDrops()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
768 widget = 0;
never executed: widget = 0;
0
769-
770 if (widget
widgetDescription
TRUEnever evaluated
FALSEnever evaluated
&& widget == m_dragTarget.data()
widget == m_dragTarget.data()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
771 ((!(event->type() == QEvent::DragMove)) ? qt_assert("event->type() == QEvent::DragMove",__FILE__,822) : qt_noop());-
772 const QPoint mapped = widget->mapFromGlobal(m_widget->mapToGlobal(event->pos()));-
773 QDragMoveEvent translated(mapped, event->possibleActions(), event->mimeData(), event->mouseButtons(), event->keyboardModifiers());-
774 translated.setDropAction(event->dropAction());-
775 if (event->isAccepted()
event->isAccepted()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
776 translated.accept();-
777 translated.setDropAction(event->dropAction());-
778 }
never executed: end of block
0
779 QGuiApplication::sendSpontaneousEvent(widget, &translated);-
780 if (translated.isAccepted()
translated.isAccepted()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
781 event->accept();-
782 }
never executed: end of block
else {
0
783 event->ignore();-
784 }
never executed: end of block
0
785 event->setDropAction(translated.dropAction());-
786 return;
never executed: return;
0
787 }-
788-
789 if (m_dragTarget.data()
m_dragTarget.data()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
790 QDragLeaveEvent le;-
791 QGuiApplication::sendSpontaneousEvent(m_dragTarget.data(), &le);-
792 m_dragTarget = 0;-
793 }
never executed: end of block
0
794 if (!widget
!widgetDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
795 event->ignore();-
796 return;
never executed: return;
0
797 }-
798 m_dragTarget = widget;-
799 const QPoint mapped = widget->mapFromGlobal(m_widget->mapToGlobal(event->pos()));-
800 QDragEnterEvent translated(mapped, event->possibleActions(), event->mimeData(), event->mouseButtons(), event->keyboardModifiers());-
801 QGuiApplication::sendSpontaneousEvent(widget, &translated);-
802 if (translated.isAccepted()
translated.isAccepted()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
803 event->accept();-
804 }
never executed: end of block
else {
0
805 event->ignore();-
806 }
never executed: end of block
0
807 event->setDropAction(translated.dropAction());-
808}
never executed: end of block
0
809-
810void QWidgetWindow::handleDragLeaveEvent(QDragLeaveEvent *event)-
811{-
812 if (m_dragTarget
m_dragTargetDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
813 QGuiApplication::sendSpontaneousEvent(m_dragTarget.data(), event);
never executed: QGuiApplication::sendSpontaneousEvent(m_dragTarget.data(), event);
0
814 m_dragTarget = 0;-
815}
never executed: end of block
0
816-
817void QWidgetWindow::handleDropEvent(QDropEvent *event)-
818{-
819 if (__builtin_expect(!!(m_dragTarget.isNull()), false)
__builtin_expe...ull()), false)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
820 QMessageLogger(__FILE__, 871, __PRETTY_FUNCTION__).warning() << m_widget << ": No drag target set.";-
821 event->ignore();-
822 return;
never executed: return;
0
823 }-
824 const QPoint mapped = m_dragTarget.data()->mapFromGlobal(m_widget->mapToGlobal(event->pos()));-
825 QDropEvent translated(mapped, event->possibleActions(), event->mimeData(), event->mouseButtons(), event->keyboardModifiers());-
826 QGuiApplication::sendSpontaneousEvent(m_dragTarget.data(), &translated);-
827 if (translated.isAccepted()
translated.isAccepted()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
828 event->accept();
never executed: event->accept();
0
829 event->setDropAction(translated.dropAction());-
830 m_dragTarget = 0;-
831}
never executed: end of block
0
832-
833-
834-
835void QWidgetWindow::handleExposeEvent(QExposeEvent *event)-
836{-
837 QWidgetPrivate *wPriv = m_widget->d_func();-
838 const bool exposed = isExposed();-
839-
840 if (wPriv->childrenHiddenByWState
wPriv->childrenHiddenByWStateDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
841-
842-
843 if (exposed
exposedDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
844-
845 if (!wPriv->childrenShownByExpose
!wPriv->childrenShownByExposeDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
846-
847 wPriv->showChildren(true);-
848 QShowEvent showEvent;-
849 QCoreApplication::sendSpontaneousEvent(m_widget, &showEvent);-
850 wPriv->childrenShownByExpose = true;-
851 }
never executed: end of block
0
852 }
never executed: end of block
else {
0
853-
854 if (wPriv->childrenShownByExpose
wPriv->childrenShownByExposeDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
855-
856-
857-
858-
859 wPriv->hideChildren(true);-
860 QHideEvent hideEvent;-
861 QCoreApplication::sendSpontaneousEvent(m_widget, &hideEvent);-
862 wPriv->childrenShownByExpose = false;-
863 }
never executed: end of block
0
864 }
never executed: end of block
0
865 }-
866-
867 if (exposed
exposedDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
868 m_widget->setAttribute(Qt::WA_Mapped);-
869 if (!event->region().isNull()
!event->region().isNull()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
870 wPriv->syncBackingStore(event->region());
never executed: wPriv->syncBackingStore(event->region());
0
871 }
never executed: end of block
else {
0
872 m_widget->setAttribute(Qt::WA_Mapped, false);-
873 }
never executed: end of block
0
874}-
875-
876void QWidgetWindow::handleWindowStateChangedEvent(QWindowStateChangeEvent *event)-
877{-
878-
879 Qt::WindowStates eventState = event->oldState();-
880 Qt::WindowStates widgetState = m_widget->windowState();-
881 if (widgetState & Qt::WindowActive
widgetState & Qt::WindowActiveDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
882 eventState |= Qt::WindowActive;
never executed: eventState |= Qt::WindowActive;
0
883-
884-
885-
886 switch (windowState()) {-
887 case
never executed: case Qt::WindowNoState:
Qt::WindowNoState:
never executed: case Qt::WindowNoState:
0
888 widgetState &= ~(Qt::WindowMinimized | Qt::WindowMaximized | Qt::WindowFullScreen);-
889 break;
never executed: break;
0
890 case
never executed: case Qt::WindowMinimized:
Qt::WindowMinimized:
never executed: case Qt::WindowMinimized:
0
891 widgetState |= Qt::WindowMinimized;-
892 break;
never executed: break;
0
893 case
never executed: case Qt::WindowMaximized:
Qt::WindowMaximized:
never executed: case Qt::WindowMaximized:
0
894 updateNormalGeometry();-
895 widgetState |= Qt::WindowMaximized;-
896 widgetState &= ~(Qt::WindowMinimized | Qt::WindowFullScreen);-
897 break;
never executed: break;
0
898 case
never executed: case Qt::WindowFullScreen:
Qt::WindowFullScreen:
never executed: case Qt::WindowFullScreen:
0
899 updateNormalGeometry();-
900 widgetState |= Qt::WindowFullScreen;-
901 widgetState &= ~(Qt::WindowMinimized);-
902 break;
never executed: break;
0
903 case
never executed: case Qt::WindowActive:
Qt::WindowActive:
never executed: case Qt::WindowActive:
0
904 break;
never executed: break;
0
905 }-
906-
907-
908-
909 if (widgetState != int(m_widget->data->window_state)
widgetState !=...>window_state)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
910 m_widget->data->window_state = widgetState;-
911 QWindowStateChangeEvent widgetEvent(eventState);-
912 QGuiApplication::sendSpontaneousEvent(m_widget, &widgetEvent);-
913 }
never executed: end of block
0
914}
never executed: end of block
0
915-
916bool QWidgetWindow::nativeEvent(const QByteArray &eventType, void *message, long *result)-
917{-
918 return
never executed: return m_widget->nativeEvent(eventType, message, result);
m_widget->nativeEvent(eventType, message, result);
never executed: return m_widget->nativeEvent(eventType, message, result);
0
919}-
920-
921-
922void QWidgetWindow::handleTabletEvent(QTabletEvent *event)-
923{-
924 static QPointer<QWidget> qt_tablet_target = 0;-
925 if (event->type() == QEvent::TabletPress
event->type() ...t::TabletPressDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
926 QWidget *widget = m_widget->childAt(event->pos());-
927 if (!widget
!widgetDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
928 widget = m_widget;
never executed: widget = m_widget;
0
929-
930 qt_tablet_target = widget;-
931 }
never executed: end of block
0
932-
933 if (qt_tablet_target
qt_tablet_targetDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
934 QPointF delta = event->globalPosF() - event->globalPos();-
935 QPointF mapped = qt_tablet_target->mapFromGlobal(event->globalPos()) + delta;-
936 QTabletEvent ev(event->type(), mapped, event->globalPosF(), event->device(), event->pointerType(),-
937 event->pressure(), event->xTilt(), event->yTilt(), event->tangentialPressure(),-
938 event->rotation(), event->z(), event->modifiers(), event->uniqueId(), event->button(), event->buttons());-
939 ev.setTimestamp(event->timestamp());-
940 QGuiApplication::sendSpontaneousEvent(qt_tablet_target, &ev);-
941 event->setAccepted(ev.isAccepted());-
942 }
never executed: end of block
0
943-
944 if (event->type() == QEvent::TabletRelease
event->type() ...:TabletReleaseDescription
TRUEnever evaluated
FALSEnever evaluated
&& event->buttons() == Qt::NoButton
event->buttons...= Qt::NoButtonDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
945 qt_tablet_target = 0;
never executed: qt_tablet_target = 0;
0
946}
never executed: end of block
0
947-
948-
949-
950void QWidgetWindow::handleGestureEvent(QNativeGestureEvent *e)-
951{-
952-
953 QObject *receiver = 0;-
954 if (QApplicationPrivate::inPopupMode()
QApplicationPr...:inPopupMode()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
955 QWidget *popup = QApplication::activePopupWidget();-
956 QWidget *popupFocusWidget = popup->focusWidget();-
957 receiver = popupFocusWidget
popupFocusWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
? popupFocusWidget : popup;
0
958 }
never executed: end of block
0
959 if (!receiver
!receiverDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
960 receiver = QApplication::widgetAt(e->globalPos());
never executed: receiver = QApplication::widgetAt(e->globalPos());
0
961 if (!receiver
!receiverDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
962 receiver = m_widget;
never executed: receiver = m_widget;
0
963-
964 QApplication::sendSpontaneousEvent(receiver, e);-
965}
never executed: end of block
0
966-
967-
968-
969void QWidgetWindow::handleContextMenuEvent(QContextMenuEvent *e)-
970{-
971-
972-
973 if (e->reason() != QContextMenuEvent::Keyboard
e->reason() !=...vent::KeyboardDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
974 return;
never executed: return;
0
975-
976 QWidget *fw = QWidget::keyboardGrabber();-
977 if (!fw
!fwDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
978 if (QApplication::activePopupWidget()
QApplication::...ePopupWidget()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
979 fw = (QApplication::activePopupWidget()->focusWidget()
QApplication::...>focusWidget()Description
TRUEnever evaluated
FALSEnever evaluated
0
980 ? QApplication::activePopupWidget()->focusWidget()-
981 : QApplication::activePopupWidget());-
982 }
never executed: end of block
else if (QApplication::focusWidget()
QApplication::focusWidget()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
983 fw = QApplication::focusWidget();-
984 }
never executed: end of block
else {
0
985 fw = m_widget;-
986 }
never executed: end of block
0
987 }-
988 if (fw
fwDescription
TRUEnever evaluated
FALSEnever evaluated
&& fw->isEnabled()
fw->isEnabled()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
989 QPoint pos = fw->inputMethodQuery(Qt::ImMicroFocus).toRect().center();-
990 QContextMenuEvent widgetEvent(QContextMenuEvent::Keyboard, pos, fw->mapToGlobal(pos),-
991 e->modifiers());-
992 QGuiApplication::sendSpontaneousEvent(fw, &widgetEvent);-
993 }
never executed: end of block
0
994}
never executed: end of block
0
995-
996-
997void QWidgetWindow::updateObjectName()-
998{-
999 QString name = m_widget->objectName();-
1000 if (name.isEmpty()
name.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1001 name = QString::fromUtf8(m_widget->metaObject()->className()) + QLatin1String("Class");
never executed: name = QString::fromUtf8(m_widget->metaObject()->className()) + QLatin1String("Class");
0
1002 name += QLatin1String("Window");-
1003 setObjectName(name);-
1004}
never executed: end of block
0
1005-
1006-
1007-
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9