qwidget.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/widgets/kernel/qwidget.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8-
9-
10-
11-
12-
13-
14-
15-
16-
17-
18-
19-
20-
21-
22static bool qt_enable_backingstore = true;-
23static inline bool qRectIntersects(const QRect &r1, const QRect &r2)-
24{-
25 return (qMax(r1.left(), r2.left()) <= qMin(r1.right(), r2.right()) &&-
26 qMax(r1.top(), r2.top()) <= qMin(r1.bottom(), r2.bottom()));-
27}-
28-
29static inline bool hasBackingStoreSupport()-
30{-
31 return true;-
32}-
33-
34-
35-
36-
37-
38extern bool qt_sendSpontaneousEvent(QObject*, QEvent*);-
39extern QDesktopWidget *qt_desktopWidget;-
40QWidgetBackingStoreTracker::QWidgetBackingStoreTracker()-
41 : m_ptr(0)-
42{-
43-
44}-
45-
46QWidgetBackingStoreTracker::~QWidgetBackingStoreTracker()-
47{-
48 delete m_ptr;-
49}-
50-
51-
52-
53-
54-
55-
56-
57void QWidgetBackingStoreTracker::create(QWidget *widget)-
58{-
59 destroy();-
60 m_ptr = new QWidgetBackingStore(widget);-
61}-
62-
63-
64-
65-
66-
67-
68void QWidgetBackingStoreTracker::destroy()-
69{-
70 delete m_ptr;-
71 m_ptr = 0;-
72 m_widgets.clear();-
73}-
74-
75-
76-
77-
78-
79-
80void QWidgetBackingStoreTracker::registerWidget(QWidget *w)-
81{-
82 ((!(m_ptr)) ? qt_assert("m_ptr",__FILE__,196203) : qt_noop());-
83 ((!(w->internalWinId())) ? qt_assert("w->internalWinId()",__FILE__,197204) : qt_noop());-
84 ((!(qt_widget_private(w)->maybeBackingStore() == m_ptr)) ? qt_assert("qt_widget_private(w)->maybeBackingStore() == m_ptr",__FILE__,198205) : qt_noop());-
85 m_widgets.insert(w);-
86}-
87void QWidgetBackingStoreTracker::unregisterWidget(QWidget *w)-
88{-
89 if (m_widgets.remove(w) && m_widgets.isEmpty()) {-
90 delete m_ptr;-
91 m_ptr = 0;-
92 }-
93}-
94-
95-
96-
97-
98-
99void QWidgetBackingStoreTracker::unregisterWidgetSubtree(QWidget *widget)-
100{-
101 unregisterWidget(widget);-
102 for (QForeachContainer<typename QtPrivate::remove_reference<decltype(widget->children())>::type> _container_((widget->children())); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QObject *child = *_container_.i; _container_.control; _container_.control = 0)-
103 if (QWidget *childWidget = qobject_cast<QWidget *>(child))-
104 unregisterWidgetSubtree(childWidget);-
105}-
106-
107QWidgetPrivate::QWidgetPrivate(int version)-
108 : QObjectPrivate(version)-
109 , extra(0)-
110 , focus_next(0)-
111 , focus_prev(0)-
112 , focus_child(0)-
113 , layout(0)-
114 , needsFlush(0)-
115 , redirectDev(0)-
116 , widgetItem(0)-
117 , extraPaintEngine(0)-
118 , polished(0)-
119 , graphicsEffect(0)-
120-
121 , imHints(Qt::ImhNone)-
122-
123-
124 , toolTipDuration(-1)-
125-
126 , inheritedFontResolveMask(0)-
127 , inheritedPaletteResolveMask(0)-
128 , leftmargin(0)-
129 , topmargin(0)-
130 , rightmargin(0)-
131 , bottommargin(0)-
132 , leftLayoutItemMargin(0)-
133 , topLayoutItemMargin(0)-
134 , rightLayoutItemMargin(0)-
135 , bottomLayoutItemMargin(0)-
136 , hd(0)-
137 , size_policy(QSizePolicy::Preferred, QSizePolicy::Preferred)-
138 , fg_role(QPalette::NoRole)-
139 , bg_role(QPalette::NoRole)-
140 , dirtyOpaqueChildren(1)-
141 , isOpaque(0)-
142 , retainSizeWhenHiddenChanged(0)-
143 , inDirtyList(0)-
144 , isScrolled(0)-
145 , isMoved(0)-
146 , usesDoubleBufferedGLContext(0)-
147 , mustHaveWindowHandle(0)-
148 , renderToTexture(0)-
149 , textureChildSeen(0)-
150-
151 , inheritsInputMethodHints(0)-
152-
153-
154 , renderToTextureReallyDirty(1)-
155 , renderToTextureComposeActive(0)-
156-
157 , childrenHiddenByWState(0)-
158 , childrenShownByExpose(0)-
159{-
160 if (!((__builtin_expect(!!(!(
__builtin_expe...e()))), false)Description
TRUEnever evaluated
FALSEnever evaluated
static_cast<QApplication *>(QCoreApplication::instance())))()))), false)
__builtin_expe...e()))), false)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
161 QMessageLogger(__FILE__, 297304, __PRETTY_FUNCTION__).fatal("QWidget: Must construct a QApplication before a QWidget");-
162 return;
never executed: return;
0
163 }-
164-
165-
166-
167-
168 (void)version;;-
169-
170-
171-
172-
173-
174-
175 isWidget = true;-
176 memset(high_attributes, 0, sizeof(high_attributes));-
177}
never executed: end of block
0
178-
179-
180QWidgetPrivate::~QWidgetPrivate()-
181{-
182 if (widgetItem)-
183 widgetItem->wid = 0;-
184-
185 if (extra)-
186 deleteExtra();-
187-
188-
189 delete graphicsEffect;-
190-
191}-
192-
193-
194-
195-
196void QWidgetPrivate::scrollChildren(int dx, int dy)-
197{-
198 QWidget * const q = q_func();-
199 if (q->children().size() > 0) {-
200 QPoint pd(dx, dy);-
201 QObjectList childObjects = q->children();-
202 for (int i = 0; i < childObjects.size(); ++i) {-
203 QWidget *w = qobject_cast<QWidget*>(childObjects.at(i));-
204 if (w && !w->isWindow()) {-
205 QPoint oldp = w->pos();-
206 QRect r(w->pos() + pd, w->size());-
207 w->data->crect = r;-
208 if (w->testAttribute(Qt::WA_WState_Created))-
209 w->d_func()->setWSGeometry();-
210 w->d_func()->setDirtyOpaqueRegion();-
211 QMoveEvent e(r.topLeft(), oldp);-
212 QApplication::sendEvent(w, &e);-
213 }-
214 }-
215 }-
216}-
217-
218void QWidgetPrivate::setWSGeometry()-
219{-
220 QWidget * const q = q_func();-
221 if (QWindow *window = q->windowHandle())-
222 window->setGeometry(data.crect);-
223}-
224-
225void QWidgetPrivate::updateWidgetTransform(QEvent *event)-
226{-
227 QWidget * const q = q_func();-
228 if (q == QGuiApplication::focusObject()
q == QGuiAppli...:focusObject()Description
TRUEnever evaluated
FALSEnever evaluated
|| event->type() == QEvent::FocusIn
event->type() ...Event::FocusInDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
229 QTransform t;-
230 QPoint p = q->mapTo(q->topLevelWidget(), QPoint(0,0));-
231 t.translate(p.x(), p.y());-
232 QGuiApplication::inputMethod()->setInputItemTransform(t);-
233 QGuiApplication::inputMethod()->setInputItemRectangle(q->rect());-
234 QGuiApplication::inputMethod()->update(Qt::ImInputItemClipRectangle);-
235 }
never executed: end of block
0
236}
never executed: end of block
0
237bool QWidget::autoFillBackground() const-
238{-
239 const QWidgetPrivate * const d = d_func();-
240 return d->extra && d->extra->autoFillBackground;-
241}-
242-
243void QWidget::setAutoFillBackground(bool enabled)-
244{-
245 QWidgetPrivate * const d = d_func();-
246 if (!d->extra)-
247 d->createExtra();-
248 if (d->extra->autoFillBackground == enabled)-
249 return;-
250-
251 d->extra->autoFillBackground = enabled;-
252 d->updateIsOpaque();-
253 update();-
254 d->updateIsOpaque();-
255}-
256QWidgetMapper *QWidgetPrivate::mapper = 0;-
257QWidgetSet *QWidgetPrivate::allWidgets = 0;-
258-
259-
260-
261-
262-
263-
264QRegion qt_dirtyRegion(QWidget *widget)-
265{-
266 if (!widget)-
267 return QRegion();-
268-
269 QWidgetBackingStore *bs = qt_widget_private(widget)->maybeBackingStore();-
270 if (!bs)-
271 return QRegion();-
272-
273 return bs->dirtyRegion(widget);-
274}-
275struct QWidgetExceptionCleaner-
276{-
277-
278 static inline void cleanup(QWidget *that, QWidgetPrivate *d)-
279 {-
280-
281 (void)that;;-
282 (void)d;;-
283 }-
284};-
285QWidget::QWidget(QWidget *parent, Qt::WindowFlags f)-
286 : QObject(*new QWidgetPrivate, 0), QPaintDevice()-
287{-
288 if (true) {-
289 d_func()->init(parent, f);-
290 } else {
dead code: { QWidgetExceptionCleaner::cleanup(this, d_func()); qt_noop(); }
-
291 QWidgetExceptionCleaner::cleanup(this, d_func());
dead code: { QWidgetExceptionCleaner::cleanup(this, d_func()); qt_noop(); }
-
292 qt_noop();
dead code: { QWidgetExceptionCleaner::cleanup(this, d_func()); qt_noop(); }
-
293 }
dead code: { QWidgetExceptionCleaner::cleanup(this, d_func()); qt_noop(); }
-
294}-
295-
296-
297-
298-
299QWidget::QWidget(QWidgetPrivate &dd, QWidget* parent, Qt::WindowFlags f)-
300 : QObject(dd, 0), QPaintDevice()-
301{-
302 QWidgetPrivate * const d = d_func();-
303 if (true) {-
304 d->init(parent, f);-
305 } else {
dead code: { QWidgetExceptionCleaner::cleanup(this, d_func()); qt_noop(); }
-
306 QWidgetExceptionCleaner::cleanup(this, d_func());
dead code: { QWidgetExceptionCleaner::cleanup(this, d_func()); qt_noop(); }
-
307 qt_noop();
dead code: { QWidgetExceptionCleaner::cleanup(this, d_func()); qt_noop(); }
-
308 }
dead code: { QWidgetExceptionCleaner::cleanup(this, d_func()); qt_noop(); }
-
309}-
310-
311-
312-
313-
314int QWidget::devType() const-
315{-
316 return QInternal::Widget;-
317}-
318-
319-
320-
321void QWidgetPrivate::adjustFlags(Qt::WindowFlags &flags, QWidget *w)-
322{-
323 bool customize = (flags & (Qt::CustomizeWindowHint-
324 | Qt::FramelessWindowHint-
325 | Qt::WindowTitleHint-
326 | Qt::WindowSystemMenuHint-
327 | Qt::WindowMinimizeButtonHint-
328 | Qt::WindowMaximizeButtonHint-
329 | Qt::WindowCloseButtonHint-
330 | Qt::WindowContextHelpButtonHint));-
331-
332 uint type = (flags & Qt::WindowType_Mask);-
333-
334 if ((type == Qt::Widget || type == Qt::SubWindow) && w && !w->parent()) {-
335 type = Qt::Window;-
336 flags |= Qt::Window;-
337 }-
338-
339 if (flags & Qt::CustomizeWindowHint) {-
340-
341-
342-
343-
344-
345 if ((flags & (Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint | Qt::WindowContextHelpButtonHint))-
346-
347-
348-
349 ) {-
350 flags |= Qt::WindowSystemMenuHint;-
351-
352-
353-
354-
355 flags |= Qt::WindowTitleHint;-
356 flags &= ~Qt::FramelessWindowHint;-
357 }-
358 } else if (customize && !(flags & Qt::FramelessWindowHint)) {-
359-
360-
361-
362 flags |= Qt::WindowSystemMenuHint;-
363 flags |= Qt::WindowTitleHint;-
364 }-
365 if (customize)-
366 ;-
367 else if (type == Qt::Dialog || type == Qt::Sheet)-
368-
369 flags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowContextHelpButtonHint | Qt::WindowCloseButtonHint;-
370-
371-
372-
373 else if (type == Qt::Tool)-
374 flags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint;-
375 else-
376 flags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinimizeButtonHint |-
377 Qt::WindowMaximizeButtonHint | Qt::WindowCloseButtonHint | Qt::WindowFullscreenButtonHint;-
378 if (w->testAttribute(Qt::WA_TransparentForMouseEvents))-
379 flags |= Qt::WindowTransparentForInput;-
380}-
381-
382void QWidgetPrivate::init(QWidget *parentWidget, Qt::WindowFlags f)-
383{-
384 QWidget * const q = q_func();-
385 if (!(__builtin_expect(!!(!
__builtin_expe...ce())), false)Description
TRUEnever evaluated
FALSEnever evaluated
qobject_cast<QApplication *>(QCoreApplication::instance()))())), false)
__builtin_expe...ce())), false)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
386 QMessageLogger(__FILE__, 11241136, __PRETTY_FUNCTION__).fatal("QWidget: Cannot create a QWidget without QApplication");
never executed: QMessageLogger(__FILE__, 1136, __PRETTY_FUNCTION__).fatal("QWidget: Cannot create a QWidget without QApplication");
0
387-
388 ((!(allWidgets)) ? qt_assert("allWidgets",__FILE__,11261138) : qt_noop());-
389 if (allWidgets
allWidgetsDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
390 allWidgets->insert(q);
never executed: allWidgets->insert(q);
0
391-
392 int targetScreen = -1;-
393 if (parentWidget
parentWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
&& parentWidget->windowType() == Qt::Desktop
parentWidget->...== Qt::DesktopDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
394 const QDesktopScreenWidget *sw = qobject_cast<const QDesktopScreenWidget *>(parentWidget);-
395 targetScreen = sw
swDescription
TRUEnever evaluated
FALSEnever evaluated
? sw->screenNumber() : 0;
0
396 parentWidget = 0;-
397 }
never executed: end of block
0
398-
399 q->data = &data;-
400-
401-
402 if (!parent
!parentDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
403 ((!(q->thread() == (static_cast<QApplication *>(QCoreApplication::instance()))->thread())) ? qt_assert_x("QWidget", "Widgets must be created in the GUI thread.",-
404 __FILE__-
405 ,-
406 11421154-
407 ) : qt_noop())-
408 ;-
409 }
never executed: end of block
0
410 if (targetScreen >= 0
targetScreen >= 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
411 topData()->initialScreenIndex = targetScreen;-
412 if (QWindow *window = q->windowHandle()
QWindow *windo...windowHandle()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
413 window->setScreen(QGuiApplication::screens().value(targetScreen, nullptr));
never executed: window->setScreen(QGuiApplication::screens().value(targetScreen, nullptr));
0
414 }
never executed: end of block
0
415-
416 data.fstrut_dirty = true;-
417-
418 data.winid = 0;-
419 data.widget_attributes = 0;-
420 data.window_flags = f;-
421 data.window_state = 0;-
422 data.focus_policy = 0;-
423 data.context_menu_policy = Qt::DefaultContextMenu;-
424 data.window_modality = Qt::NonModal;-
425-
426 data.sizehint_forced = 0;-
427 data.is_closing = 0;-
428 data.in_show = 0;-
429 data.in_set_window_state = 0;-
430 data.in_destructor = false;-
431-
432-
433 if (f & Qt::MSWindowsOwnDC
f & Qt::MSWindowsOwnDCDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
434 mustHaveWindowHandle = 1;-
435 q->setAttribute(Qt::WA_NativeWindow);-
436 }
never executed: end of block
0
437-
438-
439-
440-
441 q->setAttribute(Qt::WA_QuitOnClose);-
442 adjustQuitOnCloseAttribute();-
443-
444 q->setAttribute(Qt::WA_WState_Hidden);-
445-
446-
447 data.crect = parentWidget
parentWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
? QRect(0,0,100,30) : QRect(0,0,640,480);
0
448 focus_next = focus_prev = q;-
449-
450 if ((
(f & Qt::Windo...== Qt::DesktopDescription
TRUEnever evaluated
FALSEnever evaluated
f & Qt::WindowType_Mask) == Qt::Desktop
(f & Qt::Windo...== Qt::DesktopDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
451 q->create();
never executed: q->create();
0
452 else if (parentWidget
parentWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
453 q->setParent(parentWidget, data.window_flags);
never executed: q->setParent(parentWidget, data.window_flags);
0
454 else {-
455 adjustFlags(data.window_flags, q);-
456 resolveLayoutDirection();-
457-
458 const QBrush &background = q->palette().brush(QPalette::Window);-
459 setOpaque(q->isWindow() && background.style() != Qt::NoBrush && background.isOpaque());-
460 }
never executed: end of block
0
461 data.fnt = QFont(data.fnt, q);-
462-
463-
464-
465-
466 q->setAttribute(Qt::WA_PendingMoveEvent);-
467 q->setAttribute(Qt::WA_PendingResizeEvent);-
468-
469 if (++
++QWidgetPriva...::maxInstancesDescription
TRUEnever evaluated
FALSEnever evaluated
QWidgetPrivate::instanceCounter > QWidgetPrivate::maxInstances
++QWidgetPriva...::maxInstancesDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
470 QWidgetPrivate::maxInstances = QWidgetPrivate::instanceCounter;
never executed: QWidgetPrivate::maxInstances = QWidgetPrivate::instanceCounter;
0
471-
472 if (QApplicationPrivate::testAttribute(Qt::AA_ImmediateWidgetCreation)
QApplicationPr...idgetCreation)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
473 q->create();
never executed: q->create();
0
474-
475 QEvent e(QEvent::Create);-
476 QApplication::sendEvent(q, &e);-
477 QApplication::postEvent(q, new QEvent(QEvent::PolishRequest));-
478-
479 extraPaintEngine = 0;-
480}
never executed: end of block
0
481-
482-
483-
484void QWidgetPrivate::createRecursively()-
485{-
486 QWidget * const q = q_func();-
487 q->create(0, true, true);-
488 for (int i = 0; i < children.size(); ++i) {-
489 QWidget *child = qobject_cast<QWidget *>(children.at(i));-
490 if (child && !child->isHidden() && !child->isWindow() && !child->testAttribute(Qt::WA_WState_Created))-
491 child->d_func()->createRecursively();-
492 }-
493}-
494void QWidget::create(WId window, bool initializeWindow, bool destroyOldWindow)-
495{-
496 QWidgetPrivate * const d = d_func();-
497 if (__builtin_expect(!!(window), false))-
498 QMessageLogger(__FILE__, 12771289, __PRETTY_FUNCTION__).warning("QWidget::create(): Parameter 'window' does not have any effect.");-
499 if (testAttribute(Qt::WA_WState_Created) && window == 0 && internalWinId())-
500 return;-
501-
502 if (d->data.in_destructor)-
503 return;-
504-
505 Qt::WindowType type = windowType();-
506 Qt::WindowFlags &flags = data->window_flags;-
507-
508 if ((type == Qt::Widget || type == Qt::SubWindow) && !parentWidget()) {-
509 type = Qt::Window;-
510 flags |= Qt::Window;-
511 }-
512-
513 if (QWidget *parent = parentWidget()) {-
514 if (type & Qt::Window) {-
515 if (!parent->testAttribute(Qt::WA_WState_Created))-
516 parent->createWinId();-
517 } else if (testAttribute(Qt::WA_NativeWindow) && !parent->internalWinId()-
518 && !testAttribute(Qt::WA_DontCreateNativeAncestors)) {-
519-
520-
521-
522 d->createWinId();-
523-
524 ((!(testAttribute(Qt::WA_WState_Created))) ? qt_assert("testAttribute(Qt::WA_WState_Created)",__FILE__,13031315) : qt_noop());-
525 ((!(internalWinId())) ? qt_assert("internalWinId()",__FILE__,13041316) : qt_noop());-
526 return;-
527 }-
528 }-
529-
530-
531 static const bool paintOnScreenEnv = qEnvironmentVariableIntValue("QT_ONSCREEN_PAINT") > 0;-
532 if (paintOnScreenEnv)-
533 setAttribute(Qt::WA_PaintOnScreen);-
534-
535 if (QApplicationPrivate::testAttribute(Qt::AA_NativeWindows))-
536 setAttribute(Qt::WA_NativeWindow);-
537 d->updateIsOpaque();-
538-
539 setAttribute(Qt::WA_WState_Created);-
540 d->create_sys(window, initializeWindow, destroyOldWindow);-
541-
542-
543 if (isWindow() && windowType() != Qt::Desktop) {-
544 d->topData()->backingStoreTracker.destroy();-
545 if (hasBackingStoreSupport())-
546 d->topData()->backingStoreTracker.create(this);-
547 }-
548-
549 d->setModal_sys();-
550-
551 if (!isWindow() && parentWidget() && parentWidget()->testAttribute(Qt::WA_DropSiteRegistered))-
552 setAttribute(Qt::WA_DropSiteRegistered, true);-
553-
554-
555-
556-
557-
558-
559-
560 if (testAttribute(Qt::WA_SetWindowIcon))-
561 d->setWindowIcon_sys();-
562-
563 if (isWindow() && !d->topData()->iconText.isEmpty())-
564 d->setWindowIconText_helper(d->topData()->iconText);-
565 if (isWindow() && !d->topData()->caption.isEmpty())-
566 d->setWindowTitle_helper(d->topData()->caption);-
567 if (windowType() != Qt::Desktop) {-
568 d->updateSystemBackground();-
569-
570 if (isWindow() && !testAttribute(Qt::WA_SetWindowIcon))-
571 d->setWindowIcon_sys();-
572 }-
573-
574-
575-
576-
577-
578-
579 d->updateFrameStrut();-
580}-
581-
582void q_createNativeChildrenAndSetParent(const QWidget *parentWidget)-
583{-
584 QObjectList children = parentWidget->children();-
585 for (int i = 0; i < children.size(); i++) {-
586 if (children.at(i)->isWidgetType()) {-
587 const QWidget *childWidget = qobject_cast<const QWidget *>(children.at(i));-
588 if (childWidget) {-
589 if (childWidget->testAttribute(Qt::WA_NativeWindow)) {-
590 if (!childWidget->internalWinId())-
591 childWidget->winId();-
592 if (childWidget->windowHandle()) {-
593 if (childWidget->isWindow()) {-
594 childWidget->windowHandle()->setTransientParent(parentWidget->window()->windowHandle());-
595 } else {-
596 childWidget->windowHandle()->setParent(childWidget->nativeParentWidget()->windowHandle());-
597 }-
598 }-
599 } else {-
600 q_createNativeChildrenAndSetParent(childWidget);-
601 }-
602 }-
603 }-
604 }-
605-
606}-
607-
608void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyOldWindow)-
609{-
610 QWidget * const q = q_func();-
611-
612 (void)window;;-
613 (void)initializeWindow;;-
614 (void)destroyOldWindow;;-
615-
616 Qt::WindowFlags flags = data.window_flags;-
617-
618 if (!q->testAttribute(Qt::WA_NativeWindow)
!q->testAttrib..._NativeWindow)Description
TRUEnever evaluated
FALSEnever evaluated
&& !q->isWindow()
!q->isWindow()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
619 return;
never executed: return;
0
620-
621 QWindow *win = topData()->window;-
622-
623-
624 if (!win
!winDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
625 createTLSysExtra();-
626 win = topData()->window;-
627 }
never executed: end of block
0
628-
629 for (QForeachContainer<typename QtPrivate::remove_reference<decltype(q->const auto dynamicPropertyNames ())>::type> _container_((= q->dynamicPropertyNames())); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1)();-
630 for (const QByteArray &propertyName = *_container_.i; _container_.control; _container_.control = 0: dynamicPropertyNames) {-
631 if (!qstrncmp(propertyName, "_q_platform_", 12)
!qstrncmp(prop...latform_", 12)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
632 win->setProperty(propertyName, q->property(propertyName));
never executed: win->setProperty(propertyName, q->property(propertyName));
0
633 }
never executed: end of block
0
634-
635 if (q->testAttribute(Qt::WA_ShowWithoutActivating)
q->testAttribu...outActivating)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
636 win->setProperty("_q_showWithoutActivating", QVariant(true));
never executed: win->setProperty("_q_showWithoutActivating", QVariant(true));
0
637 if (q->testAttribute(Qt::WA_MacAlwaysShowToolWindow)
q->testAttribu...howToolWindow)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
638 win->setProperty("_q_macAlwaysShowToolWindow", QVariant::fromValue(QVariant(true)));
never executed: win->setProperty("_q_macAlwaysShowToolWindow", QVariant::fromValue(QVariant(true)));
0
639 setNetWmWindowTypes(true);-
640 win->setFlags(data.window_flags);-
641 fixPosIncludesFrame();-
642 if (q->testAttribute(Qt::WA_Moved)
q->testAttribute(Qt::WA_Moved)Description
TRUEnever evaluated
FALSEnever evaluated
0
643 || !QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::WindowManagement)
!QGuiApplicati...dowManagement)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
644 win->setGeometry(q->geometry());
never executed: win->setGeometry(q->geometry());
0
645 else-
646 win->resize(q->size());
never executed: win->resize(q->size());
0
647 if (win->isTopLevel()
win->isTopLevel()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
648 int screenNumber = topData()->initialScreenIndex;-
649 topData()->initialScreenIndex = -1;-
650 if (screenNumber < 0
screenNumber < 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
651 screenNumber = q->windowType() != Qt::Desktop
q->windowType() != Qt::DesktopDescription
TRUEnever evaluated
FALSEnever evaluated
0
652 ? QApplication::desktop()->screenNumber(q) : 0;-
653 }
never executed: end of block
0
654 win->setScreen(QGuiApplication::screens().value(screenNumber, nullptr));-
655 }
never executed: end of block
0
656-
657 QSurfaceFormat format = win->requestedFormat();-
658 if ((
(flags & Qt::Window)Description
TRUEnever evaluated
FALSEnever evaluated
flags & Qt::Window)
(flags & Qt::Window)Description
TRUEnever evaluated
FALSEnever evaluated
&& win->surfaceType() != QSurface::OpenGLSurface
win->surfaceTy...:OpenGLSurfaceDescription
TRUEnever evaluated
FALSEnever evaluated
0
659 && q->testAttribute(Qt::WA_TranslucentBackground)
q->testAttribu...entBackground)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
660 format.setAlphaBufferSize(8);-
661 }
never executed: end of block
0
662 win->setFormat(format);-
663-
664 if (QWidget *nativeParent = q->nativeParentWidget()
QWidget *nativ...ParentWidget()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
665 if (nativeParent->windowHandle()
nativeParent->windowHandle()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
666 if (flags & Qt::Window
flags & Qt::WindowDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
667 win->setTransientParent(nativeParent->window()->windowHandle());-
668 win->setParent(0);-
669 }
never executed: end of block
else {
0
670 win->setTransientParent(0);-
671 win->setParent(nativeParent->windowHandle());-
672 }
never executed: end of block
0
673 }-
674 }
never executed: end of block
0
675-
676 qt_window_private(win)->positionPolicy = topData()->posIncludesFrame
topData()->posIncludesFrameDescription
TRUEnever evaluated
FALSEnever evaluated
?
0
677 QWindowPrivate::WindowFrameInclusive : QWindowPrivate::WindowFrameExclusive;-
678 win->create();-
679-
680 if ((
(flags & Qt::D... == Qt::WindowDescription
TRUEnever evaluated
FALSEnever evaluated
flags & Qt::Desktop) == Qt::Window
(flags & Qt::D... == Qt::WindowDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
681 {0
if (QPlatformWindow *platformWindow =win->handle())
never executed: win->handle()->setFrameStrutEventsEnabled(true);
platformWindow->
never executed: win->handle()->setFrameStrutEventsEnabled(true);
never executed: win->handle()->setFrameStrutEventsEnabled(true);
()->setFrameStrutEventsEnabled(true);
never executed: win->handle()->setFrameStrutEventsEnabled(true);
682-
683 }data.window_flags = win->flags();-
684-
685 if (!topData()->role.isNull()
!topData()->role.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
686 QXcbWindowFunctions::setWmWindowRole(win, topData()->role.toLatin1());
never executed: QXcbWindowFunctions::setWmWindowRole(win, topData()->role.toLatin1());
0
687-
688 QBackingStore *store = q->backingStore();-
689-
690 if (!store
!storeDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
691 if (win
winDescription
TRUEnever evaluated
FALSEnever evaluated
&& q->windowType() != Qt::Desktop
q->windowType() != Qt::DesktopDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
692 if (q->isTopLevel()
q->isTopLevel()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
693 q->setBackingStore(new QBackingStore(win));
never executed: q->setBackingStore(new QBackingStore(win));
0
694 }
never executed: end of block
else {
0
695 q->setAttribute(Qt::WA_PaintOnScreen, true);-
696 }
never executed: end of block
0
697 }-
698-
699 setWindowModified_helper();-
700 WId id = win->winId();-
701-
702 ((!(id != WId(0))) ? qt_assert("id != WId(0)",__FILE__,14971508) : qt_noop());-
703 setWinId(id);-
704-
705-
706 q_createNativeChildrenAndSetParent(q);-
707-
708 if (extra
extraDescription
TRUEnever evaluated
FALSEnever evaluated
&& !extra->mask.isEmpty()
!extra->mask.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
709 setMask_sys(extra->mask);
never executed: setMask_sys(extra->mask);
0
710-
711 if (data.crect.width() == 0
data.crect.width() == 0Description
TRUEnever evaluated
FALSEnever evaluated
|| data.crect.height() == 0
data.crect.height() == 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
712 q->setAttribute(Qt::WA_OutsideWSRange, true);-
713 }
never executed: end of block
else if (q->isVisible()
q->isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
714-
715 win->setVisible(true);-
716 }
never executed: end of block
0
717}
never executed: end of block
0
718-
719-
720-
721-
722-
723void QWidgetPrivate::createTLSysExtra()-
724{-
725 QWidget * const q = q_func();-
726 if (!extra->topextra->window && (q->testAttribute(Qt::WA_NativeWindow) || q->isWindow())) {-
727 extra->topextra->window = new QWidgetWindow(q);-
728 if (extra->minw || extra->minh)-
729 extra->topextra->window->setMinimumSize(QSize(extra->minw, extra->minh));-
730 if (extra->maxw != ((1<<24)-1) || extra->maxh != ((1<<24)-1))-
731 extra->topextra->window->setMaximumSize(QSize(extra->maxw, extra->maxh));-
732 if (extra->topextra->opacity != 255 && q->isWindow())-
733 extra->topextra->window->setOpacity(qreal(extra->topextra->opacity) / qreal(255));-
734 }-
735-
736}-
737QWidget::~QWidget()-
738{-
739 QWidgetPrivate * const d = d_func();-
740 d->data.in_destructor = true;-
741-
742-
743-
744-
745-
746-
747-
748 forif (QForeachContainer<typename QtPrivateQGestureManager *manager = QGestureManager
QGestureManage...er::instance()Description
TRUEnever evaluated
FALSEnever evaluated
::remove_reference<decltypeinstance()
QGestureManage...er::instance()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
749-
750 for (auto it = d->gestureContext.keys())>::type> _container_((keyBegin(), end = d->gestureContext.keys())); _container_.control && _container_.ikeyEnd(); it
it != endDescription
TRUEnever evaluated
FALSEnever evaluated
!= _container_.eend
it != endDescription
TRUEnever evaluated
FALSEnever evaluated
; ++_container_.i, _container_.control ^= 1it)
0
751 formanager->cleanupCachedGestures
never executed: manager->cleanupCachedGestures(this, *it);
(Qt::GestureType type =this, *_container_.i; _container_.control; _container_.control = 0)
never executed: manager->cleanupCachedGestures(this, *it);
0
ungrabGesture(type
never executed: manager->cleanupCachedGestures(this, *it);
never executed: manager->cleanupCachedGestures(this, *it);
it);
never executed: manager->cleanupCachedGestures(this, *it);
752 }
never executed: end of block
0
753 d->gestureContext.clear();-
754-
755-
756-
757 d->registerDropSite(false);-
758-
759-
760-
761 for (int i = 0; i < d->actions.size()
i < d->actions.size()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
762 QActionPrivate *apriv = d->actions.at(i)->d_func();-
763 apriv->widgets.removeAll(this);-
764 }
never executed: end of block
0
765 d->actions.clear();-
766-
767-
768-
769-
770-
771 if (!QApplicationPrivate::is_app_closing
!QApplicationP...is_app_closingDescription
TRUEnever evaluated
FALSEnever evaluated
&& testAttribute(Qt::WA_GrabbedShortcut)
testAttribute(...abbedShortcut)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
772 (static_cast<
never executed: (static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->shortcutMap.removeShortcut(0, this, QKeySequence());
QApplication *>(QCoreApplication::instance()))->d_func()->shortcutMap.removeShortcut(0, this, QKeySequence());
never executed: (static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->shortcutMap.removeShortcut(0, this, QKeySequence());
0
773-
774-
775-
776 delete d->layout;-
777 d->layout = 0;-
778-
779-
780 ((!(d->focus_next->d_func()->focus_prev == this)) ? qt_assert("d->focus_next->d_func()->focus_prev == this",__FILE__,15871602) : qt_noop());-
781 ((!(d->focus_prev->d_func()->focus_next == this)) ? qt_assert("d->focus_prev->d_func()->focus_next == this",__FILE__,15881603) : qt_noop());-
782-
783 if (d->focus_next != this
d->focus_next != thisDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
784 d->focus_next->d_func()->focus_prev = d->focus_prev;-
785 d->focus_prev->d_func()->focus_next = d->focus_next;-
786 d->focus_next = d->focus_prev = 0;-
787 }
never executed: end of block
0
788-
789-
790 if (true) {-
791-
792 const QWidget* w = this;-
793 while (w->d_func()->extra
w->d_func()->extraDescription
TRUEnever evaluated
FALSEnever evaluated
&& w->d_func()->extra->focus_proxy
w->d_func()->e...a->focus_proxyDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
794 w = w->d_func()->extra->focus_proxy;
never executed: w = w->d_func()->extra->focus_proxy;
0
795 QWidget *window = w->window();-
796 QWExtra *e = window
windowDescription
TRUEnever evaluated
FALSEnever evaluated
? window->d_func()->extra : 0;
0
797 if (!e
!eDescription
TRUEnever evaluated
FALSEnever evaluated
|| !e->proxyWidget
!e->proxyWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
|| (w->parentWidget()
w->parentWidget()Description
TRUEnever evaluated
FALSEnever evaluated
&& w->parentWidget()->d_func()->focus_child == this
w->parentWidge..._child == thisDescription
TRUEnever evaluated
FALSEnever evaluated
))
0
798-
799 clearFocus();
never executed: clearFocus();
0
800 }
never executed: end of block
else {
dead code: { }
-
801-
802 }
dead code: { }
-
803-
804 d->setDirtyOpaqueRegion();-
805-
806 if (isWindow()
isWindow()Description
TRUEnever evaluated
FALSEnever evaluated
&& isVisible()
isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
&& internalWinId()
internalWinId()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
807 if (true) {-
808 d->close_helper(QWidgetPrivate::CloseNoEvent);-
809 }
never executed: end of block
else {
dead code: { if (true) { hide(); } else { } }
-
810-
811 if (true) {
dead code: { if (true) { hide(); } else { } }
-
812 hide();
dead code: { if (true) { hide(); } else { } }
-
813 } else {
dead code: { }
dead code: { if (true) { hide(); } else { } }
-
814-
815 }
dead code: { }
dead code: { if (true) { hide(); } else { } }
-
816 }
dead code: { if (true) { hide(); } else { } }
-
817 }-
818-
819-
820-
821-
822-
823-
824 else if (isVisible()
isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
825 (static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->sendSyntheticEnterLeave(this);-
826 }
never executed: end of block
0
827-
828 if (QWidgetBackingStore *bs = d->maybeBackingStore()
QWidgetBacking...BackingStore()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
829 bs->removeDirtyWidget(this);-
830 if (testAttribute(Qt::WA_StaticContents)
testAttribute(...taticContents)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
831 bs->removeStaticWidget(this);
never executed: bs->removeStaticWidget(this);
0
832 }
never executed: end of block
0
833-
834 delete d->needsFlush;-
835 d->needsFlush = 0;-
836-
837-
838-
839 bool blocked = d->blockSig;-
840 d->blockSig = 0;-
841-
842 if (d->isSignalConnected(0)
d->isSignalConnected(0)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
843 if (true) {-
844 destroyed(this);-
845 }
never executed: end of block
else {
dead code: { QMessageLogger(__FILE__, 1670, __PRETTY_FUNCTION__).warning("Detected an unexpected exception in ~QWidget while emitting destroyed()."); qt_noop(); }
-
846-
847-
848 QMessageLogger(__FILE__, 16551670, __PRETTY_FUNCTION__).warning("Detected an unexpected exception in ~QWidget while emitting destroyed().");
dead code: { QMessageLogger(__FILE__, 1670, __PRETTY_FUNCTION__).warning("Detected an unexpected exception in ~QWidget while emitting destroyed()."); qt_noop(); }
-
849 qt_noop();
dead code: { QMessageLogger(__FILE__, 1670, __PRETTY_FUNCTION__).warning("Detected an unexpected exception in ~QWidget while emitting destroyed()."); qt_noop(); }
-
850 }
dead code: { QMessageLogger(__FILE__, 1670, __PRETTY_FUNCTION__).warning("Detected an unexpected exception in ~QWidget while emitting destroyed()."); qt_noop(); }
-
851 }-
852-
853 if (d->declarativeData
d->declarativeDataDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
854 if (static_cast<
static_cast<QA...)->ownedByQml1Description
TRUEnever evaluated
FALSEnever evaluated
QAbstractDeclarativeDataImpl*>(d->declarativeData)->ownedByQml1
static_cast<QA...)->ownedByQml1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
855 if (QAbstractDeclarativeData::destroyed_qml1
QAbstractDecla...destroyed_qml1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
856 QAbstractDeclarativeData::destroyed_qml1(d->declarativeData, this);
never executed: QAbstractDeclarativeData::destroyed_qml1(d->declarativeData, this);
0
857 }
never executed: end of block
else {
0
858 if (QAbstractDeclarativeData::destroyed
QAbstractDecla...ata::destroyedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
859 QAbstractDeclarativeData::destroyed(d->declarativeData, this);
never executed: QAbstractDeclarativeData::destroyed(d->declarativeData, this);
0
860 }
never executed: end of block
0
861 d->declarativeData = 0;-
862 }
never executed: end of block
0
863-
864 d->blockSig = blocked;-
865 if (!d->children.isEmpty()
!d->children.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
866 d->deleteChildren();
never executed: d->deleteChildren();
0
867-
868 QApplication::removePostedEvents(this);-
869-
870 if (true) {-
871 destroy();-
872 }
never executed: end of block
else {
dead code: { }
-
873-
874 }
dead code: { }
-
875 --QWidgetPrivate::instanceCounter;-
876-
877 if (QWidgetPrivate::allWidgets
QWidgetPrivate::allWidgetsDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
878 QWidgetPrivate::allWidgets->remove(this);
never executed: QWidgetPrivate::allWidgets->remove(this);
0
879-
880 if (true) {-
881 QEvent e(QEvent::Destroy);-
882 QCoreApplication::sendEvent(this, &e);-
883 }
never executed: end of block
else {
dead code: { }
-
884-
885 }
dead code: { }
-
886}-
887-
888int QWidgetPrivate::instanceCounter = 0;-
889int QWidgetPrivate::maxInstances = 0;-
890-
891void QWidgetPrivate::setWinId(WId id)-
892{-
893 QWidget * const q = q_func();-
894-
895-
896-
897-
898-
899 bool userDesktopWidget = qt_desktopWidget != 0 && qt_desktopWidget != q && q->windowType() == Qt::Desktop;-
900 if (mapper && data.winid && !userDesktopWidget) {-
901 mapper->remove(data.winid);-
902 }-
903-
904 const WId oldWinId = data.winid;-
905-
906 data.winid = id;-
907-
908-
909-
910 if (mapper && id && !userDesktopWidget) {-
911 mapper->insert(data.winid, q);-
912 }-
913-
914 if(oldWinId != id) {-
915 QEvent e(QEvent::WinIdChange);-
916 QCoreApplication::sendEvent(q, &e);-
917 }-
918}-
919-
920void QWidgetPrivate::createTLExtra()-
921{-
922 if (!extra)-
923 createExtra();-
924 if (!extra->topextra) {-
925 QTLWExtra* x = extra->topextra = new QTLWExtra;-
926 x->icon = 0;-
927 x->backingStore = 0;-
928 x->sharedPainter = 0;-
929 x->incw = x->inch = 0;-
930 x->basew = x->baseh = 0;-
931 x->frameStrut.setCoords(0, 0, 0, 0);-
932 x->normalGeometry = QRect(0,0,-1,-1);-
933 x->savedFlags = 0;-
934 x->opacity = 255;-
935 x->posIncludesFrame = 0;-
936 x->sizeAdjusted = false;-
937 x->inTopLevelResize = false;-
938 x->inRepaint = false;-
939 x->embedded = 0;-
940 x->window = 0;-
941 x->shareContext = 0;-
942 x->initialScreenIndex = -1;-
943-
944-
945-
946-
947-
948-
949-
950 }-
951}-
952-
953-
954-
955-
956-
957-
958void QWidgetPrivate::createExtra()-
959{-
960 if (!extra) {-
961 extra = new QWExtra;-
962 extra->glContext = 0;-
963 extra->topextra = 0;-
964-
965 extra->proxyWidget = 0;-
966-
967-
968 extra->curs = 0;-
969-
970 extra->minw = 0;-
971 extra->minh = 0;-
972 extra->maxw = ((1<<24)-1);-
973 extra->maxh = ((1<<24)-1);-
974 extra->customDpiX = 0;-
975 extra->customDpiY = 0;-
976 extra->explicitMinSize = 0;-
977 extra->explicitMaxSize = 0;-
978 extra->autoFillBackground = 0;-
979 extra->nativeChildrenForced = 0;-
980 extra->inRenderWithPainter = 0;-
981 extra->hasWindowContainer = false;-
982 extra->hasMask = 0;-
983 createSysExtra();-
984-
985-
986-
987-
988 }-
989}-
990-
991void QWidgetPrivate::createSysExtra()-
992{-
993}-
994-
995-
996-
997-
998-
999-
1000void QWidgetPrivate::deleteExtra()-
1001{-
1002 if (extra) {-
1003-
1004 delete extra->curs;-
1005-
1006 deleteSysExtra();-
1007-
1008-
1009 if (QStyleSheetStyle *proxy = qobject_cast<QStyleSheetStyle *>(extra->style))-
1010 proxy->deref();-
1011-
1012 if (extra->topextra) {-
1013 deleteTLSysExtra();-
1014-
1015 delete extra->topextra->icon;-
1016 delete extra->topextra;-
1017 }-
1018 delete extra;-
1019-
1020 extra = 0;-
1021 }-
1022}-
1023-
1024void QWidgetPrivate::deleteSysExtra()-
1025{-
1026}-
1027-
1028static void deleteBackingStore(QWidgetPrivate *d)-
1029{-
1030 QTLWExtra *topData = d->topData();-
1031-
1032-
1033-
1034-
1035-
1036 QScopedPointer<QOffscreenSurface> tempSurface;-
1037-
1038 if (d->textureChildSeen && topData->shareContext) {-
1039 if (topData->window->handle()) {-
1040 topData->shareContext->makeCurrent(topData->window);-
1041 } else {-
1042 tempSurface.reset(new QOffscreenSurface);-
1043 tempSurface->setFormat(topData->shareContext->format());-
1044 tempSurface->create();-
1045 topData->shareContext->makeCurrent(tempSurface.data());-
1046 }-
1047 }-
1048-
1049-
1050 delete topData->backingStore;-
1051 topData->backingStore = 0;-
1052-
1053-
1054 if (d->textureChildSeen && topData->shareContext)-
1055 topData->shareContext->doneCurrent();-
1056-
1057}-
1058-
1059void QWidgetPrivate::deleteTLSysExtra()-
1060{-
1061 if (extra && extra->topextra) {-
1062-
1063-
1064-
1065-
1066 extra->topextra->backingStoreTracker.destroy();-
1067 deleteBackingStore(this);-
1068-
1069 qDeleteAll(extra->topextra->widgetTextures);-
1070 extra->topextra->widgetTextures.clear();-
1071 delete extra->topextra->shareContext;-
1072 extra->topextra->shareContext = 0;-
1073-
1074-
1075-
1076-
1077-
1078-
1079 if (extra->topextra->window) {-
1080 extra->topextra->window->destroy();-
1081 }-
1082 delete extra->topextra->window;-
1083 extra->topextra->window = 0;-
1084-
1085 }-
1086}-
1087-
1088-
1089-
1090-
1091-
1092-
1093bool QWidgetPrivate::isOverlapped(const QRect &rect) const-
1094{-
1095 const QWidget * const q = q_func();-
1096-
1097 const QWidget *w = q;-
1098 QRect r = rect;-
1099 while (w) {-
1100 if (w->isWindow())-
1101 return false;-
1102 QWidgetPrivate *pd = w->parentWidget()->d_func();-
1103 bool above = false;-
1104 for (int i = 0; i < pd->children.size(); ++i) {-
1105 QWidget *sibling = qobject_cast<QWidget *>(pd->children.at(i));-
1106 if (!sibling || !sibling->isVisible() || sibling->isWindow())-
1107 continue;-
1108 if (!above) {-
1109 above = (sibling == w);-
1110 continue;-
1111 }-
1112-
1113 if (qRectIntersects(sibling->d_func()->effectiveRectFor(sibling->data->crect), r)) {-
1114 const QWExtra *siblingExtra = sibling->d_func()->extra;-
1115 if (siblingExtra && siblingExtra->hasMask && !sibling->d_func()->graphicsEffect-
1116 && !siblingExtra->mask.translated(sibling->data->crect.topLeft()).intersects(r)) {-
1117 continue;-
1118 }-
1119 return true;-
1120 }-
1121 }-
1122 w = w->parentWidget();-
1123 r.translate(pd->data.crect.topLeft());-
1124 }-
1125 return false;-
1126}-
1127-
1128void QWidgetPrivate::syncBackingStore()-
1129{-
1130 if (paintOnScreen()) {-
1131 repaint_sys(dirty);-
1132 dirty = QRegion();-
1133 } else if (QWidgetBackingStore *bs = maybeBackingStore()) {-
1134 bs->sync();-
1135 }-
1136}-
1137-
1138void QWidgetPrivate::syncBackingStore(const QRegion &region)-
1139{-
1140 if (paintOnScreen())-
1141 repaint_sys(region);-
1142 else if (QWidgetBackingStore *bs = maybeBackingStore()) {-
1143 bs->sync(q_func(), region);-
1144 }-
1145}-
1146-
1147void QWidgetPrivate::setUpdatesEnabled_helper(bool enable)-
1148{-
1149 QWidget * const q = q_func();-
1150-
1151 if (enable && !q->isWindow() && q->parentWidget() && !q->parentWidget()->updatesEnabled())-
1152 return;-
1153-
1154 if (enable != q->testAttribute(Qt::WA_UpdatesDisabled))-
1155 return;-
1156-
1157 q->setAttribute(Qt::WA_UpdatesDisabled, !enable);-
1158 if (enable)-
1159 q->update();-
1160-
1161 Qt::WidgetAttribute attribute = enable ? Qt::WA_ForceUpdatesDisabled : Qt::WA_UpdatesDisabled;-
1162 for (int i = 0; i < children.size(); ++i) {-
1163 QWidget *w = qobject_cast<QWidget *>(children.at(i));-
1164 if (w && !w->isWindow() && !w->testAttribute(attribute))-
1165 w->d_func()->setUpdatesEnabled_helper(enable);-
1166 }-
1167}-
1168void QWidgetPrivate::propagatePaletteChange()-
1169{-
1170 QWidget * const q = q_func();-
1171-
1172-
1173 if (!q->parentWidget()
!q->parentWidget()Description
TRUEnever evaluated
FALSEnever evaluated
&& extra
extraDescription
TRUEnever evaluated
FALSEnever evaluated
&& extra->proxyWidget
extra->proxyWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1174 QGraphicsProxyWidget *p = extra->proxyWidget;-
1175 inheritedPaletteResolveMask = p->d_func()->inheritedPaletteResolveMask | p->palette().resolve();-
1176 }
never executed: end of block
else
0
1177-
1178 if (q->isWindow()
q->isWindow()Description
TRUEnever evaluated
FALSEnever evaluated
&& !q->testAttribute(Qt::WA_WindowPropagation)
!q->testAttrib...owPropagation)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1179 inheritedPaletteResolveMask = 0;-
1180 }
never executed: end of block
0
1181 int mask = data.pal.resolve() | inheritedPaletteResolveMask;-
1182-
1183 const bool useStyleSheetPropagationInWidgetStyles =-
1184 QCoreApplication::testAttribute(Qt::AA_UseStyleSheetPropagationInWidgetStyles);-
1185-
1186 QEvent pc(QEvent::PaletteChange);-
1187 QApplication::sendEvent(q, &pc);-
1188 for (int i = 0; i < children.size()
i < children.size()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
1189 QWidget *w = qobject_cast<QWidget*>(children.at(i));-
1190 if (w
wDescription
TRUEnever evaluated
FALSEnever evaluated
&& !(!
!w->testAttrib...WA_StyleSheet)Description
TRUEnever evaluated
FALSEnever evaluated
w->testAttribute(Qt::WA_StyleSheet)
!w->testAttrib...WA_StyleSheet)Description
TRUEnever evaluated
FALSEnever evaluated
|| useStyleSheetPropagationInWidgetStyles
useStyleSheetP...InWidgetStylesDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1191 && (!w->isWindow()
!w->isWindow()Description
TRUEnever evaluated
FALSEnever evaluated
|| w->testAttribute(Qt::WA_WindowPropagation)
w->testAttribu...owPropagation)Description
TRUEnever evaluated
FALSEnever evaluated
)) {
0
1192 QWidgetPrivate *wd = w->d_func();-
1193 wd->inheritedPaletteResolveMask = mask;-
1194 wd->resolvePalette();-
1195 }
never executed: end of block
0
1196 }
never executed: end of block
0
1197}
never executed: end of block
0
1198-
1199-
1200-
1201-
1202QRect QWidgetPrivate::clipRect() const-
1203{-
1204 const QWidget * const q = q_func();-
1205 const QWidget * w = q;-
1206 if (!w->isVisible())-
1207 return QRect();-
1208 QRect r = effectiveRectFor(q->rect());-
1209 int ox = 0;-
1210 int oy = 0;-
1211 while (w-
1212 && w->isVisible()-
1213 && !w->isWindow()-
1214 && w->parentWidget()) {-
1215 ox -= w->x();-
1216 oy -= w->y();-
1217 w = w->parentWidget();-
1218 r &= QRect(ox, oy, w->width(), w->height());-
1219 }-
1220 return r;-
1221}-
1222-
1223-
1224-
1225-
1226QRegion QWidgetPrivate::clipRegion() const-
1227{-
1228 const QWidget * const q = q_func();-
1229 if (!q->isVisible())-
1230 return QRegion();-
1231 QRegion r(q->rect());-
1232 const QWidget * w = q;-
1233 const QWidget *ignoreUpTo;-
1234 int ox = 0;-
1235 int oy = 0;-
1236 while (w-
1237 && w->isVisible()-
1238 && !w->isWindow()-
1239 && w->parentWidget()) {-
1240 ox -= w->x();-
1241 oy -= w->y();-
1242 ignoreUpTo = w;-
1243 w = w->parentWidget();-
1244 r &= QRegion(ox, oy, w->width(), w->height());-
1245-
1246 int i = 0;-
1247 while(w->d_func()->children.at(i++) != static_cast<const QObject *>(ignoreUpTo))-
1248 ;-
1249 for ( ; i < w->d_func()->children.size(); ++i) {-
1250 if(QWidget *sibling = qobject_cast<QWidget *>(w->d_func()->children.at(i))) {-
1251 if(sibling->isVisible() && !sibling->isWindow()) {-
1252 QRect siblingRect(ox+sibling->x(), oy+sibling->y(),-
1253 sibling->width(), sibling->height());-
1254 if (qRectIntersects(siblingRect, q->rect()))-
1255 r -= QRegion(siblingRect);-
1256 }-
1257 }-
1258 }-
1259 }-
1260 return r;-
1261}-
1262-
1263void QWidgetPrivate::setSystemClip(QPaintDevice *paintDevice, const QRegion &region)-
1264{-
1265-
1266 QPaintEngine *paintEngine = paintDevice->paintEngine();-
1267 QTransform scaleTransform;-
1268 const qreal devicePixelRatio = paintDevice->devicePixelRatioF();-
1269 scaleTransform.scale(devicePixelRatio, devicePixelRatio);-
1270 paintEngine->d_func()->systemClip = scaleTransform.map(region);-
1271}-
1272-
1273-
1274void QWidgetPrivate::invalidateGraphicsEffectsRecursively()-
1275{-
1276 QWidget * const q = q_func();-
1277 QWidget *w = q;-
1278 do {-
1279 if (w->graphicsEffect()) {-
1280 QWidgetEffectSourcePrivate *sourced =-
1281 static_cast<QWidgetEffectSourcePrivate *>(w->graphicsEffect()->source()->d_func());-
1282 if (!sourced->updateDueToGraphicsEffect)-
1283 w->graphicsEffect()->source()->d_func()->invalidateCache();-
1284 }-
1285 w = w->parentWidget();-
1286 } while (w);-
1287}-
1288-
1289-
1290void QWidgetPrivate::setDirtyOpaqueRegion()-
1291{-
1292 QWidget * const q = q_func();-
1293-
1294 dirtyOpaqueChildren = true;-
1295-
1296-
1297 invalidateGraphicsEffectsRecursively();-
1298-
1299-
1300 if (q->isWindow())-
1301 return;-
1302-
1303 QWidget *parent = q->parentWidget();-
1304 if (!parent)-
1305 return;-
1306-
1307-
1308 QWidgetPrivate *pd = parent->d_func();-
1309 if (!pd->dirtyOpaqueChildren)-
1310 pd->setDirtyOpaqueRegion();-
1311}-
1312-
1313const QRegion &QWidgetPrivate::getOpaqueChildren() const-
1314{-
1315 if (!dirtyOpaqueChildren)-
1316 return opaqueChildren;-
1317-
1318 QWidgetPrivate *that = const_cast<QWidgetPrivate*>(this);-
1319 that->opaqueChildren = QRegion();-
1320-
1321 for (int i = 0; i < children.size(); ++i) {-
1322 QWidget *child = qobject_cast<QWidget *>(children.at(i));-
1323 if (!child || !child->isVisible() || child->isWindow())-
1324 continue;-
1325-
1326 const QPoint offset = child->geometry().topLeft();-
1327 QWidgetPrivate *childd = child->d_func();-
1328 QRegion r = childd->isOpaque ? child->rect() : childd->getOpaqueChildren();-
1329 if (childd->extra && childd->extra->hasMask)-
1330 r &= childd->extra->mask;-
1331 if (r.isEmpty())-
1332 continue;-
1333 r.translate(offset);-
1334 that->opaqueChildren += r;-
1335 }-
1336-
1337 that->opaqueChildren &= q_func()->rect();-
1338 that->dirtyOpaqueChildren = false;-
1339-
1340 return that->opaqueChildren;-
1341}-
1342-
1343void QWidgetPrivate::subtractOpaqueChildren(QRegion &source, const QRect &clipRect) const-
1344{-
1345 if (children.isEmpty() || clipRect.isEmpty())-
1346 return;-
1347-
1348 const QRegion &r = getOpaqueChildren();-
1349 if (!r.isEmpty())-
1350 source -= (r & clipRect);-
1351}-
1352-
1353-
1354void QWidgetPrivate::subtractOpaqueSiblings(QRegion &sourceRegion, bool *hasDirtySiblingsAbove,-
1355 bool alsoNonOpaque) const-
1356{-
1357 const QWidget * const q = q_func();-
1358 static int disableSubtractOpaqueSiblings = qEnvironmentVariableIntValue("QT_NO_SUBTRACTOPAQUESIBLINGS");-
1359 if (disableSubtractOpaqueSiblings || q->isWindow())-
1360 return;-
1361-
1362-
1363-
1364-
1365-
1366-
1367 QRect clipBoundingRect;-
1368 bool dirtyClipBoundingRect = true;-
1369-
1370 QRegion parentClip;-
1371 bool dirtyParentClip = true;-
1372-
1373 QPoint parentOffset = data.crect.topLeft();-
1374-
1375 const QWidget *w = q;-
1376-
1377 while (w) {-
1378 if (w->isWindow())-
1379 break;-
1380 QWidgetPrivate *pd = w->parentWidget()->d_func();-
1381 const int myIndex = pd->children.indexOf(const_cast<QWidget *>(w));-
1382 const QRect widgetGeometry = w->d_func()->effectiveRectFor(w->data->crect);-
1383 for (int i = myIndex + 1; i < pd->children.size(); ++i) {-
1384 QWidget *sibling = qobject_cast<QWidget *>(pd->children.at(i));-
1385 if (!sibling || !sibling->isVisible() || sibling->isWindow())-
1386 continue;-
1387-
1388 const QRect siblingGeometry = sibling->d_func()->effectiveRectFor(sibling->data->crect);-
1389 if (!qRectIntersects(siblingGeometry, widgetGeometry))-
1390 continue;-
1391-
1392 if (dirtyClipBoundingRect) {-
1393 clipBoundingRect = sourceRegion.boundingRect();-
1394 dirtyClipBoundingRect = false;-
1395 }-
1396-
1397 if (!qRectIntersects(siblingGeometry, clipBoundingRect.translated(parentOffset)))-
1398 continue;-
1399-
1400 if (dirtyParentClip) {-
1401 parentClip = sourceRegion.translated(parentOffset);-
1402 dirtyParentClip = false;-
1403 }-
1404-
1405 const QPoint siblingPos(sibling->data->crect.topLeft());-
1406 const QRect siblingClipRect(sibling->d_func()->clipRect());-
1407 QRegion siblingDirty(parentClip);-
1408 siblingDirty &= (siblingClipRect.translated(siblingPos));-
1409 const bool hasMask = sibling->d_func()->extra && sibling->d_func()->extra->hasMask-
1410 && !sibling->d_func()->graphicsEffect;-
1411 if (hasMask)-
1412 siblingDirty &= sibling->d_func()->extra->mask.translated(siblingPos);-
1413 if (siblingDirty.isEmpty())-
1414 continue;-
1415-
1416 if (sibling->d_func()->isOpaque || alsoNonOpaque) {-
1417 if (hasMask) {-
1418 siblingDirty.translate(-parentOffset);-
1419 sourceRegion -= siblingDirty;-
1420 } else {-
1421 sourceRegion -= siblingGeometry.translated(-parentOffset);-
1422 }-
1423 } else {-
1424 if (hasDirtySiblingsAbove)-
1425 *hasDirtySiblingsAbove = true;-
1426 if (sibling->d_func()->children.isEmpty())-
1427 continue;-
1428 QRegion opaqueSiblingChildren(sibling->d_func()->getOpaqueChildren());-
1429 opaqueSiblingChildren.translate(-parentOffset + siblingPos);-
1430 sourceRegion -= opaqueSiblingChildren;-
1431 }-
1432 if (sourceRegion.isEmpty())-
1433 return;-
1434-
1435 dirtyClipBoundingRect = true;-
1436 dirtyParentClip = true;-
1437 }-
1438-
1439 w = w->parentWidget();-
1440 parentOffset += pd->data.crect.topLeft();-
1441 dirtyParentClip = true;-
1442 }-
1443}-
1444-
1445void QWidgetPrivate::clipToEffectiveMask(QRegion &region) const-
1446{-
1447 const QWidget * const q = q_func();-
1448-
1449 const QWidget *w = q;-
1450 QPoint offset;-
1451-
1452-
1453 if (graphicsEffect) {-
1454 w = q->parentWidget();-
1455 offset -= data.crect.topLeft();-
1456 }-
1457-
1458-
1459 while (w) {-
1460 const QWidgetPrivate *wd = w->d_func();-
1461 if (wd->extra && wd->extra->hasMask)-
1462 region &= (w != q) ? wd->extra->mask.translated(offset) : wd->extra->mask;-
1463 if (w->isWindow())-
1464 return;-
1465 offset -= wd->data.crect.topLeft();-
1466 w = w->parentWidget();-
1467 }-
1468}-
1469-
1470bool QWidgetPrivate::paintOnScreen() const-
1471{-
1472-
1473-
1474-
1475 const QWidget * const q = q_func();-
1476 if (q->testAttribute(Qt::WA_PaintOnScreen)-
1477 || (!q->isWindow() && q->window()->testAttribute(Qt::WA_PaintOnScreen))) {-
1478 return true;-
1479 }-
1480-
1481 return !qt_enable_backingstore;-
1482-
1483}-
1484-
1485void QWidgetPrivate::updateIsOpaque()-
1486{-
1487-
1488 setDirtyOpaqueRegion();-
1489-
1490-
1491 if (graphicsEffect) {-
1492-
1493 setOpaque(false);-
1494 return;-
1495 }-
1496-
1497-
1498 QWidget * const q = q_func();-
1499-
1500-
1501-
1502-
1503-
1504-
1505-
1506 if (q->testAttribute(Qt::WA_OpaquePaintEvent) || q->testAttribute(Qt::WA_PaintOnScreen)) {-
1507 setOpaque(true);-
1508 return;-
1509 }-
1510-
1511 const QPalette &pal = q->palette();-
1512-
1513 if (q->autoFillBackground()) {-
1514 const QBrush &autoFillBrush = pal.brush(q->backgroundRole());-
1515 if (autoFillBrush.style() != Qt::NoBrush && autoFillBrush.isOpaque()) {-
1516 setOpaque(true);-
1517 return;-
1518 }-
1519 }-
1520-
1521 if (q->isWindow() && !q->testAttribute(Qt::WA_NoSystemBackground)) {-
1522 const QBrush &windowBrush = q->palette().brush(QPalette::Window);-
1523 if (windowBrush.style() != Qt::NoBrush && windowBrush.isOpaque()) {-
1524 setOpaque(true);-
1525 return;-
1526 }-
1527 }-
1528 setOpaque(false);-
1529}-
1530-
1531void QWidgetPrivate::setOpaque(bool opaque)-
1532{-
1533 if (isOpaque != opaque) {-
1534 isOpaque = opaque;-
1535 updateIsTranslucent();-
1536 }-
1537}-
1538-
1539void QWidgetPrivate::updateIsTranslucent()-
1540{-
1541 QWidget * const q = q_func();-
1542 if (QWindow *window = q->windowHandle()) {-
1543 QSurfaceFormat format = window->format();-
1544 const int oldAlpha = format.alphaBufferSize();-
1545 const int newAlpha = q->testAttribute(Qt::WA_TranslucentBackground)? 8 : 0;-
1546 if (oldAlpha != newAlpha) {-
1547 format.setAlphaBufferSize(newAlpha);-
1548 window->setFormat(format);-
1549 }-
1550 }-
1551}-
1552-
1553static inline void fillRegion(QPainter *painter, const QRegion &rgn, const QBrush &brush)-
1554{-
1555 ((!(painter)) ? qt_assert("painter",__FILE__,23772395) : qt_noop());-
1556-
1557 if (brush.style() == Qt::TexturePattern) {-
1558-
1559-
1560-
1561-
1562-
1563-
1564-
1565 {-
1566 const QRect rect(rgn.boundingRect());-
1567 painter->setClipRegion(rgn);-
1568 painter->drawTiledPixmap(rect, brush.texture(), rect.topLeft());-
1569 }-
1570-
1571-
1572 } else if (brush.gradient()-
1573 && brush.gradient()->coordinateMode() == QGradient::ObjectBoundingMode) {-
1574 painter->save();-
1575 painter->setClipRegion(rgn);-
1576 painter->fillRect(0, 0, painter->device()->width(), painter->device()->height(), brush);-
1577 painter->restore();-
1578 } else {-
1579 const QVector<QRect> &rects = rgn.rects();-
1580 for (int i = 0; i < rects.size(); ++i)-
1581 painter->fillRect(rects.at(i), brush);-
1582 }-
1583}-
1584-
1585void QWidgetPrivate::paintBackground(QPainter *painter, const QRegion &rgn, int flags) const-
1586{-
1587 const QWidget * const q = q_func();-
1588-
1589-
1590 bool resetBrushOrigin = false;-
1591 QPointF oldBrushOrigin;-
1592-
1593 QAbstractScrollArea *scrollArea = qobject_cast<QAbstractScrollArea *>(parent);-
1594 if (scrollArea && scrollArea->viewport() == q) {-
1595 QObjectData *scrollPrivate = static_cast<QWidget *>(scrollArea)->d_ptr.data();-
1596 QAbstractScrollAreaPrivate *priv = static_cast<QAbstractScrollAreaPrivate *>(scrollPrivate);-
1597 oldBrushOrigin = painter->brushOrigin();-
1598 resetBrushOrigin = true;-
1599 painter->setBrushOrigin(-priv->contentsOffset());-
1600-
1601 }-
1602-
1603-
1604 const QBrush autoFillBrush = q->palette().brush(q->backgroundRole());-
1605-
1606 if ((flags & DrawAsRoot) && !(q->autoFillBackground() && autoFillBrush.isOpaque())) {-
1607 const QBrush bg = q->palette().brush(QPalette::Window);-
1608 if (!(flags & DontSetCompositionMode)) {-
1609-
1610 QPainter::CompositionMode oldMode = painter->compositionMode();-
1611 painter->setCompositionMode(QPainter::CompositionMode_Source);-
1612 fillRegion(painter, rgn, bg);-
1613 painter->setCompositionMode(oldMode);-
1614 } else {-
1615 fillRegion(painter, rgn, bg);-
1616 }-
1617 }-
1618-
1619 if (q->autoFillBackground())-
1620 fillRegion(painter, rgn, autoFillBrush);-
1621-
1622 if (q->testAttribute(Qt::WA_StyledBackground)) {-
1623 painter->setClipRegion(rgn);-
1624 QStyleOption opt;-
1625 opt.initFrom(q);-
1626 q->style()->drawPrimitive(QStyle::PE_Widget, &opt, painter, q);-
1627 }-
1628-
1629-
1630 if (resetBrushOrigin)-
1631 painter->setBrushOrigin(oldBrushOrigin);-
1632-
1633}-
1634 extern QWidget *qt_button_down;-
1635-
1636-
1637void QWidgetPrivate::deactivateWidgetCleanup()-
1638{-
1639 QWidget * const q = q_func();-
1640-
1641 if (QApplication::activeWindow() == q)-
1642 QApplication::setActiveWindow(0);-
1643-
1644 if (q == qt_button_down)-
1645 qt_button_down = 0;-
1646}-
1647QWidget *QWidget::find(WId id)-
1648{-
1649 return QWidgetPrivate::mapper ? QWidgetPrivate::mapper->value(id, 0) : 0;-
1650}-
1651WId QWidget::winId() const-
1652{-
1653 if (!testAttribute(Qt::WA_WState_Created) || !internalWinId()) {-
1654-
1655-
1656-
1657 QWidget *that = const_cast<QWidget*>(this);-
1658 that->setAttribute(Qt::WA_NativeWindow);-
1659 that->d_func()->createWinId();-
1660 return that->data->winid;-
1661 }-
1662 return data->winid;-
1663}-
1664-
1665void QWidgetPrivate::createWinId()-
1666{-
1667 QWidget * const q = q_func();-
1668-
1669-
1670-
1671-
1672 const bool forceNativeWindow = q->testAttribute(Qt::WA_NativeWindow);-
1673 if (!q->testAttribute(Qt::WA_WState_Created) || (forceNativeWindow && !q->internalWinId())) {-
1674 if (!q->isWindow()) {-
1675 QWidget *parent = q->parentWidget();-
1676 QWidgetPrivate *pd = parent->d_func();-
1677 if (forceNativeWindow && !q->testAttribute(Qt::WA_DontCreateNativeAncestors))-
1678 parent->setAttribute(Qt::WA_NativeWindow);-
1679 if (!parent->internalWinId()) {-
1680 pd->createWinId();-
1681 }-
1682-
1683 for (int i = 0; i < pd->children.size(); ++i) {-
1684 QWidget *w = qobject_cast<QWidget *>(pd->children.at(i));-
1685 if (w && !w->isWindow() && (!w->testAttribute(Qt::WA_WState_Created)-
1686 || (!w->internalWinId() && w->testAttribute(Qt::WA_NativeWindow)))) {-
1687 w->create();-
1688 }-
1689 }-
1690 } else {-
1691 q->create();-
1692 }-
1693 }-
1694}-
1695void QWidget::createWinId()-
1696{-
1697 QWidgetPrivate * const d = d_func();-
1698-
1699-
1700-
1701-
1702 d->createWinId();-
1703}-
1704WId QWidget::effectiveWinId() const-
1705{-
1706 const WId id = internalWinId();-
1707 if (id || !testAttribute(Qt::WA_WState_Created))-
1708 return id;-
1709 if (const QWidget *realParent = nativeParentWidget())-
1710 return realParent->internalWinId();-
1711 return 0;-
1712}-
1713QWindow *QWidget::windowHandle() const-
1714{-
1715 const QWidgetPrivate * const d = d_func();-
1716 QTLWExtra *extra = d->maybeTopData();-
1717 if (extra)-
1718 return extra->window;-
1719-
1720 return 0;-
1721}-
1722QString QWidget::styleSheet() const-
1723{-
1724 const QWidgetPrivate * const d = d_func();-
1725 if (!d->extra)-
1726 return QString();-
1727 return d->extra->styleSheet;-
1728}-
1729-
1730void QWidget::setStyleSheet(const QString& styleSheet)-
1731{-
1732 QWidgetPrivate * const d = d_func();-
1733 if (data->in_destructor)-
1734 return;-
1735 d->createExtra();-
1736-
1737 QStyleSheetStyle *proxy = qobject_cast<QStyleSheetStyle *>(d->extra->style);-
1738 d->extra->styleSheet = styleSheet;-
1739 if (styleSheet.isEmpty()) {-
1740 if (!proxy)-
1741 return;-
1742-
1743 d->inheritStyle();-
1744 return;-
1745 }-
1746-
1747 if (proxy) {-
1748 if (d->polished)-
1749 proxy->repolish(this);-
1750 return;-
1751 }-
1752-
1753 if (testAttribute(Qt::WA_SetStyle)) {-
1754 d->setStyle_helper(new QStyleSheetStyle(d->extra->style), true);-
1755 } else {-
1756 d->setStyle_helper(new QStyleSheetStyle(0), true);-
1757 }-
1758}-
1759-
1760-
1761-
1762-
1763-
1764-
1765-
1766QStyle *QWidget::style() const-
1767{-
1768 const QWidgetPrivate * const d = d_func();-
1769-
1770 if (d->extra && d->extra->style)-
1771 return d->extra->style;-
1772 return QApplication::style();-
1773}-
1774void QWidget::setStyle(QStyle *style)-
1775{-
1776 QWidgetPrivate * const d = d_func();-
1777 setAttribute(Qt::WA_SetStyle, style != 0);-
1778 d->createExtra();-
1779-
1780 if (QStyleSheetStyle *proxy = qobject_cast<QStyleSheetStyle *>(style)) {-
1781-
1782-
1783 proxy->ref();-
1784 d->setStyle_helper(style, false);-
1785 } else if (qobject_cast<QStyleSheetStyle *>(d->extra->style) || !(static_cast<QApplication *>(QCoreApplication::instance()))->styleSheet().isEmpty()) {-
1786-
1787 d->setStyle_helper(new QStyleSheetStyle(style), true);-
1788 } else-
1789-
1790 d->setStyle_helper(style, false);-
1791}-
1792-
1793void QWidgetPrivate::setStyle_helper(QStyle *newStyle, bool propagate, bool-
1794-
1795-
1796-
1797 )-
1798{-
1799 QWidget * const q = q_func();-
1800 QStyle *oldStyle = q->style();-
1801-
1802 QPointer<QStyle> origStyle;-
1803 {-
1804 createExtra();-
1805-
1806-
1807 origStyle = extra->style.data();-
1808-
1809 extra->style = newStyle;-
1810 }-
1811-
1812-
1813 if (q->windowType() != Qt::Desktop) {-
1814 if (polished) {-
1815 oldStyle->unpolish(q);-
1816-
1817-
1818-
1819-
1820 q->style()->polish(q);-
1821-
1822-
1823-
1824-
1825 }-
1826 }-
1827-
1828 if (propagate) {-
1829-
1830 const QObjectList childrenList = children;-
1831 for (int i = 0; i < childrenList.size(); ++i) {-
1832 QWidget *c = qobject_cast<QWidget*>(childrenList.at(i));-
1833 if (c)-
1834 c->d_func()->inheritStyle();-
1835 }-
1836 }-
1837-
1838-
1839 if (!qobject_cast<QStyleSheetStyle*>(newStyle)) {-
1840 if (const QStyleSheetStyle* cssStyle = qobject_cast<QStyleSheetStyle*>(origStyle.data())) {-
1841 cssStyle->clearWidgetFont(q);-
1842 }-
1843 }-
1844-
1845-
1846 QEvent e(QEvent::StyleChange);-
1847 QApplication::sendEvent(q, &e);-
1848-
1849-
1850-
1851 if (QStyleSheetStyle *proxy = qobject_cast<QStyleSheetStyle *>(origStyle.data()))-
1852 proxy->deref();-
1853-
1854}-
1855-
1856-
1857void QWidgetPrivate::inheritStyle()-
1858{-
1859-
1860 QWidget * const q = q_func();-
1861-
1862 QStyleSheetStyle *proxy = extra ? qobject_cast<QStyleSheetStyle *>(extra->style) : 0;-
1863-
1864 if (!q->styleSheet().isEmpty()) {-
1865 ((!(proxy)) ? qt_assert("proxy",__FILE__,28242842) : qt_noop());-
1866 proxy->repolish(q);-
1867 return;-
1868 }-
1869-
1870 QStyle *origStyle = proxy ? proxy->base : (extra ? (QStyle*)extra->style : 0);-
1871 QWidget *parent = q->parentWidget();-
1872 QStyle *parentStyle = (parent && parent->d_func()->extra) ? (QStyle*)parent->d_func()->extra->style : 0;-
1873-
1874-
1875 if (!(static_cast<QApplication *>(QCoreApplication::instance()))->styleSheet().isEmpty() || qobject_cast<QStyleSheetStyle *>(parentStyle)) {-
1876 QStyle *newStyle = parentStyle;-
1877 if (q->testAttribute(Qt::WA_SetStyle))-
1878 newStyle = new QStyleSheetStyle(origStyle);-
1879 else if (QStyleSheetStyle *newProxy = qobject_cast<QStyleSheetStyle *>(parentStyle))-
1880 newProxy->ref();-
1881-
1882 setStyle_helper(newStyle, true);-
1883 return;-
1884 }-
1885-
1886-
1887-
1888 if (origStyle == (extra ? (QStyle*)extra->style : 0))-
1889 return;-
1890-
1891-
1892-
1893-
1894 if (!q->testAttribute(Qt::WA_SetStyle))-
1895 origStyle = 0;-
1896-
1897 setStyle_helper(origStyle, true);-
1898-
1899}-
1900Qt::WindowModality QWidget::windowModality() const-
1901{-
1902 return static_cast<Qt::WindowModality>(data->window_modality);-
1903}-
1904-
1905void QWidget::setWindowModality(Qt::WindowModality windowModality)-
1906{-
1907 data->window_modality = windowModality;-
1908-
1909 setAttribute(Qt::WA_ShowModal, (data->window_modality != Qt::NonModal));-
1910 setAttribute(Qt::WA_SetWindowModality, true);-
1911}-
1912-
1913void QWidgetPrivate::setModal_sys()-
1914{-
1915 QWidget * const q = q_func();-
1916 if (q->windowHandle())-
1917 q->windowHandle()->setModality(q->windowModality());-
1918}-
1919bool QWidget::isMinimized() const-
1920{ return data->window_state & Qt::WindowMinimized; }-
1921void QWidget::showMinimized()-
1922{-
1923 bool isMin = isMinimized();-
1924 if (isMin && isVisible())-
1925 return;-
1926-
1927 ensurePolished();-
1928-
1929 if (!isMin)-
1930 setWindowState((windowState() & ~Qt::WindowActive) | Qt::WindowMinimized);-
1931 setVisible(true);-
1932}-
1933bool QWidget::isMaximized() const-
1934{ return data->window_state & Qt::WindowMaximized; }-
1935Qt::WindowStates QWidget::windowState() const-
1936{-
1937 return Qt::WindowStates(data->window_state);-
1938}-
1939void QWidget::overrideWindowState(Qt::WindowStates newstate)-
1940{-
1941 QWindowStateChangeEvent e(Qt::WindowStates(data->window_state), true);-
1942 data->window_state = newstate;-
1943 QApplication::sendEvent(this, &e);-
1944}-
1945-
1946Qt::WindowState effectiveState(Qt::WindowStates state)-
1947{-
1948 if (state & Qt::WindowMinimized)-
1949 return Qt::WindowMinimized;-
1950 else if (state & Qt::WindowFullScreen)-
1951 return Qt::WindowFullScreen;-
1952 else if (state & Qt::WindowMaximized)-
1953 return Qt::WindowMaximized;-
1954 return Qt::WindowNoState;-
1955}-
1956void QWidget::setWindowState(Qt::WindowStates newstate)-
1957{-
1958 QWidgetPrivate * const d = d_func();-
1959 Qt::WindowStates oldstate = windowState();-
1960 if (oldstate == newstate)-
1961 return;-
1962 if (isWindow() && !testAttribute(Qt::WA_WState_Created))-
1963 create();-
1964-
1965 data->window_state = newstate;-
1966 data->in_set_window_state = 1;-
1967 Qt::WindowState newEffectiveState = effectiveState(newstate);-
1968 Qt::WindowState oldEffectiveState = effectiveState(oldstate);-
1969 if (isWindow() && newEffectiveState != oldEffectiveState) {-
1970-
1971 if (!testAttribute(Qt::WA_Resized) && !isVisible())-
1972 adjustSize();-
1973-
1974 d->createTLExtra();-
1975 if (oldEffectiveState == Qt::WindowNoState)-
1976 d->topData()->normalGeometry = geometry();-
1977-
1978 ((!(windowHandle())) ? qt_assert("windowHandle()",__FILE__,30883106) : qt_noop());-
1979 windowHandle()->setWindowState(newEffectiveState);-
1980 }-
1981 data->in_set_window_state = 0;-
1982-
1983 if (newstate & Qt::WindowActive)-
1984 activateWindow();-
1985-
1986 QWindowStateChangeEvent e(oldstate);-
1987 QApplication::sendEvent(this, &e);-
1988}-
1989bool QWidget::isFullScreen() const-
1990{ return data->window_state & Qt::WindowFullScreen; }-
1991void QWidget::showFullScreen()-
1992{-
1993 ensurePolished();-
1994-
1995 setWindowState((windowState() & ~(Qt::WindowMinimized | Qt::WindowMaximized))-
1996 | Qt::WindowFullScreen);-
1997 setVisible(true);-
1998-
1999-
2000 activateWindow();-
2001-
2002}-
2003void QWidget::showMaximized()-
2004{-
2005 ensurePolished();-
2006-
2007 setWindowState((windowState() & ~(Qt::WindowMinimized | Qt::WindowFullScreen))-
2008 | Qt::WindowMaximized);-
2009 setVisible(true);-
2010}-
2011void QWidget::showNormal()-
2012{-
2013 ensurePolished();-
2014-
2015 setWindowState(windowState() & ~(Qt::WindowMinimized-
2016 | Qt::WindowMaximized-
2017 | Qt::WindowFullScreen));-
2018 setVisible(true);-
2019}-
2020bool QWidget::isEnabledTo(const QWidget *ancestor) const-
2021{-
2022 const QWidget * w = this;-
2023 while (!w->testAttribute(Qt::WA_ForceDisabled)-
2024 && !w->isWindow()-
2025 && w->parentWidget()-
2026 && w->parentWidget() != ancestor)-
2027 w = w->parentWidget();-
2028 return !w->testAttribute(Qt::WA_ForceDisabled);-
2029}-
2030void QWidget::addAction(QAction *action)-
2031{-
2032 insertAction(0, action);-
2033}-
2034void QWidget::addActions(QList<QAction*> actions)-
2035-
2036{-
2037 for(int i = 0; i < actions.count(); i++)-
2038 insertAction(0, actions.at(i));-
2039}-
2040void QWidget::insertAction(QAction *before, QAction *action)-
2041{-
2042 if (!(__builtin_expect(!!(!
__builtin_expe...ction), false)Description
TRUEnever evaluated
FALSEnever evaluated
action)), false)
__builtin_expe...ction), false)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2043 QMessageLogger(__FILE__, 33043322, __PRETTY_FUNCTION__).warning("QWidget::insertAction: Attempt to insert null action");-
2044 return;
never executed: return;
0
2045 }-
2046-
2047 QWidgetPrivate * const d = d_func();-
2048 if(d->actions.contains(action)
d->actions.contains(action)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2049 removeAction(action);
never executed: removeAction(action);
0
2050-
2051 int pos = d->actions.indexOf(before);-
2052 if (pos < 0
pos < 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2053 before = 0;-
2054 pos = d->actions.size();-
2055 }
never executed: end of block
0
2056 d->actions.insert(pos, action);-
2057-
2058 QActionPrivate *apriv = action->d_func();-
2059 apriv->widgets.append(this);-
2060-
2061 QActionEvent e(QEvent::ActionAdded, action, before);-
2062 QApplication::sendEvent(this, &e);-
2063}
never executed: end of block
0
2064void QWidget::insertActions(QAction *before, QList<QAction*> actions)-
2065-
2066{-
2067 for(int i = 0; i < actions.count()
i < actions.count()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i)
0
2068 insertAction(before, actions.at(i));
never executed: insertAction(before, actions.at(i));
0
2069}
never executed: end of block
0
2070-
2071-
2072-
2073-
2074-
2075void QWidget::removeAction(QAction *action)-
2076{-
2077 if (!action)-
2078 return;-
2079-
2080 QWidgetPrivate * const d = d_func();-
2081-
2082 QActionPrivate *apriv = action->d_func();-
2083 apriv->widgets.removeAll(this);-
2084-
2085 if (d->actions.removeAll(action)) {-
2086 QActionEvent e(QEvent::ActionRemoved, action);-
2087 QApplication::sendEvent(this, &e);-
2088 }-
2089}-
2090-
2091-
2092-
2093-
2094-
2095-
2096QList<QAction*> QWidget::actions() const-
2097{-
2098 const QWidgetPrivate * const d = d_func();-
2099 return d->actions;-
2100}-
2101void QWidget::setEnabled(bool enable)-
2102{-
2103 QWidgetPrivate * const d = d_func();-
2104 setAttribute(Qt::WA_ForceDisabled, !enable);-
2105 d->setEnabled_helper(enable);-
2106}-
2107-
2108void QWidgetPrivate::setEnabled_helper(bool enable)-
2109{-
2110 QWidget * const q = q_func();-
2111-
2112 if (enable && !q->isWindow() && q->parentWidget() && !q->parentWidget()->isEnabled())-
2113 return;-
2114-
2115 if (enable != q->testAttribute(Qt::WA_Disabled))-
2116 return;-
2117-
2118 q->setAttribute(Qt::WA_Disabled, !enable);-
2119 updateSystemBackground();-
2120-
2121 if (!enable && q->window()->focusWidget() == q) {-
2122 bool parentIsEnabled = (!q->parentWidget() || q->parentWidget()->isEnabled());-
2123 if (!parentIsEnabled || !q->focusNextChild())-
2124 q->clearFocus();-
2125 }-
2126-
2127 Qt::WidgetAttribute attribute = enable ? Qt::WA_ForceDisabled : Qt::WA_Disabled;-
2128 for (int i = 0; i < children.size(); ++i) {-
2129 QWidget *w = qobject_cast<QWidget *>(children.at(i));-
2130 if (w && !w->testAttribute(attribute))-
2131 w->d_func()->setEnabled_helper(enable);-
2132 }-
2133 if (q->testAttribute(Qt::WA_SetCursor) || q->isWindow()) {-
2134-
2135-
2136 qt_qpa_set_cursor(q, false);-
2137 }-
2138-
2139-
2140-
2141-
2142-
2143 if (q->testAttribute(Qt::WA_InputMethodEnabled) && q->hasFocus()) {-
2144 QWidget *focusWidget = effectiveFocusWidget();-
2145-
2146 if (enable) {-
2147 if (focusWidget->testAttribute(Qt::WA_InputMethodEnabled))-
2148 QGuiApplication::inputMethod()->update(Qt::ImEnabled);-
2149 } else {-
2150 QGuiApplication::inputMethod()->commit();-
2151 QGuiApplication::inputMethod()->update(Qt::ImEnabled);-
2152 }-
2153 }-
2154-
2155 QEvent e(QEvent::EnabledChange);-
2156 QApplication::sendEvent(q, &e);-
2157}-
2158bool QWidget::acceptDrops() const-
2159{-
2160 return testAttribute(Qt::WA_AcceptDrops);-
2161}-
2162-
2163void QWidget::setAcceptDrops(bool on)-
2164{-
2165 setAttribute(Qt::WA_AcceptDrops, on);-
2166-
2167}-
2168-
2169void QWidgetPrivate::registerDropSite(bool on)-
2170{-
2171 (void)on;;-
2172}-
2173void QWidget::setDisabled(bool disable)-
2174{-
2175 setEnabled(!disable);-
2176}-
2177QRect QWidget::frameGeometry() const-
2178{-
2179 const QWidgetPrivate * const d = d_func();-
2180 if (isWindow() && ! (windowType() == Qt::Popup)) {-
2181 QRect fs = d->frameStrut();-
2182 return QRect(data->crect.x() - fs.left(),-
2183 data->crect.y() - fs.top(),-
2184 data->crect.width() + fs.left() + fs.right(),-
2185 data->crect.height() + fs.top() + fs.bottom());-
2186 }-
2187 return data->crect;-
2188}-
2189int QWidget::x() const-
2190{-
2191 const QWidgetPrivate * const d = d_func();-
2192 if (isWindow() && ! (windowType() == Qt::Popup))-
2193 return data->crect.x() - d->frameStrut().left();-
2194 return data->crect.x();-
2195}-
2196int QWidget::y() const-
2197{-
2198 const QWidgetPrivate * const d = d_func();-
2199 if (isWindow() && ! (windowType() == Qt::Popup))-
2200 return data->crect.y() - d->frameStrut().top();-
2201 return data->crect.y();-
2202}-
2203QPoint QWidget::pos() const-
2204{-
2205 const QWidgetPrivate * const d = d_func();-
2206 QPoint result = data->crect.topLeft();-
2207 if (isWindow() && ! (windowType() == Qt::Popup))-
2208 if (!d->maybeTopData() || !d->maybeTopData()->posIncludesFrame)-
2209 result -= d->frameStrut().topLeft();-
2210 return result;-
2211}-
2212QRect QWidget::normalGeometry() const-
2213{-
2214 const QWidgetPrivate * const d = d_func();-
2215 if (!d->extra || !d->extra->topextra)-
2216 return QRect();-
2217-
2218 if (!isMaximized() && !isFullScreen())-
2219 return geometry();-
2220-
2221 return d->topData()->normalGeometry;-
2222}-
2223QRect QWidget::childrenRect() const-
2224{-
2225 const QWidgetPrivate * const d = d_func();-
2226 QRect r(0, 0, 0, 0);-
2227 for (int i = 0; i < d->children.size(); ++i) {-
2228 QWidget *w = qobject_cast<QWidget *>(d->children.at(i));-
2229 if (w && !w->isWindow() && !w->isHidden())-
2230 r |= w->geometry();-
2231 }-
2232 return r;-
2233}-
2234QRegion QWidget::childrenRegion() const-
2235{-
2236 const QWidgetPrivate * const d = d_func();-
2237 QRegion r;-
2238 for (int i = 0; i < d->children.size(); ++i) {-
2239 QWidget *w = qobject_cast<QWidget *>(d->children.at(i));-
2240 if (w && !w->isWindow() && !w->isHidden()) {-
2241 QRegion mask = w->mask();-
2242 if (mask.isEmpty())-
2243 r |= w->geometry();-
2244 else-
2245 r |= mask.translated(w->pos());-
2246 }-
2247 }-
2248 return r;-
2249}-
2250QSize QWidget::minimumSize() const-
2251{-
2252 const QWidgetPrivate * const d = d_func();-
2253 return d->extra ? QSize(d->extra->minw, d->extra->minh) : QSize(0, 0);-
2254}-
2255QSize QWidget::maximumSize() const-
2256{-
2257 const QWidgetPrivate * const d = d_func();-
2258 return d->extra ? QSize(d->extra->maxw, d->extra->maxh)-
2259 : QSize(((1<<24)-1), ((1<<24)-1));-
2260}-
2261QSize QWidget::sizeIncrement() const-
2262{-
2263 const QWidgetPrivate * const d = d_func();-
2264 return (d->extra && d->extra->topextra)-
2265 ? QSize(d->extra->topextra->incw, d->extra->topextra->inch)-
2266 : QSize(0, 0);-
2267}-
2268QSize QWidget::baseSize() const-
2269{-
2270 const QWidgetPrivate * const d = d_func();-
2271 return (d->extra != 0 && d->extra->topextra != 0)-
2272 ? QSize(d->extra->topextra->basew, d->extra->topextra->baseh)-
2273 : QSize(0, 0);-
2274}-
2275-
2276bool QWidgetPrivate::setMinimumSize_helper(int &minw, int &minh)-
2277{-
2278 QWidget * const q = q_func();-
2279-
2280 int mw = minw, mh = minh;-
2281 if (mw == ((1<<24)-1)
mw == ((1<<24)-1)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2282 mw = 0;
never executed: mw = 0;
0
2283 if (mh == ((1<<24)-1)
mh == ((1<<24)-1)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2284 mh = 0;
never executed: mh = 0;
0
2285 if (__builtin_expect(!!(
__builtin_expe...4)-1)), false)Description
TRUEnever evaluated
FALSEnever evaluated
minw > ((1<<24)-1) || minh > ((1<<24)-1)), false)
__builtin_expe...4)-1)), false)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2286 QMessageLogger(__FILE__, 39503972, __PRETTY_FUNCTION__).warning("QWidget::setMinimumSize: (%s/%s) "-
2287 "The largest allowed size is (%d,%d)",-
2288 q->objectName().toLocal8Bit().data(), q->metaObject()->className(), ((1<<24)-1),-
2289 ((1<<24)-1));-
2290 minw = mw = qMin<int>(minw, ((1<<24)-1));-
2291 minh = mh = qMin<int>(minh, ((1<<24)-1));-
2292 }
never executed: end of block
0
2293 if (__builtin_expect(!!(
__builtin_expe...h < 0), false)Description
TRUEnever evaluated
FALSEnever evaluated
minw < 0 || minh < 0)), false)
__builtin_expe...h < 0), false)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2294 QMessageLogger(__FILE__, 39583980, __PRETTY_FUNCTION__).warning("QWidget::setMinimumSize: (%s/%s) Negative sizes (%d,%d) "-
2295 "are not possible",-
2296 q->objectName().toLocal8Bit().data(), q->metaObject()->className(), minw, minh);-
2297 minw = mw = qMax(minw, 0);-
2298 minh = mh = qMax(minh, 0);-
2299 }
never executed: end of block
0
2300 createExtra();-
2301 if (extra->minw == mw
extra->minw == mwDescription
TRUEnever evaluated
FALSEnever evaluated
&& extra->minh == mh
extra->minh == mhDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2302 return
never executed: return false;
false;
never executed: return false;
0
2303 extra->minw = mw;-
2304 extra->minh = mh;-
2305 extra->explicitMinSize = (mw
mwDescription
TRUEnever evaluated
FALSEnever evaluated
? Qt::Horizontal : 0) | (mh ? Qt::Vertical : 0);
0
2306 return
never executed: return true;
true;
never executed: return true;
0
2307}-
2308-
2309void QWidgetPrivate::setConstraints_sys()-
2310{-
2311 QWidget * const q = q_func();-
2312 if (extra && q->windowHandle()) {-
2313 QWindow *win = q->windowHandle();-
2314 QWindowPrivate *winp = qt_window_private(win);-
2315-
2316 winp->minimumSize = QSize(extra->minw, extra->minh);-
2317 winp->maximumSize = QSize(extra->maxw, extra->maxh);-
2318-
2319 if (extra->topextra) {-
2320 winp->baseSize = QSize(extra->topextra->basew, extra->topextra->baseh);-
2321 winp->sizeIncrement = QSize(extra->topextra->incw, extra->topextra->inch);-
2322 }-
2323-
2324 if (winp->platformWindow) {-
2325 fixPosIncludesFrame();-
2326 winp->platformWindow->propagateSizeHints();-
2327 }-
2328 }-
2329}-
2330void QWidget::setMinimumSize(int minw, int minh)-
2331{-
2332 QWidgetPrivate * const d = d_func();-
2333 if (!d->setMinimumSize_helper(minw, minh))-
2334 return;-
2335-
2336 if (isWindow())-
2337 d->setConstraints_sys();-
2338 if (minw > width() || minh > height()) {-
2339 bool resized = testAttribute(Qt::WA_Resized);-
2340 bool maximized = isMaximized();-
2341 resize(qMax(minw,width()), qMax(minh,height()));-
2342 setAttribute(Qt::WA_Resized, resized);-
2343 if (maximized)-
2344 data->window_state = data->window_state | Qt::WindowMaximized;-
2345 }-
2346-
2347 if (d->extra) {-
2348 if (d->extra->proxyWidget)-
2349 d->extra->proxyWidget->setMinimumSize(minw, minh);-
2350 }-
2351-
2352 d->updateGeometry_helper(d->extra->minw == d->extra->maxw && d->extra->minh == d->extra->maxh);-
2353}-
2354-
2355bool QWidgetPrivate::setMaximumSize_helper(int &maxw, int &maxh)-
2356{-
2357 QWidget * const q = q_func();-
2358 if (__builtin_expect(!!(
__builtin_expe...4)-1)), false)Description
TRUEnever evaluated
FALSEnever evaluated
maxw > ((1<<24)-1) || maxh > ((1<<24)-1)), false)
__builtin_expe...4)-1)), false)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2359 QMessageLogger(__FILE__, 40324054, __PRETTY_FUNCTION__).warning("QWidget::setMaximumSize: (%s/%s) "-
2360 "The largest allowed size is (%d,%d)",-
2361 q->objectName().toLocal8Bit().data(), q->metaObject()->className(), ((1<<24)-1),-
2362 ((1<<24)-1));-
2363 maxw = qMin<int>(maxw, ((1<<24)-1));-
2364 maxh = qMin<int>(maxh, ((1<<24)-1));-
2365 }
never executed: end of block
0
2366 if (__builtin_expect(!!(
__builtin_expe...h < 0), false)Description
TRUEnever evaluated
FALSEnever evaluated
maxw < 0 || maxh < 0)), false)
__builtin_expe...h < 0), false)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2367 QMessageLogger(__FILE__, 40404062, __PRETTY_FUNCTION__).warning("QWidget::setMaximumSize: (%s/%s) Negative sizes (%d,%d) "-
2368 "are not possible",-
2369 q->objectName().toLocal8Bit().data(), q->metaObject()->className(), maxw, maxh);-
2370 maxw = qMax(maxw, 0);-
2371 maxh = qMax(maxh, 0);-
2372 }
never executed: end of block
0
2373 createExtra();-
2374 if (extra->maxw == maxw
extra->maxw == maxwDescription
TRUEnever evaluated
FALSEnever evaluated
&& extra->maxh == maxh
extra->maxh == maxhDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2375 return
never executed: return false;
false;
never executed: return false;
0
2376 extra->maxw = maxw;-
2377 extra->maxh = maxh;-
2378 extra->explicitMaxSize = (maxw != ((1<<24)-1)
maxw != ((1<<24)-1)Description
TRUEnever evaluated
FALSEnever evaluated
? Qt::Horizontal : 0) |
0
2379 (maxh != ((1<<24)-1) ? Qt::Vertical : 0);-
2380 return
never executed: return true;
true;
never executed: return true;
0
2381}-
2382void QWidget::setMaximumSize(int maxw, int maxh)-
2383{-
2384 QWidgetPrivate * const d = d_func();-
2385 if (!d->setMaximumSize_helper(maxw, maxh))-
2386 return;-
2387-
2388 if (isWindow())-
2389 d->setConstraints_sys();-
2390 if (maxw < width() || maxh < height()) {-
2391 bool resized = testAttribute(Qt::WA_Resized);-
2392 resize(qMin(maxw,width()), qMin(maxh,height()));-
2393 setAttribute(Qt::WA_Resized, resized);-
2394 }-
2395-
2396-
2397 if (d->extra) {-
2398 if (d->extra->proxyWidget)-
2399 d->extra->proxyWidget->setMaximumSize(maxw, maxh);-
2400 }-
2401-
2402-
2403 d->updateGeometry_helper(d->extra->minw == d->extra->maxw && d->extra->minh == d->extra->maxh);-
2404}-
2405-
2406-
2407-
2408-
2409-
2410-
2411-
2412void QWidget::setSizeIncrement(int w, int h)-
2413{-
2414 QWidgetPrivate * const d = d_func();-
2415 d->createTLExtra();-
2416 QTLWExtra* x = d->topData();-
2417 if (x->incw == w && x->inch == h)-
2418 return;-
2419 x->incw = w;-
2420 x->inch = h;-
2421 if (isWindow())-
2422 d->setConstraints_sys();-
2423}-
2424-
2425-
2426-
2427-
2428-
2429-
2430-
2431void QWidget::setBaseSize(int basew, int baseh)-
2432{-
2433 QWidgetPrivate * const d = d_func();-
2434 d->createTLExtra();-
2435 QTLWExtra* x = d->topData();-
2436 if (x->basew == basew && x->baseh == baseh)-
2437 return;-
2438 x->basew = basew;-
2439 x->baseh = baseh;-
2440 if (isWindow())-
2441 d->setConstraints_sys();-
2442}-
2443void QWidget::setFixedSize(const QSize & s)-
2444{-
2445 setFixedSize(s.width(), s.height());-
2446}-
2447void QWidget::setFixedSize(int w, int h)-
2448{-
2449 QWidgetPrivate * const d = d_func();-
2450 bool minSizeSet = d->setMinimumSize_helper(w, h);-
2451 bool maxSizeSet = d->setMaximumSize_helper(w, h);-
2452 if (!minSizeSet && !maxSizeSet)-
2453 return;-
2454-
2455 if (isWindow())-
2456 d->setConstraints_sys();-
2457 else-
2458 d->updateGeometry_helper(true);-
2459-
2460 if (w != ((1<<24)-1) || h != ((1<<24)-1))-
2461 resize(w, h);-
2462}-
2463-
2464void QWidget::setMinimumWidth(int w)-
2465{-
2466 QWidgetPrivate * const d = d_func();-
2467 d->createExtra();-
2468 uint expl = d->extra->explicitMinSize | (w ? Qt::Horizontal : 0);-
2469 setMinimumSize(w, minimumSize().height());-
2470 d->extra->explicitMinSize = expl;-
2471}-
2472-
2473void QWidget::setMinimumHeight(int h)-
2474{-
2475 QWidgetPrivate * const d = d_func();-
2476 d->createExtra();-
2477 uint expl = d->extra->explicitMinSize | (h ? Qt::Vertical : 0);-
2478 setMinimumSize(minimumSize().width(), h);-
2479 d->extra->explicitMinSize = expl;-
2480}-
2481-
2482void QWidget::setMaximumWidth(int w)-
2483{-
2484 QWidgetPrivate * const d = d_func();-
2485 d->createExtra();-
2486 uint expl = d->extra->explicitMaxSize | (w == ((1<<24)-1) ? 0 : Qt::Horizontal);-
2487 setMaximumSize(w, maximumSize().height());-
2488 d->extra->explicitMaxSize = expl;-
2489}-
2490-
2491void QWidget::setMaximumHeight(int h)-
2492{-
2493 QWidgetPrivate * const d = d_func();-
2494 d->createExtra();-
2495 uint expl = d->extra->explicitMaxSize | (h == ((1<<24)-1) ? 0 : Qt::Vertical);-
2496 setMaximumSize(maximumSize().width(), h);-
2497 d->extra->explicitMaxSize = expl;-
2498}-
2499void QWidget::setFixedWidth(int w)-
2500{-
2501 QWidgetPrivate * const d = d_func();-
2502 d->createExtra();-
2503 uint explMin = d->extra->explicitMinSize | Qt::Horizontal;-
2504 uint explMax = d->extra->explicitMaxSize | Qt::Horizontal;-
2505 setMinimumSize(w, minimumSize().height());-
2506 setMaximumSize(w, maximumSize().height());-
2507 d->extra->explicitMinSize = explMin;-
2508 d->extra->explicitMaxSize = explMax;-
2509}-
2510void QWidget::setFixedHeight(int h)-
2511{-
2512 QWidgetPrivate * const d = d_func();-
2513 d->createExtra();-
2514 uint explMin = d->extra->explicitMinSize | Qt::Vertical;-
2515 uint explMax = d->extra->explicitMaxSize | Qt::Vertical;-
2516 setMinimumSize(minimumSize().width(), h);-
2517 setMaximumSize(maximumSize().width(), h);-
2518 d->extra->explicitMinSize = explMin;-
2519 d->extra->explicitMaxSize = explMax;-
2520}-
2521QPoint QWidget::mapTo(const QWidget * parent, const QPoint & pos) const-
2522{-
2523 QPoint p = pos;-
2524 if (parent) {-
2525 const QWidget * w = this;-
2526 while (w != parent) {-
2527 ((!(w)) ? qt_assert_x("QWidget::mapTo(const QWidget *parent, const QPoint &pos)", "parent must be in parent hierarchy",-
2528 __FILE__-
2529 ,-
2530 42614283-
2531 ) : qt_noop())-
2532 ;-
2533 p = w->mapToParent(p);-
2534 w = w->parentWidget();-
2535 }-
2536 }-
2537 return p;-
2538}-
2539QPoint QWidget::mapFrom(const QWidget * parent, const QPoint & pos) const-
2540{-
2541 QPoint p(pos);-
2542 if (parent) {-
2543 const QWidget * w = this;-
2544 while (w != parent) {-
2545 ((!(w)) ? qt_assert_x("QWidget::mapFrom(const QWidget *parent, const QPoint &pos)", "parent must be in parent hierarchy",-
2546 __FILE__-
2547 ,-
2548 42854307-
2549 ) : qt_noop())-
2550 ;-
2551-
2552 p = w->mapFromParent(p);-
2553 w = w->parentWidget();-
2554 }-
2555 }-
2556 return p;-
2557}-
2558QPoint QWidget::mapToParent(const QPoint &pos) const-
2559{-
2560 return pos + data->crect.topLeft();-
2561}-
2562QPoint QWidget::mapFromParent(const QPoint &pos) const-
2563{-
2564 return pos - data->crect.topLeft();-
2565}-
2566QWidget *QWidget::window() const-
2567{-
2568 QWidget *w = const_cast<QWidget *>(this);-
2569 QWidget *p = w->parentWidget();-
2570 while (!w->isWindow() && p) {-
2571 w = p;-
2572 p = p->parentWidget();-
2573 }-
2574 return w;-
2575}-
2576QWidget *QWidget::nativeParentWidget() const-
2577{-
2578 QWidget *parent = parentWidget();-
2579 while (parent && !parent->internalWinId())-
2580 parent = parent->parentWidget();-
2581 return parent;-
2582}-
2583QPalette::ColorRole QWidget::backgroundRole() const-
2584{-
2585-
2586 const QWidget *w = this;-
2587 do {-
2588 QPalette::ColorRole role = w->d_func()->bg_role;-
2589 if (role != QPalette::NoRole)-
2590 return role;-
2591 if (w->isWindow() || w->windowType() == Qt::SubWindow)-
2592 break;-
2593 w = w->parentWidget();-
2594 } while (w);-
2595 return QPalette::Window;-
2596}-
2597void QWidget::setBackgroundRole(QPalette::ColorRole role)-
2598{-
2599 QWidgetPrivate * const d = d_func();-
2600 d->bg_role = role;-
2601 d->updateSystemBackground();-
2602 d->propagatePaletteChange();-
2603 d->updateIsOpaque();-
2604}-
2605QPalette::ColorRole QWidget::foregroundRole() const-
2606{-
2607 const QWidgetPrivate * const d = d_func();-
2608 QPalette::ColorRole rl = QPalette::ColorRole(d->fg_role);-
2609 if (rl != QPalette::NoRole)-
2610 return rl;-
2611 QPalette::ColorRole role = QPalette::WindowText;-
2612 switch (backgroundRole()) {-
2613 case QPalette::Button:-
2614 role = QPalette::ButtonText;-
2615 break;-
2616 case QPalette::Base:-
2617 role = QPalette::Text;-
2618 break;-
2619 case QPalette::Dark:-
2620 case QPalette::Shadow:-
2621 role = QPalette::Light;-
2622 break;-
2623 case QPalette::Highlight:-
2624 role = QPalette::HighlightedText;-
2625 break;-
2626 case QPalette::ToolTipBase:-
2627 role = QPalette::ToolTipText;-
2628 break;-
2629 default:-
2630 ;-
2631 }-
2632 return role;-
2633}-
2634void QWidget::setForegroundRole(QPalette::ColorRole role)-
2635{-
2636 QWidgetPrivate * const d = d_func();-
2637 d->fg_role = role;-
2638 d->updateSystemBackground();-
2639 d->propagatePaletteChange();-
2640}-
2641const QPalette &QWidget::palette() const-
2642{-
2643 if (!isEnabled()) {-
2644 data->pal.setCurrentColorGroup(QPalette::Disabled);-
2645 } else if ((!isVisible() || isActiveWindow())-
2646-
2647-
2648-
2649 ) {-
2650 data->pal.setCurrentColorGroup(QPalette::Active);-
2651 } else {-
2652-
2653-
2654-
2655-
2656-
2657-
2658 data->pal.setCurrentColorGroup(QPalette::Inactive);-
2659 }-
2660 return data->pal;-
2661}-
2662-
2663void QWidget::setPalette(const QPalette &palette)-
2664{-
2665 QWidgetPrivate * const d = d_func();-
2666 setAttribute(Qt::WA_SetPalette, palette.resolve() != 0);-
2667-
2668-
2669-
2670-
2671-
2672 QPalette naturalPalette = d->naturalWidgetPalette(d->inheritedPaletteResolveMask);-
2673 QPalette resolvedPalette = palette.resolve(naturalPalette);-
2674 d->setPalette_helper(resolvedPalette);-
2675}-
2676QPalette QWidgetPrivate::naturalWidgetPalette(uint inheritedMask) const-
2677{-
2678 const QWidget * const q = q_func();-
2679-
2680 const bool useStyleSheetPropagationInWidgetStyles =-
2681 QCoreApplication::testAttribute(Qt::AA_UseStyleSheetPropagationInWidgetStyles);-
2682-
2683 QPalette naturalPalette = QApplication::palette(q);-
2684 if (!((!
!q->testAttrib...WA_StyleSheet)Description
TRUEnever evaluated
FALSEnever evaluated
q->testAttribute(Qt::WA_StyleSheet)
!q->testAttrib...WA_StyleSheet)Description
TRUEnever evaluated
FALSEnever evaluated
|| useStyleSheetPropagationInWidgetStyles
useStyleSheetP...InWidgetStylesDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2685 && (!q->isWindow()
!q->isWindow()Description
TRUEnever evaluated
FALSEnever evaluated
|| q->testAttribute(Qt::WA_WindowPropagation)
q->testAttribu...owPropagation)Description
TRUEnever evaluated
FALSEnever evaluated
0
2686-
2687 || (extra
extraDescription
TRUEnever evaluated
FALSEnever evaluated
&& extra->proxyWidget
extra->proxyWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2688-
2689 )) {-
2690 if (QWidget *p = q->parentWidget()
QWidget *p = q->parentWidget()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2691 if (!p->testAttribute(Qt::WA_StyleSheet)))
!p->testAttrib...WA_StyleSheet)Description
TRUEnever evaluated
FALSEnever evaluated
|| useStyleSheetPropagationInWidgetStyles
useStyleSheetP...InWidgetStylesDescription
TRUEnever evaluated
FALSEnever evaluated
)
{
0
2692 if (!naturalPalette.isCopyOf(QApplication::palette())
!naturalPalett...on::palette())Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2693 QPalette inheritedPalette = p->palette();-
2694 inheritedPalette.resolve(inheritedMask);-
2695 naturalPalette = inheritedPalette.resolve(naturalPalette);-
2696 }
never executed: end of block
else {
0
2697 naturalPalette = p->palette();-
2698 }
never executed: end of block
0
2699 }-
2700 }
never executed: end of block
0
2701-
2702 else if (extra
extraDescription
TRUEnever evaluated
FALSEnever evaluated
&& extra->proxyWidget
extra->proxyWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2703 QPalette inheritedPalette = extra->proxyWidget->palette();-
2704 inheritedPalette.resolve(inheritedMask);-
2705 naturalPalette = inheritedPalette.resolve(naturalPalette);-
2706 }
never executed: end of block
0
2707-
2708 }
never executed: end of block
0
2709 naturalPalette.resolve(0);-
2710 return
never executed: return naturalPalette;
naturalPalette;
never executed: return naturalPalette;
0
2711}-
2712void QWidgetPrivate::resolvePalette()-
2713{-
2714 QPalette naturalPalette = naturalWidgetPalette(inheritedPaletteResolveMask);-
2715 QPalette resolvedPalette = data.pal.resolve(naturalPalette);-
2716 setPalette_helper(resolvedPalette);-
2717}-
2718-
2719void QWidgetPrivate::setPalette_helper(const QPalette &palette)-
2720{-
2721 QWidget * const q = q_func();-
2722 if (data.pal == palette && data.pal.resolve() == palette.resolve())-
2723 return;-
2724 data.pal = palette;-
2725 updateSystemBackground();-
2726 propagatePaletteChange();-
2727 updateIsOpaque();-
2728 q->update();-
2729 updateIsOpaque();-
2730}-
2731-
2732void QWidgetPrivate::updateSystemBackground()-
2733{-
2734}-
2735void QWidget::setFont(const QFont &font)-
2736{-
2737 QWidgetPrivate * const d = d_func();-
2738-
2739-
2740 const QStyleSheetStyle* style;-
2741 if (d->extra && (style = qobject_cast<const QStyleSheetStyle*>(d->extra->style))) {-
2742 style->saveWidgetFont(this, font);-
2743 }-
2744-
2745-
2746 setAttribute(Qt::WA_SetFont, font.resolve() != 0);-
2747-
2748-
2749-
2750-
2751-
2752 QFont naturalFont = d->naturalWidgetFont(d->inheritedFontResolveMask);-
2753 QFont resolvedFont = font.resolve(naturalFont);-
2754 d->setFont_helper(resolvedFont);-
2755}-
2756QFont QWidgetPrivate::naturalWidgetFont(uint inheritedMask) const-
2757{-
2758 const QWidget * const q = q_func();-
2759-
2760 const bool useStyleSheetPropagationInWidgetStyles =-
2761 QCoreApplication::testAttribute(Qt::AA_UseStyleSheetPropagationInWidgetStyles);-
2762-
2763 QFont naturalFont = QApplication::font(q);-
2764 if (!((!
!q->testAttrib...WA_StyleSheet)Description
TRUEnever evaluated
FALSEnever evaluated
q->testAttribute(Qt::WA_StyleSheet)
!q->testAttrib...WA_StyleSheet)Description
TRUEnever evaluated
FALSEnever evaluated
|| useStyleSheetPropagationInWidgetStyles
useStyleSheetP...InWidgetStylesDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2765 && (!q->isWindow()
!q->isWindow()Description
TRUEnever evaluated
FALSEnever evaluated
|| q->testAttribute(Qt::WA_WindowPropagation)
q->testAttribu...owPropagation)Description
TRUEnever evaluated
FALSEnever evaluated
0
2766-
2767 || (extra
extraDescription
TRUEnever evaluated
FALSEnever evaluated
&& extra->proxyWidget
extra->proxyWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2768-
2769 )) {-
2770 if (QWidget *p = q->parentWidget()
QWidget *p = q->parentWidget()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2771 if (!p->testAttribute(Qt::WA_StyleSheet)))
!p->testAttrib...WA_StyleSheet)Description
TRUEnever evaluated
FALSEnever evaluated
|| useStyleSheetPropagationInWidgetStyles
useStyleSheetP...InWidgetStylesDescription
TRUEnever evaluated
FALSEnever evaluated
)
{
0
2772 if (!naturalFont.isCopyOf(QApplication::font())
!naturalFont.i...ation::font())Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2773 if (inheritedMask != 0
inheritedMask != 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2774 QFont inheritedFont = p->font();-
2775 inheritedFont.resolve(inheritedMask);-
2776 naturalFont = inheritedFont.resolve(naturalFont);-
2777 }
never executed: end of block
0
2778 }
never executed: end of block
else {
0
2779 naturalFont = p->font();-
2780 }
never executed: end of block
0
2781 }-
2782 }
never executed: end of block
0
2783-
2784 else if (extra
extraDescription
TRUEnever evaluated
FALSEnever evaluated
&& extra->proxyWidget
extra->proxyWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2785 if (inheritedMask != 0
inheritedMask != 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2786 QFont inheritedFont = extra->proxyWidget->font();-
2787 inheritedFont.resolve(inheritedMask);-
2788 naturalFont = inheritedFont.resolve(naturalFont);-
2789 }
never executed: end of block
0
2790 }
never executed: end of block
0
2791-
2792 }
never executed: end of block
0
2793 naturalFont.resolve(0);-
2794 return
never executed: return naturalFont;
naturalFont;
never executed: return naturalFont;
0
2795}-
2796void QWidgetPrivate::resolveFont()-
2797{-
2798 QFont naturalFont = naturalWidgetFont(inheritedFontResolveMask);-
2799 QFont resolvedFont = data.fnt.resolve(naturalFont);-
2800 setFont_helper(resolvedFont);-
2801}-
2802void QWidgetPrivate::updateFont(const QFont &font)-
2803{-
2804 QWidget * const q = q_func();-
2805-
2806 const QStyleSheetStyle* cssStyle;-
2807 cssStyle = extra
extraDescription
TRUEnever evaluated
FALSEnever evaluated
? qobject_cast<const QStyleSheetStyle*>(extra->style) : 0;
0
2808 const bool useStyleSheetPropagationInWidgetStyles =-
2809 QCoreApplication::testAttribute(Qt::AA_UseStyleSheetPropagationInWidgetStyles);-
2810-
2811-
2812 data.fnt = QFont(font, q);-
2813-
2814-
2815-
2816-
2817-
2818-
2819 if (!q->parentWidget()
!q->parentWidget()Description
TRUEnever evaluated
FALSEnever evaluated
&& extra
extraDescription
TRUEnever evaluated
FALSEnever evaluated
&& extra->proxyWidget
extra->proxyWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2820 QGraphicsProxyWidget *p = extra->proxyWidget;-
2821 inheritedFontResolveMask = p->d_func()->inheritedFontResolveMask | p->font().resolve();-
2822 }
never executed: end of block
else
0
2823-
2824 if (q->isWindow()
q->isWindow()Description
TRUEnever evaluated
FALSEnever evaluated
&& !q->testAttribute(Qt::WA_WindowPropagation)
!q->testAttrib...owPropagation)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2825 inheritedFontResolveMask = 0;-
2826 }
never executed: end of block
0
2827 uint newMask = data.fnt.resolve() | inheritedFontResolveMask;-
2828-
2829 for (int i = 0; i < children.size()
i < children.size()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
2830 QWidget *w = qobject_cast<QWidget*>(children.at(i));-
2831 if (w
wDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2832 if (0) {
dead code: { }
-
2833-
2834 }
dead code: { }
else if ((!useStyleSheetPropagationInWidgetStyles
!useStyleSheet...InWidgetStylesDescription
TRUEnever evaluated
FALSEnever evaluated
&&
w->testAttribute(Qt::WA_StyleSheet)
w->testAttribu...WA_StyleSheet)Description
TRUEnever evaluated
FALSEnever evaluated
) {
-
2835-
2836 if (cssStyle
cssStyleDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2837 cssStyle->updateStyleSheetFont(w);
never executed: cssStyle->updateStyleSheetFont(w);
0
2838-
2839 }
never executed: end of block
else if ((!w->isWindow()
!w->isWindow()Description
TRUEnever evaluated
FALSEnever evaluated
|| w->testAttribute(Qt::WA_WindowPropagation)
w->testAttribu...owPropagation)Description
TRUEnever evaluated
FALSEnever evaluated
)) {
0
2840-
2841 QWidgetPrivate *wd = w->d_func();-
2842 wd->inheritedFontResolveMask = newMask;-
2843 wd->resolveFont();-
2844 }
never executed: end of block
0
2845 }
never executed: end of block
0
2846 }
never executed: end of block
0
2847-
2848-
2849 if ((!useStyleSheetPropagationInWidgetStyles
!useStyleSheet...InWidgetStylesDescription
TRUEnever evaluated
FALSEnever evaluated
&&
cssStyle
cssStyleDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2850 cssStyle->updateStyleSheetFont(q);-
2851 }
never executed: end of block
0
2852-
2853-
2854 QEvent e(QEvent::FontChange);-
2855 QApplication::sendEvent(q, &e);-
2856}
never executed: end of block
0
2857-
2858void QWidgetPrivate::setLayoutDirection_helper(Qt::LayoutDirection direction)-
2859{-
2860 QWidget * const q = q_func();-
2861-
2862 if ( (direction == Qt::RightToLeft) == q->testAttribute(Qt::WA_RightToLeft))-
2863 return;-
2864 q->setAttribute(Qt::WA_RightToLeft, (direction == Qt::RightToLeft));-
2865 if (!children.isEmpty()) {-
2866 for (int i = 0; i < children.size(); ++i) {-
2867 QWidget *w = qobject_cast<QWidget*>(children.at(i));-
2868 if (w && !w->isWindow() && !w->testAttribute(Qt::WA_SetLayoutDirection))-
2869 w->d_func()->setLayoutDirection_helper(direction);-
2870 }-
2871 }-
2872 QEvent e(QEvent::LayoutDirectionChange);-
2873 QApplication::sendEvent(q, &e);-
2874}-
2875-
2876void QWidgetPrivate::resolveLayoutDirection()-
2877{-
2878 const QWidget * const q = q_func();-
2879 if (!q->testAttribute(Qt::WA_SetLayoutDirection))-
2880 setLayoutDirection_helper(q->isWindow() ? QApplication::layoutDirection() : q->parentWidget()->layoutDirection());-
2881}-
2882void QWidget::setLayoutDirection(Qt::LayoutDirection direction)-
2883{-
2884 QWidgetPrivate * const d = d_func();-
2885-
2886 if (direction == Qt::LayoutDirectionAuto) {-
2887 unsetLayoutDirection();-
2888 return;-
2889 }-
2890-
2891 setAttribute(Qt::WA_SetLayoutDirection);-
2892 d->setLayoutDirection_helper(direction);-
2893}-
2894-
2895Qt::LayoutDirection QWidget::layoutDirection() const-
2896{-
2897 return testAttribute(Qt::WA_RightToLeft) ? Qt::RightToLeft : Qt::LeftToRight;-
2898}-
2899-
2900void QWidget::unsetLayoutDirection()-
2901{-
2902 QWidgetPrivate * const d = d_func();-
2903 setAttribute(Qt::WA_SetLayoutDirection, false);-
2904 d->resolveLayoutDirection();-
2905}-
2906QCursor QWidget::cursor() const-
2907{-
2908 const QWidgetPrivate * const d = d_func();-
2909 if (testAttribute(Qt::WA_SetCursor))-
2910 return (d->extra && d->extra->curs)-
2911 ? *d->extra->curs-
2912 : QCursor(Qt::ArrowCursor);-
2913 if (isWindow() || !parentWidget())-
2914 return QCursor(Qt::ArrowCursor);-
2915 return parentWidget()->cursor();-
2916}-
2917-
2918void QWidget::setCursor(const QCursor &cursor)-
2919{-
2920 QWidgetPrivate * const d = d_func();-
2921-
2922-
2923 if (cursor.shape() != Qt::ArrowCursor-
2924 || (d->extra && d->extra->curs))-
2925-
2926 {-
2927 d->createExtra();-
2928 QCursor *newCursor = new QCursor(cursor);-
2929 delete d->extra->curs;-
2930 d->extra->curs = newCursor;-
2931 }-
2932 setAttribute(Qt::WA_SetCursor);-
2933 d->setCursor_sys(cursor);-
2934-
2935 QEvent event(QEvent::CursorChange);-
2936 QApplication::sendEvent(this, &event);-
2937}-
2938-
2939void QWidgetPrivate::setCursor_sys(const QCursor &cursor)-
2940{-
2941 (void)cursor;;-
2942 QWidget * const q = q_func();-
2943 qt_qpa_set_cursor(q, false);-
2944}-
2945-
2946void QWidget::unsetCursor()-
2947{-
2948 QWidgetPrivate * const d = d_func();-
2949 if (d->extra) {-
2950 delete d->extra->curs;-
2951 d->extra->curs = 0;-
2952 }-
2953 if (!isWindow())-
2954 setAttribute(Qt::WA_SetCursor, false);-
2955 d->unsetCursor_sys();-
2956-
2957 QEvent event(QEvent::CursorChange);-
2958 QApplication::sendEvent(this, &event);-
2959}-
2960-
2961void QWidgetPrivate::unsetCursor_sys()-
2962{-
2963 QWidget * const q = q_func();-
2964 qt_qpa_set_cursor(q, false);-
2965}-
2966-
2967static inline void applyCursor(QWidget *w, const QCursor c&c)-
2968{-
2969 if (QWindow *window = w->windowHandle()
QWindow *windo...windowHandle()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2970 window->setCursor(c);
never executed: window->setCursor(c);
0
2971}
never executed: end of block
0
2972-
2973static inline void unsetCursor(QWidget *w)-
2974{-
2975 if (QWindow *window = w->windowHandle())-
2976 window->unsetCursor();-
2977}-
2978-
2979void qt_qpa_set_cursor(QWidget *w, bool force)-
2980{-
2981 if (!w->testAttribute(Qt::WA_WState_Created))-
2982 return;-
2983-
2984 static QPointer<QWidget> lastUnderMouse = 0;-
2985 if (force) {-
2986 lastUnderMouse = w;-
2987 } else if (lastUnderMouse) {-
2988 const WId lastWinId = lastUnderMouse->effectiveWinId();-
2989 const WId winId = w->effectiveWinId();-
2990 if (lastWinId && lastWinId == winId)-
2991 w = lastUnderMouse;-
2992 } else if (!w->internalWinId()) {-
2993 return;-
2994 }-
2995-
2996 while (!w->internalWinId() && w->parentWidget() && !w->isWindow()-
2997 && !w->testAttribute(Qt::WA_SetCursor))-
2998 w = w->parentWidget();-
2999-
3000 QWidget *nativeParent = w;-
3001 if (!w->internalWinId())-
3002 nativeParent = w->nativeParentWidget();-
3003 if (!nativeParent || !nativeParent->internalWinId())-
3004 return;-
3005-
3006 if (w->isWindow() || w->testAttribute(Qt::WA_SetCursor)) {-
3007 if (w->isEnabled())-
3008 applyCursor(nativeParent, w->cursor());-
3009 else-
3010-
3011-
3012 unsetCursor(nativeParent);-
3013 } else {-
3014 unsetCursor(nativeParent);-
3015 }-
3016}-
3017void QWidget::render(QPaintDevice *target, const QPoint &targetOffset,-
3018 const QRegion &sourceRegion, RenderFlags renderFlags)-
3019{-
3020 QPainter p(target);-
3021 render(&p, targetOffset, sourceRegion, renderFlags);-
3022}-
3023void QWidget::render(QPainter *painter, const QPoint &targetOffset,-
3024 const QRegion &sourceRegion, RenderFlags renderFlags)-
3025{-
3026 if (!(__builtin_expect(!!(!
__builtin_expe...inter), false)Description
TRUEnever evaluated
FALSEnever evaluated
painter)), false)
__builtin_expe...inter), false)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3027 QMessageLogger(__FILE__, 51315163, __PRETTY_FUNCTION__).warning("QWidget::render: Null pointer to painter");-
3028 return;
never executed: return;
0
3029 }-
3030-
3031 if (!(__builtin_expect(!!(!
__builtin_expe...ive()), false)Description
TRUEnever evaluated
FALSEnever evaluated
painter->isActive())()), false)
__builtin_expe...ive()), false)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3032 QMessageLogger(__FILE__, 51365168, __PRETTY_FUNCTION__).warning("QWidget::render: Cannot render with an inactive painter");-
3033 return;
never executed: return;
0
3034 }-
3035-
3036 const qreal opacity = painter->opacity();-
3037 if (qFuzzyIsNull(opacity)
qFuzzyIsNull(opacity)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
3038 return;
never executed: return;
0
3039-
3040 QWidgetPrivate * const d = d_func();-
3041 const bool inRenderWithPainter = d->extra
d->extraDescription
TRUEnever evaluated
FALSEnever evaluated
&& d->extra->inRenderWithPainter
d->extra->inRenderWithPainterDescription
TRUEnever evaluated
FALSEnever evaluated
;
0
3042 const QRegion toBePainted = !inRenderWithPainter
!inRenderWithPainterDescription
TRUEnever evaluated
FALSEnever evaluated
? d->prepareToRender(sourceRegion, renderFlags)
0
3043 : sourceRegion;-
3044 if (toBePainted.isEmpty()
toBePainted.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
3045 return;
never executed: return;
0
3046-
3047 if (!d->extra
!d->extraDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
3048 d->createExtra();
never executed: d->createExtra();
0
3049 d->extra->inRenderWithPainter = true;-
3050-
3051 QPaintEngine *engine = painter->paintEngine();-
3052 ((!(engine)) ? qt_assert("engine",__FILE__,51565188) : qt_noop());-
3053 QPaintEnginePrivate *enginePriv = engine->d_func();-
3054 ((!(enginePriv)) ? qt_assert("enginePriv",__FILE__,51585190) : qt_noop());-
3055 QPaintDevice *target = engine->paintDevice();-
3056 ((!(target)) ? qt_assert("target",__FILE__,51605192) : qt_noop());-
3057-
3058-
3059 if (!inRenderWithPainter
!inRenderWithPainterDescription
TRUEnever evaluated
FALSEnever evaluated
&& (opacity < 1.0
opacity < 1.0Description
TRUEnever evaluated
FALSEnever evaluated
|| (
(target->devTy...rnal::Printer)Description
TRUEnever evaluated
FALSEnever evaluated
target->devType() == QInternal::Printer)
(target->devTy...rnal::Printer)Description
TRUEnever evaluated
FALSEnever evaluated
)) {
0
3060 d->render_helper(painter, targetOffset, toBePainted, renderFlags);-
3061 d->extra->inRenderWithPainter = inRenderWithPainter;-
3062 return;
never executed: return;
0
3063 }-
3064-
3065-
3066 QPainter *oldPainter = d->sharedPainter();-
3067 d->setSharedPainter(painter);-
3068-
3069-
3070 const QTransform oldTransform = enginePriv->systemTransform;-
3071 const QRegion oldSystemClip = enginePriv->systemClip;-
3072 const QRegion oldSystemViewport = enginePriv->systemViewport;-
3073-
3074-
3075 if (painter->hasClipping()
painter->hasClipping()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3076 const QRegion painterClip = painter->deviceTransform().map(painter->clipRegion());-
3077 enginePriv->setSystemViewport(oldSystemClip.isEmpty() ? painterClip : oldSystemClip & painterClip);-
3078 }
never executed: end of block
else {
0
3079 enginePriv->setSystemViewport(oldSystemClip);-
3080 }
never executed: end of block
0
3081-
3082 d->render(target, targetOffset, toBePainted, renderFlags);-
3083-
3084-
3085 enginePriv->systemClip = oldSystemClip;enginePriv->setSystemViewport(oldSystemViewport);-
3086 enginePriv->setSystemTransform(oldTransform);-
3087 enginePriv->systemClip = oldSystemClip;-
3088-
3089-
3090 d->setSharedPainter(oldPainter);-
3091-
3092 d->extra->inRenderWithPainter = inRenderWithPainter;-
3093}
never executed: end of block
0
3094-
3095static void sendResizeEvents(QWidget *target)-
3096{-
3097 QResizeEvent e(target->size(), QSize());-
3098 QApplication::sendEvent(target, &e);-
3099-
3100 const QObjectList children = target->children();-
3101 for (int i = 0; i < children.size(); ++i) {-
3102 if (!children.at(i)->isWidgetType())-
3103 continue;-
3104 QWidget *child = static_cast<QWidget*>(children.at(i));-
3105 if (!child->isWindow() && child->testAttribute(Qt::WA_PendingResizeEvent))-
3106 sendResizeEvents(child);-
3107 }-
3108}-
3109QPixmap QWidget::grab(const QRect &rectangle)-
3110{-
3111 QWidgetPrivate * const d = d_func();-
3112 if (testAttribute(Qt::WA_PendingResizeEvent) || !testAttribute(Qt::WA_WState_Created))-
3113 sendResizeEvents(this);-
3114-
3115 const QWidget::RenderFlags renderFlags = QWidget::DrawWindowBackground | QWidget::DrawChildren | QWidget::IgnoreMask;-
3116-
3117 const bool oldDirtyOpaqueChildren = d->dirtyOpaqueChildren;-
3118 QRect r(rectangle);-
3119 if (r.width() < 0 || r.height() < 0) {-
3120-
3121-
3122 r = d->prepareToRender(QRegion(), renderFlags).boundingRect();-
3123 r.setTopLeft(rectangle.topLeft());-
3124 }-
3125-
3126 if (!r.intersects(rect()))-
3127 return QPixmap();-
3128-
3129 const qreal dpr = devicePixelRatioF();-
3130 QPixmap res((QSizeF(r.size()) * dpr).toSize());-
3131 res.setDevicePixelRatio(dpr);-
3132 if (!d->isOpaque)-
3133 res.fill(Qt::transparent);-
3134 d->render(&res, QPoint(), QRegion(r), renderFlags);-
3135-
3136 d->dirtyOpaqueChildren = oldDirtyOpaqueChildren;-
3137 return res;-
3138}-
3139QGraphicsEffect *QWidget::graphicsEffect() const-
3140{-
3141 const QWidgetPrivate * const d = d_func();-
3142 return d->graphicsEffect;-
3143}-
3144void QWidget::setGraphicsEffect(QGraphicsEffect *effect)-
3145{-
3146 QWidgetPrivate * const d = d_func();-
3147 if (d->graphicsEffect == effect)-
3148 return;-
3149-
3150 if (d->graphicsEffect) {-
3151 d->invalidateBuffer(rect());-
3152 delete d->graphicsEffect;-
3153 d->graphicsEffect = 0;-
3154 }-
3155-
3156 if (effect) {-
3157-
3158 QGraphicsEffectSourcePrivate *sourced = new QWidgetEffectSourcePrivate(this);-
3159 QGraphicsEffectSource *source = new QGraphicsEffectSource(*sourced);-
3160 d->graphicsEffect = effect;-
3161 effect->d_func()->setGraphicsEffectSource(source);-
3162 update();-
3163 }-
3164-
3165 d->updateIsOpaque();-
3166}-
3167-
3168-
3169bool QWidgetPrivate::isAboutToShow() const-
3170{-
3171 if (data.in_show)-
3172 return true;-
3173-
3174 const QWidget * const q = q_func();-
3175 if (q->isHidden())-
3176 return false;-
3177-
3178-
3179 QWidget *parent = q->parentWidget();-
3180 return parent ? parent->d_func()->isAboutToShow() : false;-
3181}-
3182-
3183QRegion QWidgetPrivate::prepareToRender(const QRegion &region, QWidget::RenderFlags renderFlags)-
3184{-
3185 QWidget * const q = q_func();-
3186 const bool isVisible = q->isVisible();-
3187-
3188-
3189 if (!isVisible && !isAboutToShow()) {-
3190 QWidget *topLevel = q->window();-
3191 (void)topLevel->d_func()->topData();-
3192 topLevel->ensurePolished();-
3193-
3194-
3195-
3196 QWidget *widget = q;-
3197 QWidgetList hiddenWidgets;-
3198 while (widget) {-
3199 if (widget->isHidden()) {-
3200 widget->setAttribute(Qt::WA_WState_Hidden, false);-
3201 hiddenWidgets.append(widget);-
3202 if (!widget->isWindow() && widget->parentWidget()->d_func()->layout)-
3203 widget->d_func()->updateGeometry_helper(true);-
3204 }-
3205 widget = widget->parentWidget();-
3206 }-
3207-
3208-
3209 if (topLevel->d_func()->layout)-
3210 topLevel->d_func()->layout->activate();-
3211-
3212-
3213 QTLWExtra *topLevelExtra = topLevel->d_func()->maybeTopData();-
3214 if (topLevelExtra && !topLevelExtra->sizeAdjusted-
3215 && !topLevel->testAttribute(Qt::WA_Resized)) {-
3216 topLevel->adjustSize();-
3217 topLevel->setAttribute(Qt::WA_Resized, false);-
3218 }-
3219-
3220-
3221 topLevel->d_func()->activateChildLayoutsRecursively();-
3222-
3223-
3224 for (int i = 0; i < hiddenWidgets.size(); ++i) {-
3225 QWidget *widget = hiddenWidgets.at(i);-
3226 widget->setAttribute(Qt::WA_WState_Hidden);-
3227 if (!widget->isWindow() && widget->parentWidget()->d_func()->layout)-
3228 widget->parentWidget()->d_func()->layout->invalidate();-
3229 }-
3230 } else if (isVisible) {-
3231 q->window()->d_func()->sendPendingMoveAndResizeEvents(true, true);-
3232 }-
3233-
3234-
3235 QRegion toBePainted = !region.isEmpty() ? region : QRegion(q->rect());-
3236 if (!(renderFlags & QWidget::IgnoreMask) && extra && extra->hasMask)-
3237 toBePainted &= extra->mask;-
3238 return toBePainted;-
3239}-
3240-
3241void QWidgetPrivate::render_helper(QPainter *painter, const QPoint &targetOffset, const QRegion &toBePainted,-
3242 QWidget::RenderFlags renderFlags)-
3243{-
3244 ((!(painter)) ? qt_assert("painter",__FILE__,54005432) : qt_noop());-
3245 ((!(!toBePainted.isEmpty())) ? qt_assert("!toBePainted.isEmpty()",__FILE__,54015433) : qt_noop());-
3246-
3247 QWidget * const q = q_func();-
3248-
3249 const QTransform originalTransform = painter->worldTransform();-
3250 const bool useDeviceCoordinates = originalTransform.isScaling();-
3251 if (!useDeviceCoordinates) {-
3252-
3253-
3254 const QRect rect = toBePainted.boundingRect();-
3255 const QSize size = rect.size();-
3256 if (size.isNull())-
3257 return;-
3258-
3259 const qreal pixmapDevicePixelRatio = painter->device()->devicePixelRatioF();-
3260 QPixmap pixmap(size * pixmapDevicePixelRatio);-
3261 pixmap.setDevicePixelRatio(pixmapDevicePixelRatio);-
3262-
3263 if (!(renderFlags & QWidget::DrawWindowBackground) || !isOpaque)-
3264 pixmap.fill(Qt::transparent);-
3265 q->render(&pixmap, QPoint(), toBePainted, renderFlags);-
3266-
3267 const bool restore = !(painter->renderHints() & QPainter::SmoothPixmapTransform);-
3268 painter->setRenderHints(QPainter::SmoothPixmapTransform, true);-
3269-
3270 painter->drawPixmap(targetOffset, pixmap);-
3271-
3272 if (restore)-
3273 painter->setRenderHints(QPainter::SmoothPixmapTransform, false);-
3274-
3275-
3276 } else {-
3277-
3278 QTransform transform = originalTransform;-
3279 transform.translate(targetOffset.x(), targetOffset.y());-
3280-
3281 QPaintDevice *device = painter->device();-
3282 ((!(device)) ? qt_assert("device",__FILE__,54385470) : qt_noop());-
3283-
3284-
3285 const QRectF rect(toBePainted.boundingRect());-
3286 QRect deviceRect = transform.mapRect(QRectF(0, 0, rect.width(), rect.height())).toAlignedRect();-
3287 deviceRect &= QRect(0, 0, device->width(), device->height());-
3288-
3289 QPixmap pixmap(deviceRect.size());-
3290 pixmap.fill(Qt::transparent);-
3291-
3292-
3293 QPainter pixmapPainter(&pixmap);-
3294 pixmapPainter.setRenderHints(painter->renderHints());-
3295 transform *= QTransform::fromTranslate(-deviceRect.x(), -deviceRect.y());-
3296 pixmapPainter.setTransform(transform);-
3297-
3298 q->render(&pixmapPainter, QPoint(), toBePainted, renderFlags);-
3299 pixmapPainter.end();-
3300-
3301-
3302 painter->setTransform(QTransform());-
3303 painter->drawPixmap(deviceRect.topLeft(), pixmap);-
3304 painter->setTransform(originalTransform);-
3305 }-
3306-
3307}-
3308-
3309void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QPoint &offset, int flags,-
3310 QPainter *sharedPainter, QWidgetBackingStore *backingStore)-
3311{-
3312 if (rgn.isEmpty()
rgn.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
3313 return;
never executed: return;
0
3314-
3315 const bool asRoot = flags & DrawAsRoot;-
3316 bool onScreen = paintOnScreen();-
3317-
3318 QWidget * const q = q_func();-
3319-
3320 if (graphicsEffect
graphicsEffectDescription
TRUEnever evaluated
FALSEnever evaluated
&& graphicsEffect->isEnabled()
graphicsEffect->isEnabled()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3321 QGraphicsEffectSource *source = graphicsEffect->d_func()->source;-
3322 QWidgetEffectSourcePrivate *sourced = static_cast<QWidgetEffectSourcePrivate *>-
3323 (source->d_func());-
3324 if (!sourced->context
!sourced->contextDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
3325 QWidgetPaintContext context(pdev, rgn, offset, flags, sharedPainter, backingStore);-
3326 sourced->context = &context;-
3327 if (!sharedPainter
!sharedPainterDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
3328 setSystemClip(pdev, rgn.translated(offset));-
3329 QPainter p(pdev);-
3330 p.translate(offset);-
3331 context.painter = &p;-
3332 graphicsEffect->draw(&p);-
3333 setSystemClip(pdev, QRegion());-
3334 }
never executed: end of block
else {
0
3335 context.painter = sharedPainter;-
3336 if (sharedPainter->worldTransform() != sourced->lastEffectTransform
sharedPainter-...ffectTransformDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
3337 sourced->invalidateCache();-
3338 sourced->lastEffectTransform = sharedPainter->worldTransform();-
3339 }
never executed: end of block
0
3340 sharedPainter->save();-
3341 sharedPainter->translate(offset);-
3342 graphicsEffect->draw(sharedPainter);-
3343 sharedPainter->restore();-
3344 }
never executed: end of block
0
3345 sourced->context = 0;-
3346-
3347-
3348-
3349 if (backingStore
backingStoreDescription
TRUEnever evaluated
FALSEnever evaluated
&& !onScreen
!onScreenDescription
TRUEnever evaluated
FALSEnever evaluated
&& !asRoot
!asRootDescription
TRUEnever evaluated
FALSEnever evaluated
&& (q->internalWinId()
q->internalWinId()Description
TRUEnever evaluated
FALSEnever evaluated
|| !q->nativeParentWidget()->isWindow()
!q->nativePare...()->isWindow()Description
TRUEnever evaluated
FALSEnever evaluated
))
0
3350 backingStore->markDirtyOnScreen(rgn, q, offset);
never executed: backingStore->markDirtyOnScreen(rgn, q, offset);
0
3351-
3352 return;
never executed: return;
0
3353 }-
3354 }
never executed: end of block
0
3355-
3356-
3357 const bool alsoOnScreen = flags & DrawPaintOnScreen;-
3358 const bool recursive = flags & DrawRecursive;-
3359 const bool alsoInvisible = flags & DrawInvisible;-
3360-
3361 ((!(sharedPainter ? sharedPainter->isActive() : true)) ? qt_assert("sharedPainter ? sharedPainter->isActive() : true",__FILE__,55175549) : qt_noop());-
3362-
3363 QRegion toBePainted(rgn);-
3364 if (asRoot
asRootDescription
TRUEnever evaluated
FALSEnever evaluated
&& !alsoInvisible
!alsoInvisibleDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
3365 toBePainted &= clipRect();
never executed: toBePainted &= clipRect();
0
3366 if (!(flags & DontSubtractOpaqueChildren)
!(flags & Dont...paqueChildren)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
3367 subtractOpaqueChildren(toBePainted, q->rect());
never executed: subtractOpaqueChildren(toBePainted, q->rect());
0
3368-
3369 if (!toBePainted.isEmpty()
!toBePainted.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3370 if (!onScreen
!onScreenDescription
TRUEnever evaluated
FALSEnever evaluated
|| alsoOnScreen
alsoOnScreenDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
3371-
3372 if (__builtin_expect(!!(
__builtin_expe...vent)), false)Description
TRUEnever evaluated
FALSEnever evaluated
q->testAttribute(Qt::WA_WState_InPaintEvent)), false)
__builtin_expe...vent)), false)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
3373 QMessageLogger(__FILE__, 55295561, __PRETTY_FUNCTION__).warning("QWidget::repaint: Recursive repaint detected");
never executed: QMessageLogger(__FILE__, 5561, __PRETTY_FUNCTION__).warning("QWidget::repaint: Recursive repaint detected");
0
3374 q->setAttribute(Qt::WA_WState_InPaintEvent);-
3375-
3376-
3377-
3378 bool flushed = QWidgetBackingStore::flushPaint(q, toBePainted);-
3379-
3380 QPaintEngine *paintEngine = pdev->paintEngine();-
3381 if (paintEngine
paintEngineDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
3382 setRedirected(pdev, -offset);-
3383 if (sharedPainter
sharedPainterDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
3384 setSystemClip(pdev, toBePainted);
never executed: setSystemClip(pdev, toBePainted);
0
3385 else-
3386 paintEngine->d_func()->systemRect = q->data->crect;
never executed: paintEngine->d_func()->systemRect = q->data->crect;
0
3387-
3388-
3389 if ((asRoot
asRootDescription
TRUEnever evaluated
FALSEnever evaluated
|| q->autoFillBackground()
q->autoFillBackground()Description
TRUEnever evaluated
FALSEnever evaluated
|| onScreen
onScreenDescription
TRUEnever evaluated
FALSEnever evaluated
|| q->testAttribute(Qt::WA_StyledBackground)
q->testAttribu...ledBackground)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
3390 && !q->testAttribute(Qt::WA_OpaquePaintEvent)
!q->testAttrib...quePaintEvent)Description
TRUEnever evaluated
FALSEnever evaluated
&& !q->testAttribute(Qt::WA_NoSystemBackground)
!q->testAttrib...temBackground)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3391-
3392 beginBackingStorePainting();-
3393-
3394 QPainter p(q);-
3395 paintBackground(&p, toBePainted, (asRoot || onScreen) ? flags | DrawAsRoot : 0);-
3396-
3397 endBackingStorePainting();-
3398-
3399 }
never executed: end of block
0
3400-
3401 if (!sharedPainter
!sharedPainterDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
3402 setSystemClip(pdev, toBePainted.translated(offset));
never executed: setSystemClip(pdev, toBePainted.translated(offset));
0
3403-
3404 if (!onScreen
!onScreenDescription
TRUEnever evaluated
FALSEnever evaluated
&& !asRoot
!asRootDescription
TRUEnever evaluated
FALSEnever evaluated
&& !isOpaque
!isOpaqueDescription
TRUEnever evaluated
FALSEnever evaluated
&& q->testAttribute(Qt::WA_TintedBackground)
q->testAttribu...tedBackground)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3405-
3406 beginBackingStorePainting();-
3407-
3408 QPainter p(q);-
3409 QColor tint = q->palette().window().color();-
3410 tint.setAlphaF(qreal(.6));-
3411 p.fillRect(toBePainted.boundingRect(), tint);-
3412-
3413 endBackingStorePainting();-
3414-
3415 }
never executed: end of block
0
3416 }
never executed: end of block
0
3417-
3418-
3419-
3420-
3421-
3422-
3423-
3424 bool skipPaintEvent = false;-
3425-
3426 if (renderToTexture
renderToTextureDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
3427-
3428-
3429 if (!q->testAttribute(Qt::WA_AlwaysStackOnTop)
!q->testAttrib...aysStackOnTop)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3430 beginBackingStorePainting();-
3431 if (backingStore) {QPainter p(q);-
3432 if (backingStore
backingStoreDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
3433 p.setCompositionMode(QPainter::CompositionMode_Source);-
3434 p.fillRect(q->rect(), Qt::transparent);-
3435 }
never executed: end of block
else {
0
3436-
3437 QImage img = grabFramebuffer();-
QPainter p(q);p.drawImage(q->rect(), img);grabFramebuffer());
3438 skipPaintEvent = true;-
3439 }
never executed: end of block
0
3440 endBackingStorePainting();-
3441 }
never executed: end of block
0
3442 if (renderToTextureReallyDirty
renderToTextureReallyDirtyDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
3443 renderToTextureReallyDirty = 0;
never executed: renderToTextureReallyDirty = 0;
0
3444 else-
3445 skipPaintEvent = true;
never executed: skipPaintEvent = true;
0
3446 }-
3447-
3448-
3449 if (!skipPaintEvent
!skipPaintEventDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
3450-
3451 sendPaintEvent(toBePainted);-
3452 }
never executed: end of block
0
3453-
3454-
3455 if (backingStore
backingStoreDescription
TRUEnever evaluated
FALSEnever evaluated
&& !onScreen
!onScreenDescription
TRUEnever evaluated
FALSEnever evaluated
&& !asRoot
!asRootDescription
TRUEnever evaluated
FALSEnever evaluated
&& (q->internalWinId()
q->internalWinId()Description
TRUEnever evaluated
FALSEnever evaluated
|| (q->nativeParentWidget()
q->nativeParentWidget()Description
TRUEnever evaluated
FALSEnever evaluated
&& !q->nativeParentWidget()->isWindow()
!q->nativePare...()->isWindow()Description
TRUEnever evaluated
FALSEnever evaluated
)))
0
3456 backingStore->markDirtyOnScreen(toBePainted, q, offset);
never executed: backingStore->markDirtyOnScreen(toBePainted, q, offset);
0
3457-
3458-
3459 if (paintEngine
paintEngineDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
3460-
3461-
3462-
3463-
3464 restoreRedirected();-
3465 if (!sharedPainter
!sharedPainterDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
3466 paintEngine->d_func()->systemRect = QRect();
never executed: paintEngine->d_func()->systemRect = QRect();
0
3467 else-
3468 paintEngine->d_func()->currentClipDevice = 0;
never executed: paintEngine->d_func()->currentClipDevice = 0;
0
3469-
3470 setSystemClip(pdev, QRegion());-
3471 }
never executed: end of block
0
3472 q->setAttribute(Qt::WA_WState_InPaintEvent, false);-
3473 if (__builtin_expect(!!(
__builtin_expe...ive()), false)Description
TRUEnever evaluated
FALSEnever evaluated
q->paintingActive())()), false)
__builtin_expe...ive()), false)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
3474 QMessageLogger(__FILE__, 56425672, __PRETTY_FUNCTION__).warning("QWidget::repaint: It is dangerous to leave painters active on a widget outside of the PaintEvent");
never executed: QMessageLogger(__FILE__, 5672, __PRETTY_FUNCTION__).warning("QWidget::repaint: It is dangerous to leave painters active on a widget outside of the PaintEvent");
0
3475-
3476 if (paintEngine
paintEngineDescription
TRUEnever evaluated
FALSEnever evaluated
&& paintEngine->autoDestruct()
paintEngine->autoDestruct()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3477 delete paintEngine;-
3478 }
never executed: end of block
0
3479-
3480-
3481 if (flushed
flushedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
3482 QWidgetBackingStore::unflushPaint(q, toBePainted);
never executed: QWidgetBackingStore::unflushPaint(q, toBePainted);
0
3483-
3484 }
never executed: end of block
else if (q->isWindow()
q->isWindow()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3485 QPaintEngine *engine = pdev->paintEngine();-
3486 if (engine
engineDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
3487 QPainter p(pdev);-
3488 p.setClipRegion(toBePainted);-
3489 const QBrush bg = q->palette().brush(QPalette::Window);-
3490 if (bg.style() == Qt::TexturePattern
bg.style() == ...TexturePatternDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
3491 p.drawTiledPixmap(q->rect(), bg.texture());
never executed: p.drawTiledPixmap(q->rect(), bg.texture());
0
3492 else-
3493 p.fillRect(q->rect(), bg);
never executed: p.fillRect(q->rect(), bg);
0
3494-
3495 if (engine->autoDestruct()
engine->autoDestruct()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
3496 delete engine;
never executed: delete engine;
0
3497 }
never executed: end of block
0
3498 }
never executed: end of block
0
3499 }
never executed: end of block
0
3500-
3501 if (recursive
recursiveDescription
TRUEnever evaluated
FALSEnever evaluated
&& !children.isEmpty()
!children.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3502 paintSiblingsRecursive(pdev, children, children.size() - 1, rgn, offset, flags & ~DrawAsRoot-
3503 , sharedPainter, backingStore);-
3504 }
never executed: end of block
0
3505}
never executed: end of block
0
3506-
3507void QWidgetPrivate::sendPaintEvent(const QRegion &toBePainted)-
3508{-
3509 QWidget * const q = q_func();-
3510 QPaintEvent e(toBePainted);-
3511 QCoreApplication::sendSpontaneousEvent(q, &e);-
3512-
3513-
3514 if (renderToTexture)-
3515 resolveSamples();-
3516-
3517}-
3518-
3519void QWidgetPrivate::render(QPaintDevice *target, const QPoint &targetOffset,-
3520 const QRegion &sourceRegion, QWidget::RenderFlags renderFlags)-
3521{-
3522 if (!(__builtin_expect(!!(!
__builtin_expe...arget), false)Description
TRUEnever evaluated
FALSEnever evaluated
target)), false)
__builtin_expe...arget), false)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3523 QMessageLogger(__FILE__, 56915721, __PRETTY_FUNCTION__).warning("QWidget::render: null pointer to paint device");-
3524 return;
never executed: return;
0
3525 }-
3526-
3527 const bool inRenderWithPainter = extra
extraDescription
TRUEnever evaluated
FALSEnever evaluated
&& extra->inRenderWithPainter
extra->inRenderWithPainterDescription
TRUEnever evaluated
FALSEnever evaluated
;
0
3528 QRegion paintRegion = !inRenderWithPainter
!inRenderWithPainterDescription
TRUEnever evaluated
FALSEnever evaluated
0
3529 ? prepareToRender(sourceRegion, renderFlags)-
3530 : sourceRegion;-
3531 if (paintRegion.isEmpty()
paintRegion.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
3532 return;
never executed: return;
0
3533-
3534-
3535 QPainter *oldSharedPainter = inRenderWithPainter
inRenderWithPainterDescription
TRUEnever evaluated
FALSEnever evaluated
? sharedPainter() : 0;
0
3536-
3537-
3538-
3539 if (target->devType() == QInternal::Widget
target->devTyp...ternal::WidgetDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
3540 QWidgetPrivate *targetPrivate = static_cast<QWidget *>(target)->d_func();-
3541 if (targetPrivate->extra
targetPrivate->extraDescription
TRUEnever evaluated
FALSEnever evaluated
&& targetPrivate->extra->inRenderWithPainter
targetPrivate-...derWithPainterDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
3542 QPainter *targetPainter = targetPrivate->sharedPainter();-
3543 if (targetPainter
targetPainterDescription
TRUEnever evaluated
FALSEnever evaluated
&& targetPainter->isActive()
targetPainter->isActive()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
3544 setSharedPainter(targetPainter);
never executed: setSharedPainter(targetPainter);
0
3545 }
never executed: end of block
0
3546 }
never executed: end of block
0
3547-
3548-
3549-
3550-
3551-
3552 QPoint offset = targetOffset;-
3553 offset -= paintRegion.boundingRect().topLeft();-
3554 QPoint redirectionOffset;-
3555 QPaintDevice *redirected = 0;-
3556-
3557 if (target->devType() == QInternal::Widget
target->devTyp...ternal::WidgetDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
3558 redirected = static_cast<QWidget *>(target)->d_func()->redirected(&redirectionOffset);
never executed: redirected = static_cast<QWidget *>(target)->d_func()->redirected(&redirectionOffset);
0
3559 if (!redirected
!redirectedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
3560 redirected = QPainter::redirected(target, &redirectionOffset);
never executed: redirected = QPainter::redirected(target, &redirectionOffset);
0
3561-
3562 if (redirected
redirectedDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
3563 target = redirected;-
3564 offset -= redirectionOffset;-
3565 }
never executed: end of block
0
3566-
3567 if (!inRenderWithPainter
!inRenderWithPainterDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
3568 if (QPaintEngine *targetEngine = target->paintEngine()
QPaintEngine *...>paintEngine()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3569 const QRegion targetSystemClip = targetEngine->systemClip();-
3570 if (!targetSystemClip.isEmpty()
!targetSystemClip.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
3571 paintRegion &= targetSystemClip.translated(-offset);
never executed: paintRegion &= targetSystemClip.translated(-offset);
0
3572 }
never executed: end of block
0
3573 }
never executed: end of block
0
3574-
3575-
3576 int flags = DrawPaintOnScreen | DrawInvisible;-
3577 if (renderFlags & QWidget::DrawWindowBackground
renderFlags & ...ndowBackgroundDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
3578 flags |= DrawAsRoot;
never executed: flags |= DrawAsRoot;
0
3579-
3580 if (renderFlags & QWidget::DrawChildren
renderFlags & ...::DrawChildrenDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
3581 flags |= DrawRecursive;
never executed: flags |= DrawRecursive;
0
3582 else-
3583 flags |= DontSubtractOpaqueChildren;
never executed: flags |= DontSubtractOpaqueChildren;
0
3584-
3585 flags |= DontSetCompositionMode;-
3586-
3587-
3588 drawWidget(target, paintRegion, offset, flags, sharedPainter());-
3589-
3590-
3591 if (oldSharedPainter
oldSharedPainterDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
3592 setSharedPainter(oldSharedPainter);
never executed: setSharedPainter(oldSharedPainter);
0
3593}
never executed: end of block
0
3594-
3595void QWidgetPrivate::paintSiblingsRecursive(QPaintDevice *pdev, const QObjectList& siblings, int index, const QRegion &rgn,-
3596 const QPoint &offset, int flags-
3597 , QPainter *sharedPainter, QWidgetBackingStore *backingStore)-
3598{-
3599 QWidget *w = 0;-
3600 QRect boundingRect;-
3601 bool dirtyBoundingRect = true;-
3602 const bool exludeOpaqueChildren = (flags & DontDrawOpaqueChildren);-
3603 const bool excludeNativeChildren = (flags & DontDrawNativeChildren);-
3604-
3605 do {-
3606 QWidget *x = qobject_cast<QWidget*>(siblings.at(index));-
3607 if (x && !(exludeOpaqueChildren && x->d_func()->isOpaque) && !x->isHidden() && !x->isWindow()-
3608 && !(excludeNativeChildren && x->internalWinId())) {-
3609 if (dirtyBoundingRect) {-
3610 boundingRect = rgn.boundingRect();-
3611 dirtyBoundingRect = false;-
3612 }-
3613-
3614 if (qRectIntersects(boundingRect, x->d_func()->effectiveRectFor(x->data->crect))) {-
3615 w = x;-
3616 break;-
3617 }-
3618 }-
3619 --index;-
3620 } while (index >= 0);-
3621-
3622 if (!w)-
3623 return;-
3624-
3625 QWidgetPrivate *wd = w->d_func();-
3626 const QPoint widgetPos(w->data->crect.topLeft());-
3627 const bool hasMask = wd->extra && wd->extra->hasMask && !wd->graphicsEffect;-
3628 if (index > 0) {-
3629 QRegion wr(rgn);-
3630 if (wd->isOpaque)-
3631 wr -= hasMask ? wd->extra->mask.translated(widgetPos) : w->data->crect;-
3632 paintSiblingsRecursive(pdev, siblings, --index, wr, offset, flags-
3633 , sharedPainter, backingStore);-
3634 }-
3635-
3636 if (w->updatesEnabled()-
3637-
3638 && (!w->d_func()->extra || !w->d_func()->extra->proxyWidget)-
3639-
3640 ) {-
3641 QRegion wRegion(rgn);-
3642 wRegion &= wd->effectiveRectFor(w->data->crect);-
3643 wRegion.translate(-widgetPos);-
3644 if (hasMask)-
3645 wRegion &= wd->extra->mask;-
3646 wd->drawWidget(pdev, wRegion, offset + widgetPos, flags, sharedPainter, backingStore);-
3647 }-
3648}-
3649-
3650-
3651QRectF QWidgetEffectSourcePrivate::boundingRect(Qt::CoordinateSystem system) const-
3652{-
3653 if (system != Qt::DeviceCoordinates
system != Qt::...iceCoordinatesDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
3654 return
never executed: return m_widget->rect();
m_widget->rect();
never executed: return m_widget->rect();
0
3655-
3656 if (!(__builtin_expect(!!(!
__builtin_expe...ntext), false)Description
TRUEnever evaluated
FALSEnever evaluated
context)), false)
__builtin_expe...ntext), false)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3657-
3658 QMessageLogger(__FILE__, 58265856, __PRETTY_FUNCTION__).warning("QGraphicsEffectSource::boundingRect: Not yet implemented, lacking device context");-
3659 return
never executed: return QRectF();
QRectF();
never executed: return QRectF();
0
3660 }-
3661-
3662 return
never executed: return context->painter->worldTransform().mapRect(m_widget->rect());
context->painter->worldTransform().mapRect(m_widget->rect());
never executed: return context->painter->worldTransform().mapRect(m_widget->rect());
0
3663}-
3664-
3665void QWidgetEffectSourcePrivate::draw(QPainter *painter)-
3666{-
3667 if (!context || context->painter != painter) {-
3668 m_widget->render(painter);-
3669 return;-
3670 }-
3671-
3672-
3673-
3674 QRegion toBePainted = context->rgn;-
3675 toBePainted &= m_widget->rect();-
3676 QWidgetPrivate *wd = qt_widget_private(m_widget);-
3677 if (wd->extra && wd->extra->hasMask)-
3678 toBePainted &= wd->extra->mask;-
3679-
3680 wd->drawWidget(context->pdev, toBePainted, context->offset, context->flags,-
3681 context->sharedPainter, context->backingStore);-
3682}-
3683-
3684QPixmap QWidgetEffectSourcePrivate::pixmap(Qt::CoordinateSystem system, QPoint *offset,-
3685 QGraphicsEffect::PixmapPadMode mode) const-
3686{-
3687 const bool deviceCoordinates = (system == Qt::DeviceCoordinates);-
3688 if (!(__builtin_expect(!!(!
__builtin_expe...nates), false)Description
TRUEnever evaluated
FALSEnever evaluated
context && deviceCoordinates)), false)
__builtin_expe...nates), false)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3689-
3690 QMessageLogger(__FILE__, 58585888, __PRETTY_FUNCTION__).warning("QGraphicsEffectSource::pixmap: Not yet implemented, lacking device context");-
3691 return
never executed: return QPixmap();
QPixmap();
never executed: return QPixmap();
0
3692 }-
3693-
3694 QPoint pixmapOffset;-
3695 QRectF sourceRect = m_widget->rect();-
3696-
3697 if (deviceCoordinates
deviceCoordinatesDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
3698 const QTransform &painterTransform = context->painter->worldTransform();-
3699 sourceRect = painterTransform.mapRect(sourceRect);-
3700 pixmapOffset = painterTransform.map(pixmapOffset);-
3701 }
never executed: end of block
0
3702-
3703 QRect effectRect;-
3704-
3705 if (mode == QGraphicsEffect::PadToEffectiveBoundingRect
mode == QGraph...veBoundingRectDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
3706 effectRect = m_widget->graphicsEffect()->boundingRectFor(sourceRect).toAlignedRect();
never executed: effectRect = m_widget->graphicsEffect()->boundingRectFor(sourceRect).toAlignedRect();
0
3707 else if (mode == QGraphicsEffect::PadToTransparentBorder
mode == QGraph...nsparentBorderDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
3708 effectRect = sourceRect.adjusted(-1, -1, 1, 1).toAlignedRect();
never executed: effectRect = sourceRect.adjusted(-1, -1, 1, 1).toAlignedRect();
0
3709 else-
3710 effectRect = sourceRect.toAlignedRect();
never executed: effectRect = sourceRect.toAlignedRect();
0
3711-
3712 if (offset
offsetDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
3713 *
never executed: *offset = effectRect.topLeft();
offset = effectRect.topLeft();
never executed: *offset = effectRect.topLeft();
0
3714-
3715 pixmapOffset -= effectRect.topLeft();-
3716-
3717 const qreal dpr = context->painter->device()->devicePixelRatio();-
3718 QPixmap pixmap(effectRect.size() * dpr);-
3719 pixmap.setDevicePixelRatio(dpr);-
3720-
3721 pixmap.fill(Qt::transparent);-
3722 m_widget->render(&pixmap, pixmapOffset, QRegion(), QWidget::DrawChildren);-
3723 return
never executed: return pixmap;
pixmap;
never executed: return pixmap;
0
3724}-
3725QGraphicsProxyWidget * QWidgetPrivate::nearestGraphicsProxyWidget(const QWidget *origin)-
3726{-
3727 if (origin) {-
3728 QWExtra *extra = origin->d_func()->extra;-
3729 if (extra && extra->proxyWidget)-
3730 return extra->proxyWidget;-
3731 return nearestGraphicsProxyWidget(origin->parentWidget());-
3732 }-
3733 return 0;-
3734}-
3735void QWidgetPrivate::setLocale_helper(const QLocale &loc, bool forceUpdate)-
3736{-
3737 QWidget * const q = q_func();-
3738 if (locale == loc && !forceUpdate)-
3739 return;-
3740-
3741 locale = loc;-
3742-
3743 if (!children.isEmpty()) {-
3744 for (int i = 0; i < children.size(); ++i) {-
3745 QWidget *w = qobject_cast<QWidget*>(children.at(i));-
3746 if (!w)-
3747 continue;-
3748 if (w->testAttribute(Qt::WA_SetLocale))-
3749 continue;-
3750 if (w->isWindow() && !w->testAttribute(Qt::WA_WindowPropagation))-
3751 continue;-
3752 w->d_func()->setLocale_helper(loc, forceUpdate);-
3753 }-
3754 }-
3755 QEvent e(QEvent::LocaleChange);-
3756 QApplication::sendEvent(q, &e);-
3757}-
3758-
3759void QWidget::setLocale(const QLocale &locale)-
3760{-
3761 QWidgetPrivate * const d = d_func();-
3762-
3763 setAttribute(Qt::WA_SetLocale);-
3764 d->setLocale_helper(locale);-
3765}-
3766-
3767QLocale QWidget::locale() const-
3768{-
3769 const QWidgetPrivate * const d = d_func();-
3770-
3771 return d->locale;-
3772}-
3773-
3774void QWidgetPrivate::resolveLocale()-
3775{-
3776 const QWidget * const q = q_func();-
3777-
3778 if (!q->testAttribute(Qt::WA_SetLocale)) {-
3779 setLocale_helper(q->isWindow()-
3780 ? QLocale()-
3781 : q->parentWidget()->locale());-
3782 }-
3783}-
3784-
3785void QWidget::unsetLocale()-
3786{-
3787 QWidgetPrivate * const d = d_func();-
3788 setAttribute(Qt::WA_SetLocale, false);-
3789 d->resolveLocale();-
3790}-
3791QString QWidget::windowTitle() const-
3792{-
3793 const QWidgetPrivate * const d = d_func();-
3794 if (d->extra && d->extra->topextra) {-
3795 if (!d->extra->topextra->caption.isEmpty())-
3796 return d->extra->topextra->caption;-
3797 if (!d->extra->topextra->filePath.isEmpty())-
3798 return QFileInfo(d->extra->topextra->filePath).fileName() + QLatin1String("[*]");-
3799 }-
3800 return QString();-
3801}-
3802QString qt_setWindowTitle_helperHelper(const QString &title, const QWidget *widget)-
3803{-
3804 ((!(widget)) ? qt_assert("widget",__FILE__,60366066) : qt_noop());-
3805-
3806-
3807-
3808-
3809-
3810 QString cap = title;-
3811-
3812-
3813 if (cap.isEmpty())-
3814 return cap;-
3815-
3816 QLatin1String placeHolder("[*]");-
3817 int index = cap.indexOf(placeHolder);-
3818-
3819-
3820 while (index != -1) {-
3821 index += placeHolder.size();-
3822 int count = 1;-
3823 while (cap.indexOf(placeHolder, index) == index) {-
3824 ++count;-
3825 index += placeHolder.size();-
3826 }-
3827-
3828 if (count%2) {-
3829 int lastIndex = cap.lastIndexOf(placeHolder, index - 1);-
3830 if (widget->isWindowModified()-
3831 && widget->style()->styleHint(QStyle::SH_TitleBar_ModifyNotification, 0, widget))-
3832 cap.replace(lastIndex, 3, QWidget::tr("*"));-
3833 else-
3834 cap.remove(lastIndex, 3);-
3835 }-
3836-
3837 index = cap.indexOf(placeHolder, index);-
3838 }-
3839-
3840 cap.replace(QLatin1String("[*][*]"), placeHolder);-
3841-
3842 return cap;-
3843}-
3844-
3845void QWidgetPrivate::setWindowTitle_helper(const QString &title)-
3846{-
3847 QWidget * const q = q_func();-
3848 if (q->testAttribute(Qt::WA_WState_Created))-
3849 setWindowTitle_sys(qt_setWindowTitle_helperHelper(title, q));-
3850}-
3851-
3852void QWidgetPrivate::setWindowTitle_sys(const QString &caption)-
3853{-
3854 QWidget * const q = q_func();-
3855 if (!q->isWindow())-
3856 return;-
3857-
3858 if (QWindow *window = q->windowHandle())-
3859 window->setTitle(caption);-
3860-
3861}-
3862-
3863void QWidgetPrivate::setWindowIconText_helper(const QString &title)-
3864{-
3865 QWidget * const q = q_func();-
3866 if (q->testAttribute(Qt::WA_WState_Created))-
3867 setWindowIconText_sys(qt_setWindowTitle_helperHelper(title, q));-
3868}-
3869-
3870void QWidgetPrivate::setWindowIconText_sys(const QString &iconText)-
3871{-
3872 QWidget * const q = q_func();-
3873-
3874-
3875 if (QWindow *window = q->windowHandle())-
3876 QXcbWindowFunctions::setWmWindowIconText(window, iconText);-
3877}-
3878void QWidget::setWindowIconText(const QString &iconText)-
3879{-
3880 if (QWidget::windowIconText() == iconText)-
3881 return;-
3882-
3883 QWidgetPrivate * const d = d_func();-
3884 d->topData()->iconText = iconText;-
3885 d->setWindowIconText_helper(iconText);-
3886-
3887 QEvent e(QEvent::IconTextChange);-
3888 QApplication::sendEvent(this, &e);-
3889-
3890 windowIconTextChanged(iconText);-
3891}-
3892void QWidget::setWindowTitle(const QString &title)-
3893{-
3894 if (QWidget::windowTitle() == title && !title.isEmpty() && !title.isNull())-
3895 return;-
3896-
3897 QWidgetPrivate * const d = d_func();-
3898 d->topData()->caption = title;-
3899 d->setWindowTitle_helper(title);-
3900-
3901 QEvent e(QEvent::WindowTitleChange);-
3902 QApplication::sendEvent(this, &e);-
3903-
3904 windowTitleChanged(title);-
3905}-
3906QIcon QWidget::windowIcon() const-
3907{-
3908 const QWidget *w = this;-
3909 while (w) {-
3910 const QWidgetPrivate *d = w->d_func();-
3911 if (d->extra && d->extra->topextra && d->extra->topextra->icon)-
3912 return *d->extra->topextra->icon;-
3913 w = w->parentWidget();-
3914 }-
3915 return QApplication::windowIcon();-
3916}-
3917-
3918void QWidgetPrivate::setWindowIcon_helper()-
3919{-
3920 QWidget * const q = q_func();-
3921 QEvent e(QEvent::WindowIconChange);-
3922-
3923-
3924-
3925-
3926-
3927 if (!q->windowHandle())-
3928 QApplication::sendEvent(q, &e);-
3929 for (int i = 0; i < children.size(); ++i) {-
3930 QWidget *w = qobject_cast<QWidget *>(children.at(i));-
3931 if (w && !w->isWindow())-
3932 QApplication::sendEvent(w, &e);-
3933 }-
3934}-
3935void QWidget::setWindowIcon(const QIcon &icon)-
3936{-
3937 QWidgetPrivate * const d = d_func();-
3938-
3939 setAttribute(Qt::WA_SetWindowIcon, !icon.isNull());-
3940 d->createTLExtra();-
3941-
3942 if (!d->extra->topextra->icon)-
3943 d->extra->topextra->icon = new QIcon();-
3944 *d->extra->topextra->icon = icon;-
3945-
3946 d->setWindowIcon_sys();-
3947 d->setWindowIcon_helper();-
3948-
3949 windowIconChanged(icon);-
3950}-
3951-
3952void QWidgetPrivate::setWindowIcon_sys()-
3953{-
3954 QWidget * const q = q_func();-
3955 if (QWindow *window = q->windowHandle())-
3956 window->setIcon(q->windowIcon());-
3957}-
3958QString QWidget::windowIconText() const-
3959{-
3960 const QWidgetPrivate * const d = d_func();-
3961 return (d->extra && d->extra->topextra) ? d->extra->topextra->iconText : QString();-
3962}-
3963QString QWidget::windowFilePath() const-
3964{-
3965 const QWidgetPrivate * const d = d_func();-
3966 return (d->extra && d->extra->topextra) ? d->extra->topextra->filePath : QString();-
3967}-
3968-
3969void QWidget::setWindowFilePath(const QString &filePath)-
3970{-
3971 if (filePath == windowFilePath())-
3972 return;-
3973-
3974 QWidgetPrivate * const d = d_func();-
3975-
3976 d->createTLExtra();-
3977 d->extra->topextra->filePath = filePath;-
3978 d->setWindowFilePath_helper(filePath);-
3979}-
3980-
3981void QWidgetPrivate::setWindowFilePath_helper(const QString &filePath)-
3982{-
3983 if (extra->topextra && extra->topextra->caption.isEmpty()) {-
3984-
3985-
3986-
3987 QWidget * const q = q_func();-
3988 (void)filePath;;-
3989 setWindowTitle_helper(q->windowTitle());-
3990-
3991 }-
3992-
3993-
3994-
3995}-
3996-
3997void QWidgetPrivate::setWindowFilePath_sys(const QString &filePath)-
3998{-
3999 QWidget * const q = q_func();-
4000 if (!q->isWindow())-
4001 return;-
4002-
4003 if (QWindow *window = q->windowHandle())-
4004 window->setFilePath(filePath);-
4005}-
4006-
4007-
4008-
4009-
4010-
4011-
4012-
4013QString QWidget::windowRole() const-
4014{-
4015 const QWidgetPrivate * const d = d_func();-
4016 return (d->extra && d->extra->topextra) ? d->extra->topextra->role : QString();-
4017}-
4018-
4019-
4020-
4021-
4022-
4023void QWidget::setWindowRole(const QString &role)-
4024{-
4025 QWidgetPrivate * const d = d_func();-
4026 d->createTLExtra();-
4027 d->topData()->role = role;-
4028 if (windowHandle())-
4029 QXcbWindowFunctions::setWmWindowRole(windowHandle(), role.toLatin1());-
4030}-
4031void QWidget::setFocusProxy(QWidget * w)-
4032{-
4033 QWidgetPrivate * const d = d_func();-
4034 if (!w
!wDescription
TRUEnever evaluated
FALSEnever evaluated
&& !d->extra
!d->extraDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
4035 return;
never executed: return;
0
4036-
4037 for (QWidget* fp = w; fp
fpDescription
TRUEnever evaluated
FALSEnever evaluated
; fp = fp->focusProxy()) {
0
4038 if (__builtin_expect(!!(
__builtin_expe... this), false)Description
TRUEnever evaluated
FALSEnever evaluated
fp == this)), false)
__builtin_expe... this), false)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
4039 QMessageLogger(__FILE__, 63886418, __PRETTY_FUNCTION__).warning("QWidget: %s (%s) already in focus proxy chain", metaObject()->className(), objectName().toLocal8Bit().constData());-
4040 return;
never executed: return;
0
4041 }-
4042 }
never executed: end of block
0
4043-
4044 d->createExtra();-
4045 d->extra->focus_proxy = w;-
4046}
never executed: end of block
0
4047QWidget * QWidget::focusProxy() const-
4048{-
4049 const QWidgetPrivate * const d = d_func();-
4050 return d->extra ? (QWidget *)d->extra->focus_proxy : 0;-
4051}-
4052bool QWidget::hasFocus() const-
4053{-
4054 const QWidget* w = this;-
4055 while (w->d_func()->extra && w->d_func()->extra->focus_proxy)-
4056 w = w->d_func()->extra->focus_proxy;-
4057-
4058 if (QWidget *window = w->window()) {-
4059 QWExtra *e = window->d_func()->extra;-
4060 if (e && e->proxyWidget && e->proxyWidget->hasFocus() && window->focusWidget() == w)-
4061 return true;-
4062 }-
4063-
4064 return (QApplication::focusWidget() == w);-
4065}-
4066void QWidget::setFocus(Qt::FocusReason reason)-
4067{-
4068 if (!isEnabled())-
4069 return;-
4070-
4071 QWidget *f = this;-
4072 while (f->d_func()->extra && f->d_func()->extra->focus_proxy)-
4073 f = f->d_func()->extra->focus_proxy;-
4074-
4075 if (QApplication::focusWidget() == f-
4076-
4077-
4078-
4079 )-
4080 return;-
4081-
4082-
4083 QWidget *previousProxyFocus = 0;-
4084 if (QWExtra *topData = window()->d_func()->extra) {-
4085 if (topData->proxyWidget && topData->proxyWidget->hasFocus()) {-
4086 previousProxyFocus = topData->proxyWidget->widget()->focusWidget();-
4087 if (previousProxyFocus && previousProxyFocus->focusProxy())-
4088 previousProxyFocus = previousProxyFocus->focusProxy();-
4089 if (previousProxyFocus == this && !topData->proxyWidget->d_func()->proxyIsGivingFocus)-
4090 return;-
4091 }-
4092 }-
4093-
4094-
4095-
4096-
4097 if (QWExtra *topData = window()->d_func()->extra) {-
4098 if (topData->proxyWidget && !topData->proxyWidget->hasFocus()) {-
4099 f->d_func()->updateFocusChild();-
4100 topData->proxyWidget->d_func()->focusFromWidgetToProxy = 1;-
4101 topData->proxyWidget->setFocus(reason);-
4102 topData->proxyWidget->d_func()->focusFromWidgetToProxy = 0;-
4103 }-
4104 }-
4105-
4106-
4107 if (f->isActiveWindow()) {-
4108 QWidget *prev = QApplicationPrivate::focus_widget;-
4109 if (prev) {-
4110 if (reason != Qt::PopupFocusReason && reason != Qt::MenuBarFocusReason-
4111 && prev->testAttribute(Qt::WA_InputMethodEnabled)) {-
4112 QGuiApplication::inputMethod()->commit();-
4113 }-
4114-
4115 if (reason != Qt::NoFocusReason) {-
4116 QFocusEvent focusAboutToChange(QEvent::FocusAboutToChange, reason);-
4117 QApplication::sendEvent(prev, &focusAboutToChange);-
4118 }-
4119 }-
4120-
4121 f->d_func()->updateFocusChild();-
4122-
4123 QApplicationPrivate::setFocusWidget(f, reason);-
4124-
4125-
4126-
4127-
4128-
4129-
4130-
4131 if (!(f->inherits("QMenuBar") || f->inherits("QMenu") || f->inherits("QMenuItem")))-
4132 {-
4133 QAccessibleEvent event(f, QAccessible::Focus);-
4134 QAccessible::updateAccessibility(&event);-
4135 }-
4136-
4137-
4138 if (QWExtra *topData = window()->d_func()->extra) {-
4139 if (topData->proxyWidget) {-
4140 if (previousProxyFocus && previousProxyFocus != f) {-
4141-
4142 QFocusEvent event(QEvent::FocusOut, reason);-
4143 QPointer<QWidget> that = previousProxyFocus;-
4144 QApplication::sendEvent(previousProxyFocus, &event);-
4145 if (that)-
4146 QApplication::sendEvent(that->style(), &event);-
4147 }-
4148 if (!isHidden()) {-
4149-
4150-
4151 if (QWExtra *topData = window()->d_func()->extra)-
4152 if (topData->proxyWidget && topData->proxyWidget->hasFocus())-
4153 topData->proxyWidget->d_func()->updateProxyInputMethodAcceptanceFromWidget();-
4154-
4155-
4156 QFocusEvent event(QEvent::FocusIn, reason);-
4157 QPointer<QWidget> that = f;-
4158 QApplication::sendEvent(f, &event);-
4159 if (that)-
4160 QApplication::sendEvent(that->style(), &event);-
4161 }-
4162 }-
4163 }-
4164-
4165 } else {-
4166 f->d_func()->updateFocusChild();-
4167 }-
4168-
4169 if (QTLWExtra *extra = f->window()->d_func()->maybeTopData()) {-
4170 if (extra->window)-
4171 extra->window->focusObjectChanged(f);-
4172 }-
4173}-
4174-
4175void QWidgetPrivate::setFocus_sys()-
4176{-
4177 QWidget * const q = q_func();-
4178-
4179 const QWidget *topLevel = q->window();-
4180 if (topLevel->windowType() != Qt::Popup) {-
4181 if (QWindow *nativeWindow = q->window()->windowHandle()) {-
4182 if (nativeWindow != QGuiApplication::focusWindow()-
4183 && q->testAttribute(Qt::WA_WState_Created)) {-
4184 nativeWindow->requestActivate();-
4185 }-
4186 }-
4187 }-
4188}-
4189-
4190-
4191void QWidgetPrivate::updateFocusChild()-
4192{-
4193 QWidget * const q = q_func();-
4194-
4195 QWidget *w = q;-
4196 if (q->isHidden()) {-
4197 while (w && w->isHidden()) {-
4198 w->d_func()->focus_child = q;-
4199 w = w->isWindow() ? 0 : w->parentWidget();-
4200 }-
4201 } else {-
4202 while (w) {-
4203 w->d_func()->focus_child = q;-
4204 w = w->isWindow() ? 0 : w->parentWidget();-
4205 }-
4206 }-
4207}-
4208void QWidget::clearFocus()-
4209{-
4210 if (hasFocus()) {-
4211 if (testAttribute(Qt::WA_InputMethodEnabled))-
4212 QGuiApplication::inputMethod()->commit();-
4213-
4214 QFocusEvent focusAboutToChange(QEvent::FocusAboutToChange);-
4215 QApplication::sendEvent(this, &focusAboutToChange);-
4216 }-
4217-
4218 QWidget *w = this;-
4219 while (w) {-
4220-
4221 if (w->d_func()->focus_child == this)-
4222 w->d_func()->focus_child = 0;-
4223 w = w->parentWidget();-
4224 }-
4225-
4226-
4227-
4228-
4229-
4230 QWExtra *topData = d_func()->extra;-
4231 if (topData && topData->proxyWidget)-
4232 topData->proxyWidget->clearFocus();-
4233-
4234-
4235 if (hasFocus()) {-
4236-
4237 QApplicationPrivate::setFocusWidget(0, Qt::OtherFocusReason);-
4238-
4239-
4240-
4241-
4242-
4243 {-
4244-
4245 QAccessibleEvent event(this, QAccessible::Focus);-
4246 QAccessible::updateAccessibility(&event);-
4247-
4248 }-
4249 }-
4250-
4251-
4252-
4253-
4254-
4255 if (QTLWExtra *extra = window()->d_func()->maybeTopData()) {-
4256 if (extra->window)-
4257 extra->window->focusObjectChanged(extra->window->focusObject());-
4258 }-
4259}-
4260bool QWidget::focusNextPrevChild(bool next)-
4261{-
4262 QWidgetPrivate * const d = d_func();-
4263 QWidget* p = parentWidget();-
4264 bool isSubWindow = (windowType() == Qt::SubWindow);-
4265 if (!isWindow() && !isSubWindow && p)-
4266 return p->focusNextPrevChild(next);-
4267-
4268 if (d->extra && d->extra->proxyWidget)-
4269 return d->extra->proxyWidget->focusNextPrevChild(next);-
4270-
4271-
4272 bool wrappingOccurred = false;-
4273 QWidget *w = QApplicationPrivate::focusNextPrevChild_helper(this, next,-
4274 &wrappingOccurred);-
4275 if (!w) return false;-
4276-
4277 Qt::FocusReason reason = next ? Qt::TabFocusReason : Qt::BacktabFocusReason;-
4278-
4279-
4280-
4281-
4282-
4283-
4284 if (wrappingOccurred) {-
4285 QWindow *window = windowHandle();-
4286 if (window != 0) {-
4287 QWindowPrivate *winp = qt_window_private(window);-
4288-
4289 if (winp->platformWindow != 0) {-
4290 QFocusEvent event(QEvent::FocusIn, reason);-
4291 event.ignore();-
4292 winp->platformWindow->windowEvent(&event);-
4293 if (event.isAccepted()) return true;-
4294 }-
4295 }-
4296 }-
4297-
4298 w->setFocus(reason);-
4299 return true;-
4300}-
4301QWidget *QWidget::focusWidget() const-
4302{-
4303 return const_cast<QWidget *>(d_func()->focus_child);-
4304}-
4305-
4306-
4307-
4308-
4309-
4310-
4311QWidget *QWidget::nextInFocusChain() const-
4312{-
4313 return const_cast<QWidget *>(d_func()->focus_next);-
4314}-
4315QWidget *QWidget::previousInFocusChain() const-
4316{-
4317 return const_cast<QWidget *>(d_func()->focus_prev);-
4318}-
4319bool QWidget::isActiveWindow() const-
4320{-
4321 QWidget *tlw = window();-
4322 if(tlw == QApplication::activeWindow() || (isVisible() && (tlw->windowType() == Qt::Popup)))-
4323 return true;-
4324-
4325-
4326 if (QWExtra *tlwExtra = tlw->d_func()->extra) {-
4327 if (isVisible() && tlwExtra->proxyWidget)-
4328 return tlwExtra->proxyWidget->isActiveWindow();-
4329 }-
4330-
4331-
4332 if(style()->styleHint(QStyle::SH_Widget_ShareActivation, 0, this)) {-
4333 if(tlw->windowType() == Qt::Tool &&-
4334 !tlw->isModal() &&-
4335 (!tlw->parentWidget() || tlw->parentWidget()->isActiveWindow()))-
4336 return true;-
4337 QWidget *w = QApplication::activeWindow();-
4338 while(w && tlw->windowType() == Qt::Tool &&-
4339 !w->isModal() && w->parentWidget()) {-
4340 w = w->parentWidget()->window();-
4341 if(w == tlw)-
4342 return true;-
4343 }-
4344 }-
4345-
4346-
4347 if (QWindow *ww = QGuiApplication::focusWindow()) {-
4348 while (ww) {-
4349 QWidgetWindow *qww = qobject_cast<QWidgetWindow *>(ww);-
4350 QWindowContainer *qwc = qww ? qobject_cast<QWindowContainer *>(qww->widget()) : 0;-
4351 if (qwc && qwc->topLevelWidget() == tlw)-
4352 return true;-
4353 ww = ww->parent();-
4354 }-
4355 }-
4356-
4357-
4358-
4359-
4360-
4361-
4362 if (const QWindow *w = tlw->windowHandle()) {-
4363 if (w->handle())-
4364 return w->handle()->isActive();-
4365 }-
4366-
4367 return false;-
4368}-
4369void QWidget::setTabOrder(QWidget* first, QWidget *second)-
4370{-
4371 if (!first
!firstDescription
TRUEnever evaluated
FALSEnever evaluated
|| !second
!secondDescription
TRUEnever evaluated
FALSEnever evaluated
|| first->focusPolicy() == Qt::NoFocus
first->focusPo...== Qt::NoFocusDescription
TRUEnever evaluated
FALSEnever evaluated
|| second->focusPolicy() == Qt::NoFocus
second->focusP...== Qt::NoFocusDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
4372 return;
never executed: return;
0
4373-
4374 if (__builtin_expect(!!(
__builtin_expe...dow()), false)Description
TRUEnever evaluated
FALSEnever evaluated
first->window() != second->window())()), false)
__builtin_expe...dow()), false)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
4375 QMessageLogger(__FILE__, 69026932, __PRETTY_FUNCTION__).warning("QWidget::setTabOrder: 'first' and 'second' must be in the same window");-
4376 return;
never executed: return;
0
4377 }-
4378-
4379 QWidget *fp = first->focusProxy();-
4380 if (fp
fpDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
4381-
4382-
4383-
4384-
4385 QList<QWidget *> l = first->findChildren<QWidget *>();-
4386 for (int i = l.size()-1; i >= 0
i >= 0Description
TRUEnever evaluated
FALSEnever evaluated
; --i) {
0
4387 QWidget * next = l.at(i);-
4388 if (next->window() == fp->window()
next->window() == fp->window()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
4389 fp = next;-
4390 if (fp->focusPolicy() != Qt::NoFocus
fp->focusPolic...!= Qt::NoFocusDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
4391 break;
never executed: break;
0
4392 }
never executed: end of block
0
4393 }
never executed: end of block
0
4394 first = fp;-
4395 }
never executed: end of block
0
4396-
4397 if (fp == second
fp == secondDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
4398 return;
never executed: return;
0
4399-
4400 if (QWidget *sp = second->focusProxy()
QWidget *sp = ...->focusProxy()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
4401 second = sp;
never executed: second = sp;
0
4402-
4403-
4404 QWidget *fn = first->d_func()->focus_next;-
4405-
4406 if (fn == second
fn == secondDescription
TRUEnever evaluated
FALSEnever evaluated
|| first == second
first == secondDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
4407 return;
never executed: return;
0
4408-
4409 QWidget *sp = second->d_func()->focus_prev;-
4410 QWidget *sn = second->d_func()->focus_next;-
4411-
4412 fn->d_func()->focus_prev = second;-
4413 first->d_func()->focus_next = second;-
4414-
4415 second->d_func()->focus_next = fn;-
4416 second->d_func()->focus_prev = first;-
4417-
4418 sp->d_func()->focus_next = sn;-
4419 sn->d_func()->focus_prev = sp;-
4420-
4421-
4422 ((!(first->d_func()->focus_next->d_func()->focus_prev == first)) ? qt_assert("first->d_func()->focus_next->d_func()->focus_prev == first",__FILE__,69496979) : qt_noop());-
4423 ((!(first->d_func()->focus_prev->d_func()->focus_next == first)) ? qt_assert("first->d_func()->focus_prev->d_func()->focus_next == first",__FILE__,69506980) : qt_noop());-
4424-
4425 ((!(second->d_func()->focus_next->d_func()->focus_prev == second)) ? qt_assert("second->d_func()->focus_next->d_func()->focus_prev == second",__FILE__,69526982) : qt_noop());-
4426 ((!(second->d_func()->focus_prev->d_func()->focus_next == second)) ? qt_assert("second->d_func()->focus_prev->d_func()->focus_next == second",__FILE__,69536983) : qt_noop());-
4427}
never executed: end of block
0
4428void QWidgetPrivate::reparentFocusWidgets(QWidget * oldtlw)-
4429{-
4430 QWidget * const q = q_func();-
4431 if (oldtlw == q->window())-
4432 return;-
4433-
4434 if(focus_child)-
4435 focus_child->clearFocus();-
4436-
4437-
4438 QWidget *firstOld = 0;-
4439-
4440 QWidget *o = 0;-
4441 QWidget *n = q;-
4442-
4443 bool prevWasNew = true;-
4444 QWidget *w = focus_next;-
4445-
4446-
4447-
4448-
4449 while (w != q) {-
4450 bool currentIsNew = q->isAncestorOf(w);-
4451 if (currentIsNew) {-
4452 if (!prevWasNew) {-
4453-
4454 n->d_func()->focus_next = w;-
4455 w->d_func()->focus_prev = n;-
4456 }-
4457 n = w;-
4458 } else {-
4459 if (prevWasNew) {-
4460-
4461 if (o) {-
4462 o->d_func()->focus_next = w;-
4463 w->d_func()->focus_prev = o;-
4464 } else {-
4465-
4466 firstOld = w;-
4467 }-
4468 }-
4469 o = w;-
4470 }-
4471 w = w->d_func()->focus_next;-
4472 prevWasNew = currentIsNew;-
4473 }-
4474-
4475-
4476 if (firstOld) {-
4477 o->d_func()->focus_next = firstOld;-
4478 firstOld->d_func()->focus_prev = o;-
4479 }-
4480-
4481 if (!q->isWindow()) {-
4482 QWidget *topLevel = q->window();-
4483-
4484-
4485 QWidget *prev = topLevel->d_func()->focus_prev;-
4486-
4487 topLevel->d_func()->focus_prev = n;-
4488 prev->d_func()->focus_next = q;-
4489-
4490 focus_prev = prev;-
4491 n->d_func()->focus_next = topLevel;-
4492 } else {-
4493-
4494 n->d_func()->focus_next = q;-
4495 focus_prev = n;-
4496 }-
4497-
4498}-
4499int QWidgetPrivate::pointToRect(const QPoint &p, const QRect &r)-
4500{-
4501 int dx = 0;-
4502 int dy = 0;-
4503 if (p.x() < r.left())-
4504 dx = r.left() - p.x();-
4505 else if (p.x() > r.right())-
4506 dx = p.x() - r.right();-
4507 if (p.y() < r.top())-
4508 dy = r.top() - p.y();-
4509 else if (p.y() > r.bottom())-
4510 dy = p.y() - r.bottom();-
4511 return dx + dy;-
4512}-
4513QSize QWidget::frameSize() const-
4514{-
4515 const QWidgetPrivate * const d = d_func();-
4516 if (isWindow() && !(windowType() == Qt::Popup)) {-
4517 QRect fs = d->frameStrut();-
4518 return QSize(data->crect.width() + fs.left() + fs.right(),-
4519 data->crect.height() + fs.top() + fs.bottom());-
4520 }-
4521 return data->crect.size();-
4522}-
4523void QWidget::move(const QPoint &p)-
4524{-
4525 QWidgetPrivate * const d = d_func();-
4526 setAttribute(Qt::WA_Moved);-
4527 if (testAttribute(Qt::WA_WState_Created)) {-
4528 if (isWindow())-
4529 d->topData()->posIncludesFrame = false;-
4530 d->setGeometry_sys(p.x() + geometry().x() - QWidget::x(),-
4531 p.y() + geometry().y() - QWidget::y(),-
4532 width(), height(), true);-
4533 d->setDirtyOpaqueRegion();-
4534 } else {-
4535-
4536 if (isWindow())-
4537 d->topData()->posIncludesFrame = true;-
4538 data->crect.moveTopLeft(p);-
4539 setAttribute(Qt::WA_PendingMoveEvent);-
4540 }-
4541-
4542 if (d->extra && d->extra->hasWindowContainer)-
4543 QWindowContainer::parentWasMoved(this);-
4544}-
4545-
4546-
4547-
4548-
4549void QWidgetPrivate::fixPosIncludesFrame()-
4550{-
4551 QWidget * const q = q_func();-
4552 if (QTLWExtra *te = maybeTopData()) {-
4553 if (te->posIncludesFrame) {-
4554-
4555-
4556 if (q->testAttribute(Qt::WA_DontShowOnScreen)) {-
4557 te->posIncludesFrame = 0;-
4558 } else {-
4559 if (q->windowHandle()) {-
4560 updateFrameStrut();-
4561 if (!q->data->fstrut_dirty) {-
4562 data.crect.translate(te->frameStrut.x(), te->frameStrut.y());-
4563 te->posIncludesFrame = 0;-
4564 }-
4565 }-
4566 }-
4567 }-
4568 }-
4569}-
4570-
4571-
4572-
4573-
4574-
4575-
4576-
4577void QWidget::resize(const QSize &s)-
4578{-
4579 QWidgetPrivate * const d = d_func();-
4580 setAttribute(Qt::WA_Resized);-
4581 if (testAttribute(Qt::WA_WState_Created)) {-
4582 d->fixPosIncludesFrame();-
4583 d->setGeometry_sys(geometry().x(), geometry().y(), s.width(), s.height(), false);-
4584 d->setDirtyOpaqueRegion();-
4585 } else {-
4586 data->crect.setSize(s.boundedTo(maximumSize()).expandedTo(minimumSize()));-
4587 setAttribute(Qt::WA_PendingResizeEvent);-
4588 }-
4589}-
4590-
4591void QWidget::setGeometry(const QRect &r)-
4592{-
4593 QWidgetPrivate * const d = d_func();-
4594 setAttribute(Qt::WA_Resized);-
4595 setAttribute(Qt::WA_Moved);-
4596 if (isWindow())-
4597 d->topData()->posIncludesFrame = 0;-
4598 if (testAttribute(Qt::WA_WState_Created)) {-
4599 d->setGeometry_sys(r.x(), r.y(), r.width(), r.height(), true);-
4600 d->setDirtyOpaqueRegion();-
4601 } else {-
4602 data->crect.setTopLeft(r.topLeft());-
4603 data->crect.setSize(r.size().boundedTo(maximumSize()).expandedTo(minimumSize()));-
4604 setAttribute(Qt::WA_PendingMoveEvent);-
4605 setAttribute(Qt::WA_PendingResizeEvent);-
4606 }-
4607-
4608 if (d->extra && d->extra->hasWindowContainer)-
4609 QWindowContainer::parentWasMoved(this);-
4610}-
4611-
4612void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove)-
4613{-
4614 QWidget * const q = q_func();-
4615 if (extra) {-
4616 w = qMin(w,extra->maxw);-
4617 h = qMin(h,extra->maxh);-
4618 w = qMax(w,extra->minw);-
4619 h = qMax(h,extra->minh);-
4620 }-
4621-
4622 if (q->isWindow() && q->windowHandle()) {-
4623 QPlatformIntegration *integration = QGuiApplicationPrivate::platformIntegration();-
4624 if (!integration->hasCapability(QPlatformIntegration::NonFullScreenWindows)) {-
4625 x = 0;-
4626 y = 0;-
4627 w = q->windowHandle()->width();-
4628 h = q->windowHandle()->height();-
4629 }-
4630 }-
4631-
4632 QPoint oldp = q->geometry().topLeft();-
4633 QSize olds = q->size();-
4634 QRect r(x, y, w, h);-
4635-
4636 bool isResize = olds != r.size();-
4637 isMove = oldp != r.topLeft();-
4638-
4639-
4640-
4641-
4642 if (r.size() == olds && oldp == r.topLeft())-
4643 return;-
4644-
4645 if (!data.in_set_window_state) {-
4646 q->data->window_state &= ~Qt::WindowMaximized;-
4647 q->data->window_state &= ~Qt::WindowFullScreen;-
4648 if (q->isWindow())-
4649 topData()->normalGeometry = QRect(0, 0, -1, -1);-
4650 }-
4651-
4652 QPoint oldPos = q->pos();-
4653 data.crect = r;-
4654-
4655 bool needsShow = false;-
4656-
4657 if (q->isWindow() || q->windowHandle()) {-
4658 if (!(data.window_state & Qt::WindowFullScreen) && (w == 0 || h == 0)) {-
4659 q->setAttribute(Qt::WA_OutsideWSRange, true);-
4660 if (q->isVisible())-
4661 hide_sys();-
4662 data.crect = QRect(x, y, w, h);-
4663 } else if (q->testAttribute(Qt::WA_OutsideWSRange)) {-
4664 q->setAttribute(Qt::WA_OutsideWSRange, false);-
4665 needsShow = true;-
4666 }-
4667 }-
4668-
4669 if (q->isVisible()) {-
4670 if (!q->testAttribute(Qt::WA_DontShowOnScreen) && !q->testAttribute(Qt::WA_OutsideWSRange)) {-
4671 if (q->windowHandle()) {-
4672 if (q->isWindow()) {-
4673 q->windowHandle()->setGeometry(q->geometry());-
4674 } else {-
4675 QPoint posInNativeParent = q->mapTo(q->nativeParentWidget(),QPoint());-
4676 q->windowHandle()->setGeometry(QRect(posInNativeParent,r.size()));-
4677 }-
4678-
4679 if (needsShow)-
4680 show_sys();-
4681 }-
4682-
4683 if (!q->isWindow()) {-
4684 if (renderToTexture) {-
4685 QRegion updateRegion(q->geometry());-
4686 updateRegion += QRect(oldPos, olds);-
4687 q->parentWidget()->d_func()->invalidateBuffer(updateRegion);-
4688 } else if (isMove && !isResize) {-
4689 moveRect(QRect(oldPos, olds), x - oldPos.x(), y - oldPos.y());-
4690 } else {-
4691 invalidateBuffer_resizeHelper(oldPos, olds);-
4692 }-
4693 }-
4694 }-
4695-
4696 if (isMove) {-
4697 QMoveEvent e(q->pos(), oldPos);-
4698 QApplication::sendEvent(q, &e);-
4699 }-
4700 if (isResize) {-
4701 QResizeEvent e(r.size(), olds);-
4702 QApplication::sendEvent(q, &e);-
4703 if (q->windowHandle())-
4704 q->update();-
4705 }-
4706 } else {-
4707 if (isMove && q->pos() != oldPos)-
4708 q->setAttribute(Qt::WA_PendingMoveEvent, true);-
4709 if (isResize)-
4710 q->setAttribute(Qt::WA_PendingResizeEvent, true);-
4711 }-
4712-
4713}-
4714QByteArray QWidget::saveGeometry() const-
4715{-
4716 QByteArray array;-
4717 QDataStream stream(&array, QIODevice::WriteOnly);-
4718 stream.setVersion(QDataStream::Qt_4_0);-
4719 const quint32 magicNumber = 0x1D9D0CB;-
4720-
4721-
4722-
4723 quint16 majorVersion = 2;-
4724 quint16 minorVersion = 0;-
4725 const int screenNumber = QApplication::desktop()->screenNumber(this);-
4726 stream << magicNumber-
4727 << majorVersion-
4728 << minorVersion-
4729-
4730-
4731-
4732-
4733 << frameGeometry()-
4734 << normalGeometry()-
4735-
4736 << qint32(screenNumber)-
4737 << quint8(windowState() & Qt::WindowMaximized)-
4738 << quint8(windowState() & Qt::WindowFullScreen)-
4739 << qint32(QApplication::desktop()->screenGeometry(screenNumber).width());-
4740 return array;-
4741}-
4742bool QWidget::restoreGeometry(const QByteArray &geometry)-
4743{-
4744 if (geometry.size() < 4)-
4745 return false;-
4746 QDataStream stream(geometry);-
4747 stream.setVersion(QDataStream::Qt_4_0);-
4748-
4749 const quint32 magicNumber = 0x1D9D0CB;-
4750 quint32 storedMagicNumber;-
4751 stream >> storedMagicNumber;-
4752 if (storedMagicNumber != magicNumber)-
4753 return false;-
4754-
4755 const quint16 currentMajorVersion = 2;-
4756 quint16 majorVersion = 0;-
4757 quint16 minorVersion = 0;-
4758-
4759 stream >> majorVersion >> minorVersion;-
4760-
4761 if (majorVersion > currentMajorVersion)-
4762 return false;-
4763-
4764-
4765 QRect restoredFrameGeometry;-
4766 QRect restoredNormalGeometry;-
4767 qint32 restoredScreenNumber;-
4768 quint8 maximized;-
4769 quint8 fullScreen;-
4770 qint32 restoredScreenWidth = 0;-
4771-
4772 stream >> restoredFrameGeometry-
4773 >> restoredNormalGeometry-
4774 >> restoredScreenNumber-
4775 >> maximized-
4776 >> fullScreen;-
4777-
4778 if (majorVersion > 1)-
4779 stream >> restoredScreenWidth;-
4780-
4781 const QDesktopWidget * const desktop = QApplication::desktop();-
4782 if (restoredScreenNumber >= desktop->numScreens())-
4783 restoredScreenNumber = desktop->primaryScreen();-
4784 const qreal screenWidthF = qreal(desktop->screenGeometry(restoredScreenNumber).width());-
4785-
4786-
4787 if (restoredScreenWidth) {-
4788 const qreal factor = qreal(restoredScreenWidth) / screenWidthF;-
4789 if (factor < 0.8 || factor > 1.25)-
4790 return false;-
4791 } else {-
4792-
4793-
4794 if (!maximized && !fullScreen && qreal(restoredFrameGeometry.width()) / screenWidthF > 1.5)-
4795 return false;-
4796 }-
4797-
4798 const int frameHeight = 20;-
4799 if (!restoredFrameGeometry.isValid())-
4800 restoredFrameGeometry = QRect(QPoint(0,0), sizeHint());-
4801-
4802 if (!restoredNormalGeometry.isValid())-
4803 restoredNormalGeometry = QRect(QPoint(0, frameHeight), sizeHint());-
4804 if (!restoredNormalGeometry.isValid()) {-
4805-
4806 restoredNormalGeometry.setSize(restoredNormalGeometry-
4807 .size()-
4808 .expandedTo(d_func()->adjustedSize()));-
4809 }-
4810-
4811 const QRect availableGeometry = desktop->availableGeometry(restoredScreenNumber);-
4812 if (!restoredFrameGeometry.intersects(availableGeometry)) {-
4813 restoredFrameGeometry.moveBottom(qMin(restoredFrameGeometry.bottom(), availableGeometry.bottom()));-
4814 restoredFrameGeometry.moveLeft(qMax(restoredFrameGeometry.left(), availableGeometry.left()));-
4815 restoredFrameGeometry.moveRight(qMin(restoredFrameGeometry.right(), availableGeometry.right()));-
4816 }-
4817 restoredFrameGeometry.moveTop(qMax(restoredFrameGeometry.top(), availableGeometry.top()));-
4818-
4819 if (!restoredNormalGeometry.intersects(availableGeometry)) {-
4820 restoredNormalGeometry.moveBottom(qMin(restoredNormalGeometry.bottom(), availableGeometry.bottom()));-
4821 restoredNormalGeometry.moveLeft(qMax(restoredNormalGeometry.left(), availableGeometry.left()));-
4822 restoredNormalGeometry.moveRight(qMin(restoredNormalGeometry.right(), availableGeometry.right()));-
4823 }-
4824 restoredNormalGeometry.moveTop(qMax(restoredNormalGeometry.top(), availableGeometry.top() + frameHeight));-
4825-
4826 if (maximized || fullScreen) {-
4827-
4828-
4829 Qt::WindowStates ws = windowState();-
4830-
4831 setGeometry(restoredNormalGeometry);-
4832 if (maximized)-
4833 ws |= Qt::WindowMaximized;-
4834 if (fullScreen)-
4835 ws |= Qt::WindowFullScreen;-
4836 setWindowState(ws);-
4837 d_func()->topData()->normalGeometry = restoredNormalGeometry;-
4838 } else {-
4839 QPoint offset;-
4840-
4841-
4842-
4843-
4844 setWindowState(windowState() & ~(Qt::WindowMaximized | Qt::WindowFullScreen));-
4845 move(restoredFrameGeometry.topLeft() + offset);-
4846 resize(restoredNormalGeometry.size());-
4847 }-
4848 return true;-
4849}-
4850void QWidget::setContentsMargins(int left, int top, int right, int bottom)-
4851{-
4852 QWidgetPrivate * const d = d_func();-
4853 if (left == d->leftmargin && top == d->topmargin-
4854 && right == d->rightmargin && bottom == d->bottommargin)-
4855 return;-
4856 d->leftmargin = left;-
4857 d->topmargin = top;-
4858 d->rightmargin = right;-
4859 d->bottommargin = bottom;-
4860-
4861 if (QLayout *l=d->layout)-
4862 l->update();-
4863 else-
4864 updateGeometry();-
4865-
4866 if (isVisible()) {-
4867 update();-
4868 QResizeEvent e(data->crect.size(), data->crect.size());-
4869 QApplication::sendEvent(this, &e);-
4870 } else {-
4871 setAttribute(Qt::WA_PendingResizeEvent, true);-
4872 }-
4873-
4874 QEvent e(QEvent::ContentsRectChange);-
4875 QApplication::sendEvent(this, &e);-
4876}-
4877void QWidget::setContentsMargins(const QMargins &margins)-
4878{-
4879 setContentsMargins(margins.left(), margins.top(),-
4880 margins.right(), margins.bottom());-
4881}-
4882-
4883-
4884-
4885-
4886-
4887-
4888-
4889void QWidget::getContentsMargins(int *left, int *top, int *right, int *bottom) const-
4890{-
4891 const QWidgetPrivate * const d = d_func();-
4892 if (left)-
4893 *left = d->leftmargin;-
4894 if (top)-
4895 *top = d->topmargin;-
4896 if (right)-
4897 *right = d->rightmargin;-
4898 if (bottom)-
4899 *bottom = d->bottommargin;-
4900}-
4901QMargins QWidget::contentsMargins() const-
4902{-
4903 const QWidgetPrivate * const d = d_func();-
4904 return QMargins(d->leftmargin, d->topmargin, d->rightmargin, d->bottommargin);-
4905}-
4906-
4907-
4908-
4909-
4910-
4911-
4912-
4913QRect QWidget::contentsRect() const-
4914{-
4915 const QWidgetPrivate * const d = d_func();-
4916 return QRect(QPoint(d->leftmargin, d->topmargin),-
4917 QPoint(data->crect.width() - 1 - d->rightmargin,-
4918 data->crect.height() - 1 - d->bottommargin));-
4919-
4920}-
4921Qt::ContextMenuPolicy QWidget::contextMenuPolicy() const-
4922{-
4923 return (Qt::ContextMenuPolicy)data->context_menu_policy;-
4924}-
4925-
4926void QWidget::setContextMenuPolicy(Qt::ContextMenuPolicy policy)-
4927{-
4928 data->context_menu_policy = (uint) policy;-
4929}-
4930Qt::FocusPolicy QWidget::focusPolicy() const-
4931{-
4932 return (Qt::FocusPolicy)data->focus_policy;-
4933}-
4934-
4935void QWidget::setFocusPolicy(Qt::FocusPolicy policy)-
4936{-
4937 data->focus_policy = (uint) policy;-
4938 QWidgetPrivate * const d = d_func();-
4939 if (d->extra && d->extra->focus_proxy)-
4940 d->extra->focus_proxy->setFocusPolicy(policy);-
4941}-
4942void QWidget::setUpdatesEnabled(bool enable)-
4943{-
4944 QWidgetPrivate * const d = d_func();-
4945 setAttribute(Qt::WA_ForceUpdatesDisabled, !enable);-
4946 d->setUpdatesEnabled_helper(enable);-
4947}-
4948void QWidget::show()-
4949{-
4950 Qt::WindowState defaultState = QGuiApplicationPrivate::platformIntegration()->defaultWindowState(data->window_flags);-
4951 if (defaultState == Qt::WindowFullScreen)-
4952 showFullScreen();-
4953 else if (defaultState == Qt::WindowMaximized)-
4954 showMaximized();-
4955 else-
4956 setVisible(true);-
4957}-
4958-
4959-
4960-
4961-
4962-
4963-
4964void QWidgetPrivate::show_recursive()-
4965{-
4966 QWidget * const q = q_func();-
4967-
4968-
4969 if (!q->testAttribute(Qt::WA_WState_Created))-
4970 createRecursively();-
4971 q->ensurePolished();-
4972-
4973 if (!q->isWindow() && q->parentWidget()->d_func()->layout && !q->parentWidget()->data->in_show)-
4974 q->parentWidget()->d_func()->layout->activate();-
4975-
4976 if (layout)-
4977 layout->activate();-
4978-
4979 show_helper();-
4980}-
4981-
4982void QWidgetPrivate::sendPendingMoveAndResizeEvents(bool recursive, bool disableUpdates)-
4983{-
4984 QWidget * const q = q_func();-
4985-
4986 disableUpdates = disableUpdates && q->updatesEnabled();-
4987 if (disableUpdates)-
4988 q->setAttribute(Qt::WA_UpdatesDisabled);-
4989-
4990 if (q->testAttribute(Qt::WA_PendingMoveEvent)) {-
4991 QMoveEvent e(data.crect.topLeft(), data.crect.topLeft());-
4992 QApplication::sendEvent(q, &e);-
4993 q->setAttribute(Qt::WA_PendingMoveEvent, false);-
4994 }-
4995-
4996 if (q->testAttribute(Qt::WA_PendingResizeEvent)) {-
4997 QResizeEvent e(data.crect.size(), QSize());-
4998 QApplication::sendEvent(q, &e);-
4999 q->setAttribute(Qt::WA_PendingResizeEvent, false);-
5000 }-
5001-
5002 if (disableUpdates)-
5003 q->setAttribute(Qt::WA_UpdatesDisabled, false);-
5004-
5005 if (!recursive)-
5006 return;-
5007-
5008 for (int i = 0; i < children.size(); ++i) {-
5009 if (QWidget *child = qobject_cast<QWidget *>(children.at(i)))-
5010 child->d_func()->sendPendingMoveAndResizeEvents(recursive, disableUpdates);-
5011 }-
5012}-
5013-
5014void QWidgetPrivate::activateChildLayoutsRecursively()-
5015{-
5016 sendPendingMoveAndResizeEvents(false, true);-
5017-
5018 for (int i = 0; i < children.size(); ++i) {-
5019 QWidget *child = qobject_cast<QWidget *>(children.at(i));-
5020 if (!child || child->isHidden() || child->isWindow())-
5021 continue;-
5022-
5023 child->ensurePolished();-
5024-
5025-
5026 QWidgetPrivate *childPrivate = child->d_func();-
5027 if (childPrivate->layout)-
5028 childPrivate->layout->activate();-
5029-
5030-
5031 const bool wasVisible = child->isVisible();-
5032 if (!wasVisible)-
5033 child->setAttribute(Qt::WA_WState_Visible);-
5034-
5035-
5036 childPrivate->activateChildLayoutsRecursively();-
5037-
5038-
5039 if (!wasVisible)-
5040 child->setAttribute(Qt::WA_WState_Visible, false);-
5041 }-
5042}-
5043-
5044void QWidgetPrivate::show_helper()-
5045{-
5046 QWidget * const q = q_func();-
5047 data.in_show = true;-
5048-
5049 sendPendingMoveAndResizeEvents();-
5050-
5051-
5052 q->setAttribute(Qt::WA_WState_Visible);-
5053-
5054-
5055 showChildren(false);-
5056-
5057-
5058-
5059 const bool isWindow = q->isWindow();-
5060-
5061 bool isEmbedded = isWindow && q->graphicsProxyWidget() != nullptr;-
5062-
5063-
5064-
5065-
5066-
5067-
5068-
5069 if (isWindow && !isEmbedded) {-
5070 if ((q->windowType() == Qt::Tool) || (q->windowType() == Qt::Popup) || q->windowType() == Qt::ToolTip) {-
5071 q->raise();-
5072 if (q->parentWidget() && q->parentWidget()->window()->testAttribute(Qt::WA_KeyboardFocusChange))-
5073 q->setAttribute(Qt::WA_KeyboardFocusChange);-
5074 } else {-
5075 while (QApplication::activePopupWidget()) {-
5076 if (!QApplication::activePopupWidget()->close())-
5077 break;-
5078 }-
5079 }-
5080 }-
5081-
5082-
5083-
5084-
5085 if (isWindow) {-
5086 if (!isEmbedded && !bypassGraphicsProxyWidget(q)) {-
5087 QGraphicsProxyWidget *ancestorProxy = nearestGraphicsProxyWidget(q->parentWidget());-
5088 if (ancestorProxy) {-
5089 isEmbedded = true;-
5090 ancestorProxy->d_func()->embedSubWindow(q);-
5091 }-
5092 }-
5093 }-
5094 QShowEvent showEvent;-
5095 QApplication::sendEvent(q, &showEvent);-
5096-
5097 show_sys();-
5098-
5099 if (!isEmbedded && q->windowType() == Qt::Popup)-
5100 (static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->openPopup(q);-
5101-
5102-
5103 if (q->windowType() != Qt::ToolTip) {-
5104 QAccessibleEvent event(q, QAccessible::ObjectShow);-
5105 QAccessible::updateAccessibility(&event);-
5106 }-
5107-
5108-
5109 if (QApplicationPrivate::hidden_focus_widget == q) {-
5110 QApplicationPrivate::hidden_focus_widget = 0;-
5111 q->setFocus(Qt::OtherFocusReason);-
5112 }-
5113-
5114-
5115-
5116-
5117 if (!(static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->in_exec && q->windowType() == Qt::SplashScreen)-
5118 QApplication::processEvents();-
5119-
5120 data.in_show = false;-
5121}-
5122-
5123void QWidgetPrivate::show_sys()-
5124{-
5125 QWidget * const q = q_func();-
5126-
5127 QWindow *window = q->windowHandle();-
5128-
5129 if (q->testAttribute(Qt::WA_DontShowOnScreen)) {-
5130 invalidateBuffer(q->rect());-
5131 q->setAttribute(Qt::WA_Mapped);-
5132-
5133 if (window && q->isWindow()-
5134-
5135 && (!extra || !extra->proxyWidget)-
5136-
5137 && q->windowModality() != Qt::NonModal) {-
5138 QGuiApplicationPrivate::showModalWindow(window);-
5139 }-
5140 return;-
5141 }-
5142-
5143 if (renderToTexture && !q->isWindow())-
5144 QApplication::postEvent(q->parentWidget(), new QUpdateLaterEvent(q->geometry()));-
5145 else-
5146 QApplication::postEvent(q, new QUpdateLaterEvent(q->rect()));-
5147-
5148 if ((!q->isWindow() && !q->testAttribute(Qt::WA_NativeWindow))-
5149 || q->testAttribute(Qt::WA_OutsideWSRange)) {-
5150 return;-
5151 }-
5152-
5153 if (window) {-
5154 if (q->isWindow())-
5155 fixPosIncludesFrame();-
5156 QRect geomRect = q->geometry();-
5157 if (!q->isWindow()) {-
5158 QPoint topLeftOfWindow = q->mapTo(q->nativeParentWidget(),QPoint());-
5159 geomRect.moveTopLeft(topLeftOfWindow);-
5160 }-
5161 const QRect windowRect = window->geometry();-
5162 if (windowRect != geomRect) {-
5163 if (q->testAttribute(Qt::WA_Moved)-
5164 || !QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::WindowManagement))-
5165 window->setGeometry(geomRect);-
5166 else-
5167 window->resize(geomRect.size());-
5168 }-
5169-
5170-
5171 qt_qpa_set_cursor(q, false);-
5172-
5173 invalidateBuffer(q->rect());-
5174 window->setVisible(true);-
5175-
5176 if (window->isTopLevel()) {-
5177 const QPoint crectTopLeft = q->data->crect.topLeft();-
5178 const QPoint windowTopLeft = window->geometry().topLeft();-
5179 if (crectTopLeft == QPoint(0, 0) && windowTopLeft != crectTopLeft)-
5180 q->data->crect.moveTopLeft(windowTopLeft);-
5181 }-
5182 }-
5183}-
5184void QWidget::hide()-
5185{-
5186 setVisible(false);-
5187}-
5188-
5189-
5190-
5191void QWidgetPrivate::hide_helper()-
5192{-
5193 QWidget * const q = q_func();-
5194-
5195 bool isEmbedded = false;-
5196-
5197 isEmbedded = q->isWindow() && !bypassGraphicsProxyWidget(q) && nearestGraphicsProxyWidget(q->parentWidget()) != 0;-
5198-
5199-
5200-
5201-
5202 if (!isEmbedded && (q->windowType() == Qt::Popup))-
5203 (static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->closePopup(q);-
5204-
5205-
5206-
5207-
5208-
5209-
5210-
5211 q->setAttribute(Qt::WA_Mapped, false);-
5212 hide_sys();-
5213-
5214 bool wasVisible = q->testAttribute(Qt::WA_WState_Visible);-
5215-
5216 if (wasVisible) {-
5217 q->setAttribute(Qt::WA_WState_Visible, false);-
5218-
5219 }-
5220-
5221 QHideEvent hideEvent;-
5222 QApplication::sendEvent(q, &hideEvent);-
5223 hideChildren(false);-
5224-
5225-
5226-
5227 if (wasVisible) {-
5228 (static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->sendSyntheticEnterLeave(q);-
5229 QWidget *fw = QApplication::focusWidget();-
5230 while (fw && !fw->isWindow()) {-
5231 if (fw == q) {-
5232 q->focusNextPrevChild(true);-
5233 break;-
5234 }-
5235 fw = fw->parentWidget();-
5236 }-
5237 }-
5238-
5239 if (QWidgetBackingStore *bs = maybeBackingStore())-
5240 bs->removeDirtyWidget(q);-
5241-
5242-
5243 if (wasVisible) {-
5244 QAccessibleEvent event(q, QAccessible::ObjectHide);-
5245 QAccessible::updateAccessibility(&event);-
5246 }-
5247-
5248}-
5249-
5250void QWidgetPrivate::hide_sys()-
5251{-
5252 QWidget * const q = q_func();-
5253-
5254 QWindow *window = q->windowHandle();-
5255-
5256 if (q->testAttribute(Qt::WA_DontShowOnScreen)) {-
5257 q->setAttribute(Qt::WA_Mapped, false);-
5258-
5259 if (window && q->isWindow()-
5260-
5261 && (!extra || !extra->proxyWidget)-
5262-
5263 && q->windowModality() != Qt::NonModal) {-
5264 QGuiApplicationPrivate::hideModalWindow(window);-
5265 }-
5266-
5267 }-
5268-
5269 deactivateWidgetCleanup();-
5270-
5271 if (!q->isWindow()) {-
5272 QWidget *p = q->parentWidget();-
5273 if (p &&p->isVisible()) {-
5274 if (renderToTexture)-
5275 p->d_func()->invalidateBuffer(q->geometry());-
5276 else-
5277 invalidateBuffer(q->rect());-
5278 }-
5279 } else {-
5280 invalidateBuffer(q->rect());-
5281 }-
5282-
5283 if (window)-
5284 window->setVisible(false);-
5285}-
5286void QWidget::setVisible(bool visible)-
5287{-
5288 if (visible) {-
5289 if (testAttribute(Qt::WA_WState_ExplicitShowHide) && !testAttribute(Qt::WA_WState_Hidden))-
5290 return;-
5291-
5292 QWidgetPrivate * const d = d_func();-
5293-
5294-
5295 if (!isWindow() && parentWidget() && parentWidget()->isVisible()-
5296 && !parentWidget()->testAttribute(Qt::WA_WState_Created))-
5297 parentWidget()->window()->d_func()->createRecursively();-
5298-
5299-
5300 QWidget *pw = parentWidget();-
5301 if (!testAttribute(Qt::WA_WState_Created)-
5302 && (isWindow() || pw->testAttribute(Qt::WA_WState_Created))) {-
5303 create();-
5304 }-
5305-
5306 bool wasResized = testAttribute(Qt::WA_Resized);-
5307 Qt::WindowStates initialWindowState = windowState();-
5308-
5309-
5310 ensurePolished();-
5311-
5312-
5313 setAttribute(Qt::WA_WState_ExplicitShowHide);-
5314-
5315 bool needUpdateGeometry = !isWindow() && testAttribute(Qt::WA_WState_Hidden);-
5316-
5317 setAttribute(Qt::WA_WState_Hidden, false);-
5318-
5319 if (needUpdateGeometry)-
5320 d->updateGeometry_helper(true);-
5321-
5322-
5323 if (d->layout)-
5324 d->layout->activate();-
5325-
5326 if (!isWindow()) {-
5327 QWidget *parent = parentWidget();-
5328 while (parent && parent->isVisible() && parent->d_func()->layout && !parent->data->in_show) {-
5329 parent->d_func()->layout->activate();-
5330 if (parent->isWindow())-
5331 break;-
5332 parent = parent->parentWidget();-
5333 }-
5334 if (parent)-
5335 parent->d_func()->setDirtyOpaqueRegion();-
5336 }-
5337-
5338-
5339 if (!wasResized-
5340 && (isWindow() || !parentWidget()->d_func()->layout)) {-
5341 if (isWindow()) {-
5342 adjustSize();-
5343 if (windowState() != initialWindowState)-
5344 setWindowState(initialWindowState);-
5345 } else {-
5346 adjustSize();-
5347 }-
5348 setAttribute(Qt::WA_Resized, false);-
5349 }-
5350-
5351 setAttribute(Qt::WA_KeyboardFocusChange, false);-
5352-
5353 if (isWindow() || parentWidget()->isVisible()) {-
5354 d->show_helper();-
5355-
5356 (static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->sendSyntheticEnterLeave(this);-
5357 }-
5358-
5359 QEvent showToParentEvent(QEvent::ShowToParent);-
5360 QApplication::sendEvent(this, &showToParentEvent);-
5361 } else {-
5362 if (testAttribute(Qt::WA_WState_ExplicitShowHide) && testAttribute(Qt::WA_WState_Hidden))-
5363 return;-
5364 if (QApplicationPrivate::hidden_focus_widget == this)-
5365 QApplicationPrivate::hidden_focus_widget = 0;-
5366-
5367 QWidgetPrivate * const d = d_func();-
5368-
5369-
5370-
5371-
5372-
5373 if (!isWindow() && parentWidget())-
5374 parentWidget()->d_func()->setDirtyOpaqueRegion();-
5375-
5376 setAttribute(Qt::WA_WState_Hidden);-
5377 setAttribute(Qt::WA_WState_ExplicitShowHide);-
5378 if (testAttribute(Qt::WA_WState_Created))-
5379 d->hide_helper();-
5380-
5381-
5382 if (!isWindow() && parentWidget()) {-
5383 if (parentWidget()->d_func()->layout)-
5384 parentWidget()->d_func()->layout->invalidate();-
5385 else if (parentWidget()->isVisible())-
5386 QApplication::postEvent(parentWidget(), new QEvent(QEvent::LayoutRequest));-
5387 }-
5388-
5389 QEvent hideToParentEvent(QEvent::HideToParent);-
5390 QApplication::sendEvent(this, &hideToParentEvent);-
5391 }-
5392}-
5393-
5394-
5395-
5396-
5397void QWidget::setHidden(bool hidden)-
5398{-
5399 setVisible(!hidden);-
5400}-
5401-
5402void QWidgetPrivate::_q_showIfNotHidden()-
5403{-
5404 QWidget * const q = q_func();-
5405 if ( !(q->isHidden() && q->testAttribute(Qt::WA_WState_ExplicitShowHide)) )-
5406 q->setVisible(true);-
5407}-
5408-
5409void QWidgetPrivate::showChildren(bool spontaneous)-
5410{-
5411 QList<QObject*> childList = children;-
5412 for (int i = 0; i < childList.size(); ++i) {-
5413 QWidget *widget = qobject_cast<QWidget*>(childList.at(i));-
5414 if (!widget-
5415 || widget->isWindow()-
5416 || widget->testAttribute(Qt::WA_WState_Hidden))-
5417 continue;-
5418 if (spontaneous) {-
5419 widget->setAttribute(Qt::WA_Mapped);-
5420 widget->d_func()->showChildren(true);-
5421 QShowEvent e;-
5422 QApplication::sendSpontaneousEvent(widget, &e);-
5423 } else {-
5424 if (widget->testAttribute(Qt::WA_WState_ExplicitShowHide))-
5425 widget->d_func()->show_recursive();-
5426 else-
5427 widget->show();-
5428 }-
5429 }-
5430}-
5431-
5432void QWidgetPrivate::hideChildren(bool spontaneous)-
5433{-
5434 QList<QObject*> childList = children;-
5435 for (int i = 0; i < childList.size(); ++i) {-
5436 QWidget *widget = qobject_cast<QWidget*>(childList.at(i));-
5437 if (!widget || widget->isWindow() || widget->testAttribute(Qt::WA_WState_Hidden))-
5438 continue;-
5439 if (spontaneous)-
5440 widget->setAttribute(Qt::WA_Mapped, false);-
5441 else-
5442 widget->setAttribute(Qt::WA_WState_Visible, false);-
5443 widget->d_func()->hideChildren(spontaneous);-
5444 QHideEvent e;-
5445 if (spontaneous) {-
5446 QApplication::sendSpontaneousEvent(widget, &e);-
5447 } else {-
5448 QApplication::sendEvent(widget, &e);-
5449 if (widget->internalWinId()-
5450 && widget->testAttribute(Qt::WA_DontCreateNativeAncestors)) {-
5451-
5452-
5453 widget->d_func()->hide_sys();-
5454 }-
5455 }-
5456 (static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->sendSyntheticEnterLeave(widget);-
5457-
5458 if (!spontaneous) {-
5459 QAccessibleEvent event(widget, QAccessible::ObjectHide);-
5460 QAccessible::updateAccessibility(&event);-
5461 }-
5462-
5463 }-
5464}-
5465-
5466bool QWidgetPrivate::close_helper(CloseMode mode)-
5467{-
5468 if (data.is_closing)-
5469 return true;-
5470-
5471 QWidget * const q = q_func();-
5472 data.is_closing = 1;-
5473-
5474 QPointer<QWidget> that = q;-
5475 QPointer<QWidget> parentWidget = q->parentWidget();-
5476-
5477 bool quitOnClose = q->testAttribute(Qt::WA_QuitOnClose);-
5478 if (mode != CloseNoEvent) {-
5479 QCloseEvent e;-
5480 if (mode == CloseWithSpontaneousEvent)-
5481 QApplication::sendSpontaneousEvent(q, &e);-
5482 else-
5483 QApplication::sendEvent(q, &e);-
5484 if (!that.isNull() && !e.isAccepted()) {-
5485 data.is_closing = 0;-
5486 return false;-
5487 }-
5488 }-
5489-
5490 if (!that.isNull() && !q->isHidden())-
5491 q->hide();-
5492-
5493-
5494 quitOnClose = quitOnClose && (parentWidget.isNull() || !parentWidget->isVisible());-
5495-
5496 if (quitOnClose) {-
5497-
5498-
5499-
5500 QWidgetList list = QApplication::topLevelWidgets();-
5501 bool lastWindowClosed = true;-
5502 for (int i = 0; i < list.size(); ++i) {-
5503 QWidget *w = list.at(i);-
5504 if (!w->isVisible() || w->parentWidget() || !w->testAttribute(Qt::WA_QuitOnClose))-
5505 continue;-
5506 lastWindowClosed = false;-
5507 break;-
5508 }-
5509 if (lastWindowClosed) {-
5510 QGuiApplicationPrivate::emitLastWindowClosed();-
5511 QCoreApplicationPrivate *applicationPrivate = static_cast<QCoreApplicationPrivate*>(QObjectPrivate::get(QCoreApplication::instance()));-
5512 applicationPrivate->maybeQuit();-
5513 }-
5514 }-
5515-
5516-
5517 if (!that.isNull()) {-
5518 data.is_closing = 0;-
5519 if (q->testAttribute(Qt::WA_DeleteOnClose)) {-
5520 q->setAttribute(Qt::WA_DeleteOnClose, false);-
5521 q->deleteLater();-
5522 }-
5523 }-
5524 return true;-
5525}-
5526bool QWidget::close()-
5527{-
5528 return d_func()->close_helper(QWidgetPrivate::CloseWithEvent);-
5529}-
5530bool QWidget::isVisibleTo(const QWidget *ancestor) const-
5531{-
5532 if (!ancestor)-
5533 return isVisible();-
5534 const QWidget * w = this;-
5535 while (!w->isHidden()-
5536 && !w->isWindow()-
5537 && w->parentWidget()-
5538 && w->parentWidget() != ancestor)-
5539 w = w->parentWidget();-
5540 return !w->isHidden();-
5541}-
5542QRegion QWidget::visibleRegion() const-
5543{-
5544 const QWidgetPrivate * const d = d_func();-
5545-
5546 QRect clipRect = d->clipRect();-
5547 if (clipRect.isEmpty())-
5548 return QRegion();-
5549 QRegion r(clipRect);-
5550 d->subtractOpaqueChildren(r, clipRect);-
5551 d->subtractOpaqueSiblings(r);-
5552 return r;-
5553}-
5554-
5555-
5556QSize QWidgetPrivate::adjustedSize() const-
5557{-
5558 const QWidget * const q = q_func();-
5559-
5560 QSize s = q->sizeHint();-
5561-
5562 if (q->isWindow()) {-
5563 Qt::Orientations exp;-
5564 if (layout) {-
5565 if (layout->hasHeightForWidth())-
5566 s.setHeight(layout->totalHeightForWidth(s.width()));-
5567 exp = layout->expandingDirections();-
5568 } else-
5569 {-
5570 if (q->sizePolicy().hasHeightForWidth())-
5571 s.setHeight(q->heightForWidth(s.width()));-
5572 exp = q->sizePolicy().expandingDirections();-
5573 }-
5574 if (exp & Qt::Horizontal)-
5575 s.setWidth(qMax(s.width(), 200));-
5576 if (exp & Qt::Vertical)-
5577 s.setHeight(qMax(s.height(), 100));-
5578-
5579-
5580-
5581 QRect screen = QApplication::desktop()->screenGeometry(q->pos());-
5582-
5583-
5584-
5585-
5586-
5587 s.setWidth(qMin(s.width(), screen.width()*2/3));-
5588 s.setHeight(qMin(s.height(), screen.height()*2/3));-
5589-
5590 if (QTLWExtra *extra = maybeTopData())-
5591 extra->sizeAdjusted = true;-
5592 }-
5593-
5594 if (!s.isValid()) {-
5595 QRect r = q->childrenRect();-
5596 if (r.isNull())-
5597 return s;-
5598 s = r.size() + QSize(2 * r.x(), 2 * r.y());-
5599 }-
5600-
5601 return s;-
5602}-
5603void QWidget::adjustSize()-
5604{-
5605 QWidgetPrivate * const d = d_func();-
5606 ensurePolished();-
5607 QSize s = d->adjustedSize();-
5608-
5609 if (d->layout)-
5610 d->layout->activate();-
5611-
5612 if (s.isValid())-
5613 resize(s);-
5614}-
5615QSize QWidget::sizeHint() const-
5616{-
5617 const QWidgetPrivate * const d = d_func();-
5618 if (d->layout)-
5619 return d->layout->totalSizeHint();-
5620 return QSize(-1, -1);-
5621}-
5622QSize QWidget::minimumSizeHint() const-
5623{-
5624 const QWidgetPrivate * const d = d_func();-
5625 if (d->layout)-
5626 return d->layout->totalMinimumSize();-
5627 return QSize(-1, -1);-
5628}-
5629bool QWidget::isAncestorOf(const QWidget *child) const-
5630{-
5631 while (child) {-
5632 if (child == this)-
5633 return true;-
5634 if (child->isWindow())-
5635 return false;-
5636 child = child->parentWidget();-
5637 }-
5638 return false;-
5639}-
5640bool QWidget::event(QEvent *event)-
5641{-
5642 QWidgetPrivate * const d = d_func();-
5643-
5644-
5645 if (!isEnabled()) {-
5646 switch(event->type()) {-
5647 case QEvent::TabletPress:-
5648 case QEvent::TabletRelease:-
5649 case QEvent::TabletMove:-
5650 case QEvent::MouseButtonPress:-
5651 case QEvent::MouseButtonRelease:-
5652 case QEvent::MouseButtonDblClick:-
5653 case QEvent::MouseMove:-
5654 case QEvent::TouchBegin:-
5655 case QEvent::TouchUpdate:-
5656 case QEvent::TouchEnd:-
5657 case QEvent::TouchCancel:-
5658 case QEvent::ContextMenu:-
5659 case QEvent::KeyPress:-
5660 case QEvent::KeyRelease:-
5661-
5662 case QEvent::Wheel:-
5663-
5664 return false;-
5665 default:-
5666 break;-
5667 }-
5668 }-
5669 switch (event->type()) {-
5670 case QEvent::MouseMove:-
5671 mouseMoveEvent((QMouseEvent*)event);-
5672 break;-
5673-
5674 case QEvent::MouseButtonPress:-
5675 mousePressEvent((QMouseEvent*)event);-
5676 break;-
5677-
5678 case QEvent::MouseButtonRelease:-
5679 mouseReleaseEvent((QMouseEvent*)event);-
5680 break;-
5681-
5682 case QEvent::MouseButtonDblClick:-
5683 mouseDoubleClickEvent((QMouseEvent*)event);-
5684 break;-
5685-
5686 case QEvent::Wheel:-
5687 wheelEvent((QWheelEvent*)event);-
5688 break;-
5689-
5690-
5691 case QEvent::TabletMove:-
5692 case QEvent::TabletPress:-
5693 case QEvent::TabletRelease:-
5694 tabletEvent((QTabletEvent*)event);-
5695 break;-
5696-
5697 case QEvent::KeyPress: {-
5698 QKeyEvent *k = (QKeyEvent *)event;-
5699 bool res = false;-
5700 if (!(k->modifiers() & (Qt::ControlModifier | Qt::AltModifier))) {-
5701 if (k->key() == Qt::Key_Backtab-
5702 || (k->key() == Qt::Key_Tab && (k->modifiers() & Qt::ShiftModifier)))-
5703 res = focusNextPrevChild(false);-
5704 else if (k->key() == Qt::Key_Tab)-
5705 res = focusNextPrevChild(true);-
5706 if (res)-
5707 break;-
5708 }-
5709 keyPressEvent(k);-
5710 if (!k->isAccepted()-
5711 && k->modifiers() & Qt::ShiftModifier && k->key() == Qt::Key_F1-
5712 && d->whatsThis.size()) {-
5713 QWhatsThis::showText(mapToGlobal(inputMethodQuery(Qt::ImCursorRectangle).toRect().center()), d->whatsThis, this);-
5714 k->accept();-
5715 }-
5716-
5717 }-
5718 break;-
5719-
5720 case QEvent::KeyRelease:-
5721 keyReleaseEvent((QKeyEvent*)event);-
5722-
5723 case QEvent::ShortcutOverride:-
5724 break;-
5725-
5726 case QEvent::InputMethod:-
5727 inputMethodEvent((QInputMethodEvent *) event);-
5728 break;-
5729-
5730 case QEvent::InputMethodQuery:-
5731 if (testAttribute(Qt::WA_InputMethodEnabled)) {-
5732 QInputMethodQueryEvent *query = static_cast<QInputMethodQueryEvent *>(event);-
5733 Qt::InputMethodQueries queries = query->queries();-
5734 for (uint i = 0; i < 32; ++i) {-
5735 Qt::InputMethodQuery q = (Qt::InputMethodQuery)(int)(queries & (1<<i));-
5736 if (q) {-
5737 QVariant v = inputMethodQuery(q);-
5738 if (q == Qt::ImEnabled && !v.isValid() && isEnabled())-
5739 v = QVariant(true);-
5740 query->setValue(q, v);-
5741 }-
5742 }-
5743 query->accept();-
5744 }-
5745 break;-
5746-
5747 case QEvent::PolishRequest:-
5748 ensurePolished();-
5749 break;-
5750-
5751 case QEvent::Polish: {-
5752 style()->polish(this);-
5753 setAttribute(Qt::WA_WState_Polished);-
5754 if (!QApplication::font(this).isCopyOf(QApplication::font()))-
5755 d->resolveFont();-
5756 if (!QApplication::palette(this).isCopyOf(QApplication::palette()))-
5757 d->resolvePalette();-
5758 }-
5759 break;-
5760-
5761 case QEvent::ApplicationWindowIconChange:-
5762 if (isWindow() && !testAttribute(Qt::WA_SetWindowIcon)) {-
5763 d->setWindowIcon_sys();-
5764 d->setWindowIcon_helper();-
5765 }-
5766 break;-
5767 case QEvent::FocusIn:-
5768 focusInEvent((QFocusEvent*)event);-
5769 d->updateWidgetTransform(event);-
5770 break;-
5771-
5772 case QEvent::FocusOut:-
5773 focusOutEvent((QFocusEvent*)event);-
5774 break;-
5775-
5776 case QEvent::Enter:-
5777-
5778 if (d->statusTip.size()) {-
5779 QStatusTipEvent tip(d->statusTip);-
5780 QApplication::sendEvent(const_cast<QWidget *>(this), &tip);-
5781 }-
5782-
5783 enterEvent(event);-
5784 break;-
5785-
5786 case QEvent::Leave:-
5787-
5788 if (d->statusTip.size()) {-
5789 QString empty;-
5790 QStatusTipEvent tip(empty);-
5791 QApplication::sendEvent(const_cast<QWidget *>(this), &tip);-
5792 }-
5793-
5794 leaveEvent(event);-
5795 break;-
5796-
5797 case QEvent::HoverEnter:-
5798 case QEvent::HoverLeave:-
5799 update();-
5800 break;-
5801-
5802 case QEvent::Paint:-
5803-
5804-
5805-
5806 paintEvent((QPaintEvent*)event);-
5807 break;-
5808-
5809 case QEvent::Move:-
5810 moveEvent((QMoveEvent*)event);-
5811 d->updateWidgetTransform(event);-
5812 break;-
5813-
5814 case QEvent::Resize:-
5815 resizeEvent((QResizeEvent*)event);-
5816 d->updateWidgetTransform(event);-
5817 break;-
5818-
5819 case QEvent::Close:-
5820 closeEvent((QCloseEvent *)event);-
5821 break;-
5822-
5823-
5824 case QEvent::ContextMenu:-
5825 switch (data->context_menu_policy) {-
5826 case Qt::PreventContextMenu:-
5827 break;-
5828 case Qt::DefaultContextMenu:-
5829 contextMenuEvent(static_cast<QContextMenuEvent *>(event));-
5830 break;-
5831 case Qt::CustomContextMenu:-
5832 customContextMenuRequested(static_cast<QContextMenuEvent *>(event)->pos());-
5833 break;-
5834-
5835 case Qt::ActionsContextMenu:-
5836 if (d->actions.count()) {-
5837 QMenu::exec(d->actions, static_cast<QContextMenuEvent *>(event)->globalPos(),-
5838 0, this);-
5839 break;-
5840 }-
5841-
5842-
5843 default:-
5844 event->ignore();-
5845 break;-
5846 }-
5847 break;-
5848-
5849-
5850-
5851 case QEvent::Drop:-
5852 dropEvent((QDropEvent*) event);-
5853 break;-
5854-
5855 case QEvent::DragEnter:-
5856 dragEnterEvent((QDragEnterEvent*) event);-
5857 break;-
5858-
5859 case QEvent::DragMove:-
5860 dragMoveEvent((QDragMoveEvent*) event);-
5861 break;-
5862-
5863 case QEvent::DragLeave:-
5864 dragLeaveEvent((QDragLeaveEvent*) event);-
5865 break;-
5866-
5867-
5868 case QEvent::Show:-
5869 showEvent((QShowEvent*) event);-
5870 break;-
5871-
5872 case QEvent::Hide:-
5873 hideEvent((QHideEvent*) event);-
5874 break;-
5875-
5876 case QEvent::ShowWindowRequest:-
5877 if (!isHidden())-
5878 d->show_sys();-
5879 break;-
5880-
5881 case QEvent::ApplicationFontChange:-
5882 d->resolveFont();-
5883 break;-
5884 case QEvent::ApplicationPaletteChange:-
5885 if (!(windowType() == Qt::Desktop))-
5886 d->resolvePalette();-
5887 break;-
5888-
5889 case QEvent::ToolBarChange:-
5890 case QEvent::ActivationChange:-
5891 case QEvent::EnabledChange:-
5892 case QEvent::FontChange:-
5893 case QEvent::StyleChange:-
5894 case QEvent::PaletteChange:-
5895 case QEvent::WindowTitleChange:-
5896 case QEvent::IconTextChange:-
5897 case QEvent::ModifiedChange:-
5898 case QEvent::MouseTrackingChange:-
5899 case QEvent::ParentChange:-
5900 case QEvent::LocaleChange:-
5901 case QEvent::MacSizeChange:-
5902 case QEvent::ContentsRectChange:-
5903 case QEvent::ThemeChange:-
5904 case QEvent::ReadOnlyChange:-
5905 changeEvent(event);-
5906 break;-
5907-
5908 case QEvent::WindowStateChange: {-
5909 const bool wasMinimized = static_cast<const QWindowStateChangeEvent *>(event)->oldState() & Qt::WindowMinimized;-
5910 if (wasMinimized != isMinimized()) {-
5911 QWidget *widget = const_cast<QWidget *>(this);-
5912 if (wasMinimized) {-
5913-
5914 if (!d->childrenShownByExpose) {-
5915-
5916 d->showChildren(true);-
5917 QShowEvent showEvent;-
5918 QCoreApplication::sendSpontaneousEvent(widget, &showEvent);-
5919 }-
5920 d->childrenHiddenByWState = false;-
5921 } else {-
5922 QHideEvent hideEvent;-
5923 QCoreApplication::sendSpontaneousEvent(widget, &hideEvent);-
5924 d->hideChildren(true);-
5925 d->childrenHiddenByWState = true;-
5926 }-
5927 d->childrenShownByExpose = false;-
5928 }-
5929 changeEvent(event);-
5930 }-
5931 break;-
5932-
5933 case QEvent::WindowActivate:-
5934 case QEvent::WindowDeactivate: {-
5935 if (isVisible() && !palette().isEqual(QPalette::Active, QPalette::Inactive))-
5936 update();-
5937 QList<QObject*> childList = d->children;-
5938 for (int i = 0; i < childList.size(); ++i) {-
5939 QWidget *w = qobject_cast<QWidget *>(childList.at(i));-
5940 if (w && w->isVisible() && !w->isWindow())-
5941 QApplication::sendEvent(w, event);-
5942 }-
5943 break; }-
5944-
5945 case QEvent::LanguageChange:-
5946 changeEvent(event);-
5947 {-
5948 QList<QObject*> childList = d->children;-
5949 for (int i = 0; i < childList.size(); ++i) {-
5950 QObject *o = childList.at(i);-
5951 if (o)-
5952 QApplication::sendEvent(o, event);-
5953 }-
5954 }-
5955 update();-
5956 break;-
5957-
5958 case QEvent::ApplicationLayoutDirectionChange:-
5959 d->resolveLayoutDirection();-
5960 break;-
5961-
5962 case QEvent::LayoutDirectionChange:-
5963 if (d->layout)-
5964 d->layout->invalidate();-
5965 update();-
5966 changeEvent(event);-
5967 break;-
5968 case QEvent::UpdateRequest:-
5969 d->syncBackingStore();-
5970 break;-
5971 case QEvent::UpdateLater:-
5972 update(static_cast<QUpdateLaterEvent*>(event)->region());-
5973 break;-
5974 case QEvent::StyleAnimationUpdate:-
5975 if (isVisible() && !window()->isMinimized()) {-
5976 event->accept();-
5977 update();-
5978 }-
5979 break;-
5980-
5981 case QEvent::WindowBlocked:-
5982 case QEvent::WindowUnblocked:-
5983 if (!d->children.isEmpty()) {-
5984 QWidget *modalWidget = QApplication::activeModalWidget();-
5985 for (int i = 0; i < d->children.size(); ++i) {-
5986 QObject *o = d->children.at(i);-
5987 if (o && o != modalWidget && o->isWidgetType()) {-
5988 QWidget *w = static_cast<QWidget *>(o);-
5989-
5990 if (!w->isWindow())-
5991 QApplication::sendEvent(w, event);-
5992 }-
5993 }-
5994 }-
5995-
5996-
5997-
5998 break;-
5999-
6000 case QEvent::ToolTip:-
6001 if (!d->toolTip.isEmpty())-
6002 QToolTip::showText(static_cast<QHelpEvent*>(event)->globalPos(), d->toolTip, this, QRect(), d->toolTipDuration);-
6003 else-
6004 event->ignore();-
6005 break;-
6006-
6007-
6008 case QEvent::WhatsThis:-
6009 if (d->whatsThis.size())-
6010 QWhatsThis::showText(static_cast<QHelpEvent *>(event)->globalPos(), d->whatsThis, this);-
6011 else-
6012 event->ignore();-
6013 break;-
6014 case QEvent::QueryWhatsThis:-
6015 if (d->whatsThis.isEmpty())-
6016 event->ignore();-
6017 break;-
6018-
6019 case QEvent::EmbeddingControl:-
6020 d->topData()->frameStrut.setCoords(0 ,0, 0, 0);-
6021 data->fstrut_dirty = false;-
6022-
6023-
6024-
6025 break;-
6026-
6027 case QEvent::ActionAdded:-
6028 case QEvent::ActionRemoved:-
6029 case QEvent::ActionChanged:-
6030 actionEvent((QActionEvent*)event);-
6031 break;-
6032-
6033-
6034 case QEvent::KeyboardLayoutChange:-
6035 {-
6036 changeEvent(event);-
6037-
6038-
6039 QList<QObject*> childList = d->children;-
6040 for (int i = 0; i < childList.size(); ++i) {-
6041 QWidget *w = qobject_cast<QWidget *>(childList.at(i));-
6042 if (w && w->isVisible() && !w->isWindow())-
6043 QApplication::sendEvent(w, event);-
6044 }-
6045 break;-
6046 }-
6047-
6048-
6049-
6050-
6051-
6052 case QEvent::TouchBegin:-
6053 case QEvent::TouchUpdate:-
6054 case QEvent::TouchEnd:-
6055 case QEvent::TouchCancel:-
6056 {-
6057 event->ignore();-
6058 break;-
6059 }-
6060-
6061 case QEvent::Gesture:-
6062 event->ignore();-
6063 break;-
6064-
6065 case QEvent::ScreenChangeInternal:-
6066 if (const QTLWExtra *te = d->maybeTopData()) {-
6067 const QWindow *win = te->window;-
6068 d->setWinId((win && win->handle()) ? win->handle()->winId() : 0);-
6069 }-
6070-
6071 d->renderToTextureReallyDirty = 1;-
6072-
6073 break;-
6074-
6075 case QEvent::DynamicPropertyChange: {-
6076 const QByteArray &propName = static_cast<QDynamicPropertyChangeEvent *>(event)->propertyName();-
6077 if (propName.length() == 13 && !qstrncmp(propName, "_q_customDpi", 12)) {-
6078 uint value = property(propName.constData()).toUInt();-
6079 if (!d->extra)-
6080 d->createExtra();-
6081 const char axis = propName.at(12);-
6082 if (axis == 'X')-
6083 d->extra->customDpiX = value;-
6084 else if (axis == 'Y')-
6085 d->extra->customDpiY = value;-
6086 d->updateFont(d->data.fnt);-
6087 }-
6088 if (windowHandle() && !qstrncmp(propName, "_q_platform_", 12))-
6089 windowHandle()->setProperty(propName, property(propName));-
6090-
6091 }-
6092-
6093 default:-
6094 return QObject::event(event);-
6095 }-
6096 return true;-
6097}-
6098void QWidget::changeEvent(QEvent * event)-
6099{-
6100 switch(event->type()) {-
6101 case QEvent::EnabledChange: {-
6102 update();-
6103-
6104 QAccessible::State s;-
6105 s.disabled = true;-
6106 QAccessibleStateChangeEvent event(this, s);-
6107 QAccessible::updateAccessibility(&event);-
6108-
6109 break;-
6110 }-
6111-
6112 case QEvent::FontChange:-
6113 case QEvent::StyleChange: {-
6114 QWidgetPrivate * const d = d_func();-
6115 update();-
6116 updateGeometry();-
6117 if (d->layout)-
6118 d->layout->invalidate();-
6119 break;-
6120 }-
6121-
6122 case QEvent::PaletteChange:-
6123 update();-
6124 break;-
6125-
6126 case QEvent::ThemeChange:-
6127 if (QApplication::desktopSettingsAware() && windowType() != Qt::Desktop-
6128 && (static_cast<QApplication *>(QCoreApplication::instance())) && !QApplication::closingDown()) {-
6129 if (testAttribute(Qt::WA_WState_Polished))-
6130 QApplication::style()->unpolish(this);-
6131 if (testAttribute(Qt::WA_WState_Polished))-
6132 QApplication::style()->polish(this);-
6133 QEvent styleChangedEvent(QEvent::StyleChange);-
6134 QCoreApplication::sendEvent(this, &styleChangedEvent);-
6135 if (isVisible())-
6136 update();-
6137 }-
6138 break;-
6139 default:-
6140 break;-
6141 }-
6142}-
6143void QWidget::mouseMoveEvent(QMouseEvent *event)-
6144{-
6145 event->ignore();-
6146}-
6147void QWidget::mousePressEvent(QMouseEvent *event)-
6148{-
6149 event->ignore();-
6150 if ((windowType() == Qt::Popup)) {-
6151 event->accept();-
6152 QWidget* w;-
6153 while ((w = QApplication::activePopupWidget()) && w != this){-
6154 w->close();-
6155 if (QApplication::activePopupWidget() == w)-
6156 w->hide();-
6157 }-
6158 if (!rect().contains(event->pos())){-
6159 close();-
6160 }-
6161 }-
6162}-
6163void QWidget::mouseReleaseEvent(QMouseEvent *event)-
6164{-
6165 event->ignore();-
6166}-
6167void QWidget::mouseDoubleClickEvent(QMouseEvent *event)-
6168{-
6169 mousePressEvent(event);-
6170}-
6171void QWidget::wheelEvent(QWheelEvent *event)-
6172{-
6173 event->ignore();-
6174}-
6175void QWidget::tabletEvent(QTabletEvent *event)-
6176{-
6177 event->ignore();-
6178}-
6179void QWidget::keyPressEvent(QKeyEvent *event)-
6180{-
6181 if ((windowType() == Qt::Popup) && event->matches(QKeySequence::Cancel)) {-
6182 event->accept();-
6183 close();-
6184 } else {-
6185 event->ignore();-
6186 }-
6187}-
6188void QWidget::keyReleaseEvent(QKeyEvent *event)-
6189{-
6190 event->ignore();-
6191}-
6192void QWidget::focusInEvent(QFocusEvent *)-
6193{-
6194 if (focusPolicy() != Qt::NoFocus || !isWindow()) {-
6195 update();-
6196 }-
6197}-
6198void QWidget::focusOutEvent(QFocusEvent *)-
6199{-
6200 if (focusPolicy() != Qt::NoFocus || !isWindow())-
6201 update();-
6202-
6203-
6204-
6205 if ((static_cast<QApplication *>(QCoreApplication::instance()))->autoSipEnabled() && testAttribute(Qt::WA_InputMethodEnabled))-
6206 QGuiApplication::inputMethod()->hide();-
6207-
6208}-
6209void QWidget::enterEvent(QEvent *)-
6210{-
6211}-
6212void QWidget::leaveEvent(QEvent *)-
6213{-
6214}-
6215void QWidget::paintEvent(QPaintEvent *)-
6216{-
6217}-
6218void QWidget::moveEvent(QMoveEvent *)-
6219{-
6220}-
6221void QWidget::resizeEvent(QResizeEvent * )-
6222{-
6223}-
6224void QWidget::actionEvent(QActionEvent *)-
6225{-
6226-
6227}-
6228void QWidget::closeEvent(QCloseEvent *event)-
6229{-
6230 event->accept();-
6231}-
6232void QWidget::contextMenuEvent(QContextMenuEvent *event)-
6233{-
6234 event->ignore();-
6235}-
6236void QWidget::inputMethodEvent(QInputMethodEvent *event)-
6237{-
6238 event->ignore();-
6239}-
6240QVariant QWidget::inputMethodQuery(Qt::InputMethodQuery query) const-
6241{-
6242 switch(query) {-
6243 case
never executed: case Qt::ImCursorRectangle:
Qt::ImCursorRectangle:
never executed: case Qt::ImCursorRectangle:
0
6244 return
never executed: return QRect(width()/2, 0, 1, height());
QRect(width()/2, 0, 1, height());
never executed: return QRect(width()/2, 0, 1, height());
0
6245 case
never executed: case Qt::ImFont:
Qt::ImFont:
never executed: case Qt::ImFont:
0
6246 return
never executed: return font();
font();
never executed: return font();
0
6247 case
never executed: case Qt::ImAnchorPosition:
Qt::ImAnchorPosition:
never executed: case Qt::ImAnchorPosition:
0
6248-
6249 return
never executed: return inputMethodQuery(Qt::ImCursorPosition);
inputMethodQuery(Qt::ImCursorPosition);
never executed: return inputMethodQuery(Qt::ImCursorPosition);
0
6250 case
never executed: case Qt::ImHints:
Qt::ImHints:
never executed: case Qt::ImHints:
0
6251 return
never executed: return (int)inputMethodHints();
(int)inputMethodHints();
never executed: return (int)inputMethodHints();
0
6252 case
never executed: case Qt::ImInputItemClipRectangle:
Qt::ImInputItemClipRectangle:
never executed: case Qt::ImInputItemClipRectangle:
0
6253 return
never executed: return d_func()->clipRect();
d_func()->clipRect
never executed: return d_func()->clipRect();
never executed: return d_func()->clipRect();
();
never executed: return d_func()->clipRect();
0
6254 default
never executed: default:
:
never executed: default:
0
6255 return
never executed: return QVariant();
QVariant();
never executed: return QVariant();
0
6256 }-
6257}-
6258Qt::InputMethodHints QWidget::inputMethodHints() const-
6259{-
6260-
6261 const QWidgetPrivate *priv = d_func();-
6262 while (priv->inheritsInputMethodHints) {-
6263 priv = priv->q_func()->parentWidget()->d_func();-
6264 ((!(priv)) ? qt_assert("priv",__FILE__,98009832) : qt_noop());-
6265 }-
6266 return priv->imHints;-
6267-
6268-
6269-
6270}-
6271-
6272void QWidget::setInputMethodHints(Qt::InputMethodHints hints)-
6273{-
6274-
6275 QWidgetPrivate * const d = d_func();-
6276 if (d->imHints == hints)-
6277 return;-
6278 d->imHints = hints;-
6279 if (this == QGuiApplication::focusObject())-
6280 QGuiApplication::inputMethod()->update(Qt::ImHints);-
6281-
6282-
6283-
6284}-
6285void QWidget::dragEnterEvent(QDragEnterEvent *)-
6286{-
6287}-
6288void QWidget::dragMoveEvent(QDragMoveEvent *)-
6289{-
6290}-
6291void QWidget::dragLeaveEvent(QDragLeaveEvent *)-
6292{-
6293}-
6294void QWidget::dropEvent(QDropEvent *)-
6295{-
6296}-
6297void QWidget::showEvent(QShowEvent *)-
6298{-
6299}-
6300void QWidget::hideEvent(QHideEvent *)-
6301{-
6302}-
6303bool QWidget::nativeEvent(const QByteArray &eventType, void *message, long *result)-
6304{-
6305 (void)eventType;;-
6306 (void)message;;-
6307 (void)result;;-
6308 return false;-
6309}-
6310void QWidget::ensurePolished() const-
6311{-
6312 const QWidgetPrivate * const d = d_func();-
6313-
6314 const QMetaObject *m = metaObject();-
6315 if (m == d->polished)-
6316 return;-
6317 d->polished = m;-
6318-
6319 QEvent e(QEvent::Polish);-
6320 QCoreApplication::sendEvent(const_cast<QWidget *>(this), &e);-
6321-
6322-
6323 QList<QObject*> children = d->children;-
6324 for (int i = 0; i < children.size(); ++i) {-
6325 QObject *o = children.at(i);-
6326 if(!o->isWidgetType())-
6327 continue;-
6328 if (QWidget *w = qobject_cast<QWidget *>(o))-
6329 w->ensurePolished();-
6330 }-
6331-
6332 if (d->parent && d->sendChildEvents) {-
6333 QChildEvent e(QEvent::ChildPolished, const_cast<QWidget *>(this));-
6334 QCoreApplication::sendEvent(d->parent, &e);-
6335 }-
6336}-
6337-
6338-
6339-
6340-
6341-
6342-
6343-
6344QRegion QWidget::mask() const-
6345{-
6346 const QWidgetPrivate * const d = d_func();-
6347 return d->extra ? d->extra->mask : QRegion();-
6348}-
6349QLayout *QWidget::layout() const-
6350{-
6351 return d_func()->layout;-
6352}-
6353void QWidget::setLayout(QLayout *l)-
6354{-
6355 if (!(__builtin_expect(!!(!
__builtin_expe...!!(!l), false)Description
TRUEnever evaluated
FALSEnever evaluated
l)), false)
__builtin_expe...!!(!l), false)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
6356 QMessageLogger(__FILE__, 1007510107, __PRETTY_FUNCTION__).warning("QWidget::setLayout: Cannot set layout to 0");-
6357 return;
never executed: return;
0
6358 }-
6359 if (layout()
layout()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
6360 if (__builtin_expect(!!(
__builtin_expe... != l), false)Description
TRUEnever evaluated
FALSEnever evaluated
layout() != l)), false)
__builtin_expe... != l), false)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
6361 QMessageLogger(__FILE__, 1008010112, __PRETTY_FUNCTION__).warning("QWidget::setLayout: Attempting to set QLayout \"%s\" on %s \"%s\", which already has a"
never executed: QMessageLogger(__FILE__, 10112, __PRETTY_FUNCTION__).warning("QWidget::setLayout: Attempting to set QLayout \"%s\" on %s \"%s\", which already has a" " layout", l->objectName().toLocal8Bit().data(), metaObject()->className(), objectName().toLocal8Bit().data());
0
6362 " layout", l->objectName().toLocal8Bit().data(), metaObject()->className(),
never executed: QMessageLogger(__FILE__, 10112, __PRETTY_FUNCTION__).warning("QWidget::setLayout: Attempting to set QLayout \"%s\" on %s \"%s\", which already has a" " layout", l->objectName().toLocal8Bit().data(), metaObject()->className(), objectName().toLocal8Bit().data());
0
6363 objectName().toLocal8Bit().data());
never executed: QMessageLogger(__FILE__, 10112, __PRETTY_FUNCTION__).warning("QWidget::setLayout: Attempting to set QLayout \"%s\" on %s \"%s\", which already has a" " layout", l->objectName().toLocal8Bit().data(), metaObject()->className(), objectName().toLocal8Bit().data());
0
6364 return;
never executed: return;
0
6365 }-
6366-
6367 QObject *oldParent = l->parent();-
6368 if (oldParent
oldParentDescription
TRUEnever evaluated
FALSEnever evaluated
&& oldParent != this
oldParent != thisDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
6369 if (oldParent->isWidgetType()
oldParent->isWidgetType()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
6370-
6371-
6372 QWidget *oldParentWidget = static_cast<QWidget *>(oldParent);-
6373 oldParentWidget->takeLayout();-
6374 }
never executed: end of block
else {
0
6375 QMessageLogger(__FILE__, 1009410126, __PRETTY_FUNCTION__).warning("QWidget::setLayout: Attempting to set QLayout \"%s\" on %s \"%s\", when the QLayout already has a parent",-
6376 l->objectName().toLocal8Bit().data(), metaObject()->className(),-
6377 objectName().toLocal8Bit().data());-
6378 return;
never executed: return;
0
6379 }-
6380 }-
6381-
6382 QWidgetPrivate * const d = d_func();-
6383 l->d_func()->topLevel = true;-
6384 d->layout = l;-
6385 if (oldParent != this
oldParent != thisDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
6386 l->setParent(this);-
6387 l->d_func()->reparentChildWidgets(this);-
6388 l->invalidate();-
6389 }
never executed: end of block
0
6390-
6391 if (isWindow()
isWindow()Description
TRUEnever evaluated
FALSEnever evaluated
&& d->maybeTopData()
d->maybeTopData()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
6392 d->topData()->sizeAdjusted = false;
never executed: d->topData()->sizeAdjusted = false;
0
6393}
never executed: end of block
0
6394QLayout *QWidget::takeLayout()-
6395{-
6396 QWidgetPrivate * const d = d_func();-
6397 QLayout *l = layout();-
6398 if (!l)-
6399 return 0;-
6400 d->layout = 0;-
6401 l->setParent(0);-
6402 return l;-
6403}-
6404QSizePolicy QWidget::sizePolicy() const-
6405{-
6406 const QWidgetPrivate * const d = d_func();-
6407 return d->size_policy;-
6408}-
6409-
6410void QWidget::setSizePolicy(QSizePolicy policy)-
6411{-
6412 QWidgetPrivate * const d = d_func();-
6413 setAttribute(Qt::WA_WState_OwnSizePolicy);-
6414 if (policy == d->size_policy)-
6415 return;-
6416-
6417 if (d->size_policy.retainSizeWhenHidden() != policy.retainSizeWhenHidden())-
6418 d->retainSizeWhenHiddenChanged = 1;-
6419-
6420 d->size_policy = policy;-
6421-
6422-
6423 if (QWExtra *extra = d->extra) {-
6424 if (extra->proxyWidget)-
6425 extra->proxyWidget->setSizePolicy(policy);-
6426 }-
6427-
6428-
6429 updateGeometry();-
6430 d->retainSizeWhenHiddenChanged = 0;-
6431-
6432 if (isWindow() && d->maybeTopData())-
6433 d->topData()->sizeAdjusted = false;-
6434}-
6435int QWidget::heightForWidth(int w) const-
6436{-
6437 if (layout() && layout()->hasHeightForWidth())-
6438 return layout()->totalHeightForWidth(w);-
6439 return -1;-
6440}-
6441-
6442-
6443-
6444-
6445-
6446-
6447-
6448bool QWidget::hasHeightForWidth() const-
6449{-
6450 const QWidgetPrivate * const d = d_func();-
6451 return d->layout ? d->layout->hasHeightForWidth() : d->size_policy.hasHeightForWidth();-
6452}-
6453QWidget *QWidget::childAt(const QPoint &p) const-
6454{-
6455 return d_func()->childAt_helper(p, false);-
6456}-
6457-
6458QWidget *QWidgetPrivate::childAt_helper(const QPoint &p, bool ignoreChildrenInDestructor) const-
6459{-
6460 if (children.isEmpty())-
6461 return 0;-
6462-
6463 if (!pointInsideRectAndMask(p))-
6464 return 0;-
6465 return childAtRecursiveHelper(p, ignoreChildrenInDestructor);-
6466}-
6467-
6468QWidget *QWidgetPrivate::childAtRecursiveHelper(const QPoint &p, bool ignoreChildrenInDestructor) const-
6469{-
6470 for (int i = children.size() - 1; i >= 0; --i) {-
6471 QWidget *child = qobject_cast<QWidget *>(children.at(i));-
6472 if (!child || child->isWindow() || child->isHidden() || child->testAttribute(Qt::WA_TransparentForMouseEvents)-
6473 || (ignoreChildrenInDestructor && child->data->in_destructor)) {-
6474 continue;-
6475 }-
6476-
6477-
6478 QPoint childPoint = p;-
6479 childPoint -= child->data->crect.topLeft();-
6480-
6481-
6482 if (!child->d_func()->pointInsideRectAndMask(childPoint))-
6483 continue;-
6484-
6485-
6486 if (QWidget *w = child->d_func()->childAtRecursiveHelper(childPoint, ignoreChildrenInDestructor))-
6487 return w;-
6488-
6489-
6490 return child;-
6491 }-
6492 return 0;-
6493}-
6494-
6495void QWidgetPrivate::updateGeometry_helper(bool forceUpdate)-
6496{-
6497 QWidget * const q = q_func();-
6498 if (widgetItem)-
6499 widgetItem->invalidateSizeCache();-
6500 QWidget *parent;-
6501 if (forceUpdate || !extra || extra->minw != extra->maxw || extra->minh != extra->maxh) {-
6502 const int isHidden = q->isHidden() && !size_policy.retainSizeWhenHidden() && !retainSizeWhenHiddenChanged;-
6503-
6504 if (!q->isWindow() && !isHidden && (parent = q->parentWidget())) {-
6505 if (parent->d_func()->layout)-
6506 parent->d_func()->layout->invalidate();-
6507 else if (parent->isVisible())-
6508 QApplication::postEvent(parent, new QEvent(QEvent::LayoutRequest));-
6509 }-
6510 }-
6511}-
6512void QWidget::updateGeometry()-
6513{-
6514 QWidgetPrivate * const d = d_func();-
6515 d->updateGeometry_helper(false);-
6516}-
6517void QWidget::setWindowFlags(Qt::WindowFlags flags)-
6518{-
6519 QWidgetPrivate * const d = d_func();-
6520 d->setWindowFlags(flags);-
6521}-
6522-
6523-
6524-
6525-
6526-
6527void QWidgetPrivate::setWindowFlags(Qt::WindowFlags flags)-
6528{-
6529 QWidget * const q = q_func();-
6530 if (q->data->window_flags == flags)-
6531 return;-
6532-
6533 if ((q->data->window_flags | flags) & Qt::Window) {-
6534-
6535 QPoint oldPos = q->pos();-
6536 bool visible = q->isVisible();-
6537 const bool windowFlagChanged = (q->data->window_flags ^ flags) & Qt::Window;-
6538 q->setParent(q->parentWidget(), flags);-
6539-
6540-
6541-
6542 if (!windowFlagChanged && (visible || q->testAttribute(Qt::WA_Moved)))-
6543 q->move(oldPos);-
6544-
6545 adjustQuitOnCloseAttribute();-
6546 } else {-
6547 q->data->window_flags = flags;-
6548 }-
6549}-
6550void QWidget::overrideWindowFlags(Qt::WindowFlags flags)-
6551{-
6552 data->window_flags = flags;-
6553}-
6554void QWidget::setParent(QWidget *parent)-
6555{-
6556 if (parent == parentWidget())-
6557 return;-
6558 setParent((QWidget*)parent, windowFlags() & ~Qt::WindowType_Mask);-
6559}-
6560-
6561-
6562static void sendWindowChangeToTextureChildrenRecursively(QWidget *widget)-
6563{-
6564 QWidgetPrivate *d = QWidgetPrivate::get(widget);-
6565 if (d->renderToTexture) {-
6566 QEvent e(QEvent::WindowChangeInternal);-
6567 QApplication::sendEvent(widget, &e);-
6568 }-
6569-
6570 for (int i = 0; i < d->children.size(); ++i) {-
6571 QWidget *w = qobject_cast<QWidget *>(d->children.at(i));-
6572 if (w && !w->isWindow() && !w->isHidden() && QWidgetPrivate::get(w)->textureChildSeen)-
6573 sendWindowChangeToTextureChildrenRecursively(w);-
6574 }-
6575}-
6576void QWidget::setParent(QWidget *parent, Qt::WindowFlags f)-
6577{-
6578 QWidgetPrivate * const d = d_func();-
6579 bool resized = testAttribute(Qt::WA_Resized);-
6580 bool wasCreated = testAttribute(Qt::WA_WState_Created);-
6581 QWidget *oldtlw = window();-
6582-
6583 if (f & Qt::Window
f & Qt::WindowDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
6584 d->data.fstrut_dirty = true;
never executed: d->data.fstrut_dirty = true;
0
6585-
6586 QWidget *desktopWidget = 0;-
6587 if (parent
parentDescription
TRUEnever evaluated
FALSEnever evaluated
&& parent->windowType() == Qt::Desktop
parent->window...== Qt::DesktopDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
6588 desktopWidget = parent;
never executed: desktopWidget = parent;
0
6589 bool newParent = (
(parent != parentWidget())Description
TRUEnever evaluated
FALSEnever evaluated
parent != parentWidget())
(parent != parentWidget())Description
TRUEnever evaluated
FALSEnever evaluated
|| !wasCreated
!wasCreatedDescription
TRUEnever evaluated
FALSEnever evaluated
|| desktopWidget
desktopWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
;
0
6590-
6591 if (newParent
newParentDescription
TRUEnever evaluated
FALSEnever evaluated
&& parent
parentDescription
TRUEnever evaluated
FALSEnever evaluated
&& !desktopWidget
!desktopWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
6592 if (testAttribute(Qt::WA_NativeWindow)
testAttribute(..._NativeWindow)Description
TRUEnever evaluated
FALSEnever evaluated
&& !(static_cast<QApplication *>(QCoreApplication::instance()))->testAttribute(Qt::AA_DontCreateNativeWidgetSiblings)
!(static_cast<...idgetSiblings)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
6593 parent->d_func()->enforceNativeChildren();
never executed: parent->d_func()->enforceNativeChildren();
0
6594 else if (parent->d_func()->nativeChildrenForced()
parent->d_func...ildrenForced()Description
TRUEnever evaluated
FALSEnever evaluated
|| parent->testAttribute(Qt::WA_PaintOnScreen)
parent->testAt...PaintOnScreen)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
6595 setAttribute(Qt::WA_NativeWindow);
never executed: setAttribute(Qt::WA_NativeWindow);
0
6596 }
never executed: end of block
0
6597-
6598 if (wasCreated
wasCreatedDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
6599 if (!testAttribute(Qt::WA_WState_Hidden)
!testAttribute...WState_Hidden)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
6600 hide();-
6601 setAttribute(Qt::WA_WState_ExplicitShowHide, false);-
6602 }
never executed: end of block
0
6603 if (newParent
newParentDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
6604 QEvent e(QEvent::ParentAboutToChange);-
6605 QApplication::sendEvent(this, &e);-
6606 }
never executed: end of block
0
6607 }
never executed: end of block
0
6608 if (newParent
newParentDescription
TRUEnever evaluated
FALSEnever evaluated
&& isAncestorOf(focusWidget())
isAncestorOf(focusWidget())Description
TRUEnever evaluated
FALSEnever evaluated
)
0
6609 focusWidget()->clearFocus();
never executed: focusWidget()->clearFocus();
0
6610-
6611 QTLWExtra *oldTopExtra = window()->d_func()->maybeTopData();-
6612 QWidgetBackingStoreTracker *oldBsTracker = oldTopExtra
oldTopExtraDescription
TRUEnever evaluated
FALSEnever evaluated
? &oldTopExtra->backingStoreTracker : 0;
0
6613-
6614 d->setParent_sys(parent, f);-
6615-
6616 QTLWExtra *topExtra = window()->d_func()->maybeTopData();-
6617 QWidgetBackingStoreTracker *bsTracker = topExtra
topExtraDescription
TRUEnever evaluated
FALSEnever evaluated
? &topExtra->backingStoreTracker : 0;
0
6618 if (oldBsTracker
oldBsTrackerDescription
TRUEnever evaluated
FALSEnever evaluated
&& oldBsTracker != bsTracker
oldBsTracker != bsTrackerDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
6619 oldBsTracker->unregisterWidgetSubtree(this);
never executed: oldBsTracker->unregisterWidgetSubtree(this);
0
6620-
6621 if (desktopWidget
desktopWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
6622 parent = 0;
never executed: parent = 0;
0
6623-
6624-
6625 if (d->textureChildSeen
d->textureChildSeenDescription
TRUEnever evaluated
FALSEnever evaluated
&& parent
parentDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
6626-
6627 QWidgetPrivate::get(parent)->setTextureChildSeen();-
6628 }
never executed: end of block
0
6629-
6630-
6631 if (QWidgetBackingStore *oldBs = oldtlw->d_func()->maybeBackingStore()
QWidgetBacking...BackingStore()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
6632 if (newParent
newParentDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
6633 oldBs->removeDirtyWidget(this);
never executed: oldBs->removeDirtyWidget(this);
0
6634-
6635-
6636 oldBs->moveStaticWidgets(this);-
6637 }
never executed: end of block
0
6638-
6639-
6640 if (QApplicationPrivate::testAttribute(Qt::AA_ImmediateWidgetCreation)
QApplicationPr...idgetCreation)Description
TRUEnever evaluated
FALSEnever evaluated
&& !testAttribute(Qt::WA_WState_Created)
!testAttribute...State_Created)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
6641 create();
never executed: create();
0
6642-
6643 d->reparentFocusWidgets(oldtlw);-
6644 setAttribute(Qt::WA_Resized, resized);-
6645-
6646 const bool useStyleSheetPropagationInWidgetStyles =-
6647 QCoreApplication::testAttribute(Qt::AA_UseStyleSheetPropagationInWidgetStyles);-
6648-
6649 if (!useStyleSheetPropagationInWidgetStyles
!useStyleSheet...InWidgetStylesDescription
TRUEnever evaluated
FALSEnever evaluated
&& !
!testAttribute...WA_StyleSheet)Description
TRUEnever evaluated
FALSEnever evaluated
testAttribute(Qt::WA_StyleSheet)
!testAttribute...WA_StyleSheet)Description
TRUEnever evaluated
FALSEnever evaluated
0
6650 && (!parent
!parentDescription
TRUEnever evaluated
FALSEnever evaluated
|| !parent->testAttribute(Qt::WA_StyleSheet)
!parent->testA...WA_StyleSheet)Description
TRUEnever evaluated
FALSEnever evaluated
)) {
0
6651 d->resolveFont();-
6652 d->resolvePalette();-
6653 }
never executed: end of block
0
6654 d->resolveLayoutDirection();-
6655 d->resolveLocale();-
6656-
6657-
6658-
6659-
6660-
6661 if (newParent
newParentDescription
TRUEnever evaluated
FALSEnever evaluated
0
6662-
6663-
6664-
6665 ) {-
6666-
6667 if (!isWindow()
!isWindow()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
6668 if (!testAttribute(Qt::WA_ForceDisabled)
!testAttribute...ForceDisabled)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
6669 d->setEnabled_helper(parent ? parent->isEnabled() : true);
never executed: d->setEnabled_helper(parent ? parent->isEnabled() : true);
0
6670 if (!testAttribute(Qt::WA_ForceUpdatesDisabled)
!testAttribute...datesDisabled)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
6671 d->setUpdatesEnabled_helper(parent ? parent->updatesEnabled() : true);
never executed: d->setUpdatesEnabled_helper(parent ? parent->updatesEnabled() : true);
0
6672 }
never executed: end of block
0
6673 d->inheritStyle();-
6674-
6675-
6676 if (parent
parentDescription
TRUEnever evaluated
FALSEnever evaluated
&& d->sendChildEvents
d->sendChildEventsDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
6677 QChildEvent e(QEvent::ChildAdded, this);-
6678 QApplication::sendEvent(parent, &e);-
6679 }
never executed: end of block
0
6680 if (parent
parentDescription
TRUEnever evaluated
FALSEnever evaluated
&& d->sendChildEvents
d->sendChildEventsDescription
TRUEnever evaluated
FALSEnever evaluated
&& d->polished
d->polishedDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
6681 QChildEvent e(QEvent::ChildPolished, this);-
6682 QCoreApplication::sendEvent(parent, &e);-
6683 }
never executed: end of block
0
6684-
6685 QEvent e(QEvent::ParentChange);-
6686 QApplication::sendEvent(this, &e);-
6687 }
never executed: end of block
0
6688-
6689-
6690 if (d->textureChildSeen
d->textureChildSeenDescription
TRUEnever evaluated
FALSEnever evaluated
&& oldtlw != window()
oldtlw != window()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
6691 sendWindowChangeToTextureChildrenRecursively(this);-
6692 }
never executed: end of block
0
6693-
6694-
6695 if (!wasCreated
!wasCreatedDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
6696 if (isWindow()
isWindow()Description
TRUEnever evaluated
FALSEnever evaluated
|| parentWidget()->isVisible()
parentWidget()->isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
6697 setAttribute(Qt::WA_WState_Hidden, true);
never executed: setAttribute(Qt::WA_WState_Hidden, true);
0
6698 else if (!testAttribute(Qt::WA_WState_ExplicitShowHide)
!testAttribute...licitShowHide)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
6699 setAttribute(Qt::WA_WState_Hidden, false);
never executed: setAttribute(Qt::WA_WState_Hidden, false);
0
6700 }
never executed: end of block
0
6701-
6702 d->updateIsOpaque();-
6703-
6704-
6705-
6706-
6707 if (oldtlw->graphicsProxyWidget()
oldtlw->graphicsProxyWidget()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
6708 if (QGraphicsProxyWidget *ancestorProxy = d->nearestGraphicsProxyWidget(oldtlw)
QGraphicsProxy...Widget(oldtlw)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
6709 ancestorProxy->d_func()->unembedSubWindow(this);
never executed: ancestorProxy->d_func()->unembedSubWindow(this);
0
6710 }
never executed: end of block
0
6711 if (isWindow()
isWindow()Description
TRUEnever evaluated
FALSEnever evaluated
&& parent
parentDescription
TRUEnever evaluated
FALSEnever evaluated
&& !graphicsProxyWidget()
!graphicsProxyWidget()Description
TRUEnever evaluated
FALSEnever evaluated
&& !bypassGraphicsProxyWidget(this)
!bypassGraphic...xyWidget(this)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
6712 if (QGraphicsProxyWidget *ancestorProxy = d->nearestGraphicsProxyWidget(parent)
QGraphicsProxy...Widget(parent)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
6713 ancestorProxy->d_func()->embedSubWindow(this);
never executed: ancestorProxy->d_func()->embedSubWindow(this);
0
6714 }
never executed: end of block
0
6715-
6716-
6717 if (d->extra
d->extraDescription
TRUEnever evaluated
FALSEnever evaluated
&& d->extra->hasWindowContainer
d->extra->hasWindowContainerDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
6718 QWindowContainer::parentWasChanged(this);
never executed: QWindowContainer::parentWasChanged(this);
0
6719}
never executed: end of block
0
6720-
6721void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f)-
6722{-
6723 QWidget * const q = q_func();-
6724-
6725 Qt::WindowFlags oldFlags = data.window_flags;-
6726 bool wasCreated = q->testAttribute(Qt::WA_WState_Created);-
6727-
6728 int targetScreen = -1;-
6729-
6730 if (newparent && newparent->windowType() == Qt::Desktop) {-
6731-
6732-
6733 const QDesktopScreenWidget *sw = qobject_cast<const QDesktopScreenWidget *>(newparent);-
6734 targetScreen = sw ? sw->screenNumber() : 0;-
6735 newparent = 0;-
6736 }-
6737-
6738 setWinId(0);-
6739-
6740 if (parent != newparent) {-
6741 QObjectPrivate::setParent_helper(newparent);-
6742 if (q->windowHandle()) {-
6743 q->windowHandle()->setFlags(f);-
6744 QWidget *parentWithWindow =-
6745 newparent ? (newparent->windowHandle() ? newparent : newparent->nativeParentWidget()) : 0;-
6746 if (parentWithWindow) {-
6747 QWidget *topLevel = parentWithWindow->window();-
6748 if ((f & Qt::Window) && topLevel && topLevel->windowHandle()) {-
6749 q->windowHandle()->setTransientParent(topLevel->windowHandle());-
6750 q->windowHandle()->setParent(0);-
6751 } else {-
6752 q->windowHandle()->setTransientParent(0);-
6753 q->windowHandle()->setParent(parentWithWindow->windowHandle());-
6754 }-
6755 } else {-
6756 q->windowHandle()->setTransientParent(0);-
6757 q->windowHandle()->setParent(0);-
6758 }-
6759 }-
6760 }-
6761-
6762 if (!newparent) {-
6763 f |= Qt::Window;-
6764 if (targetScreen == -1) {-
6765 if (parent)-
6766 targetScreen = QApplication::desktop()->screenNumber(q->parentWidget()->window());-
6767 }-
6768 }-
6769-
6770 bool explicitlyHidden = q->testAttribute(Qt::WA_WState_Hidden) && q->testAttribute(Qt::WA_WState_ExplicitShowHide);-
6771-
6772-
6773 if (wasCreated && !(f & Qt::Window) && (oldFlags & Qt::Window) && !q->testAttribute(Qt::WA_NativeWindow)) {-
6774 if (extra && extra->hasWindowContainer)-
6775 QWindowContainer::toplevelAboutToBeDestroyed(q);-
6776-
6777 QWindow *newParentWindow = newparent->windowHandle();-
6778 if (!newParentWindow)-
6779 if (QWidget *npw = newparent->nativeParentWidget())-
6780 newParentWindow = npw->windowHandle();-
6781-
6782 for (QForeachContainer<typename QtPrivate::remove_reference<decltype(q->windowHandle()->children())>::type> _container_((q->windowHandle()->children())); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QObject *child = *_container_.i; _container_.control; _container_.control = 0) {-
6783 QWindow *childWindow = qobject_cast<QWindow *>(child);-
6784 if (!childWindow)-
6785 continue;-
6786-
6787 QWidgetWindow *childWW = qobject_cast<QWidgetWindow *>(childWindow);-
6788 QWidget *childWidget = childWW ? childWW->widget() : 0;-
6789 if (!childWW || (childWidget && childWidget->testAttribute(Qt::WA_NativeWindow)))-
6790 childWindow->setParent(newParentWindow);-
6791 }-
6792 q->destroy();-
6793 }-
6794-
6795 adjustFlags(f, q);-
6796 data.window_flags = f;-
6797 q->setAttribute(Qt::WA_WState_Created, false);-
6798 q->setAttribute(Qt::WA_WState_Visible, false);-
6799 q->setAttribute(Qt::WA_WState_Hidden, false);-
6800-
6801 if (newparent && wasCreated && (q->testAttribute(Qt::WA_NativeWindow) || (f & Qt::Window)))-
6802 q->createWinId();-
6803-
6804 if (q->isWindow() || (!newparent || newparent->isVisible()) || explicitlyHidden)-
6805 q->setAttribute(Qt::WA_WState_Hidden);-
6806 q->setAttribute(Qt::WA_WState_ExplicitShowHide, explicitlyHidden);-
6807-
6808-
6809 if (!newparent && targetScreen != -1) {-
6810-
6811 if (q->testAttribute(Qt::WA_WState_Created))-
6812 q->windowHandle()->setScreen(QGuiApplication::screens().value(targetScreen, 0));-
6813 else-
6814 topData()->initialScreenIndex = targetScreen;-
6815 }-
6816}-
6817void QWidget::scroll(int dx, int dy)-
6818{-
6819 if ((!updatesEnabled() && children().size() == 0) || !isVisible())-
6820 return;-
6821 if (dx == 0 && dy == 0)-
6822 return;-
6823 QWidgetPrivate * const d = d_func();-
6824-
6825 if (QGraphicsProxyWidget *proxy = QWidgetPrivate::nearestGraphicsProxyWidget(this)) {-
6826-
6827-
6828-
6829 if (!d->dirty.isEmpty()) {-
6830 for (QForeachContainer<typename QtPrivate::remove_reference<decltype((d->dirty.translated(dx, dy)).rects())>::type> _container_(((d->dirty.translated(dx, dy)).rects())); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (const QRect &rect = *_container_.i; _container_.control; _container_.control = 0)-
6831 proxy->update(rect);-
6832 }-
6833 proxy->scroll(dx, dy, proxy->subWidgetRect(this));-
6834 return;-
6835 }-
6836-
6837 d->setDirtyOpaqueRegion();-
6838 d->scroll_sys(dx, dy);-
6839}-
6840-
6841void QWidgetPrivate::scroll_sys(int dx, int dy)-
6842{-
6843 QWidget * const q = q_func();-
6844 scrollChildren(dx, dy);-
6845 scrollRect(q->rect(), dx, dy);-
6846}-
6847void QWidget::scroll(int dx, int dy, const QRect &r)-
6848{-
6849-
6850 if ((!updatesEnabled() && children().size() == 0) || !isVisible())-
6851 return;-
6852 if (dx == 0 && dy == 0)-
6853 return;-
6854 QWidgetPrivate * const d = d_func();-
6855-
6856 if (QGraphicsProxyWidget *proxy = QWidgetPrivate::nearestGraphicsProxyWidget(this)) {-
6857-
6858-
6859-
6860 if (!d->dirty.isEmpty()) {-
6861 for (QForeachContainer<typename QtPrivate::remove_reference<decltype((d->dirty.translated(dx, dy) & r).rects())>::type> _container_(((d->dirty.translated(dx, dy) & r).rects())); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (const QRect &rect = *_container_.i; _container_.control; _container_.control = 0)-
6862 proxy->update(rect);-
6863 }-
6864 proxy->scroll(dx, dy, r.translated(proxy->subWidgetRect(this).topLeft().toPoint()));-
6865 return;-
6866 }-
6867-
6868 d->scroll_sys(dx, dy, r);-
6869}-
6870-
6871void QWidgetPrivate::scroll_sys(int dx, int dy, const QRect &r)-
6872{-
6873 scrollRect(r, dx, dy);-
6874}-
6875void QWidget::repaint()-
6876{-
6877 repaint(rect());-
6878}-
6879void QWidget::repaint(int x, int y, int w, int h)-
6880{-
6881 if (x > data->crect.width() || y > data->crect.height())-
6882 return;-
6883-
6884 if (w < 0)-
6885 w = data->crect.width() - x;-
6886 if (h < 0)-
6887 h = data->crect.height() - y;-
6888-
6889 repaint(QRect(x, y, w, h));-
6890}-
6891-
6892-
6893-
6894-
6895-
6896void QWidget::repaint(const QRect &rect)-
6897{-
6898 QWidgetPrivate * const d = d_func();-
6899-
6900 if (testAttribute(Qt::WA_WState_ConfigPending)) {-
6901 update(rect);-
6902 return;-
6903 }-
6904-
6905 if (!isVisible() || !updatesEnabled() || rect.isEmpty())-
6906 return;-
6907-
6908 if (hasBackingStoreSupport()) {-
6909 QTLWExtra *tlwExtra = window()->d_func()->maybeTopData();-
6910 if (tlwExtra && !tlwExtra->inTopLevelResize && tlwExtra->backingStore) {-
6911 tlwExtra->inRepaint = true;-
6912 tlwExtra->backingStoreTracker->markDirty(rect, this, QWidgetBackingStore::UpdateNow);-
6913 tlwExtra->inRepaint = false;-
6914 }-
6915 } else {-
6916 d->repaint_sys(rect);-
6917 }-
6918}-
6919-
6920-
6921-
6922-
6923-
6924-
6925void QWidget::repaint(const QRegion &rgn)-
6926{-
6927 QWidgetPrivate * const d = d_func();-
6928-
6929 if (testAttribute(Qt::WA_WState_ConfigPending)) {-
6930 update(rgn);-
6931 return;-
6932 }-
6933-
6934 if (!isVisible() || !updatesEnabled() || rgn.isEmpty())-
6935 return;-
6936-
6937 if (hasBackingStoreSupport()) {-
6938 QTLWExtra *tlwExtra = window()->d_func()->maybeTopData();-
6939 if (tlwExtra && !tlwExtra->inTopLevelResize && tlwExtra->backingStore) {-
6940 tlwExtra->inRepaint = true;-
6941 tlwExtra->backingStoreTracker->markDirty(rgn, this, QWidgetBackingStore::UpdateNow);-
6942 tlwExtra->inRepaint = false;-
6943 }-
6944 } else {-
6945 d->repaint_sys(rgn);-
6946 }-
6947}-
6948void QWidget::update()-
6949{-
6950 update(rect());-
6951}-
6952void QWidget::update(const QRect &rect)-
6953{-
6954 if (!isVisible() || !updatesEnabled())-
6955 return;-
6956-
6957 QRect r = rect & QWidget::rect();-
6958-
6959 if (r.isEmpty())-
6960 return;-
6961-
6962 if (testAttribute(Qt::WA_WState_InPaintEvent)) {-
6963 QApplication::postEvent(this, new QUpdateLaterEvent(r));-
6964 return;-
6965 }-
6966-
6967 if (hasBackingStoreSupport()) {-
6968 QTLWExtra *tlwExtra = window()->d_func()->maybeTopData();-
6969 if (tlwExtra && !tlwExtra->inTopLevelResize && tlwExtra->backingStore)-
6970 tlwExtra->backingStoreTracker->markDirty(r, this);-
6971 } else {-
6972 d_func()->repaint_sys(r);-
6973 }-
6974}-
6975-
6976-
6977-
6978-
6979-
6980-
6981void QWidget::update(const QRegion &rgn)-
6982{-
6983 if (!isVisible() || !updatesEnabled())-
6984 return;-
6985-
6986 QRegion r = rgn & QWidget::rect();-
6987-
6988 if (r.isEmpty())-
6989 return;-
6990-
6991 if (testAttribute(Qt::WA_WState_InPaintEvent)) {-
6992 QApplication::postEvent(this, new QUpdateLaterEvent(r));-
6993 return;-
6994 }-
6995-
6996 if (hasBackingStoreSupport()) {-
6997 QTLWExtra *tlwExtra = window()->d_func()->maybeTopData();-
6998 if (tlwExtra && !tlwExtra->inTopLevelResize && tlwExtra->backingStore)-
6999 tlwExtra->backingStoreTracker->markDirty(r, this);-
7000 } else {-
7001 d_func()->repaint_sys(r);-
7002 }-
7003}-
7004-
7005-
7006-
7007-
7008-
7009-
7010-
7011static void setAttribute_internal(Qt::WidgetAttribute attribute, bool on, QWidgetData *data,-
7012 QWidgetPrivate *d)-
7013{-
7014 if (attribute < int(8*sizeof(uint))) {-
7015 if (on)-
7016 data->widget_attributes |= (1<<attribute);-
7017 else-
7018 data->widget_attributes &= ~(1<<attribute);-
7019 } else {-
7020 const int x = attribute - 8*sizeof(uint);-
7021 const int int_off = x / (8*sizeof(uint));-
7022 if (on)-
7023 d->high_attributes[int_off] |= (1<<(x-(int_off*8*sizeof(uint))));-
7024 else-
7025 d->high_attributes[int_off] &= ~(1<<(x-(int_off*8*sizeof(uint))));-
7026 }-
7027}-
7028void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on)-
7029{-
7030 if (testAttribute(attribute) == on)-
7031 return;-
7032-
7033 QWidgetPrivate * const d = d_func();-
7034 static_assert(bool(sizeof(d->high_attributes)*8 >= (Qt::WA_AttributeCount - sizeof(uint)*8)), "QWidget::setAttribute(WidgetAttribute, bool): " "QWidgetPrivate::high_attributes[] too small to contain all attributes in WidgetAttribute")-
7035-
7036 ;-
7037 if (attribute == Qt::WA_NativeWindow && !d->mustHaveWindowHandle) {-
7038 QPlatformIntegration *platformIntegration = QGuiApplicationPrivate::platformIntegration();-
7039 if (!platformIntegration->hasCapability(QPlatformIntegration::NativeWidgets))-
7040 return;-
7041 }-
7042-
7043 setAttribute_internal(attribute, on, data, d);-
7044-
7045 switch (attribute) {-
7046-
7047-
7048 case Qt::WA_AcceptDrops: {-
7049 if (on && !testAttribute(Qt::WA_DropSiteRegistered))-
7050 setAttribute(Qt::WA_DropSiteRegistered, true);-
7051 else if (!on && (isWindow() || !parentWidget() || !parentWidget()->testAttribute(Qt::WA_DropSiteRegistered)))-
7052 setAttribute(Qt::WA_DropSiteRegistered, false);-
7053 QEvent e(QEvent::AcceptDropsChange);-
7054 QApplication::sendEvent(this, &e);-
7055 break;-
7056 }-
7057 case Qt::WA_DropSiteRegistered: {-
7058 d->registerDropSite(on);-
7059 for (int i = 0; i < d->children.size(); ++i) {-
7060 QWidget *w = qobject_cast<QWidget *>(d->children.at(i));-
7061 if (w && !w->isWindow() && !w->testAttribute(Qt::WA_AcceptDrops) && w->testAttribute(Qt::WA_DropSiteRegistered) != on)-
7062 w->setAttribute(Qt::WA_DropSiteRegistered, on);-
7063 }-
7064 break;-
7065 }-
7066-
7067-
7068 case Qt::WA_NoChildEventsForParent:-
7069 d->sendChildEvents = !on;-
7070 break;-
7071 case Qt::WA_NoChildEventsFromChildren:-
7072 d->receiveChildEvents = !on;-
7073 break;-
7074 case Qt::WA_MacBrushedMetal:-
7075 case Qt::WA_MacAlwaysShowToolWindow:-
7076-
7077-
7078-
7079 break;-
7080 case Qt::WA_MacNormalSize:-
7081 case Qt::WA_MacSmallSize:-
7082 case Qt::WA_MacMiniSize:-
7083 break;-
7084 case Qt::WA_ShowModal:-
7085 if (!on) {-
7086-
7087 data->window_modality = Qt::NonModal;-
7088 } else if (data->window_modality == Qt::NonModal) {-
7089-
7090-
7091-
7092-
7093 QWidget *w = parentWidget();-
7094 if (w)-
7095 w = w->window();-
7096 while (w && !w->testAttribute(Qt::WA_GroupLeader)) {-
7097 w = w->parentWidget();-
7098 if (w)-
7099 w = w->window();-
7100 }-
7101 data->window_modality = (w && w->testAttribute(Qt::WA_GroupLeader))-
7102 ? Qt::WindowModal-
7103 : Qt::ApplicationModal;-
7104-
7105-
7106-
7107 }-
7108 if (testAttribute(Qt::WA_WState_Created)) {-
7109-
7110 d->setModal_sys();-
7111 }-
7112 break;-
7113 case Qt::WA_MouseTracking: {-
7114 QEvent e(QEvent::MouseTrackingChange);-
7115 QApplication::sendEvent(this, &e);-
7116 break; }-
7117 case Qt::WA_NativeWindow: {-
7118 d->createTLExtra();-
7119 if (on)-
7120 d->createTLSysExtra();-
7121-
7122 QWidget *focusWidget = d->effectiveFocusWidget();-
7123 if (on && !internalWinId() && this == QGuiApplication::focusObject()-
7124 && focusWidget->testAttribute(Qt::WA_InputMethodEnabled)) {-
7125 QGuiApplication::inputMethod()->commit();-
7126 QGuiApplication::inputMethod()->update(Qt::ImEnabled);-
7127 }-
7128 if (!(static_cast<QApplication *>(QCoreApplication::instance()))->testAttribute(Qt::AA_DontCreateNativeWidgetSiblings) && parentWidget())-
7129 parentWidget()->d_func()->enforceNativeChildren();-
7130 if (on && !internalWinId() && testAttribute(Qt::WA_WState_Created))-
7131 d->createWinId();-
7132 if (isEnabled() && focusWidget->isEnabled() && this == QGuiApplication::focusObject()-
7133 && focusWidget->testAttribute(Qt::WA_InputMethodEnabled)) {-
7134 QGuiApplication::inputMethod()->update(Qt::ImEnabled);-
7135 }-
7136-
7137 break;-
7138 }-
7139 case Qt::WA_PaintOnScreen:-
7140 d->updateIsOpaque();-
7141 case Qt::WA_OpaquePaintEvent:-
7142 d->updateIsOpaque();-
7143 break;-
7144 case Qt::WA_NoSystemBackground:-
7145 d->updateIsOpaque();-
7146-
7147 case Qt::WA_UpdatesDisabled:-
7148 d->updateSystemBackground();-
7149 break;-
7150 case Qt::WA_TransparentForMouseEvents:-
7151-
7152-
7153-
7154 break;-
7155 case Qt::WA_InputMethodEnabled: {-
7156-
7157 if (QGuiApplication::focusObject() == this) {-
7158 if (!on)-
7159 QGuiApplication::inputMethod()->commit();-
7160 QGuiApplication::inputMethod()->update(Qt::ImEnabled);-
7161 }-
7162-
7163 break;-
7164 }-
7165 case Qt::WA_WindowPropagation:-
7166 d->resolvePalette();-
7167 d->resolveFont();-
7168 d->resolveLocale();-
7169 break;-
7170 case Qt::WA_DontShowOnScreen: {-
7171 if (on && isVisible()) {-
7172-
7173-
7174-
7175 d->hide_sys();-
7176 d->show_sys();-
7177 }-
7178 break;-
7179 }-
7180-
7181 case Qt::WA_X11NetWmWindowTypeDesktop:-
7182 case Qt::WA_X11NetWmWindowTypeDock:-
7183 case Qt::WA_X11NetWmWindowTypeToolBar:-
7184 case Qt::WA_X11NetWmWindowTypeMenu:-
7185 case Qt::WA_X11NetWmWindowTypeUtility:-
7186 case Qt::WA_X11NetWmWindowTypeSplash:-
7187 case Qt::WA_X11NetWmWindowTypeDialog:-
7188 case Qt::WA_X11NetWmWindowTypeDropDownMenu:-
7189 case Qt::WA_X11NetWmWindowTypePopupMenu:-
7190 case Qt::WA_X11NetWmWindowTypeToolTip:-
7191 case Qt::WA_X11NetWmWindowTypeNotification:-
7192 case Qt::WA_X11NetWmWindowTypeCombo:-
7193 case Qt::WA_X11NetWmWindowTypeDND:-
7194 d->setNetWmWindowTypes();-
7195 break;-
7196-
7197 case Qt::WA_StaticContents:-
7198 if (QWidgetBackingStore *bs = d->maybeBackingStore()) {-
7199 if (on)-
7200 bs->addStaticWidget(this);-
7201 else-
7202 bs->removeStaticWidget(this);-
7203 }-
7204 break;-
7205 case Qt::WA_TranslucentBackground:-
7206 if (on) {-
7207 setAttribute(Qt::WA_NoSystemBackground);-
7208 d->updateIsTranslucent();-
7209 }-
7210-
7211 break;-
7212 case Qt::WA_AcceptTouchEvents:-
7213-
7214-
7215-
7216-
7217 break;-
7218 default:-
7219 break;-
7220 }-
7221}-
7222bool QWidget::testAttribute_helper(Qt::WidgetAttribute attribute) const-
7223{-
7224 const QWidgetPrivate * const d = d_func();-
7225 const int x = attribute - 8*sizeof(uint);-
7226 const int int_off = x / (8*sizeof(uint));-
7227 return (d->high_attributes[int_off] & (1<<(x-(int_off*8*sizeof(uint)))));-
7228}-
7229qreal QWidget::windowOpacity() const-
7230{-
7231 const QWidgetPrivate * const d = d_func();-
7232 return (isWindow() && d->maybeTopData()) ? d->maybeTopData()->opacity / 255. : 1.0;-
7233}-
7234-
7235void QWidget::setWindowOpacity(qreal opacity)-
7236{-
7237 QWidgetPrivate * const d = d_func();-
7238 if (!isWindow())-
7239 return;-
7240-
7241 opacity = qBound(qreal(0.0), opacity, qreal(1.0));-
7242 QTLWExtra *extra = d->topData();-
7243 extra->opacity = uint(opacity * 255);-
7244 setAttribute(Qt::WA_WState_WindowOpacitySet);-
7245 d->setWindowOpacity_sys(opacity);-
7246-
7247 if (!testAttribute(Qt::WA_WState_Created))-
7248 return;-
7249-
7250-
7251 if (QGraphicsProxyWidget *proxy = graphicsProxyWidget()) {-
7252-
7253 if (proxy->cacheMode() == QGraphicsItem::NoCache)-
7254 proxy->update();-
7255 else if (QGraphicsScene *scene = proxy->scene())-
7256 scene->update(proxy->sceneBoundingRect());-
7257 return;-
7258 }-
7259-
7260}-
7261-
7262void QWidgetPrivate::setWindowOpacity_sys(qreal level)-
7263{-
7264 QWidget * const q = q_func();-
7265 if (q->windowHandle())-
7266 q->windowHandle()->setOpacity(level);-
7267}-
7268bool QWidget::isWindowModified() const-
7269{-
7270 return testAttribute(Qt::WA_WindowModified);-
7271}-
7272-
7273void QWidget::setWindowModified(bool mod)-
7274{-
7275 QWidgetPrivate * const d = d_func();-
7276 setAttribute(Qt::WA_WindowModified, mod);-
7277-
7278 d->setWindowModified_helper();-
7279-
7280 QEvent e(QEvent::ModifiedChange);-
7281 QApplication::sendEvent(this, &e);-
7282}-
7283-
7284void QWidgetPrivate::setWindowModified_helper()-
7285{-
7286 QWidget * const q = q_func();-
7287 QWindow *window = q->windowHandle();-
7288 if (!window
!windowDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
7289 return;
never executed: return;
0
7290 QPlatformWindow *platformWindow = window->handle();-
7291 if (!platformWindow
!platformWindowDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
7292 return;
never executed: return;
0
7293 bool on = q->testAttribute(Qt::WA_WindowModified);-
7294 if (!platformWindow->setWindowModified(on)
!platformWindo...owModified(on)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
7295 if (!(__builtin_expect(!!(on && !
__builtin_expe...*]"))), false)Description
TRUEnever evaluated
FALSEnever evaluated
q->windowTitle().contains(QLatin1String("[*]"))), false)
__builtin_expe...*]"))), false)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
7296 && on)QMessageLogger(__FILE__, 1141711451, __PRETTY_FUNCTION__).warning("QWidget::setWindowModified: The window title does not contain a '[*]' placeholder");
never executed: QMessageLogger(__FILE__, 11451, __PRETTY_FUNCTION__).warning("QWidget::setWindowModified: The window title does not contain a '[*]' placeholder");
0
7297 setWindowTitle_helper(q->windowTitle());-
7298 setWindowIconText_helper(q->windowIconText());-
7299 }
never executed: end of block
0
7300}
never executed: end of block
0
7301void QWidget::setToolTip(const QString &s)-
7302{-
7303 QWidgetPrivate * const d = d_func();-
7304 d->toolTip = s;-
7305-
7306 QEvent event(QEvent::ToolTipChange);-
7307 QApplication::sendEvent(this, &event);-
7308}-
7309-
7310QString QWidget::toolTip() const-
7311{-
7312 const QWidgetPrivate * const d = d_func();-
7313 return d->toolTip;-
7314}-
7315void QWidget::setToolTipDuration(int msec)-
7316{-
7317 QWidgetPrivate * const d = d_func();-
7318 d->toolTipDuration = msec;-
7319}-
7320-
7321int QWidget::toolTipDuration() const-
7322{-
7323 const QWidgetPrivate * const d = d_func();-
7324 return d->toolTipDuration;-
7325}-
7326void QWidget::setStatusTip(const QString &s)-
7327{-
7328 QWidgetPrivate * const d = d_func();-
7329 d->statusTip = s;-
7330}-
7331-
7332QString QWidget::statusTip() const-
7333{-
7334 const QWidgetPrivate * const d = d_func();-
7335 return d->statusTip;-
7336}-
7337void QWidget::setWhatsThis(const QString &s)-
7338{-
7339 QWidgetPrivate * const d = d_func();-
7340 d->whatsThis = s;-
7341}-
7342-
7343QString QWidget::whatsThis() const-
7344{-
7345 const QWidgetPrivate * const d = d_func();-
7346 return d->whatsThis;-
7347}-
7348void QWidget::setAccessibleName(const QString &name)-
7349{-
7350 QWidgetPrivate * const d = d_func();-
7351 d->accessibleName = name;-
7352 QAccessibleEvent event(this, QAccessible::NameChanged);-
7353 QAccessible::updateAccessibility(&event);-
7354}-
7355-
7356QString QWidget::accessibleName() const-
7357{-
7358 const QWidgetPrivate * const d = d_func();-
7359 return d->accessibleName;-
7360}-
7361void QWidget::setAccessibleDescription(const QString &description)-
7362{-
7363 QWidgetPrivate * const d = d_func();-
7364 d->accessibleDescription = description;-
7365 QAccessibleEvent event(this, QAccessible::DescriptionChanged);-
7366 QAccessible::updateAccessibility(&event);-
7367}-
7368-
7369QString QWidget::accessibleDescription() const-
7370{-
7371 const QWidgetPrivate * const d = d_func();-
7372 return d->accessibleDescription;-
7373}-
7374int QWidget::grabShortcut(const QKeySequence &key, Qt::ShortcutContext context)-
7375{-
7376 ((!((static_cast<QApplication *>(QCoreApplication::instance())))) ? qt_assert("qApp",__FILE__,1162111655) : qt_noop());-
7377 if (key.isEmpty())-
7378 return 0;-
7379 setAttribute(Qt::WA_GrabbedShortcut);-
7380 return (static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->shortcutMap.addShortcut(this, key, context, qWidgetShortcutContextMatcher);-
7381}-
7382void QWidget::releaseShortcut(int id)-
7383{-
7384 ((!((static_cast<QApplication *>(QCoreApplication::instance())))) ? qt_assert("qApp",__FILE__,1164511679) : qt_noop());-
7385 if (id)-
7386 (static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->shortcutMap.removeShortcut(id, this, 0);-
7387}-
7388void QWidget::setShortcutEnabled(int id, bool enable)-
7389{-
7390 ((!((static_cast<QApplication *>(QCoreApplication::instance())))) ? qt_assert("qApp",__FILE__,1166411698) : qt_noop());-
7391 if (id)-
7392 (static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->shortcutMap.setShortcutEnabled(enable, id, this, 0);-
7393}-
7394void QWidget::setShortcutAutoRepeat(int id, bool enable)-
7395{-
7396 ((!((static_cast<QApplication *>(QCoreApplication::instance())))) ? qt_assert("qApp",__FILE__,1167911713) : qt_noop());-
7397 if (id)-
7398 (static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->shortcutMap.setShortcutAutoRepeat(enable, id, this, 0);-
7399}-
7400-
7401-
7402-
7403-
7404-
7405void QWidget::updateMicroFocus()-
7406{-
7407-
7408 if (this == QGuiApplication::focusObject())-
7409 QGuiApplication::inputMethod()->update(Qt::ImQueryAll);-
7410}-
7411void QWidget::raise()-
7412{-
7413 QWidgetPrivate * const d = d_func();-
7414 if (!isWindow()) {-
7415 QWidget *p = parentWidget();-
7416 const int parentChildCount = p->d_func()->children.size();-
7417 if (parentChildCount < 2)-
7418 return;-
7419 const int from = p->d_func()->children.indexOf(this);-
7420 ((!(from >= 0)) ? qt_assert("from >= 0",__FILE__,1171611750) : qt_noop());-
7421-
7422 if (from != parentChildCount -1)-
7423 p->d_func()->children.move(from, parentChildCount - 1);-
7424 if (!testAttribute(Qt::WA_WState_Created) && p->testAttribute(Qt::WA_WState_Created))-
7425 create();-
7426 else if (from == parentChildCount - 1)-
7427 return;-
7428-
7429 QRegion region(rect());-
7430 d->subtractOpaqueSiblings(region);-
7431 d->invalidateBuffer(region);-
7432 }-
7433 if (testAttribute(Qt::WA_WState_Created))-
7434 d->raise_sys();-
7435-
7436 if (d->extra && d->extra->hasWindowContainer)-
7437 QWindowContainer::parentWasRaised(this);-
7438-
7439 QEvent e(QEvent::ZOrderChange);-
7440 QApplication::sendEvent(this, &e);-
7441}-
7442-
7443void QWidgetPrivate::raise_sys()-
7444{-
7445 QWidget * const q = q_func();-
7446 if (q->isWindow() || q->testAttribute(Qt::WA_NativeWindow)) {-
7447 q->windowHandle()->raise();-
7448 } else if (renderToTexture) {-
7449 if (QWidget *p = q->parentWidget()) {-
7450 setDirtyOpaqueRegion();-
7451 p->d_func()->invalidateBuffer(effectiveRectFor(q->geometry()));-
7452 }-
7453 }-
7454}-
7455void QWidget::lower()-
7456{-
7457 QWidgetPrivate * const d = d_func();-
7458 if (!isWindow()) {-
7459 QWidget *p = parentWidget();-
7460 const int parentChildCount = p->d_func()->children.size();-
7461 if (parentChildCount < 2)-
7462 return;-
7463 const int from = p->d_func()->children.indexOf(this);-
7464 ((!(from >= 0)) ? qt_assert("from >= 0",__FILE__,1177011804) : qt_noop());-
7465-
7466 if (from != 0)-
7467 p->d_func()->children.move(from, 0);-
7468 if (!testAttribute(Qt::WA_WState_Created) && p->testAttribute(Qt::WA_WState_Created))-
7469 create();-
7470 else if (from == 0)-
7471 return;-
7472 }-
7473 if (testAttribute(Qt::WA_WState_Created))-
7474 d->lower_sys();-
7475-
7476 if (d->extra && d->extra->hasWindowContainer)-
7477 QWindowContainer::parentWasLowered(this);-
7478-
7479 QEvent e(QEvent::ZOrderChange);-
7480 QApplication::sendEvent(this, &e);-
7481}-
7482-
7483void QWidgetPrivate::lower_sys()-
7484{-
7485 QWidget * const q = q_func();-
7486 if (q->isWindow() || q->testAttribute(Qt::WA_NativeWindow)) {-
7487 ((!(q->testAttribute(Qt::WA_WState_Created))) ? qt_assert("q->testAttribute(Qt::WA_WState_Created)",__FILE__,1179311827) : qt_noop());-
7488 q->windowHandle()->lower();-
7489 } else if (QWidget *p = q->parentWidget()) {-
7490 setDirtyOpaqueRegion();-
7491 p->d_func()->invalidateBuffer(effectiveRectFor(q->geometry()));-
7492 }-
7493}-
7494void QWidget::stackUnder(QWidget* w)-
7495{-
7496 QWidgetPrivate * const d = d_func();-
7497 QWidget *p = parentWidget();-
7498 if (!w || isWindow() || p != w->parentWidget() || this == w)-
7499 return;-
7500 if (p) {-
7501 int from = p->d_func()->children.indexOf(this);-
7502 int to = p->d_func()->children.indexOf(w);-
7503 ((!(from >= 0)) ? qt_assert("from >= 0",__FILE__,1181711851) : qt_noop());-
7504 ((!(to >= 0)) ? qt_assert("to >= 0",__FILE__,1181811852) : qt_noop());-
7505 if (from < to)-
7506 --to;-
7507-
7508 if (from != to)-
7509 p->d_func()->children.move(from, to);-
7510 if (!testAttribute(Qt::WA_WState_Created) && p->testAttribute(Qt::WA_WState_Created))-
7511 create();-
7512 else if (from == to)-
7513 return;-
7514 }-
7515 if (testAttribute(Qt::WA_WState_Created))-
7516 d->stackUnder_sys(w);-
7517-
7518 QEvent e(QEvent::ZOrderChange);-
7519 QApplication::sendEvent(this, &e);-
7520}-
7521-
7522void QWidgetPrivate::stackUnder_sys(QWidget*)-
7523{-
7524 QWidget * const q = q_func();-
7525 if (QWidget *p = q->parentWidget()) {-
7526 setDirtyOpaqueRegion();-
7527 p->d_func()->invalidateBuffer(effectiveRectFor(q->geometry()));-
7528 }-
7529}-
7530QRect QWidgetPrivate::frameStrut() const-
7531{-
7532 const QWidget * const q = q_func();-
7533 if (!q->isWindow() || (q->windowType() == Qt::Desktop) || q->testAttribute(Qt::WA_DontShowOnScreen)) {-
7534-
7535 return QRect(0, 0, 1, 1);-
7536 }-
7537-
7538 if (data.fstrut_dirty-
7539-
7540-
7541 && q->isVisible()-
7542-
7543 && q->testAttribute(Qt::WA_WState_Created))-
7544 const_cast<QWidgetPrivate *>(this)->updateFrameStrut();-
7545-
7546 return maybeTopData() ? maybeTopData()->frameStrut : QRect();-
7547}-
7548-
7549void QWidgetPrivate::updateFrameStrut()-
7550{-
7551 QWidget * const q = q_func();-
7552 if (q->data->fstrut_dirty) {-
7553 if (QTLWExtra *te = maybeTopData()) {-
7554 if (te->window && te->window->handle()) {-
7555 const QMargins margins = te->window->frameMargins();-
7556 if (!margins.isNull()) {-
7557 te->frameStrut.setCoords(margins.left(), margins.top(), margins.right(), margins.bottom());-
7558 q->data->fstrut_dirty = false;-
7559 }-
7560 }-
7561 }-
7562 }-
7563}-
7564void QWidget::setBackingStore(QBackingStore *store)-
7565{-
7566-
7567-
7568 if (!isTopLevel())-
7569 return;-
7570-
7571 QWidgetPrivate * const d = d_func();-
7572-
7573 QTLWExtra *topData = d->topData();-
7574 if (topData->backingStore == store)-
7575 return;-
7576-
7577 QBackingStore *oldStore = topData->backingStore;-
7578 deleteBackingStore(d);-
7579 topData->backingStore = store;-
7580-
7581 QWidgetBackingStore *bs = d->maybeBackingStore();-
7582 if (!bs)-
7583 return;-
7584-
7585 if (isTopLevel()) {-
7586 if (bs->store != oldStore && bs->store != store)-
7587 delete bs->store;-
7588 bs->store = store;-
7589 }-
7590}-
7591-
7592-
7593-
7594-
7595-
7596-
7597QBackingStore *QWidget::backingStore() const-
7598{-
7599 const QWidgetPrivate * const d = d_func();-
7600 QTLWExtra *extra = d->maybeTopData();-
7601 if (extra && extra->backingStore)-
7602 return extra->backingStore;-
7603-
7604 QWidgetBackingStore *bs = d->maybeBackingStore();-
7605-
7606 return bs ? bs->store : 0;-
7607}-
7608-
7609void QWidgetPrivate::getLayoutItemMargins(int *left, int *top, int *right, int *bottom) const-
7610{-
7611 if (left)-
7612 *left = (int)leftLayoutItemMargin;-
7613 if (top)-
7614 *top = (int)topLayoutItemMargin;-
7615 if (right)-
7616 *right = (int)rightLayoutItemMargin;-
7617 if (bottom)-
7618 *bottom = (int)bottomLayoutItemMargin;-
7619}-
7620-
7621void QWidgetPrivate::setLayoutItemMargins(int left, int top, int right, int bottom)-
7622{-
7623 if (leftLayoutItemMargin == left-
7624 && topLayoutItemMargin == top-
7625 && rightLayoutItemMargin == right-
7626 && bottomLayoutItemMargin == bottom)-
7627 return;-
7628-
7629 QWidget * const q = q_func();-
7630 leftLayoutItemMargin = (signed char)left;-
7631 topLayoutItemMargin = (signed char)top;-
7632 rightLayoutItemMargin = (signed char)right;-
7633 bottomLayoutItemMargin = (signed char)bottom;-
7634 q->updateGeometry();-
7635}-
7636-
7637void QWidgetPrivate::setLayoutItemMargins(QStyle::SubElement element, const QStyleOption *opt)-
7638{-
7639 QWidget * const q = q_func();-
7640 QStyleOption myOpt;-
7641 if (!opt) {-
7642 myOpt.initFrom(q);-
7643 myOpt.rect.setRect(0, 0, 32768, 32768);-
7644 opt = &myOpt;-
7645 }-
7646-
7647 QRect liRect = q->style()->subElementRect(element, opt, q);-
7648 if (liRect.isValid()) {-
7649 leftLayoutItemMargin = (signed char)(opt->rect.left() - liRect.left());-
7650 topLayoutItemMargin = (signed char)(opt->rect.top() - liRect.top());-
7651 rightLayoutItemMargin = (signed char)(liRect.right() - opt->rect.right());-
7652 bottomLayoutItemMargin = (signed char)(liRect.bottom() - opt->rect.bottom());-
7653 } else {-
7654 leftLayoutItemMargin = 0;-
7655 topLayoutItemMargin = 0;-
7656 rightLayoutItemMargin = 0;-
7657 bottomLayoutItemMargin = 0;-
7658 }-
7659}-
7660-
7661void QWidgetPrivate::adjustQuitOnCloseAttribute()-
7662{-
7663 QWidget * const q = q_func();-
7664-
7665 if (!q->parentWidget()) {-
7666 Qt::WindowType type = q->windowType();-
7667 if (type == Qt::Widget || type == Qt::SubWindow)-
7668 type = Qt::Window;-
7669 if (type != Qt::Widget && type != Qt::Window && type != Qt::Dialog)-
7670 q->setAttribute(Qt::WA_QuitOnClose, false);-
7671 }-
7672}-
7673-
7674QOpenGLContext *QWidgetPrivate::shareContext() const-
7675{-
7676-
7677-
7678-
7679 if (!(__builtin_expect(!!(!
__builtin_expe...indow), false)Description
TRUEnever evaluated
FALSEnever evaluated
extra || !extra->topextra || !extra->topextra->window)), false)
__builtin_expe...indow), false)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
7680 QMessageLogger(__FILE__, 1216712203, __PRETTY_FUNCTION__).warning("Asking for share context for widget that does not have a window handle");-
7681 return
never executed: return 0;
0;
never executed: return 0;
0
7682 }-
7683 QWidgetPrivate *that = const_cast<QWidgetPrivate *>(this);-
7684 if (!extra->topextra->shareContext
!extra->topextra->shareContextDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
7685 QOpenGLContext *ctx = new QOpenGLContext;-
7686 ctx->setShareContext(qt_gl_global_share_context());-
7687 ctx->setFormat(extra->topextra->window->format());-
7688 ctx->setScreen(extra->topextra->window->screen());-
7689 ctx->create();-
7690 that->extra->topextra->shareContext = ctx;-
7691 }
never executed: end of block
0
7692 return
never executed: return that->extra->topextra->shareContext;
that->extra->topextra->shareContext;
never executed: return that->extra->topextra->shareContext;
0
7693-
7694}-
7695-
7696-
7697void QWidgetPrivate::sendComposeStatus(QWidget *w, bool end)-
7698{-
7699 QWidgetPrivate *wd = QWidgetPrivate::get(w);-
7700 if (!wd->textureChildSeen)-
7701 return;-
7702 if (end)-
7703 wd->endCompose();-
7704 else-
7705 wd->beginCompose();-
7706 for (int i = 0; i < wd->children.size(); ++i) {-
7707 w = qobject_cast<QWidget *>(wd->children.at(i));-
7708 if (w && !w->isWindow() && !w->isHidden() && QWidgetPrivate::get(w)->textureChildSeen)-
7709 sendComposeStatus(w, end);-
7710 }-
7711}-
7712-
7713-
7714__attribute__((visibility("default"))) QWidgetData *qt_qwidget_data(QWidget *widget)-
7715{-
7716 return widget->data;-
7717}-
7718-
7719__attribute__((visibility("default"))) QWidgetPrivate *qt_widget_private(QWidget *widget)-
7720{-
7721 return widget->d_func();-
7722}-
7723QGraphicsProxyWidget *QWidget::graphicsProxyWidget() const-
7724{-
7725 const QWidgetPrivate * const d = d_func();-
7726 if (d->extra) {-
7727 return d->extra->proxyWidget;-
7728 }-
7729 return 0;-
7730}-
7731void QWidget::grabGesture(Qt::GestureType gesture, Qt::GestureFlags flags)-
7732{-
7733 QWidgetPrivate * const d = d_func();-
7734 d->gestureContext.insert(gesture, flags);-
7735 (void)QGestureManager::instance();-
7736}-
7737-
7738-
7739-
7740-
7741-
7742-
7743-
7744void QWidget::ungrabGesture(Qt::GestureType gesture)-
7745{-
7746-
7747 QWidgetPrivate * const d = d_func();-
7748 if (d->gestureContext.remove(gesture)
d->gestureCont...emove(gesture)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
7749 if (QGestureManager *manager = QGestureManager::instance()
QGestureManage...er::instance()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
7750 manager->cleanupCachedGestures(this, gesture);
never executed: manager->cleanupCachedGestures(this, gesture);
0
7751 }
never executed: end of block
0
7752}
never executed: end of block
0
7753void QWidget::destroy(bool destroyWindow, bool destroySubWindows)-
7754{-
7755 QWidgetPrivate * const d = d_func();-
7756-
7757 d->aboutToDestroy();-
7758 if (!isWindow() && parentWidget())-
7759 parentWidget()->d_func()->invalidateBuffer(d->effectiveRectFor(geometry()));-
7760 d->deactivateWidgetCleanup();-
7761-
7762 if ((windowType() == Qt::Popup) && (static_cast<QApplication *>(QCoreApplication::instance())))-
7763 (static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->closePopup(this);-
7764-
7765 if (this == QApplicationPrivate::active_window)-
7766 QApplication::setActiveWindow(0);-
7767 if (QWidget::mouseGrabber() == this)-
7768 releaseMouse();-
7769 if (QWidget::keyboardGrabber() == this)-
7770 releaseKeyboard();-
7771-
7772 setAttribute(Qt::WA_WState_Created, false);-
7773-
7774 if (windowType() != Qt::Desktop) {-
7775 if (destroySubWindows) {-
7776 QObjectList childList(children());-
7777 for (int i = 0; i < childList.size(); i++) {-
7778 QWidget *widget = qobject_cast<QWidget *>(childList.at(i));-
7779 if (widget && widget->testAttribute(Qt::WA_NativeWindow)) {-
7780 if (widget->windowHandle()) {-
7781 widget->destroy();-
7782 }-
7783 }-
7784 }-
7785 }-
7786 if (destroyWindow) {-
7787 d->deleteTLSysExtra();-
7788 } else {-
7789 if (parentWidget() && parentWidget()->testAttribute(Qt::WA_WState_Created)) {-
7790 d->hide_sys();-
7791 }-
7792 }-
7793-
7794 d->setWinId(0);-
7795 }-
7796}-
7797QPaintEngine *QWidget::paintEngine() const-
7798{-
7799 QMessageLogger(__FILE__, 1233212369, __PRETTY_FUNCTION__).warning("QWidget::paintEngine: Should no longer be called");-
7800 return 0;-
7801}-
7802-
7803-
7804static inline bool canMapPosition(QWindow *window)-
7805{-
7806 return window->handle() && !qt_window_private(window)->resizeEventPending;-
7807}-
7808-
7809-
7810static inline QGraphicsProxyWidget *graphicsProxyWidget(const QWidget *w)-
7811{-
7812 QGraphicsProxyWidget *result = nullptr;-
7813 const QWidgetPrivate *d = qt_widget_private(const_cast<QWidget *>(w));-
7814 if (d->extra)-
7815 result = d->extra->proxyWidget;-
7816 return result;-
7817}-
7818-
7819-
7820struct MapToGlobalTransformResult {-
7821 QTransform transform;-
7822 QWindow *window;-
7823};-
7824-
7825static MapToGlobalTransformResult mapToGlobalTransform(const QWidget *w)-
7826{-
7827 MapToGlobalTransformResult result;-
7828 result.window = nullptr;-
7829 for ( ; w ; w = w->parentWidget()) {-
7830-
7831 if (QGraphicsProxyWidget *qgpw = graphicsProxyWidget(w)) {-
7832 if (const QGraphicsScene *scene = qgpw->scene()) {-
7833 const QList <QGraphicsView *> views = scene->views();-
7834 if (!views.isEmpty()) {-
7835 result.transform *= qgpw->sceneTransform();-
7836 result.transform *= views.first()->viewportTransform();-
7837 w = views.first()->viewport();-
7838 }-
7839 }-
7840 }-
7841-
7842 QWindow *window = w->windowHandle();-
7843 if (window && canMapPosition(window)) {-
7844 result.window = window;-
7845 break;-
7846 }-
7847-
7848 const QPoint topLeft = w->geometry().topLeft();-
7849 result.transform.translate(topLeft.x(), topLeft.y());-
7850 if (w->isWindow())-
7851 break;-
7852 }-
7853 return result;-
7854}-
7855QPoint QWidget::mapToGlobal(const QPoint &pos) const-
7856{-
7857 const MapToGlobalTransformResult t = mapToGlobalTransform(this);-
7858 const QPoint g = t.transform.map(pos);-
7859 return t.window ? t.window->mapToGlobal(g) : g;-
7860}-
7861QPoint QWidget::mapFromGlobal(const QPoint &pos) const-
7862{-
7863 const MapToGlobalTransformResult t = mapToGlobalTransform(this);-
7864 const QPoint windowLocal = t.window ? t.window->mapFromGlobal(pos) : pos;-
7865 return t.transform.inverted().map(windowLocal);-
7866}-
7867-
7868QWidget *qt_pressGrab = 0;-
7869QWidget *qt_mouseGrb = 0;-
7870static bool mouseGrabWithCursor = false;-
7871static QWidget *keyboardGrb = 0;-
7872-
7873static inline QWindow *grabberWindow(const QWidget *w)-
7874{-
7875 QWindow *window = w->windowHandle();-
7876 if (!window)-
7877 if (const QWidget *nativeParent = w->nativeParentWidget())-
7878 window = nativeParent->windowHandle();-
7879 return window;-
7880}-
7881-
7882-
7883static void grabMouseForWidget(QWidget *widget, const QCursor *cursor = 0)-
7884-
7885-
7886-
7887{-
7888 if (qt_mouseGrb)-
7889 qt_mouseGrb->releaseMouse();-
7890-
7891 mouseGrabWithCursor = false;-
7892 if (QWindow *window = grabberWindow(widget)) {-
7893-
7894 if (cursor) {-
7895 mouseGrabWithCursor = true;-
7896 QGuiApplication::setOverrideCursor(*cursor);-
7897 }-
7898-
7899 window->setMouseGrabEnabled(true);-
7900 }-
7901-
7902 qt_mouseGrb = widget;-
7903 qt_pressGrab = 0;-
7904}-
7905-
7906static void releaseMouseGrabOfWidget(QWidget *widget)-
7907{-
7908 if (qt_mouseGrb == widget) {-
7909 if (QWindow *window = grabberWindow(widget)) {-
7910-
7911 if (mouseGrabWithCursor) {-
7912 QGuiApplication::restoreOverrideCursor();-
7913 mouseGrabWithCursor = false;-
7914 }-
7915-
7916 window->setMouseGrabEnabled(false);-
7917 }-
7918 }-
7919 qt_mouseGrb = 0;-
7920}-
7921void QWidget::grabMouse()-
7922{-
7923 grabMouseForWidget(this);-
7924}-
7925void QWidget::grabMouse(const QCursor &cursor)-
7926{-
7927 grabMouseForWidget(this, &cursor);-
7928}-
7929-
7930-
7931bool QWidgetPrivate::stealMouseGrab(bool grab)-
7932{-
7933-
7934-
7935 QWidget * const q = q_func();-
7936 QWindow *window = grabberWindow(q);-
7937 return window ? window->setMouseGrabEnabled(grab) : false;-
7938}-
7939void QWidget::releaseMouse()-
7940{-
7941 releaseMouseGrabOfWidget(this);-
7942}-
7943void QWidget::grabKeyboard()-
7944{-
7945 if (keyboardGrb)-
7946 keyboardGrb->releaseKeyboard();-
7947 if (QWindow *window = grabberWindow(this))-
7948 window->setKeyboardGrabEnabled(true);-
7949 keyboardGrb = this;-
7950}-
7951-
7952bool QWidgetPrivate::stealKeyboardGrab(bool grab)-
7953{-
7954-
7955-
7956 QWidget * const q = q_func();-
7957 QWindow *window = grabberWindow(q);-
7958 return window ? window->setKeyboardGrabEnabled(grab) : false;-
7959}-
7960void QWidget::releaseKeyboard()-
7961{-
7962 if (keyboardGrb == this) {-
7963 if (QWindow *window = grabberWindow(this))-
7964 window->setKeyboardGrabEnabled(false);-
7965 keyboardGrb = 0;-
7966 }-
7967}-
7968QWidget *QWidget::mouseGrabber()-
7969{-
7970 if (qt_mouseGrb)-
7971 return qt_mouseGrb;-
7972 return qt_pressGrab;-
7973}-
7974QWidget *QWidget::keyboardGrabber()-
7975{-
7976 return keyboardGrb;-
7977}-
7978void QWidget::activateWindow()-
7979{-
7980 QWindow *const wnd = window()->windowHandle();-
7981-
7982 if (wnd)-
7983 wnd->requestActivate();-
7984}-
7985int QWidget::metric(PaintDeviceMetric m) const-
7986{-
7987 const QWidgetPrivate * const d = d_func();-
7988-
7989 QWindow *topLevelWindow = 0;-
7990 QScreen *screen = 0;-
7991 if (QWidget *topLevel = window()) {-
7992 topLevelWindow = topLevel->windowHandle();-
7993 if (topLevelWindow)-
7994 screen = topLevelWindow->screen();-
7995 }-
7996 if (!screen && QGuiApplication::primaryScreen())-
7997 screen = QGuiApplication::primaryScreen();-
7998-
7999 if (!screen) {-
8000 if (m == PdmDpiX || m == PdmDpiY)-
8001 return 72;-
8002 return QPaintDevice::metric(m);-
8003 }-
8004 int val;-
8005 if (m == PdmWidth) {-
8006 val = data->crect.width();-
8007 } else if (m == PdmWidthMM) {-
8008 val = data->crect.width() * screen->physicalSize().width() / screen->geometry().width();-
8009 } else if (m == PdmHeight) {-
8010 val = data->crect.height();-
8011 } else if (m == PdmHeightMM) {-
8012 val = data->crect.height() * screen->physicalSize().height() / screen->geometry().height();-
8013 } else if (m == PdmDepth) {-
8014 return screen->depth();-
8015 } else if (m == PdmDpiX) {-
8016 if (d->extra && d->extra->customDpiX)-
8017 return d->extra->customDpiX;-
8018 else if (d->parent)-
8019 return static_cast<QWidget *>(d->parent)->metric(m);-
8020 return qRound(screen->logicalDotsPerInchX());-
8021 } else if (m == PdmDpiY) {-
8022 if (d->extra && d->extra->customDpiY)-
8023 return d->extra->customDpiY;-
8024 else if (d->parent)-
8025 return static_cast<QWidget *>(d->parent)->metric(m);-
8026 return qRound(screen->logicalDotsPerInchY());-
8027 } else if (m == PdmPhysicalDpiX) {-
8028 return qRound(screen->physicalDotsPerInchX());-
8029 } else if (m == PdmPhysicalDpiY) {-
8030 return qRound(screen->physicalDotsPerInchY());-
8031 } else if (m == PdmDevicePixelRatio) {-
8032 return topLevelWindow ? topLevelWindow->devicePixelRatio() : (static_cast<QApplication *>(QCoreApplication::instance()))->devicePixelRatio();-
8033 } else if (m == PdmDevicePixelRatioScaled) {-
8034 return (QPaintDevice::devicePixelRatioFScale() *-
8035 (topLevelWindow ? topLevelWindow->devicePixelRatio() : (static_cast<QApplication *>(QCoreApplication::instance()))->devicePixelRatio()));-
8036 } else {-
8037 val = QPaintDevice::metric(m);-
8038 }-
8039 return val;-
8040}-
8041-
8042-
8043-
8044-
8045-
8046-
8047void QWidget::initPainter(QPainter *painter) const-
8048{-
8049 const QPalette &pal = palette();-
8050 painter->d_func()->state->pen = QPen(pal.brush(foregroundRole()), 1);-
8051 painter->d_func()->state->bgBrush = pal.brush(backgroundRole());-
8052 QFont f(font(), const_cast<QWidget *>(this));-
8053 painter->d_func()->state->deviceFont = f;-
8054 painter->d_func()->state->font = f;-
8055}-
8056-
8057-
8058-
8059-
8060-
8061-
8062QPaintDevice *QWidget::redirected(QPoint *offset) const-
8063{-
8064 return d_func()->redirected(offset);-
8065}-
8066-
8067-
8068-
8069-
8070-
8071-
8072QPainter *QWidget::sharedPainter() const-
8073{-
8074-
8075 if (!d_func()->redirectDev)-
8076 return 0;-
8077-
8078 QPainter *sp = d_func()->sharedPainter();-
8079 if (!sp || !sp->isActive())-
8080 return 0;-
8081-
8082 if (sp->paintEngine()->paintDevice() != d_func()->redirectDev)-
8083 return 0;-
8084-
8085 return sp;-
8086}-
8087void QWidget::setMask(const QRegion &newMask)-
8088{-
8089 QWidgetPrivate * const d = d_func();-
8090-
8091 d->createExtra();-
8092 if (newMask == d->extra->mask)-
8093 return;-
8094-
8095-
8096 const QRegion oldMask(d->extra->mask);-
8097-
8098-
8099 d->extra->mask = newMask;-
8100 d->extra->hasMask = !newMask.isEmpty();-
8101-
8102-
8103 if (!testAttribute(Qt::WA_WState_Created))-
8104 return;-
8105-
8106-
8107 d->setMask_sys(newMask);-
8108-
8109-
8110 if (!isVisible())-
8111 return;-
8112-
8113 if (!d->extra->hasMask) {-
8114-
8115 QRegion expose(rect());-
8116 expose -= oldMask;-
8117 if (!expose.isEmpty()) {-
8118 d->setDirtyOpaqueRegion();-
8119 update(expose);-
8120 }-
8121 return;-
8122 }-
8123-
8124 if (!isWindow()) {-
8125-
8126 QRegion parentExpose(rect());-
8127 parentExpose -= newMask;-
8128 if (!parentExpose.isEmpty()) {-
8129 d->setDirtyOpaqueRegion();-
8130 parentExpose.translate(data->crect.topLeft());-
8131 parentWidget()->update(parentExpose);-
8132 }-
8133-
8134-
8135 if (!oldMask.isEmpty())-
8136 update(newMask - oldMask);-
8137 }-
8138-
8139}-
8140-
8141void QWidgetPrivate::setMask_sys(const QRegion &region)-
8142{-
8143 QWidget * const q = q_func();-
8144 if (QWindow *window = q->windowHandle())-
8145 window->setMask(region);-
8146}-
8147void QWidget::setMask(const QBitmap &bitmap)-
8148{-
8149 setMask(QRegion(bitmap));-
8150}-
8151void QWidget::clearMask()-
8152{-
8153 setMask(QRegion());-
8154}-
8155-
8156void QWidgetPrivate::setWidgetParentHelper(QObject *widgetAsObject, QObject *newParent)-
8157{-
8158 ((!(widgetAsObject->isWidgetType())) ? qt_assert("widgetAsObject->isWidgetType()",__FILE__,1291712954) : qt_noop());-
8159 ((!(!newParent || newParent->isWidgetType())) ? qt_assert("!newParent || newParent->isWidgetType()",__FILE__,1291812955) : qt_noop());-
8160 QWidget *widget = static_cast<QWidget*>(widgetAsObject);-
8161 widget->setParent(static_cast<QWidget*>(newParent));-
8162}-
8163-
8164void QWidgetPrivate::setNetWmWindowTypes(bool skipIfMissing)-
8165{-
8166 QWidget * const q = q_func();-
8167-
8168 if (!q->windowHandle())-
8169 return;-
8170-
8171 int wmWindowType = 0;-
8172 if (q->testAttribute(Qt::WA_X11NetWmWindowTypeDesktop))-
8173 wmWindowType |= QXcbWindowFunctions::Desktop;-
8174 if (q->testAttribute(Qt::WA_X11NetWmWindowTypeDock))-
8175 wmWindowType |= QXcbWindowFunctions::Dock;-
8176 if (q->testAttribute(Qt::WA_X11NetWmWindowTypeToolBar))-
8177 wmWindowType |= QXcbWindowFunctions::Toolbar;-
8178 if (q->testAttribute(Qt::WA_X11NetWmWindowTypeMenu))-
8179 wmWindowType |= QXcbWindowFunctions::Menu;-
8180 if (q->testAttribute(Qt::WA_X11NetWmWindowTypeUtility))-
8181 wmWindowType |= QXcbWindowFunctions::Utility;-
8182 if (q->testAttribute(Qt::WA_X11NetWmWindowTypeSplash))-
8183 wmWindowType |= QXcbWindowFunctions::Splash;-
8184 if (q->testAttribute(Qt::WA_X11NetWmWindowTypeDialog))-
8185 wmWindowType |= QXcbWindowFunctions::Dialog;-
8186 if (q->testAttribute(Qt::WA_X11NetWmWindowTypeDropDownMenu))-
8187 wmWindowType |= QXcbWindowFunctions::DropDownMenu;-
8188 if (q->testAttribute(Qt::WA_X11NetWmWindowTypePopupMenu))-
8189 wmWindowType |= QXcbWindowFunctions::PopupMenu;-
8190 if (q->testAttribute(Qt::WA_X11NetWmWindowTypeToolTip))-
8191 wmWindowType |= QXcbWindowFunctions::Tooltip;-
8192 if (q->testAttribute(Qt::WA_X11NetWmWindowTypeNotification))-
8193 wmWindowType |= QXcbWindowFunctions::Notification;-
8194 if (q->testAttribute(Qt::WA_X11NetWmWindowTypeCombo))-
8195 wmWindowType |= QXcbWindowFunctions::Combo;-
8196 if (q->testAttribute(Qt::WA_X11NetWmWindowTypeDND))-
8197 wmWindowType |= QXcbWindowFunctions::Dnd;-
8198-
8199 if (wmWindowType == 0 && skipIfMissing)-
8200 return;-
8201-
8202 QXcbWindowFunctions::setWmWindowType(q->windowHandle(), static_cast<QXcbWindowFunctions::WmWindowType>(wmWindowType));-
8203}-
8204-
8205-
8206-
8207static inline void formatWidgetAttributes(QDebug debug, const QWidget *widget)-
8208{-
8209 const QMetaObject *qtMo = qt_getEnumMetaObject(Qt::WA_AttributeCount);-
8210 const QMetaEnum me = qtMo->enumerator(qtMo->indexOfEnumerator("WidgetAttribute"));-
8211 debug << ", attributes=[";-
8212 int count = 0;-
8213 for (int a = 0; a < Qt::WA_AttributeCount; ++a) {-
8214 if (widget->testAttribute(static_cast<Qt::WidgetAttribute>(a))) {-
8215 if (count++)-
8216 debug << ',';-
8217 debug << me.valueToKey(a);-
8218 }-
8219 }-
8220 debug << ']';-
8221}-
8222-
8223QDebug operator<<(QDebug debug, const QWidget *widget)-
8224{-
8225 const QDebugStateSaver saver(debug);-
8226 debug.nospace();-
8227 if (widget) {-
8228 debug << widget->metaObject()->className() << '(' << (const void *)widget;-
8229 if (!widget->objectName().isEmpty())-
8230 debug << ", name=" << widget->objectName();-
8231 if (debug.verbosity() > 2) {-
8232 const QRect geometry = widget->geometry();-
8233 const QRect frameGeometry = widget->frameGeometry();-
8234 if (widget->isVisible())-
8235 debug << ", visible";-
8236 if (!widget->isEnabled())-
8237 debug << ", disabled";-
8238 debug << ", states=" << widget->windowState()-
8239 << ", type=" << widget->windowType() << ", flags=" << widget->windowFlags();-
8240 formatWidgetAttributes(debug, widget);-
8241 if (widget->isWindow())-
8242 debug << ", window";-
8243 debug << ", " << geometry.width() << 'x' << geometry.height()-
8244 << forcesign << geometry.x() << geometry.y() << noforcesign;-
8245 if (frameGeometry != geometry) {-
8246 const QMargins margins(geometry.x() - frameGeometry.x(),-
8247 geometry.y() - frameGeometry.y(),-
8248 frameGeometry.right() - geometry.right(),-
8249 frameGeometry.bottom() - geometry.bottom());-
8250 debug << ", margins=" << margins;-
8251 }-
8252 debug << ", devicePixelRatio=" << widget->devicePixelRatioF();-
8253 if (const WId wid = widget->internalWinId())-
8254 debug << ", winId=0x" << hex << wid << dec;-
8255 }-
8256 debug << ')';-
8257 } else {-
8258 debug << "QWidget(0x0)";-
8259 }-
8260 return debug;-
8261}-
8262-
8263-
Switch to Source codePreprocessed file

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