kernel/qwidget.cpp

Source codeSwitch to Preprocessed file
LineSource CodeCoverage
1/**************************************************************************** -
2** -
3** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -
4** Contact: http://www.qt-project.org/legal -
5** -
6** This file is part of the QtGui module of the Qt Toolkit. -
7** -
8** $QT_BEGIN_LICENSE:LGPL$ -
9** Commercial License Usage -
10** Licensees holding valid commercial Qt licenses may use this file in -
11** accordance with the commercial license agreement provided with the -
12** Software or, alternatively, in accordance with the terms contained in -
13** a written agreement between you and Digia. For licensing terms and -
14** conditions see http://qt.digia.com/licensing. For further information -
15** use the contact form at http://qt.digia.com/contact-us. -
16** -
17** GNU Lesser General Public License Usage -
18** Alternatively, this file may be used under the terms of the GNU Lesser -
19** General Public License version 2.1 as published by the Free Software -
20** Foundation and appearing in the file LICENSE.LGPL included in the -
21** packaging of this file. Please review the following information to -
22** ensure the GNU Lesser General Public License version 2.1 requirements -
23** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -
24** -
25** In addition, as a special exception, Digia gives you certain additional -
26** rights. These rights are described in the Digia Qt LGPL Exception -
27** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -
28** -
29** GNU General Public License Usage -
30** Alternatively, this file may be used under the terms of the GNU -
31** General Public License version 3.0 as published by the Free Software -
32** Foundation and appearing in the file LICENSE.GPL included in the -
33** packaging of this file. Please review the following information to -
34** ensure the GNU General Public License version 3.0 requirements will be -
35** met: http://www.gnu.org/copyleft/gpl.html. -
36** -
37** -
38** $QT_END_LICENSE$ -
39** -
40****************************************************************************/ -
41 -
42#include "qapplication.h" -
43#include "qapplication_p.h" -
44#include "qbrush.h" -
45#include "qcursor.h" -
46#include "qdesktopwidget.h" -
47#include "qevent.h" -
48#include "qhash.h" -
49#include "qlayout.h" -
50#include "qmenu.h" -
51#include "qmetaobject.h" -
52#include "qpixmap.h" -
53#include "qpointer.h" -
54#include "qstack.h" -
55#include "qstyle.h" -
56#include "qstylefactory.h" -
57#include "qvariant.h" -
58#include "qwidget.h" -
59#include "qstyleoption.h" -
60#include "qstylehints.h" -
61#ifndef QT_NO_ACCESSIBILITY -
62# include "qaccessible.h" -
63#endif -
64#ifdef Q_WS_MAC -
65# include "qt_mac_p.h" -
66# include "qt_cocoa_helpers_mac_p.h" -
67# include "qmainwindow.h" -
68# include "qtoolbar.h" -
69# include <private/qmainwindowlayout_p.h> -
70#endif -
71#include <qpa/qplatformwindow.h> -
72#include "private/qwidgetwindow_qpa_p.h" -
73#include "qpainter.h" -
74#include "qtooltip.h" -
75#include "qwhatsthis.h" -
76#include "qdebug.h" -
77#include "private/qstylesheetstyle_p.h" -
78#include "private/qstyle_p.h" -
79#include "qfileinfo.h" -
80#include <QtGui/qinputmethod.h> -
81 -
82#include <private/qgraphicseffect_p.h> -
83#include <qbackingstore.h> -
84#include <private/qwidgetbackingstore_p.h> -
85#ifdef Q_WS_MAC -
86# include <private/qpaintengine_mac_p.h> -
87#endif -
88#include <private/qpaintengine_raster_p.h> -
89 -
90#include "qwidget_p.h" -
91#include <QtGui/private/qwindow_p.h> -
92#include "qaction_p.h" -
93#include "qlayout_p.h" -
94#include "QtWidgets/qgraphicsproxywidget.h" -
95#include "QtWidgets/qgraphicsscene.h" -
96#include "private/qgraphicsproxywidget_p.h" -
97#include "QtWidgets/qabstractscrollarea.h" -
98#include "private/qabstractscrollarea_p.h" -
99#include "private/qevent_p.h" -
100 -
101#include "private/qgesturemanager_p.h" -
102 -
103#ifdef QT_KEYPAD_NAVIGATION -
104#include "qtabwidget.h" // Needed in inTabWidget() -
105#endif // QT_KEYPAD_NAVIGATION -
106 -
107 -
108// widget/widget data creation count -
109//#define QWIDGET_EXTRA_DEBUG -
110//#define ALIEN_DEBUG -
111 -
112QT_BEGIN_NAMESPACE -
113 -
114static bool qt_enable_backingstore = true; -
115#ifdef Q_WS_X11 -
116// for compatibility with Qt 4.0 -
117Q_WIDGETS_EXPORT void qt_x11_set_global_double_buffer(bool enable) -
118{ -
119 qt_enable_backingstore = enable; -
120} -
121#endif -
122 -
123#ifdef Q_WS_MAC -
124bool qt_mac_clearDirtyOnWidgetInsideDrawWidget = false; -
125#endif -
126 -
127static inline bool qRectIntersects(const QRect &r1, const QRect &r2) -
128{ -
129 return (qMax(r1.left(), r2.left()) <= qMin(r1.right(), r2.right()) &&
executed: return (qMax(r1.left(), r2.left()) <= qMin(r1.right(), r2.right()) && qMax(r1.top(), r2.top()) <= qMin(r1.bottom(), r2.bottom()));
Execution Count:75657
75657
130 qMax(r1.top(), r2.top()) <= qMin(r1.bottom(), r2.bottom()));
executed: return (qMax(r1.left(), r2.left()) <= qMin(r1.right(), r2.right()) && qMax(r1.top(), r2.top()) <= qMin(r1.bottom(), r2.bottom()));
Execution Count:75657
75657
131} -
132 -
133static inline bool hasBackingStoreSupport() -
134{ -
135 return true;
executed: return true;
Execution Count:102707
102707
136} -
137 -
138#ifdef Q_WS_MAC -
139# define QT_NO_PAINT_DEBUG -
140#endif -
141 -
142extern bool qt_sendSpontaneousEvent(QObject*, QEvent*); // qapplication.cpp -
143extern QDesktopWidget *qt_desktopWidget; // qapplication.cpp -
144 -
145/*! -
146 \internal -
147 \class QWidgetBackingStoreTracker -
148 \brief Class which allows tracking of which widgets are using a given backing store -
149 -
150 QWidgetBackingStoreTracker is a thin wrapper around a QWidgetBackingStore pointer, -
151 which maintains a list of the QWidgets which are currently using the backing -
152 store. This list is modified via the registerWidget and unregisterWidget functions. -
153 */ -
154 -
155QWidgetBackingStoreTracker::QWidgetBackingStoreTracker() -
156 : m_ptr(0) -
157{ -
158 -
159}
executed: }
Execution Count:3525
3525
160 -
161QWidgetBackingStoreTracker::~QWidgetBackingStoreTracker() -
162{ -
163 delete m_ptr;
executed (the execution status of this line is deduced): delete m_ptr;
-
164}
executed: }
Execution Count:3482
3482
165 -
166/*! -
167 \internal -
168 Destroy the contained QWidgetBackingStore, if not null, and clear the list of -
169 widgets using the backing store, then create a new QWidgetBackingStore, providing -
170 the QWidget. -
171 */ -
172void QWidgetBackingStoreTracker::create(QWidget *widget) -
173{ -
174 destroy();
executed (the execution status of this line is deduced): destroy();
-
175 m_ptr = new QWidgetBackingStore(widget);
executed (the execution status of this line is deduced): m_ptr = new QWidgetBackingStore(widget);
-
176}
executed: }
Execution Count:2504
2504
177 -
178/*! -
179 \internal -
180 Destroy the contained QWidgetBackingStore, if not null, and clear the list of -
181 widgets using the backing store. -
182 */ -
183void QWidgetBackingStoreTracker::destroy() -
184{ -
185 delete m_ptr;
executed (the execution status of this line is deduced): delete m_ptr;
-
186 m_ptr = 0;
executed (the execution status of this line is deduced): m_ptr = 0;
-
187 m_widgets.clear();
executed (the execution status of this line is deduced): m_widgets.clear();
-
188}
executed: }
Execution Count:11813
11813
189 -
190/*! -
191 \internal -
192 Add the widget to the list of widgets currently using the backing store. -
193 If the widget was already in the list, this function is a no-op. -
194 */ -
195void QWidgetBackingStoreTracker::registerWidget(QWidget *w) -
196{ -
197 Q_ASSERT(m_ptr);
never executed (the execution status of this line is deduced): qt_noop();
-
198 Q_ASSERT(w->internalWinId());
never executed (the execution status of this line is deduced): qt_noop();
-
199 Q_ASSERT(qt_widget_private(w)->maybeBackingStore() == m_ptr);
never executed (the execution status of this line is deduced): qt_noop();
-
200 m_widgets.insert(w);
never executed (the execution status of this line is deduced): m_widgets.insert(w);
-
201}
never executed: }
0
202 -
203/*! -
204 \internal -
205 Remove the widget from the list of widgets currently using the backing store. -
206 If the widget was in the list, and removing it causes the list to be empty, -
207 the backing store is deleted. -
208 If the widget was not in the list, this function is a no-op. -
209 */ -
210void QWidgetBackingStoreTracker::unregisterWidget(QWidget *w) -
211{ -
212 if (m_widgets.remove(w) && m_widgets.isEmpty()) {
partially evaluated: m_widgets.remove(w)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:324
never evaluated: m_widgets.isEmpty()
0-324
213 delete m_ptr;
never executed (the execution status of this line is deduced): delete m_ptr;
-
214 m_ptr = 0;
never executed (the execution status of this line is deduced): m_ptr = 0;
-
215 }
never executed: }
0
216}
executed: }
Execution Count:324
324
217 -
218/*! -
219 \internal -
220 Recursively remove widget and all of its descendents. -
221 */ -
222void QWidgetBackingStoreTracker::unregisterWidgetSubtree(QWidget *widget) -
223{ -
224 unregisterWidget(widget);
executed (the execution status of this line is deduced): unregisterWidget(widget);
-
225 foreach (QObject *child, widget->children())
executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(widget->children())> _container_(widget->children()); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QObject *child = *_container_.i;; __extension__ ({--_container_.brk; break;}))
-
226 if (QWidget *childWidget = qobject_cast<QWidget *>(child))
evaluated: QWidget *childWidget = qobject_cast<QWidget *>(child)
TRUEFALSE
yes
Evaluation Count:139
yes
Evaluation Count:318
139-318
227 unregisterWidgetSubtree(childWidget);
executed: unregisterWidgetSubtree(childWidget);
Execution Count:139
139
228}
executed: }
Execution Count:324
324
229 -
230QWidgetPrivate::QWidgetPrivate(int version) -
231 : QObjectPrivate(version) -
232 , extra(0) -
233 , focus_next(0) -
234 , focus_prev(0) -
235 , focus_child(0) -
236 , layout(0) -
237 , needsFlush(0) -
238 , redirectDev(0) -
239 , widgetItem(0) -
240 , extraPaintEngine(0) -
241 , polished(0) -
242 , graphicsEffect(0) -
243#if !defined(QT_NO_IM) -
244 , imHints(Qt::ImhNone) -
245#endif -
246 , inheritedFontResolveMask(0) -
247 , inheritedPaletteResolveMask(0) -
248 , leftmargin(0) -
249 , topmargin(0) -
250 , rightmargin(0) -
251 , bottommargin(0) -
252 , leftLayoutItemMargin(0) -
253 , topLayoutItemMargin(0) -
254 , rightLayoutItemMargin(0) -
255 , bottomLayoutItemMargin(0) -
256 , hd(0) -
257 , size_policy(QSizePolicy::Preferred, QSizePolicy::Preferred) -
258 , fg_role(QPalette::NoRole) -
259 , bg_role(QPalette::NoRole) -
260 , dirtyOpaqueChildren(1) -
261 , isOpaque(0) -
262 , inDirtyList(0) -
263 , isScrolled(0) -
264 , isMoved(0) -
265 , usesDoubleBufferedGLContext(0) -
266#ifndef QT_NO_IM -
267 , inheritsInputMethodHints(0) -
268#endif -
269#if defined(Q_OS_WIN) -
270 , noPaintOnScreen(0) -
271#endif -
272#if defined(Q_WS_X11) -
273 , picture(0) -
274#elif defined(Q_WS_WIN) -
275 #ifndef QT_NO_GESTURES -
276 , nativeGesturePanEnabled(0) -
277 #endif -
278#elif defined(Q_WS_MAC) -
279 , needWindowChange(0) -
280 , window_event(0) -
281 , qd_hd(0) -
282#endif -
283{ -
284 if (!qApp) {
partially evaluated: !(static_cast<QApplication *>(QCoreApplication::instance()))
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:45562
0-45562
285 qFatal("QWidget: Must construct a QApplication before a QPaintDevice");
never executed (the execution status of this line is deduced): QMessageLogger("kernel/qwidget.cpp", 285, __PRETTY_FUNCTION__).fatal("QWidget: Must construct a QApplication before a QPaintDevice");
-
286 return;
never executed: return;
0
287 } -
288 -
289 if (version != QObjectPrivateVersion)
partially evaluated: version != QObjectPrivateVersion
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:45562
0-45562
290 qFatal("Cannot mix incompatible Qt libraries");
never executed: QMessageLogger("kernel/qwidget.cpp", 290, __PRETTY_FUNCTION__).fatal("Cannot mix incompatible Qt libraries");
0
291 -
292 isWidget = true;
executed (the execution status of this line is deduced): isWidget = true;
-
293 memset(high_attributes, 0, sizeof(high_attributes));
executed (the execution status of this line is deduced): memset(high_attributes, 0, sizeof(high_attributes));
-
294#ifdef Q_WS_MAC -
295 drawRectOriginalAdded = false; -
296 originalDrawMethod = true; -
297 changeMethods = false; -
298 isInUnifiedToolbar = false; -
299 unifiedSurface = 0; -
300 toolbar_ancestor = 0; -
301 flushRequested = false; -
302 touchEventsEnabled = false; -
303#endif // Q_WS_MAC -
304#ifdef QWIDGET_EXTRA_DEBUG -
305 static int count = 0; -
306 qDebug() << "widgets" << ++count; -
307#endif -
308}
executed: }
Execution Count:45562
45562
309 -
310 -
311QWidgetPrivate::~QWidgetPrivate() -
312{ -
313 if (widgetItem)
evaluated: widgetItem
TRUEFALSE
yes
Evaluation Count:65
yes
Evaluation Count:41421
65-41421
314 widgetItem->wid = 0;
executed: widgetItem->wid = 0;
Execution Count:65
65
315 -
316 if (extra)
evaluated: extra
TRUEFALSE
yes
Evaluation Count:16507
yes
Evaluation Count:24979
16507-24979
317 deleteExtra();
executed: deleteExtra();
Execution Count:16507
16507
318 -
319#ifndef QT_NO_GRAPHICSEFFECT -
320 delete graphicsEffect;
executed (the execution status of this line is deduced): delete graphicsEffect;
-
321#endif //QT_NO_GRAPHICSEFFECT -
322}
executed: }
Execution Count:41486
41486
323 -
324/*! -
325 \internal -
326*/ -
327void QWidgetPrivate::scrollChildren(int dx, int dy) -
328{ -
329 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
330 if (q->children().size() > 0) { // scroll children
evaluated: q->children().size() > 0
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:14643
6-14643
331 QPoint pd(dx, dy);
executed (the execution status of this line is deduced): QPoint pd(dx, dy);
-
332 QObjectList childObjects = q->children();
executed (the execution status of this line is deduced): QObjectList childObjects = q->children();
-
333 for (int i = 0; i < childObjects.size(); ++i) { // move all children
evaluated: i < childObjects.size()
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:6
6
334 QWidget *w = qobject_cast<QWidget*>(childObjects.at(i));
executed (the execution status of this line is deduced): QWidget *w = qobject_cast<QWidget*>(childObjects.at(i));
-
335 if (w && !w->isWindow()) {
partially evaluated: w
TRUEFALSE
yes
Evaluation Count:6
no
Evaluation Count:0
partially evaluated: !w->isWindow()
TRUEFALSE
yes
Evaluation Count:6
no
Evaluation Count:0
0-6
336 QPoint oldp = w->pos();
executed (the execution status of this line is deduced): QPoint oldp = w->pos();
-
337 QRect r(w->pos() + pd, w->size());
executed (the execution status of this line is deduced): QRect r(w->pos() + pd, w->size());
-
338 w->data->crect = r;
executed (the execution status of this line is deduced): w->data->crect = r;
-
339 if (w->testAttribute(Qt::WA_WState_Created))
partially evaluated: w->testAttribute(Qt::WA_WState_Created)
TRUEFALSE
yes
Evaluation Count:6
no
Evaluation Count:0
0-6
340 w->d_func()->setWSGeometry();
executed: w->d_func()->setWSGeometry();
Execution Count:6
6
341 w->d_func()->setDirtyOpaqueRegion();
executed (the execution status of this line is deduced): w->d_func()->setDirtyOpaqueRegion();
-
342 QMoveEvent e(r.topLeft(), oldp);
executed (the execution status of this line is deduced): QMoveEvent e(r.topLeft(), oldp);
-
343 QApplication::sendEvent(w, &e);
executed (the execution status of this line is deduced): QApplication::sendEvent(w, &e);
-
344 }
executed: }
Execution Count:6
6
345 }
executed: }
Execution Count:6
6
346 }
executed: }
Execution Count:6
6
347}
executed: }
Execution Count:14649
14649
348 -
349void QWidgetPrivate::updateWidgetTransform() -
350{ -
351 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
352 if (q == qGuiApp->focusObject()) {
evaluated: q == (static_cast<QGuiApplication *>(QCoreApplication::instance()))->focusObject()
TRUEFALSE
yes
Evaluation Count:2324
yes
Evaluation Count:28042
2324-28042
353 QTransform t;
executed (the execution status of this line is deduced): QTransform t;
-
354 QPoint p = q->mapTo(q->topLevelWidget(), QPoint(0,0));
executed (the execution status of this line is deduced): QPoint p = q->mapTo(q->topLevelWidget(), QPoint(0,0));
-
355 t.translate(p.x(), p.y());
executed (the execution status of this line is deduced): t.translate(p.x(), p.y());
-
356 qApp->inputMethod()->setInputItemTransform(t);
executed (the execution status of this line is deduced): (static_cast<QApplication *>(QCoreApplication::instance()))->inputMethod()->setInputItemTransform(t);
-
357 }
executed: }
Execution Count:2324
2324
358}
executed: }
Execution Count:30366
30366
359 -
360#ifdef QT_KEYPAD_NAVIGATION -
361QPointer<QWidget> QWidgetPrivate::editingWidget; -
362 -
363/*! -
364 Returns true if this widget currently has edit focus; otherwise false. -
365 -
366 This feature is only available in Qt for Embedded Linux. -
367 -
368 \sa setEditFocus(), QApplication::keypadNavigationEnabled() -
369*/ -
370bool QWidget::hasEditFocus() const -
371{ -
372 const QWidget* w = this; -
373 while (w->d_func()->extra && w->d_func()->extra->focus_proxy) -
374 w = w->d_func()->extra->focus_proxy; -
375 return QWidgetPrivate::editingWidget == w; -
376} -
377 -
378/*! -
379 \fn void QWidget::setEditFocus(bool enable) -
380 -
381 If \a enable is true, make this widget have edit focus, in which -
382 case Qt::Key_Up and Qt::Key_Down will be delivered to the widget -
383 normally; otherwise, Qt::Key_Up and Qt::Key_Down are used to -
384 change focus. -
385 -
386 This feature is only available in Qt for Embedded Linux. -
387 -
388 \sa hasEditFocus(), QApplication::keypadNavigationEnabled() -
389*/ -
390void QWidget::setEditFocus(bool on) -
391{ -
392 QWidget *f = this; -
393 while (f->d_func()->extra && f->d_func()->extra->focus_proxy) -
394 f = f->d_func()->extra->focus_proxy; -
395 -
396 if (QWidgetPrivate::editingWidget && QWidgetPrivate::editingWidget != f) -
397 QWidgetPrivate::editingWidget->setEditFocus(false); -
398 -
399 if (on && !f->hasFocus()) -
400 f->setFocus(); -
401 -
402 if ((!on && !QWidgetPrivate::editingWidget) -
403 || (on && QWidgetPrivate::editingWidget == f)) { -
404 return; -
405 } -
406 -
407 if (!on && QWidgetPrivate::editingWidget == f) { -
408 QWidgetPrivate::editingWidget = 0; -
409 QEvent event(QEvent::LeaveEditFocus); -
410 QApplication::sendEvent(f, &event); -
411 QApplication::sendEvent(f->style(), &event); -
412 } else if (on) { -
413 QWidgetPrivate::editingWidget = f; -
414 QEvent event(QEvent::EnterEditFocus); -
415 QApplication::sendEvent(f, &event); -
416 QApplication::sendEvent(f->style(), &event); -
417 } -
418} -
419#endif -
420 -
421/*! -
422 \property QWidget::autoFillBackground -
423 \brief whether the widget background is filled automatically -
424 \since 4.1 -
425 -
426 If enabled, this property will cause Qt to fill the background of the -
427 widget before invoking the paint event. The color used is defined by the -
428 QPalette::Window color role from the widget's \l{QPalette}{palette}. -
429 -
430 In addition, Windows are always filled with QPalette::Window, unless the -
431 WA_OpaquePaintEvent or WA_NoSystemBackground attributes are set. -
432 -
433 This property cannot be turned off (i.e., set to false) if a widget's -
434 parent has a static gradient for its background. -
435 -
436 \warning Use this property with caution in conjunction with -
437 \l{Qt Style Sheets}. When a widget has a style sheet with a valid -
438 background or a border-image, this property is automatically disabled. -
439 -
440 By default, this property is false. -
441 -
442 \sa Qt::WA_OpaquePaintEvent, Qt::WA_NoSystemBackground, -
443 {QWidget#Transparency and Double Buffering}{Transparency and Double Buffering} -
444*/ -
445bool QWidget::autoFillBackground() const -
446{ -
447 Q_D(const QWidget);
executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
448 return d->extra && d->extra->autoFillBackground;
executed: return d->extra && d->extra->autoFillBackground;
Execution Count:107777
107777
449} -
450 -
451void QWidget::setAutoFillBackground(bool enabled) -
452{ -
453 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
454 if (!d->extra)
evaluated: !d->extra
TRUEFALSE
yes
Evaluation Count:5393
yes
Evaluation Count:962
962-5393
455 d->createExtra();
executed: d->createExtra();
Execution Count:5393
5393
456 if (d->extra->autoFillBackground == enabled)
evaluated: d->extra->autoFillBackground == enabled
TRUEFALSE
yes
Evaluation Count:73
yes
Evaluation Count:6282
73-6282
457 return;
executed: return;
Execution Count:73
73
458 -
459 d->extra->autoFillBackground = enabled;
executed (the execution status of this line is deduced): d->extra->autoFillBackground = enabled;
-
460 d->updateIsOpaque();
executed (the execution status of this line is deduced): d->updateIsOpaque();
-
461 update();
executed (the execution status of this line is deduced): update();
-
462 d->updateIsOpaque();
executed (the execution status of this line is deduced): d->updateIsOpaque();
-
463}
executed: }
Execution Count:6282
6282
464 -
465/*! -
466 \class QWidget -
467 \brief The QWidget class is the base class of all user interface objects. -
468 -
469 \ingroup basicwidgets -
470 \inmodule QtWidgets -
471 -
472 The widget is the atom of the user interface: it receives mouse, keyboard -
473 and other events from the window system, and paints a representation of -
474 itself on the screen. Every widget is rectangular, and they are sorted in a -
475 Z-order. A widget is clipped by its parent and by the widgets in front of -
476 it. -
477 -
478 A widget that is not embedded in a parent widget is called a window. -
479 Usually, windows have a frame and a title bar, although it is also possible -
480 to create windows without such decoration using suitable -
481 \l{Qt::WindowFlags}{window flags}). In Qt, QMainWindow and the various -
482 subclasses of QDialog are the most common window types. -
483 -
484 Every widget's constructor accepts one or two standard arguments: -
485 -
486 \list 1 -
487 \li \c{QWidget *parent = 0} is the parent of the new widget. If it is 0 -
488 (the default), the new widget will be a window. If not, it will be -
489 a child of \e parent, and be constrained by \e parent's geometry -
490 (unless you specify Qt::Window as window flag). -
491 \li \c{Qt::WindowFlags f = 0} (where available) sets the window flags; -
492 the default is suitable for almost all widgets, but to get, for -
493 example, a window without a window system frame, you must use -
494 special flags. -
495 \endlist -
496 -
497 QWidget has many member functions, but some of them have little direct -
498 functionality; for example, QWidget has a font property, but never uses -
499 this itself. There are many subclasses which provide real functionality, -
500 such as QLabel, QPushButton, QListWidget, and QTabWidget. -
501 -
502 -
503 \section1 Top-Level and Child Widgets -
504 -
505 A widget without a parent widget is always an independent window (top-level -
506 widget). For these widgets, setWindowTitle() and setWindowIcon() set the -
507 title bar and icon respectively. -
508 -
509 Non-window widgets are child widgets, displayed within their parent -
510 widgets. Most widgets in Qt are mainly useful as child widgets. For -
511 example, it is possible to display a button as a top-level window, but most -
512 people prefer to put their buttons inside other widgets, such as QDialog. -
513 -
514 \image parent-child-widgets.png A parent widget containing various child widgets. -
515 -
516 The diagram above shows a QGroupBox widget being used to hold various child -
517 widgets in a layout provided by QGridLayout. The QLabel child widgets have -
518 been outlined to indicate their full sizes. -
519 -
520 If you want to use a QWidget to hold child widgets you will usually want to -
521 add a layout to the parent QWidget. See \l{Layout Management} for more -
522 information. -
523 -
524 -
525 \section1 Composite Widgets -
526 -
527 When a widget is used as a container to group a number of child widgets, it -
528 is known as a composite widget. These can be created by constructing a -
529 widget with the required visual properties - a QFrame, for example - and -
530 adding child widgets to it, usually managed by a layout. The above diagram -
531 shows such a composite widget that was created using Qt Designer. -
532 -
533 Composite widgets can also be created by subclassing a standard widget, -
534 such as QWidget or QFrame, and adding the necessary layout and child -
535 widgets in the constructor of the subclass. Many of the \l{Qt Examples} -
536 {examples provided with Qt} use this approach, and it is also covered in -
537 the Qt \l{Tutorials}. -
538 -
539 -
540 \section1 Custom Widgets and Painting -
541 -
542 Since QWidget is a subclass of QPaintDevice, subclasses can be used to -
543 display custom content that is composed using a series of painting -
544 operations with an instance of the QPainter class. This approach contrasts -
545 with the canvas-style approach used by the \l{Graphics View} -
546 {Graphics View Framework} where items are added to a scene by the -
547 application and are rendered by the framework itself. -
548 -
549 Each widget performs all painting operations from within its paintEvent() -
550 function. This is called whenever the widget needs to be redrawn, either -
551 as a result of some external change or when requested by the application. -
552 -
553 The \l{widgets/analogclock}{Analog Clock example} shows how a simple widget -
554 can handle paint events. -
555 -
556 -
557 \section1 Size Hints and Size Policies -
558 -
559 When implementing a new widget, it is almost always useful to reimplement -
560 sizeHint() to provide a reasonable default size for the widget and to set -
561 the correct size policy with setSizePolicy(). -
562 -
563 By default, composite widgets which do not provide a size hint will be -
564 sized according to the space requirements of their child widgets. -
565 -
566 The size policy lets you supply good default behavior for the layout -
567 management system, so that other widgets can contain and manage yours -
568 easily. The default size policy indicates that the size hint represents -
569 the preferred size of the widget, and this is often good enough for many -
570 widgets. -
571 -
572 \note The size of top-level widgets are constrained to 2/3 of the desktop's -
573 height and width. You can resize() the widget manually if these bounds are -
574 inadequate. -
575 -
576 -
577 \section1 Events -
578 -
579 Widgets respond to events that are typically caused by user actions. Qt -
580 delivers events to widgets by calling specific event handler functions with -
581 instances of QEvent subclasses containing information about each event. -
582 -
583 If your widget only contains child widgets, you probably do not need to -
584 implement any event handlers. If you want to detect a mouse click in a -
585 child widget call the child's underMouse() function inside the widget's -
586 mousePressEvent(). -
587 -
588 The \l{widgets/scribble}{Scribble example} implements a wider set of -
589 events to handle mouse movement, button presses, and window resizing. -
590 -
591 You will need to supply the behavior and content for your own widgets, but -
592 here is a brief overview of the events that are relevant to QWidget, -
593 starting with the most common ones: -
594 -
595 \list -
596 \li paintEvent() is called whenever the widget needs to be repainted. -
597 Every widget displaying custom content must implement it. Painting -
598 using a QPainter can only take place in a paintEvent() or a -
599 function called by a paintEvent(). -
600 \li resizeEvent() is called when the widget has been resized. -
601 \li mousePressEvent() is called when a mouse button is pressed while -
602 the mouse cursor is inside the widget, or when the widget has -
603 grabbed the mouse using grabMouse(). Pressing the mouse without -
604 releasing it is effectively the same as calling grabMouse(). -
605 \li mouseReleaseEvent() is called when a mouse button is released. A -
606 widget receives mouse release events when it has received the -
607 corresponding mouse press event. This means that if the user -
608 presses the mouse inside \e your widget, then drags the mouse -
609 somewhere else before releasing the mouse button, \e your widget -
610 receives the release event. There is one exception: if a popup menu -
611 appears while the mouse button is held down, this popup immediately -
612 steals the mouse events. -
613 \li mouseDoubleClickEvent() is called when the user double-clicks in -
614 the widget. If the user double-clicks, the widget receives a mouse -
615 press event, a mouse release event, (a mouse click event,) a second -
616 mouse press, this event and finally a second mouse release event. -
617 (Some mouse move events may also be -
618 received if the mouse is not held steady during this operation.) It -
619 is \e{not possible} to distinguish a click from a double-click -
620 until the second click arrives. (This is one reason why most GUI -
621 books recommend that double-clicks be an extension of -
622 single-clicks, rather than trigger a different action.) -
623 \endlist -
624 -
625 Widgets that accept keyboard input need to reimplement a few more event -
626 handlers: -
627 -
628 \list -
629 \li keyPressEvent() is called whenever a key is pressed, and again when -
630 a key has been held down long enough for it to auto-repeat. The -
631 \uicontrol Tab and \uicontrol Shift+Tab keys are only passed to the widget if -
632 they are not used by the focus-change mechanisms. To force those -
633 keys to be processed by your widget, you must reimplement -
634 QWidget::event(). -
635 \li focusInEvent() is called when the widget gains keyboard focus -
636 (assuming you have called setFocusPolicy()). Well-behaved widgets -
637 indicate that they own the keyboard focus in a clear but discreet -
638 way. -
639 \li focusOutEvent() is called when the widget loses keyboard focus. -
640 \endlist -
641 -
642 You may be required to also reimplement some of the less common event -
643 handlers: -
644 -
645 \list -
646 \li mouseMoveEvent() is called whenever the mouse moves while a mouse -
647 button is held down. This can be useful during drag and drop -
648 operations. If you call \l{setMouseTracking()}{setMouseTracking}(true), -
649 you get mouse move events even when no buttons are held down. -
650 (See also the \l{Drag and Drop} guide.) -
651 \li keyReleaseEvent() is called whenever a key is released and while it -
652 is held down (if the key is auto-repeating). In that case, the -
653 widget will receive a pair of key release and key press event for -
654 every repeat. The \uicontrol Tab and \uicontrol Shift+Tab keys are only passed -
655 to the widget if they are not used by the focus-change mechanisms. -
656 To force those keys to be processed by your widget, you must -
657 reimplement QWidget::event(). -
658 \li wheelEvent() is called whenever the user turns the mouse wheel -
659 while the widget has the focus. -
660 \li enterEvent() is called when the mouse enters the widget's screen -
661 space. (This excludes screen space owned by any of the widget's -
662 children.) -
663 \li leaveEvent() is called when the mouse leaves the widget's screen -
664 space. If the mouse enters a child widget it will not cause a -
665 leaveEvent(). -
666 \li moveEvent() is called when the widget has been moved relative to -
667 its parent. -
668 \li closeEvent() is called when the user closes the widget (or when -
669 close() is called). -
670 \endlist -
671 -
672 There are also some rather obscure events described in the documentation -
673 for QEvent::Type. To handle these events, you need to reimplement event() -
674 directly. -
675 -
676 The default implementation of event() handles \uicontrol Tab and \uicontrol Shift+Tab -
677 (to move the keyboard focus), and passes on most of the other events to -
678 one of the more specialized handlers above. -
679 -
680 Events and the mechanism used to deliver them are covered in -
681 \l{The Event System}. -
682 -
683 \section1 Groups of Functions and Properties -
684 -
685 \table -
686 \header \li Context \li Functions and Properties -
687 -
688 \row \li Window functions \li -
689 show(), -
690 hide(), -
691 raise(), -
692 lower(), -
693 close(). -
694 -
695 \row \li Top-level windows \li -
696 \l windowModified, \l windowTitle, \l windowIcon, \l windowIconText, -
697 \l isActiveWindow, activateWindow(), \l minimized, showMinimized(), -
698 \l maximized, showMaximized(), \l fullScreen, showFullScreen(), -
699 showNormal(). -
700 -
701 \row \li Window contents \li -
702 update(), -
703 repaint(), -
704 scroll(). -
705 -
706 \row \li Geometry \li -
707 \l pos, x(), y(), \l rect, \l size, width(), height(), move(), resize(), -
708 \l sizePolicy, sizeHint(), minimumSizeHint(), -
709 updateGeometry(), layout(), -
710 \l frameGeometry, \l geometry, \l childrenRect, \l childrenRegion, -
711 adjustSize(), -
712 mapFromGlobal(), mapToGlobal(), -
713 mapFromParent(), mapToParent(), -
714 \l maximumSize, \l minimumSize, \l sizeIncrement, -
715 \l baseSize, setFixedSize() -
716 -
717 \row \li Mode \li -
718 \l visible, isVisibleTo(), -
719 \l enabled, isEnabledTo(), -
720 \l modal, -
721 isWindow(), -
722 \l mouseTracking, -
723 \l updatesEnabled, -
724 visibleRegion(). -
725 -
726 \row \li Look and feel \li -
727 style(), -
728 setStyle(), -
729 \l styleSheet, -
730 \l cursor, -
731 \l font, -
732 \l palette, -
733 backgroundRole(), setBackgroundRole(), -
734 fontInfo(), fontMetrics(). -
735 -
736 \row \li Keyboard focus functions \li -
737 \l focus, \l focusPolicy, -
738 setFocus(), clearFocus(), setTabOrder(), setFocusProxy(), -
739 focusNextChild(), focusPreviousChild(). -
740 -
741 \row \li Mouse and keyboard grabbing \li -
742 grabMouse(), releaseMouse(), -
743 grabKeyboard(), releaseKeyboard(), -
744 mouseGrabber(), keyboardGrabber(). -
745 -
746 \row \li Event handlers \li -
747 event(), -
748 mousePressEvent(), -
749 mouseReleaseEvent(), -
750 mouseDoubleClickEvent(), -
751 mouseMoveEvent(), -
752 keyPressEvent(), -
753 keyReleaseEvent(), -
754 focusInEvent(), -
755 focusOutEvent(), -
756 wheelEvent(), -
757 enterEvent(), -
758 leaveEvent(), -
759 paintEvent(), -
760 moveEvent(), -
761 resizeEvent(), -
762 closeEvent(), -
763 dragEnterEvent(), -
764 dragMoveEvent(), -
765 dragLeaveEvent(), -
766 dropEvent(), -
767 childEvent(), -
768 showEvent(), -
769 hideEvent(), -
770 customEvent(). -
771 changeEvent(), -
772 -
773 \row \li System functions \li -
774 parentWidget(), window(), setParent(), winId(), -
775 find(), metric(). -
776 -
777 \row \li Interactive help \li -
778 setToolTip(), setWhatsThis() -
779 -
780 \endtable -
781 -
782 -
783 \section1 Widget Style Sheets -
784 -
785 In addition to the standard widget styles for each platform, widgets can -
786 also be styled according to rules specified in a \l{styleSheet} -
787 {style sheet}. This feature enables you to customize the appearance of -
788 specific widgets to provide visual cues to users about their purpose. For -
789 example, a button could be styled in a particular way to indicate that it -
790 performs a destructive action. -
791 -
792 The use of widget style sheets is described in more detail in the -
793 \l{Qt Style Sheets} document. -
794 -
795 -
796 \section1 Transparency and Double Buffering -
797 -
798 Since Qt 4.0, QWidget automatically double-buffers its painting, so there -
799 is no need to write double-buffering code in paintEvent() to avoid -
800 flicker. -
801 -
802 Since Qt 4.1, the Qt::WA_ContentsPropagated widget attribute has been -
803 deprecated. Instead, the contents of parent widgets are propagated by -
804 default to each of their children as long as Qt::WA_PaintOnScreen is not -
805 set. Custom widgets can be written to take advantage of this feature by -
806 updating irregular regions (to create non-rectangular child widgets), or -
807 painting with colors that have less than full alpha component. The -
808 following diagram shows how attributes and properties of a custom widget -
809 can be fine-tuned to achieve different effects. -
810 -
811 \image propagation-custom.png -
812 -
813 In the above diagram, a semi-transparent rectangular child widget with an -
814 area removed is constructed and added to a parent widget (a QLabel showing -
815 a pixmap). Then, different properties and widget attributes are set to -
816 achieve different effects: -
817 -
818 \list -
819 \li The left widget has no additional properties or widget attributes -
820 set. This default state suits most custom widgets using -
821 transparency, are irregularly-shaped, or do not paint over their -
822 entire area with an opaque brush. -
823 \li The center widget has the \l autoFillBackground property set. This -
824 property is used with custom widgets that rely on the widget to -
825 supply a default background, and do not paint over their entire -
826 area with an opaque brush. -
827 \li The right widget has the Qt::WA_OpaquePaintEvent widget attribute -
828 set. This indicates that the widget will paint over its entire area -
829 with opaque colors. The widget's area will initially be -
830 \e{uninitialized}, represented in the diagram with a red diagonal -
831 grid pattern that shines through the overpainted area. The -
832 Qt::WA_OpaquePaintArea attribute is useful for widgets that need to -
833 paint their own specialized contents quickly and do not need a -
834 default filled background. -
835 \endlist -
836 -
837 To rapidly update custom widgets with simple background colors, such as -
838 real-time plotting or graphing widgets, it is better to define a suitable -
839 background color (using setBackgroundRole() with the -
840 QPalette::Window role), set the \l autoFillBackground property, and only -
841 implement the necessary drawing functionality in the widget's paintEvent(). -
842 -
843 To rapidly update custom widgets that constantly paint over their entire -
844 areas with opaque content, e.g., video streaming widgets, it is better to -
845 set the widget's Qt::WA_OpaquePaintEvent, avoiding any unnecessary overhead -
846 associated with repainting the widget's background. -
847 -
848 If a widget has both the Qt::WA_OpaquePaintEvent widget attribute \e{and} -
849 the \l autoFillBackground property set, the Qt::WA_OpaquePaintEvent -
850 attribute takes precedence. Depending on your requirements, you should -
851 choose either one of them. -
852 -
853 Since Qt 4.1, the contents of parent widgets are also propagated to -
854 standard Qt widgets. This can lead to some unexpected results if the -
855 parent widget is decorated in a non-standard way, as shown in the diagram -
856 below. -
857 -
858 \image propagation-standard.png -
859 -
860 The scope for customizing the painting behavior of standard Qt widgets, -
861 without resorting to subclassing, is slightly less than that possible for -
862 custom widgets. Usually, the desired appearance of a standard widget can be -
863 achieved by setting its \l autoFillBackground property. -
864 -
865 -
866 \section1 Creating Translucent Windows -
867 -
868 Since Qt 4.5, it has been possible to create windows with translucent regions -
869 on window systems that support compositing. -
870 -
871 To enable this feature in a top-level widget, set its Qt::WA_TranslucentBackground -
872 attribute with setAttribute() and ensure that its background is painted with -
873 non-opaque colors in the regions you want to be partially transparent. -
874 -
875 Platform notes: -
876 -
877 \list -
878 \li X11: This feature relies on the use of an X server that supports ARGB visuals -
879 and a compositing window manager. -
880 \li Windows: The widget needs to have the Qt::FramelessWindowHint window flag set -
881 for the translucency to work. -
882 \endlist -
883 -
884 -
885 \section1 Native Widgets vs Alien Widgets -
886 -
887 Introduced in Qt 4.4, alien widgets are widgets unknown to the windowing -
888 system. They do not have a native window handle associated with them. This -
889 feature significantly speeds up widget painting, resizing, and removes flicker. -
890 -
891 Should you require the old behavior with native windows, you can choose -
892 one of the following options: -
893 -
894 \list 1 -
895 \li Use the \c{QT_USE_NATIVE_WINDOWS=1} in your environment. -
896 \li Set the Qt::AA_NativeWindows attribute on your application. All -
897 widgets will be native widgets. -
898 \li Set the Qt::WA_NativeWindow attribute on widgets: The widget itself -
899 and all of its ancestors will become native (unless -
900 Qt::WA_DontCreateNativeAncestors is set). -
901 \li Call QWidget::winId to enforce a native window (this implies 3). -
902 \li Set the Qt::WA_PaintOnScreen attribute to enforce a native window -
903 (this implies 3). -
904 \endlist -
905 -
906 \sa QEvent, QPainter, QGridLayout, QBoxLayout -
907 -
908*/ -
909 -
910QWidgetMapper *QWidgetPrivate::mapper = 0; // widget with wid -
911QWidgetSet *QWidgetPrivate::allWidgets = 0; // widgets with no wid -
912 -
913 -
914/***************************************************************************** -
915 QWidget utility functions -
916 *****************************************************************************/ -
917 -
918QRegion qt_dirtyRegion(QWidget *widget) -
919{ -
920 if (!widget)
never evaluated: !widget
0
921 return QRegion();
never executed: return QRegion();
0
922 -
923 QWidgetBackingStore *bs = qt_widget_private(widget)->maybeBackingStore();
never executed (the execution status of this line is deduced): QWidgetBackingStore *bs = qt_widget_private(widget)->maybeBackingStore();
-
924 if (!bs)
never evaluated: !bs
0
925 return QRegion();
never executed: return QRegion();
0
926 -
927 return bs->dirtyRegion(widget);
never executed: return bs->dirtyRegion(widget);
0
928} -
929 -
930/***************************************************************************** -
931 QWidget member functions -
932 *****************************************************************************/ -
933 -
934/* -
935 Widget state flags: -
936 \list -
937 \li Qt::WA_WState_Created The widget has a valid winId(). -
938 \li Qt::WA_WState_Visible The widget is currently visible. -
939 \li Qt::WA_WState_Hidden The widget is hidden, i.e. it won't -
940 become visible unless you call show() on it. Qt::WA_WState_Hidden -
941 implies !Qt::WA_WState_Visible. -
942 \li Qt::WA_WState_CompressKeys Compress keyboard events. -
943 \li Qt::WA_WState_BlockUpdates Repaints and updates are disabled. -
944 \li Qt::WA_WState_InPaintEvent Currently processing a paint event. -
945 \li Qt::WA_WState_Reparented The widget has been reparented. -
946 \li Qt::WA_WState_ConfigPending A configuration (resize/move) event is pending. -
947 \li Qt::WA_WState_DND (Deprecated) The widget supports drag and drop, see setAcceptDrops(). -
948 \endlist -
949*/ -
950 -
951struct QWidgetExceptionCleaner -
952{ -
953 /* this cleans up when the constructor throws an exception */ -
954 static inline void cleanup(QWidget *that, QWidgetPrivate *d) -
955 { -
956#ifdef QT_NO_EXCEPTIONS -
957 Q_UNUSED(that);
never executed (the execution status of this line is deduced): (void)that;;
-
958 Q_UNUSED(d);
never executed (the execution status of this line is deduced): (void)d;;
-
959#else -
960 QWidgetPrivate::allWidgets->remove(that); -
961 if (d->focus_next != that) { -
962 if (d->focus_next) -
963 d->focus_next->d_func()->focus_prev = d->focus_prev; -
964 if (d->focus_prev) -
965 d->focus_prev->d_func()->focus_next = d->focus_next; -
966 } -
967#endif -
968 }
never executed: }
0
969}; -
970 -
971/*! -
972 Constructs a widget which is a child of \a parent, with widget -
973 flags set to \a f. -
974 -
975 If \a parent is 0, the new widget becomes a window. If -
976 \a parent is another widget, this widget becomes a child window -
977 inside \a parent. The new widget is deleted when its \a parent is -
978 deleted. -
979 -
980 The widget flags argument, \a f, is normally 0, but it can be set -
981 to customize the frame of a window (i.e. \a -
982 parent must be 0). To customize the frame, use a value composed -
983 from the bitwise OR of any of the \l{Qt::WindowFlags}{window flags}. -
984 -
985 If you add a child widget to an already visible widget you must -
986 explicitly show the child to make it visible. -
987 -
988 Note that the X11 version of Qt may not be able to deliver all -
989 combinations of style flags on all systems. This is because on -
990 X11, Qt can only ask the window manager, and the window manager -
991 can override the application's settings. On Windows, Qt can set -
992 whatever flags you want. -
993 -
994 \sa windowFlags -
995*/ -
996QWidget::QWidget(QWidget *parent, Qt::WindowFlags f) -
997 : QObject(*new QWidgetPrivate, 0), QPaintDevice() -
998{ -
999 QT_TRY {
partially evaluated: true
TRUEFALSE
yes
Evaluation Count:19087
no
Evaluation Count:0
0-19087
1000 d_func()->init(parent, f);
executed (the execution status of this line is deduced): d_func()->init(parent, f);
-
1001 } QT_CATCH(...) {
executed: }
Execution Count:19087
19087
1002 QWidgetExceptionCleaner::cleanup(this, d_func());
never executed (the execution status of this line is deduced): QWidgetExceptionCleaner::cleanup(this, d_func());
-
1003 QT_RETHROW;
never executed (the execution status of this line is deduced): qt_noop();
-
1004 }
never executed: }
0
1005} -
1006 -
1007 -
1008/*! \internal -
1009*/ -
1010QWidget::QWidget(QWidgetPrivate &dd, QWidget* parent, Qt::WindowFlags f) -
1011 : QObject(dd, 0), QPaintDevice() -
1012{ -
1013 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
1014 QT_TRY {
partially evaluated: true
TRUEFALSE
yes
Evaluation Count:26475
no
Evaluation Count:0
0-26475
1015 d->init(parent, f);
executed (the execution status of this line is deduced): d->init(parent, f);
-
1016 } QT_CATCH(...) {
executed: }
Execution Count:26475
26475
1017 QWidgetExceptionCleaner::cleanup(this, d_func());
never executed (the execution status of this line is deduced): QWidgetExceptionCleaner::cleanup(this, d_func());
-
1018 QT_RETHROW;
never executed (the execution status of this line is deduced): qt_noop();
-
1019 }
never executed: }
0
1020} -
1021 -
1022/*! -
1023 \internal -
1024*/ -
1025int QWidget::devType() const -
1026{ -
1027 return QInternal::Widget;
executed: return QInternal::Widget;
Execution Count:45474
45474
1028} -
1029 -
1030 -
1031//### w is a "this" ptr, passed as a param because QWorkspace needs special logic -
1032void QWidgetPrivate::adjustFlags(Qt::WindowFlags &flags, QWidget *w) -
1033{ -
1034 bool customize = (flags & (Qt::CustomizeWindowHint
executed (the execution status of this line is deduced): bool customize = (flags & (Qt::CustomizeWindowHint
-
1035 | Qt::FramelessWindowHint
executed (the execution status of this line is deduced): | Qt::FramelessWindowHint
-
1036 | Qt::WindowTitleHint
executed (the execution status of this line is deduced): | Qt::WindowTitleHint
-
1037 | Qt::WindowSystemMenuHint
executed (the execution status of this line is deduced): | Qt::WindowSystemMenuHint
-
1038 | Qt::WindowMinimizeButtonHint
executed (the execution status of this line is deduced): | Qt::WindowMinimizeButtonHint
-
1039 | Qt::WindowMaximizeButtonHint
executed (the execution status of this line is deduced): | Qt::WindowMaximizeButtonHint
-
1040 | Qt::WindowCloseButtonHint
executed (the execution status of this line is deduced): | Qt::WindowCloseButtonHint
-
1041 | Qt::WindowContextHelpButtonHint));
executed (the execution status of this line is deduced): | Qt::WindowContextHelpButtonHint));
-
1042 -
1043 uint type = (flags & Qt::WindowType_Mask);
executed (the execution status of this line is deduced): uint type = (flags & Qt::WindowType_Mask);
-
1044 -
1045 if ((type == Qt::Widget || type == Qt::SubWindow) && w && !w->parent()) {
evaluated: type == Qt::Widget
TRUEFALSE
yes
Evaluation Count:47693
yes
Evaluation Count:1699
evaluated: type == Qt::SubWindow
TRUEFALSE
yes
Evaluation Count:21
yes
Evaluation Count:1678
partially evaluated: w
TRUEFALSE
yes
Evaluation Count:47714
no
Evaluation Count:0
evaluated: !w->parent()
TRUEFALSE
yes
Evaluation Count:7387
yes
Evaluation Count:40327
0-47714
1046 type = Qt::Window;
executed (the execution status of this line is deduced): type = Qt::Window;
-
1047 flags |= Qt::Window;
executed (the execution status of this line is deduced): flags |= Qt::Window;
-
1048 }
executed: }
Execution Count:7387
7387
1049 -
1050 if (flags & Qt::CustomizeWindowHint) {
partially evaluated: flags & Qt::CustomizeWindowHint
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:49392
0-49392
1051 // modify window flags to make them consistent. -
1052 // Only enable this on non-Mac platforms. Since the old way of doing this would -
1053 // interpret WindowSystemMenuHint as a close button and we can't change that behavior -
1054 // we can't just add this in. -
1055#ifndef Q_WS_MAC -
1056 if (flags & (Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint | Qt::WindowContextHelpButtonHint)) {
never evaluated: flags & (Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint | Qt::WindowContextHelpButtonHint)
0
1057 flags |= Qt::WindowSystemMenuHint;
never executed (the execution status of this line is deduced): flags |= Qt::WindowSystemMenuHint;
-
1058#else -
1059 if (flags & (Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint -
1060 | Qt::WindowSystemMenuHint)) { -
1061#endif -
1062 flags |= Qt::WindowTitleHint;
never executed (the execution status of this line is deduced): flags |= Qt::WindowTitleHint;
-
1063 flags &= ~Qt::FramelessWindowHint;
never executed (the execution status of this line is deduced): flags &= ~Qt::FramelessWindowHint;
-
1064 }
never executed: }
0
1065 } else if (customize && !(flags & Qt::FramelessWindowHint)) {
never executed: }
evaluated: customize
TRUEFALSE
yes
Evaluation Count:3805
yes
Evaluation Count:45587
evaluated: !(flags & Qt::FramelessWindowHint)
TRUEFALSE
yes
Evaluation Count:3547
yes
Evaluation Count:258
0-45587
1066 // if any of the window hints that affect the titlebar are set -
1067 // and the window is supposed to have frame, we add a titlebar -
1068 // and system menu by default. -
1069 flags |= Qt::WindowSystemMenuHint;
executed (the execution status of this line is deduced): flags |= Qt::WindowSystemMenuHint;
-
1070 flags |= Qt::WindowTitleHint;
executed (the execution status of this line is deduced): flags |= Qt::WindowTitleHint;
-
1071 }
executed: }
Execution Count:3547
3547
1072 if (customize)
evaluated: customize
TRUEFALSE
yes
Evaluation Count:3805
yes
Evaluation Count:45587
3805-45587
1073 ; // don't modify window flags if the user explicitly set them.
executed: ;
Execution Count:3805
3805
1074 else if (type == Qt::Dialog || type == Qt::Sheet)
evaluated: type == Qt::Dialog
TRUEFALSE
yes
Evaluation Count:339
yes
Evaluation Count:45248
evaluated: type == Qt::Sheet
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:45247
1-45248
1075#ifndef Q_OS_WINCE -
1076 flags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowContextHelpButtonHint | Qt::WindowCloseButtonHint;
executed: flags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowContextHelpButtonHint | Qt::WindowCloseButtonHint;
Execution Count:340
340
1077#else -
1078 flags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint; -
1079#endif -
1080 else if (type == Qt::Tool)
evaluated: type == Qt::Tool
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:45240
7-45240
1081 flags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint;
executed: flags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint;
Execution Count:7
7
1082 else -
1083 flags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinimizeButtonHint |
executed: flags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinimizeButtonHint | Qt::WindowMaximizeButtonHint | Qt::WindowCloseButtonHint | Qt::WindowFullscreenButtonHint;
Execution Count:45240
45240
1084 Qt::WindowMaximizeButtonHint | Qt::WindowCloseButtonHint | Qt::WindowFullscreenButtonHint;
executed: flags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinimizeButtonHint | Qt::WindowMaximizeButtonHint | Qt::WindowCloseButtonHint | Qt::WindowFullscreenButtonHint;
Execution Count:45240
45240
1085 -
1086} -
1087 -
1088void QWidgetPrivate::init(QWidget *parentWidget, Qt::WindowFlags f) -
1089{ -
1090 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
1091 if (!qobject_cast<QApplication *>(QCoreApplication::instance()))
partially evaluated: !qobject_cast<QApplication *>(QCoreApplication::instance())
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:45562
0-45562
1092 qFatal("QWidget: Cannot create a QWidget without QApplication");
never executed: QMessageLogger("kernel/qwidget.cpp", 1092, __PRETTY_FUNCTION__).fatal("QWidget: Cannot create a QWidget without QApplication");
0
1093 -
1094 Q_ASSERT(allWidgets);
executed (the execution status of this line is deduced): qt_noop();
-
1095 if (allWidgets)
partially evaluated: allWidgets
TRUEFALSE
yes
Evaluation Count:45562
no
Evaluation Count:0
0-45562
1096 allWidgets->insert(q);
executed: allWidgets->insert(q);
Execution Count:45562
45562
1097 -
1098 QWidget *desktopWidget = 0;
executed (the execution status of this line is deduced): QWidget *desktopWidget = 0;
-
1099 if (parentWidget && parentWidget->windowType() == Qt::Desktop) {
evaluated: parentWidget
TRUEFALSE
yes
Evaluation Count:37602
yes
Evaluation Count:7960
partially evaluated: parentWidget->windowType() == Qt::Desktop
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:37602
0-37602
1100 desktopWidget = parentWidget;
never executed (the execution status of this line is deduced): desktopWidget = parentWidget;
-
1101 parentWidget = 0;
never executed (the execution status of this line is deduced): parentWidget = 0;
-
1102 }
never executed: }
0
1103 -
1104 q->data = &data;
executed (the execution status of this line is deduced): q->data = &data;
-
1105 -
1106#ifndef QT_NO_THREAD -
1107 if (!parent) {
partially evaluated: !parent
TRUEFALSE
yes
Evaluation Count:45562
no
Evaluation Count:0
0-45562
1108 Q_ASSERT_X(q->thread() == qApp->thread(), "QWidget",
executed (the execution status of this line is deduced): qt_noop();
-
1109 "Widgets must be created in the GUI thread."); -
1110 }
executed: }
Execution Count:45562
45562
1111#endif -
1112 -
1113#if defined(Q_WS_X11) -
1114 if (desktopWidget) { -
1115 // make sure the widget is created on the same screen as the -
1116 // programmer specified desktop widget -
1117 xinfo = desktopWidget->d_func()->xinfo; -
1118 } -
1119#endif -
1120 if (desktopWidget) {
partially evaluated: desktopWidget
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:45562
0-45562
1121 const int screen = desktopWidget->d_func()->topData()->screenIndex;
never executed (the execution status of this line is deduced): const int screen = desktopWidget->d_func()->topData()->screenIndex;
-
1122 if (QWindow *window = q->windowHandle())
never evaluated: QWindow *window = q->windowHandle()
0
1123 window->setScreen(QGuiApplication::screens().value(screen, 0));
never executed: window->setScreen(QGuiApplication::screens().value(screen, 0));
0
1124 }
never executed: }
0
1125 -
1126 data.fstrut_dirty = true;
executed (the execution status of this line is deduced): data.fstrut_dirty = true;
-
1127 -
1128 data.winid = 0;
executed (the execution status of this line is deduced): data.winid = 0;
-
1129 data.widget_attributes = 0;
executed (the execution status of this line is deduced): data.widget_attributes = 0;
-
1130 data.window_flags = f;
executed (the execution status of this line is deduced): data.window_flags = f;
-
1131 data.window_state = 0;
executed (the execution status of this line is deduced): data.window_state = 0;
-
1132 data.focus_policy = 0;
executed (the execution status of this line is deduced): data.focus_policy = 0;
-
1133 data.context_menu_policy = Qt::DefaultContextMenu;
executed (the execution status of this line is deduced): data.context_menu_policy = Qt::DefaultContextMenu;
-
1134 data.window_modality = Qt::NonModal;
executed (the execution status of this line is deduced): data.window_modality = Qt::NonModal;
-
1135 -
1136 data.sizehint_forced = 0;
executed (the execution status of this line is deduced): data.sizehint_forced = 0;
-
1137 data.is_closing = 0;
executed (the execution status of this line is deduced): data.is_closing = 0;
-
1138 data.in_show = 0;
executed (the execution status of this line is deduced): data.in_show = 0;
-
1139 data.in_set_window_state = 0;
executed (the execution status of this line is deduced): data.in_set_window_state = 0;
-
1140 data.in_destructor = false;
executed (the execution status of this line is deduced): data.in_destructor = false;
-
1141 -
1142 // Widgets with Qt::MSWindowsOwnDC (typically QGLWidget) must have a window handle. -
1143 if (f & Qt::MSWindowsOwnDC)
evaluated: f & Qt::MSWindowsOwnDC
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:45561
1-45561
1144 q->setAttribute(Qt::WA_NativeWindow);
executed: q->setAttribute(Qt::WA_NativeWindow);
Execution Count:1
1
1145 -
1146//#ifdef Q_WS_MAC -
1147// q->setAttribute(Qt::WA_NativeWindow); -
1148//#endif -
1149 -
1150 q->setAttribute(Qt::WA_QuitOnClose); // might be cleared in adjustQuitOnCloseAttribute()
executed (the execution status of this line is deduced): q->setAttribute(Qt::WA_QuitOnClose);
-
1151 adjustQuitOnCloseAttribute();
executed (the execution status of this line is deduced): adjustQuitOnCloseAttribute();
-
1152 -
1153 q->setAttribute(Qt::WA_WState_Hidden);
executed (the execution status of this line is deduced): q->setAttribute(Qt::WA_WState_Hidden);
-
1154 -
1155 //give potential windows a bigger "pre-initial" size; create_sys() will give them a new size later -
1156 data.crect = parentWidget ? QRect(0,0,100,30) : QRect(0,0,640,480);
evaluated: parentWidget
TRUEFALSE
yes
Evaluation Count:37602
yes
Evaluation Count:7960
7960-37602
1157 focus_next = focus_prev = q;
executed (the execution status of this line is deduced): focus_next = focus_prev = q;
-
1158 -
1159 if ((f & Qt::WindowType_Mask) == Qt::Desktop)
evaluated: (f & Qt::WindowType_Mask) == Qt::Desktop
TRUEFALSE
yes
Evaluation Count:131
yes
Evaluation Count:45431
131-45431
1160 q->create();
executed: q->create();
Execution Count:131
131
1161 else if (parentWidget)
evaluated: parentWidget
TRUEFALSE
yes
Evaluation Count:37602
yes
Evaluation Count:7829
7829-37602
1162 q->setParent(parentWidget, data.window_flags);
executed: q->setParent(parentWidget, data.window_flags);
Execution Count:37602
37602
1163 else { -
1164 adjustFlags(data.window_flags, q);
executed (the execution status of this line is deduced): adjustFlags(data.window_flags, q);
-
1165 resolveLayoutDirection();
executed (the execution status of this line is deduced): resolveLayoutDirection();
-
1166 // opaque system background? -
1167 const QBrush &background = q->palette().brush(QPalette::Window);
executed (the execution status of this line is deduced): const QBrush &background = q->palette().brush(QPalette::Window);
-
1168 setOpaque(q->isWindow() && background.style() != Qt::NoBrush && background.isOpaque());
executed (the execution status of this line is deduced): setOpaque(q->isWindow() && background.style() != Qt::NoBrush && background.isOpaque());
-
1169 }
executed: }
Execution Count:7829
7829
1170 data.fnt = QFont(data.fnt, q);
executed (the execution status of this line is deduced): data.fnt = QFont(data.fnt, q);
-
1171#if defined(Q_WS_X11) -
1172 data.fnt.x11SetScreen(xinfo.screen()); -
1173#endif // Q_WS_X11 -
1174 -
1175 q->setAttribute(Qt::WA_PendingMoveEvent);
executed (the execution status of this line is deduced): q->setAttribute(Qt::WA_PendingMoveEvent);
-
1176 q->setAttribute(Qt::WA_PendingResizeEvent);
executed (the execution status of this line is deduced): q->setAttribute(Qt::WA_PendingResizeEvent);
-
1177 -
1178 if (++QWidgetPrivate::instanceCounter > QWidgetPrivate::maxInstances)
evaluated: ++QWidgetPrivate::instanceCounter > QWidgetPrivate::maxInstances
TRUEFALSE
yes
Evaluation Count:6811
yes
Evaluation Count:38751
6811-38751
1179 QWidgetPrivate::maxInstances = QWidgetPrivate::instanceCounter;
executed: QWidgetPrivate::maxInstances = QWidgetPrivate::instanceCounter;
Execution Count:6811
6811
1180 -
1181 if (QApplicationPrivate::testAttribute(Qt::AA_ImmediateWidgetCreation))
evaluated: QApplicationPrivate::testAttribute(Qt::AA_ImmediateWidgetCreation)
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:45560
2-45560
1182 q->create();
executed: q->create();
Execution Count:2
2
1183 -
1184 QEvent e(QEvent::Create);
executed (the execution status of this line is deduced): QEvent e(QEvent::Create);
-
1185 QApplication::sendEvent(q, &e);
executed (the execution status of this line is deduced): QApplication::sendEvent(q, &e);
-
1186 QApplication::postEvent(q, new QEvent(QEvent::PolishRequest));
executed (the execution status of this line is deduced): QApplication::postEvent(q, new QEvent(QEvent::PolishRequest));
-
1187 -
1188 extraPaintEngine = 0;
executed (the execution status of this line is deduced): extraPaintEngine = 0;
-
1189 -
1190#ifdef Q_WS_MAC -
1191 // If we add a child to the unified toolbar, we have to redirect the painting. -
1192 if (parentWidget && parentWidget->d_func() && parentWidget->d_func()->isInUnifiedToolbar) { -
1193 if (parentWidget->d_func()->unifiedSurface) { -
1194 QWidget *toolbar = parentWidget->d_func()->toolbar_ancestor; -
1195 parentWidget->d_func()->unifiedSurface->recursiveRedirect(toolbar, toolbar, toolbar->d_func()->toolbar_offset); -
1196 } -
1197 } -
1198#endif // Q_WS_MAC -
1199}
executed: }
Execution Count:45562
45562
1200 -
1201 -
1202 -
1203void QWidgetPrivate::createRecursively() -
1204{ -
1205 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
1206 q->create(0, true, true);
executed (the execution status of this line is deduced): q->create(0, true, true);
-
1207 for (int i = 0; i < children.size(); ++i) {
evaluated: i < children.size()
TRUEFALSE
yes
Evaluation Count:1198
yes
Evaluation Count:1203
1198-1203
1208 QWidget *child = qobject_cast<QWidget *>(children.at(i));
executed (the execution status of this line is deduced): QWidget *child = qobject_cast<QWidget *>(children.at(i));
-
1209 if (child && !child->isHidden() && !child->isWindow() && !child->testAttribute(Qt::WA_WState_Created))
evaluated: child
TRUEFALSE
yes
Evaluation Count:784
yes
Evaluation Count:414
evaluated: !child->isHidden()
TRUEFALSE
yes
Evaluation Count:478
yes
Evaluation Count:306
partially evaluated: !child->isWindow()
TRUEFALSE
yes
Evaluation Count:478
no
Evaluation Count:0
partially evaluated: !child->testAttribute(Qt::WA_WState_Created)
TRUEFALSE
yes
Evaluation Count:478
no
Evaluation Count:0
0-784
1210 child->d_func()->createRecursively();
executed: child->d_func()->createRecursively();
Execution Count:478
478
1211 }
executed: }
Execution Count:1198
1198
1212}
executed: }
Execution Count:1203
1203
1213 -
1214 -
1215 -
1216 -
1217/*! -
1218 Creates a new widget window if \a window is 0, otherwise sets the -
1219 widget's window to \a window. -
1220 -
1221 Initializes the window (sets the geometry etc.) if \a -
1222 initializeWindow is true. If \a initializeWindow is false, no -
1223 initialization is performed. This parameter only makes sense if \a -
1224 window is a valid window. -
1225 -
1226 Destroys the old window if \a destroyOldWindow is true. If \a -
1227 destroyOldWindow is false, you are responsible for destroying the -
1228 window yourself (using platform native code). -
1229 -
1230 The QWidget constructor calls create(0,true,true) to create a -
1231 window for this widget. -
1232*/ -
1233 -
1234void QWidget::create(WId window, bool initializeWindow, bool destroyOldWindow) -
1235{ -
1236 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
1237 if (testAttribute(Qt::WA_WState_Created) && window == 0 && internalWinId())
evaluated: testAttribute(Qt::WA_WState_Created)
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:11630
partially evaluated: window == 0
TRUEFALSE
yes
Evaluation Count:13
no
Evaluation Count:0
partially evaluated: internalWinId()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13
0-11630
1238 return;
never executed: return;
0
1239 -
1240 if (d->data.in_destructor)
partially evaluated: d->data.in_destructor
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:11643
0-11643
1241 return;
never executed: return;
0
1242 -
1243 Qt::WindowType type = windowType();
executed (the execution status of this line is deduced): Qt::WindowType type = windowType();
-
1244 Qt::WindowFlags &flags = data->window_flags;
executed (the execution status of this line is deduced): Qt::WindowFlags &flags = data->window_flags;
-
1245 -
1246 if ((type == Qt::Widget || type == Qt::SubWindow) && !parentWidget()) {
evaluated: type == Qt::Widget
TRUEFALSE
yes
Evaluation Count:8910
yes
Evaluation Count:2733
evaluated: type == Qt::SubWindow
TRUEFALSE
yes
Evaluation Count:97
yes
Evaluation Count:2636
partially evaluated: !parentWidget()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:9007
0-9007
1247 type = Qt::Window;
never executed (the execution status of this line is deduced): type = Qt::Window;
-
1248 flags |= Qt::Window;
never executed (the execution status of this line is deduced): flags |= Qt::Window;
-
1249 }
never executed: }
0
1250 -
1251 if (QWidget *parent = parentWidget()) {
evaluated: QWidget *parent = parentWidget()
TRUEFALSE
yes
Evaluation Count:9110
yes
Evaluation Count:2533
2533-9110
1252 if (type & Qt::Window) {
evaluated: type & Qt::Window
TRUEFALSE
yes
Evaluation Count:103
yes
Evaluation Count:9007
103-9007
1253 if (!parent->testAttribute(Qt::WA_WState_Created))
evaluated: !parent->testAttribute(Qt::WA_WState_Created)
TRUEFALSE
yes
Evaluation Count:41
yes
Evaluation Count:62
41-62
1254 parent->createWinId();
executed: parent->createWinId();
Execution Count:41
41
1255 } else if (testAttribute(Qt::WA_NativeWindow) && !parent->internalWinId()
executed: }
Execution Count:103
evaluated: testAttribute(Qt::WA_NativeWindow)
TRUEFALSE
yes
Evaluation Count:40
yes
Evaluation Count:8967
evaluated: !parent->internalWinId()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:36
4-8967
1256 && !testAttribute(Qt::WA_DontCreateNativeAncestors)) {
evaluated: !testAttribute(Qt::WA_DontCreateNativeAncestors)
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2
2
1257 // We're about to create a native child widget that doesn't have a native parent; -
1258 // enforce a native handle for the parent unless the Qt::WA_DontCreateNativeAncestors -
1259 // attribute is set. -
1260 d->createWinId(window);
executed (the execution status of this line is deduced): d->createWinId(window);
-
1261 // Nothing more to do. -
1262 Q_ASSERT(testAttribute(Qt::WA_WState_Created));
executed (the execution status of this line is deduced): qt_noop();
-
1263 Q_ASSERT(internalWinId());
executed (the execution status of this line is deduced): qt_noop();
-
1264 return;
executed: return;
Execution Count:2
2
1265 } -
1266 } -
1267 -
1268 -
1269 static int paintOnScreenEnv = -1; -
1270 if (paintOnScreenEnv == -1)
evaluated: paintOnScreenEnv == -1
TRUEFALSE
yes
Evaluation Count:94
yes
Evaluation Count:11547
94-11547
1271 paintOnScreenEnv = qgetenv("QT_ONSCREEN_PAINT").toInt() > 0 ? 1 : 0;
executed: paintOnScreenEnv = qgetenv("QT_ONSCREEN_PAINT").toInt() > 0 ? 1 : 0;
Execution Count:94
partially evaluated: qgetenv("QT_ONSCREEN_PAINT").toInt() > 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:94
0-94
1272 if (paintOnScreenEnv == 1)
partially evaluated: paintOnScreenEnv == 1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:11641
0-11641
1273 setAttribute(Qt::WA_PaintOnScreen);
never executed: setAttribute(Qt::WA_PaintOnScreen);
0
1274 -
1275 if (QApplicationPrivate::testAttribute(Qt::AA_NativeWindows))
partially evaluated: QApplicationPrivate::testAttribute(Qt::AA_NativeWindows)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:11641
0-11641
1276 setAttribute(Qt::WA_NativeWindow);
never executed: setAttribute(Qt::WA_NativeWindow);
0
1277 -
1278#ifdef ALIEN_DEBUG -
1279 qDebug() << "QWidget::create:" << this << "parent:" << parentWidget() -
1280 << "Alien?" << !testAttribute(Qt::WA_NativeWindow); -
1281#endif -
1282 -
1283#if defined (Q_WS_WIN) && !defined(QT_NO_DRAGANDDROP) -
1284 // Unregister the dropsite (if already registered) before we -
1285 // re-create the widget with a native window. -
1286 if (testAttribute(Qt::WA_WState_Created) && !internalWinId() && testAttribute(Qt::WA_NativeWindow) -
1287 && d->extra && d->extra->dropTarget) { -
1288 d->registerDropSite(false); -
1289 } -
1290#endif // defined (Q_WS_WIN) && !defined(QT_NO_DRAGANDDROP) -
1291 -
1292 d->updateIsOpaque();
executed (the execution status of this line is deduced): d->updateIsOpaque();
-
1293 -
1294 setAttribute(Qt::WA_WState_Created); // set created flag
executed (the execution status of this line is deduced): setAttribute(Qt::WA_WState_Created);
-
1295 d->create_sys(window, initializeWindow, destroyOldWindow);
executed (the execution status of this line is deduced): d->create_sys(window, initializeWindow, destroyOldWindow);
-
1296 -
1297 // a real toplevel window needs a backing store -
1298 if (isWindow() && windowType() != Qt::Desktop) {
evaluated: isWindow()
TRUEFALSE
yes
Evaluation Count:2636
yes
Evaluation Count:9005
evaluated: windowType() != Qt::Desktop
TRUEFALSE
yes
Evaluation Count:2504
yes
Evaluation Count:132
132-9005
1299 d->topData()->backingStoreTracker.destroy();
executed (the execution status of this line is deduced): d->topData()->backingStoreTracker.destroy();
-
1300 if (hasBackingStoreSupport())
partially evaluated: hasBackingStoreSupport()
TRUEFALSE
yes
Evaluation Count:2504
no
Evaluation Count:0
0-2504
1301 d->topData()->backingStoreTracker.create(this);
executed: d->topData()->backingStoreTracker.create(this);
Execution Count:2504
2504
1302 }
executed: }
Execution Count:2504
2504
1303 -
1304 d->setModal_sys();
executed (the execution status of this line is deduced): d->setModal_sys();
-
1305 -
1306 if (!isWindow() && parentWidget() && parentWidget()->testAttribute(Qt::WA_DropSiteRegistered))
evaluated: !isWindow()
TRUEFALSE
yes
Evaluation Count:9005
yes
Evaluation Count:2636
partially evaluated: parentWidget()
TRUEFALSE
yes
Evaluation Count:9005
no
Evaluation Count:0
evaluated: parentWidget()->testAttribute(Qt::WA_DropSiteRegistered)
TRUEFALSE
yes
Evaluation Count:1904
yes
Evaluation Count:7101
0-9005
1307 setAttribute(Qt::WA_DropSiteRegistered, true);
executed: setAttribute(Qt::WA_DropSiteRegistered, true);
Execution Count:1904
1904
1308 -
1309#ifdef QT_EVAL -
1310 extern void qt_eval_init_widget(QWidget *w); -
1311 qt_eval_init_widget(this); -
1312#endif -
1313 -
1314 // need to force the resting of the icon after changing parents -
1315 if (testAttribute(Qt::WA_SetWindowIcon))
partially evaluated: testAttribute(Qt::WA_SetWindowIcon)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:11641
0-11641
1316 d->setWindowIcon_sys();
never executed: d->setWindowIcon_sys();
0
1317 -
1318 if (isWindow() && !d->topData()->iconText.isEmpty())
evaluated: isWindow()
TRUEFALSE
yes
Evaluation Count:2636
yes
Evaluation Count:9005
partially evaluated: !d->topData()->iconText.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2636
0-9005
1319 d->setWindowIconText_helper(d->topData()->iconText);
never executed: d->setWindowIconText_helper(d->topData()->iconText);
0
1320 if (isWindow() && !d->topData()->caption.isEmpty())
evaluated: isWindow()
TRUEFALSE
yes
Evaluation Count:2636
yes
Evaluation Count:9005
evaluated: !d->topData()->caption.isEmpty()
TRUEFALSE
yes
Evaluation Count:128
yes
Evaluation Count:2508
128-9005
1321 d->setWindowTitle_helper(d->topData()->caption);
executed: d->setWindowTitle_helper(d->topData()->caption);
Execution Count:128
128
1322 if (windowType() != Qt::Desktop) {
evaluated: windowType() != Qt::Desktop
TRUEFALSE
yes
Evaluation Count:11509
yes
Evaluation Count:132
132-11509
1323 d->updateSystemBackground();
executed (the execution status of this line is deduced): d->updateSystemBackground();
-
1324 -
1325 if (isWindow() && !testAttribute(Qt::WA_SetWindowIcon))
evaluated: isWindow()
TRUEFALSE
yes
Evaluation Count:2504
yes
Evaluation Count:9005
partially evaluated: !testAttribute(Qt::WA_SetWindowIcon)
TRUEFALSE
yes
Evaluation Count:2504
no
Evaluation Count:0
0-9005
1326 d->setWindowIcon_sys();
executed: d->setWindowIcon_sys();
Execution Count:2504
2504
1327 }
executed: }
Execution Count:11509
11509
1328 -
1329 // Frame strut update needed in cases where there are native widgets such as QGLWidget, -
1330 // as those force native window creation on their ancestors before they are shown. -
1331 // If the strut is not updated, any subsequent move of the top level window before show -
1332 // will cause window frame to be ignored when positioning the window. -
1333 // Note that this only helps on platforms that handle window creation synchronously. -
1334 d->updateFrameStrut();
executed (the execution status of this line is deduced): d->updateFrameStrut();
-
1335}
executed: }
Execution Count:11641
11641
1336 -
1337/*! -
1338 Destroys the widget. -
1339 -
1340 All this widget's children are deleted first. The application -
1341 exits if this widget is the main widget. -
1342*/ -
1343 -
1344QWidget::~QWidget() -
1345{ -
1346 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
1347 d->data.in_destructor = true;
executed (the execution status of this line is deduced): d->data.in_destructor = true;
-
1348 -
1349#if defined (QT_CHECK_STATE) -
1350 if (paintingActive()) -
1351 qWarning("QWidget: %s (%s) deleted while being painted", className(), name()); -
1352#endif -
1353 -
1354#ifndef QT_NO_GESTURES -
1355 foreach (Qt::GestureType type, d->gestureContext.keys())
executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(d->gestureContext.keys())> _container_(d->gestureContext.keys()); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (Qt::GestureType type = *_container_.i;; __extension__ ({--_container_.brk; break;}))
-
1356 ungrabGesture(type);
executed: ungrabGesture(type);
Execution Count:5414
5414
1357#endif -
1358 -
1359 // force acceptDrops false before winId is destroyed. -
1360 d->registerDropSite(false);
executed (the execution status of this line is deduced): d->registerDropSite(false);
-
1361 -
1362#ifndef QT_NO_ACTION -
1363 // remove all actions from this widget -
1364 for (int i = 0; i < d->actions.size(); ++i) {
evaluated: i < d->actions.size()
TRUEFALSE
yes
Evaluation Count:3290
yes
Evaluation Count:41486
3290-41486
1365 QActionPrivate *apriv = d->actions.at(i)->d_func();
executed (the execution status of this line is deduced): QActionPrivate *apriv = d->actions.at(i)->d_func();
-
1366 apriv->widgets.removeAll(this);
executed (the execution status of this line is deduced): apriv->widgets.removeAll(this);
-
1367 }
executed: }
Execution Count:3290
3290
1368 d->actions.clear();
executed (the execution status of this line is deduced): d->actions.clear();
-
1369#endif -
1370 -
1371#ifndef QT_NO_SHORTCUT -
1372 // Remove all shortcuts grabbed by this -
1373 // widget, unless application is closing -
1374 if (!QApplicationPrivate::is_app_closing && testAttribute(Qt::WA_GrabbedShortcut))
evaluated: !QApplicationPrivate::is_app_closing
TRUEFALSE
yes
Evaluation Count:41270
yes
Evaluation Count:216
evaluated: testAttribute(Qt::WA_GrabbedShortcut)
TRUEFALSE
yes
Evaluation Count:1479
yes
Evaluation Count:39791
216-41270
1375 qApp->d_func()->shortcutMap.removeShortcut(0, this, QKeySequence());
executed: (static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->shortcutMap.removeShortcut(0, this, QKeySequence());
Execution Count:1479
1479
1376#endif -
1377 -
1378 // delete layout while we still are a valid widget -
1379 delete d->layout;
executed (the execution status of this line is deduced): delete d->layout;
-
1380 d->layout = 0;
executed (the execution status of this line is deduced): d->layout = 0;
-
1381 // Remove myself from focus list -
1382 -
1383 Q_ASSERT(d->focus_next->d_func()->focus_prev == this);
executed (the execution status of this line is deduced): qt_noop();
-
1384 Q_ASSERT(d->focus_prev->d_func()->focus_next == this);
executed (the execution status of this line is deduced): qt_noop();
-
1385 -
1386 if (d->focus_next != this) {
evaluated: d->focus_next != this
TRUEFALSE
yes
Evaluation Count:36280
yes
Evaluation Count:5206
5206-36280
1387 d->focus_next->d_func()->focus_prev = d->focus_prev;
executed (the execution status of this line is deduced): d->focus_next->d_func()->focus_prev = d->focus_prev;
-
1388 d->focus_prev->d_func()->focus_next = d->focus_next;
executed (the execution status of this line is deduced): d->focus_prev->d_func()->focus_next = d->focus_next;
-
1389 d->focus_next = d->focus_prev = 0;
executed (the execution status of this line is deduced): d->focus_next = d->focus_prev = 0;
-
1390 }
executed: }
Execution Count:36280
36280
1391 -
1392 -
1393 QT_TRY {
partially evaluated: true
TRUEFALSE
yes
Evaluation Count:41486
no
Evaluation Count:0
0-41486
1394#ifndef QT_NO_GRAPHICSVIEW -
1395 const QWidget* w = this;
executed (the execution status of this line is deduced): const QWidget* w = this;
-
1396 while (w->d_func()->extra && w->d_func()->extra->focus_proxy)
evaluated: w->d_func()->extra
TRUEFALSE
yes
Evaluation Count:18077
yes
Evaluation Count:29703
evaluated: w->d_func()->extra->focus_proxy
TRUEFALSE
yes
Evaluation Count:6294
yes
Evaluation Count:11783
6294-29703
1397 w = w->d_func()->extra->focus_proxy;
executed: w = w->d_func()->extra->focus_proxy;
Execution Count:6294
6294
1398 QWidget *window = w->window();
executed (the execution status of this line is deduced): QWidget *window = w->window();
-
1399 QWExtra *e = window ? window->d_func()->extra : 0;
partially evaluated: window
TRUEFALSE
yes
Evaluation Count:41486
no
Evaluation Count:0
0-41486
1400 if (!e || !e->proxyWidget)
evaluated: !e
TRUEFALSE
yes
Evaluation Count:10225
yes
Evaluation Count:31261
evaluated: !e->proxyWidget
TRUEFALSE
yes
Evaluation Count:31257
yes
Evaluation Count:4
4-31261
1401#endif -
1402 clearFocus();
executed: clearFocus();
Execution Count:41482
41482
1403 } QT_CATCH(...) {
executed: }
Execution Count:41486
41486
1404 // swallow this problem because we are in a destructor -
1405 }
never executed: }
0
1406 -
1407 d->setDirtyOpaqueRegion();
executed (the execution status of this line is deduced): d->setDirtyOpaqueRegion();
-
1408 -
1409 if (isWindow() && isVisible() && internalWinId()) {
evaluated: isWindow()
TRUEFALSE
yes
Evaluation Count:5206
yes
Evaluation Count:36280
evaluated: isVisible()
TRUEFALSE
yes
Evaluation Count:2096
yes
Evaluation Count:3110
partially evaluated: internalWinId()
TRUEFALSE
yes
Evaluation Count:2096
no
Evaluation Count:0
0-36280
1410 QT_TRY {
partially evaluated: true
TRUEFALSE
yes
Evaluation Count:2096
no
Evaluation Count:0
0-2096
1411 d->close_helper(QWidgetPrivate::CloseNoEvent);
executed (the execution status of this line is deduced): d->close_helper(QWidgetPrivate::CloseNoEvent);
-
1412 } QT_CATCH(...) {
executed: }
Execution Count:2096
2096
1413 // if we're out of memory, at least hide the window. -
1414 QT_TRY {
never evaluated: true
0
1415 hide();
never executed (the execution status of this line is deduced): hide();
-
1416 } QT_CATCH(...) {
never executed: }
0
1417 // and if that also doesn't work, then give up -
1418 }
never executed: }
0
1419 } -
1420 } -
1421 -
1422#if defined(Q_WS_WIN) || defined(Q_WS_X11)|| defined(Q_WS_MAC) -
1423 else if (!internalWinId() && isVisible()) { -
1424 qApp->d_func()->sendSyntheticEnterLeave(this); -
1425 } -
1426#endif -
1427 else if (isVisible()) {
evaluated: isVisible()
TRUEFALSE
yes
Evaluation Count:619
yes
Evaluation Count:38771
619-38771
1428 qApp->d_func()->sendSyntheticEnterLeave(this);
executed (the execution status of this line is deduced): (static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->sendSyntheticEnterLeave(this);
-
1429 }
executed: }
Execution Count:619
619
1430 -
1431 if (QWidgetBackingStore *bs = d->maybeBackingStore()) {
evaluated: QWidgetBackingStore *bs = d->maybeBackingStore()
TRUEFALSE
yes
Evaluation Count:19169
yes
Evaluation Count:22317
19169-22317
1432 bs->removeDirtyWidget(this);
executed (the execution status of this line is deduced): bs->removeDirtyWidget(this);
-
1433 if (testAttribute(Qt::WA_StaticContents))
evaluated: testAttribute(Qt::WA_StaticContents)
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:19166
3-19166
1434 bs->removeStaticWidget(this);
executed: bs->removeStaticWidget(this);
Execution Count:3
3
1435 }
executed: }
Execution Count:19169
19169
1436 -
1437 delete d->needsFlush;
executed (the execution status of this line is deduced): delete d->needsFlush;
-
1438 d->needsFlush = 0;
executed (the execution status of this line is deduced): d->needsFlush = 0;
-
1439 -
1440 // The next 20 lines are duplicated from QObject, but required here -
1441 // since QWidget deletes is children itself -
1442 bool blocked = d->blockSig;
executed (the execution status of this line is deduced): bool blocked = d->blockSig;
-
1443 d->blockSig = 0; // unblock signals so we always emit destroyed()
executed (the execution status of this line is deduced): d->blockSig = 0;
-
1444 -
1445 if (d->isSignalConnected(0)) {
evaluated: d->isSignalConnected(0)
TRUEFALSE
yes
Evaluation Count:3688
yes
Evaluation Count:37798
3688-37798
1446 QT_TRY {
partially evaluated: true
TRUEFALSE
yes
Evaluation Count:3688
no
Evaluation Count:0
0-3688
1447 emit destroyed(this);
executed (the execution status of this line is deduced): destroyed(this);
-
1448 } QT_CATCH(...) {
executed: }
Execution Count:3688
3688
1449 // all the signal/slots connections are still in place - if we don't -
1450 // quit now, we will crash pretty soon. -
1451 qWarning("Detected an unexpected exception in ~QWidget while emitting destroyed().");
never executed (the execution status of this line is deduced): QMessageLogger("kernel/qwidget.cpp", 1451, __PRETTY_FUNCTION__).warning("Detected an unexpected exception in ~QWidget while emitting destroyed().");
-
1452 QT_RETHROW;
never executed (the execution status of this line is deduced): qt_noop();
-
1453 }
never executed: }
0
1454 } -
1455 -
1456 if (d->declarativeData) {
partially evaluated: d->declarativeData
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:41486
0-41486
1457 QAbstractDeclarativeData::destroyed(d->declarativeData, this);
never executed (the execution status of this line is deduced): QAbstractDeclarativeData::destroyed(d->declarativeData, this);
-
1458 d->declarativeData = 0; // don't activate again in ~QObject
never executed (the execution status of this line is deduced): d->declarativeData = 0;
-
1459 }
never executed: }
0
1460 -
1461 d->blockSig = blocked;
executed (the execution status of this line is deduced): d->blockSig = blocked;
-
1462 -
1463#ifdef Q_WS_MAC -
1464 // QCocoaView holds a pointer back to this widget. Clear it now -
1465 // to make sure it's not followed later on. The lifetime of the -
1466 // QCocoaView might exceed the lifetime of this widget in cases -
1467 // where Cocoa itself holds references to it. -
1468 extern void qt_mac_clearCocoaViewQWidgetPointers(QWidget *); -
1469 qt_mac_clearCocoaViewQWidgetPointers(this); -
1470#endif -
1471 -
1472 if (!d->children.isEmpty())
evaluated: !d->children.isEmpty()
TRUEFALSE
yes
Evaluation Count:18909
yes
Evaluation Count:22577
18909-22577
1473 d->deleteChildren();
executed: d->deleteChildren();
Execution Count:18909
18909
1474 -
1475 QApplication::removePostedEvents(this);
executed (the execution status of this line is deduced): QApplication::removePostedEvents(this);
-
1476 -
1477 QT_TRY {
partially evaluated: true
TRUEFALSE
yes
Evaluation Count:41486
no
Evaluation Count:0
0-41486
1478 destroy(); // platform-dependent cleanup
executed (the execution status of this line is deduced): destroy();
-
1479 } QT_CATCH(...) {
executed: }
Execution Count:41486
41486
1480 // if this fails we can't do anything about it but at least we are not allowed to throw. -
1481 }
never executed: }
0
1482 --QWidgetPrivate::instanceCounter;
executed (the execution status of this line is deduced): --QWidgetPrivate::instanceCounter;
-
1483 -
1484 if (QWidgetPrivate::allWidgets) // might have been deleted by ~QApplication
evaluated: QWidgetPrivate::allWidgets
TRUEFALSE
yes
Evaluation Count:41270
yes
Evaluation Count:216
216-41270
1485 QWidgetPrivate::allWidgets->remove(this);
executed: QWidgetPrivate::allWidgets->remove(this);
Execution Count:41270
41270
1486 -
1487 QT_TRY {
partially evaluated: true
TRUEFALSE
yes
Evaluation Count:41486
no
Evaluation Count:0
0-41486
1488 QEvent e(QEvent::Destroy);
executed (the execution status of this line is deduced): QEvent e(QEvent::Destroy);
-
1489 QCoreApplication::sendEvent(this, &e);
executed (the execution status of this line is deduced): QCoreApplication::sendEvent(this, &e);
-
1490 } QT_CATCH(const std::exception&) {
executed: }
Execution Count:41486
41486
1491 // if this fails we can't do anything about it but at least we are not allowed to throw. -
1492 }
never executed: }
0
1493} -
1494 -
1495int QWidgetPrivate::instanceCounter = 0; // Current number of widget instances -
1496int QWidgetPrivate::maxInstances = 0; // Maximum number of widget instances -
1497 -
1498void QWidgetPrivate::setWinId(WId id) // set widget identifier -
1499{ -
1500 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
1501 // the user might create a widget with Qt::Desktop window -
1502 // attribute (or create another QDesktopWidget instance), which -
1503 // will have the same windowid (the root window id) as the -
1504 // qt_desktopWidget. We should not add the second desktop widget -
1505 // to the mapper. -
1506 bool userDesktopWidget = qt_desktopWidget != 0 && qt_desktopWidget != q && q->windowType() == Qt::Desktop;
evaluated: qt_desktopWidget != 0
TRUEFALSE
yes
Evaluation Count:82270
yes
Evaluation Count:13506
evaluated: qt_desktopWidget != q
TRUEFALSE
yes
Evaluation Count:82164
yes
Evaluation Count:106
evaluated: q->windowType() == Qt::Desktop
TRUEFALSE
yes
Evaluation Count:176
yes
Evaluation Count:81988
106-82270
1507 if (mapper && data.winid && !userDesktopWidget) {
evaluated: mapper
TRUEFALSE
yes
Evaluation Count:95146
yes
Evaluation Count:630
evaluated: data.winid
TRUEFALSE
yes
Evaluation Count:2526
yes
Evaluation Count:92620
evaluated: !userDesktopWidget
TRUEFALSE
yes
Evaluation Count:2502
yes
Evaluation Count:24
24-95146
1508 mapper->remove(data.winid);
executed (the execution status of this line is deduced): mapper->remove(data.winid);
-
1509 }
executed: }
Execution Count:2502
2502
1510 -
1511 const WId oldWinId = data.winid;
executed (the execution status of this line is deduced): const WId oldWinId = data.winid;
-
1512 -
1513 data.winid = id;
executed (the execution status of this line is deduced): data.winid = id;
-
1514#if defined(Q_WS_X11) -
1515 hd = id; // X11: hd == ident -
1516#endif -
1517 if (mapper && id && !userDesktopWidget) {
evaluated: mapper
TRUEFALSE
yes
Evaluation Count:95146
yes
Evaluation Count:630
evaluated: id
TRUEFALSE
yes
Evaluation Count:2674
yes
Evaluation Count:92472
evaluated: !userDesktopWidget
TRUEFALSE
yes
Evaluation Count:2651
yes
Evaluation Count:23
23-95146
1518 mapper->insert(data.winid, q);
executed (the execution status of this line is deduced): mapper->insert(data.winid, q);
-
1519 }
executed: }
Execution Count:2651
2651
1520 -
1521 if(oldWinId != id) {
evaluated: oldWinId != id
TRUEFALSE
yes
Evaluation Count:5347
yes
Evaluation Count:90429
5347-90429
1522 QEvent e(QEvent::WinIdChange);
executed (the execution status of this line is deduced): QEvent e(QEvent::WinIdChange);
-
1523 QCoreApplication::sendEvent(q, &e);
executed (the execution status of this line is deduced): QCoreApplication::sendEvent(q, &e);
-
1524 }
executed: }
Execution Count:5347
5347
1525}
executed: }
Execution Count:95776
95776
1526 -
1527void QWidgetPrivate::createTLExtra() -
1528{ -
1529 if (!extra)
evaluated: !extra
TRUEFALSE
yes
Evaluation Count:2795
yes
Evaluation Count:40984
2795-40984
1530 createExtra();
executed: createExtra();
Execution Count:2795
2795
1531 if (!extra->topextra) {
evaluated: !extra->topextra
TRUEFALSE
yes
Evaluation Count:3525
yes
Evaluation Count:40254
3525-40254
1532 QTLWExtra* x = extra->topextra = new QTLWExtra;
executed (the execution status of this line is deduced): QTLWExtra* x = extra->topextra = new QTLWExtra;
-
1533 x->icon = 0;
executed (the execution status of this line is deduced): x->icon = 0;
-
1534 x->backingStore = 0;
executed (the execution status of this line is deduced): x->backingStore = 0;
-
1535 x->sharedPainter = 0;
executed (the execution status of this line is deduced): x->sharedPainter = 0;
-
1536 x->incw = x->inch = 0;
executed (the execution status of this line is deduced): x->incw = x->inch = 0;
-
1537 x->basew = x->baseh = 0;
executed (the execution status of this line is deduced): x->basew = x->baseh = 0;
-
1538 x->frameStrut.setCoords(0, 0, 0, 0);
executed (the execution status of this line is deduced): x->frameStrut.setCoords(0, 0, 0, 0);
-
1539 x->normalGeometry = QRect(0,0,-1,-1);
executed (the execution status of this line is deduced): x->normalGeometry = QRect(0,0,-1,-1);
-
1540 x->savedFlags = 0;
executed (the execution status of this line is deduced): x->savedFlags = 0;
-
1541 x->opacity = 255;
executed (the execution status of this line is deduced): x->opacity = 255;
-
1542 x->posIncludesFrame = 0;
executed (the execution status of this line is deduced): x->posIncludesFrame = 0;
-
1543 x->sizeAdjusted = false;
executed (the execution status of this line is deduced): x->sizeAdjusted = false;
-
1544 x->inTopLevelResize = false;
executed (the execution status of this line is deduced): x->inTopLevelResize = false;
-
1545 x->inRepaint = false;
executed (the execution status of this line is deduced): x->inRepaint = false;
-
1546 x->embedded = 0;
executed (the execution status of this line is deduced): x->embedded = 0;
-
1547#ifdef Q_WS_MAC -
1548 x->wasMaximized = false; -
1549#endif // Q_WS_MAC -
1550 createTLSysExtra();
executed (the execution status of this line is deduced): createTLSysExtra();
-
1551#ifdef QWIDGET_EXTRA_DEBUG -
1552 static int count = 0; -
1553 qDebug() << "tlextra" << ++count; -
1554#endif -
1555 }
executed: }
Execution Count:3525
3525
1556}
executed: }
Execution Count:43779
43779
1557 -
1558/*! -
1559 \internal -
1560 Creates the widget extra data. -
1561*/ -
1562 -
1563void QWidgetPrivate::createExtra() -
1564{ -
1565 if (!extra) { // if not exists
evaluated: !extra
TRUEFALSE
yes
Evaluation Count:17278
yes
Evaluation Count:21339
17278-21339
1566 extra = new QWExtra;
executed (the execution status of this line is deduced): extra = new QWExtra;
-
1567 extra->glContext = 0;
executed (the execution status of this line is deduced): extra->glContext = 0;
-
1568 extra->topextra = 0;
executed (the execution status of this line is deduced): extra->topextra = 0;
-
1569#ifndef QT_NO_GRAPHICSVIEW -
1570 extra->proxyWidget = 0;
executed (the execution status of this line is deduced): extra->proxyWidget = 0;
-
1571#endif -
1572#ifndef QT_NO_CURSOR -
1573 extra->curs = 0;
executed (the execution status of this line is deduced): extra->curs = 0;
-
1574#endif -
1575 extra->minw = 0;
executed (the execution status of this line is deduced): extra->minw = 0;
-
1576 extra->minh = 0;
executed (the execution status of this line is deduced): extra->minh = 0;
-
1577 extra->maxw = QWIDGETSIZE_MAX;
executed (the execution status of this line is deduced): extra->maxw = ((1<<24)-1);
-
1578 extra->maxh = QWIDGETSIZE_MAX;
executed (the execution status of this line is deduced): extra->maxh = ((1<<24)-1);
-
1579 extra->customDpiX = 0;
executed (the execution status of this line is deduced): extra->customDpiX = 0;
-
1580 extra->customDpiY = 0;
executed (the execution status of this line is deduced): extra->customDpiY = 0;
-
1581 extra->explicitMinSize = 0;
executed (the execution status of this line is deduced): extra->explicitMinSize = 0;
-
1582 extra->explicitMaxSize = 0;
executed (the execution status of this line is deduced): extra->explicitMaxSize = 0;
-
1583 extra->autoFillBackground = 0;
executed (the execution status of this line is deduced): extra->autoFillBackground = 0;
-
1584 extra->nativeChildrenForced = 0;
executed (the execution status of this line is deduced): extra->nativeChildrenForced = 0;
-
1585 extra->inRenderWithPainter = 0;
executed (the execution status of this line is deduced): extra->inRenderWithPainter = 0;
-
1586 extra->hasMask = 0;
executed (the execution status of this line is deduced): extra->hasMask = 0;
-
1587 createSysExtra();
executed (the execution status of this line is deduced): createSysExtra();
-
1588#ifdef QWIDGET_EXTRA_DEBUG -
1589 static int count = 0; -
1590 qDebug() << "extra" << ++count; -
1591#endif -
1592 }
executed: }
Execution Count:17278
17278
1593}
executed: }
Execution Count:38617
38617
1594 -
1595 -
1596/*! -
1597 \internal -
1598 Deletes the widget extra data. -
1599*/ -
1600 -
1601void QWidgetPrivate::deleteExtra() -
1602{ -
1603 if (extra) { // if exists
partially evaluated: extra
TRUEFALSE
yes
Evaluation Count:16507
no
Evaluation Count:0
0-16507
1604#ifndef QT_NO_CURSOR -
1605 delete extra->curs;
executed (the execution status of this line is deduced): delete extra->curs;
-
1606#endif -
1607 deleteSysExtra();
executed (the execution status of this line is deduced): deleteSysExtra();
-
1608#ifndef QT_NO_STYLE_STYLESHEET -
1609 // dereference the stylesheet style -
1610 if (QStyleSheetStyle *proxy = qobject_cast<QStyleSheetStyle *>(extra->style))
evaluated: QStyleSheetStyle *proxy = qobject_cast<QStyleSheetStyle *>(extra->style)
TRUEFALSE
yes
Evaluation Count:2377
yes
Evaluation Count:14130
2377-14130
1611 proxy->deref();
executed: proxy->deref();
Execution Count:2377
2377
1612#endif -
1613 if (extra->topextra) {
evaluated: extra->topextra
TRUEFALSE
yes
Evaluation Count:3482
yes
Evaluation Count:13025
3482-13025
1614 deleteTLSysExtra();
executed (the execution status of this line is deduced): deleteTLSysExtra();
-
1615 // extra->topextra->backingStore destroyed in QWidgetPrivate::deleteTLSysExtra() -
1616 delete extra->topextra->icon;
executed (the execution status of this line is deduced): delete extra->topextra->icon;
-
1617 delete extra->topextra;
executed (the execution status of this line is deduced): delete extra->topextra;
-
1618 }
executed: }
Execution Count:3482
3482
1619 delete extra;
executed (the execution status of this line is deduced): delete extra;
-
1620 // extra->xic destroyed in QWidget::destroy() -
1621 extra = 0;
executed (the execution status of this line is deduced): extra = 0;
-
1622 }
executed: }
Execution Count:16507
16507
1623}
executed: }
Execution Count:16507
16507
1624 -
1625/* -
1626 Returns true if there are widgets above this which overlap with -
1627 \a rect, which is in parent's coordinate system (same as crect). -
1628*/ -
1629 -
1630bool QWidgetPrivate::isOverlapped(const QRect &rect) const -
1631{ -
1632 Q_Q(const QWidget);
executed (the execution status of this line is deduced): const QWidget * const q = q_func();
-
1633 -
1634 const QWidget *w = q;
executed (the execution status of this line is deduced): const QWidget *w = q;
-
1635 QRect r = rect;
executed (the execution status of this line is deduced): QRect r = rect;
-
1636 while (w) {
partially evaluated: w
TRUEFALSE
yes
Evaluation Count:37493
no
Evaluation Count:0
0-37493
1637 if (w->isWindow())
evaluated: w->isWindow()
TRUEFALSE
yes
Evaluation Count:14789
yes
Evaluation Count:22704
14789-22704
1638 return false;
executed: return false;
Execution Count:14789
14789
1639 QWidgetPrivate *pd = w->parentWidget()->d_func();
executed (the execution status of this line is deduced): QWidgetPrivate *pd = w->parentWidget()->d_func();
-
1640 bool above = false;
executed (the execution status of this line is deduced): bool above = false;
-
1641 for (int i = 0; i < pd->children.size(); ++i) {
evaluated: i < pd->children.size()
TRUEFALSE
yes
Evaluation Count:124422
yes
Evaluation Count:22699
22699-124422
1642 QWidget *sibling = qobject_cast<QWidget *>(pd->children.at(i));
executed (the execution status of this line is deduced): QWidget *sibling = qobject_cast<QWidget *>(pd->children.at(i));
-
1643 if (!sibling || !sibling->isVisible() || sibling->isWindow())
evaluated: !sibling
TRUEFALSE
yes
Evaluation Count:30631
yes
Evaluation Count:93791
evaluated: !sibling->isVisible()
TRUEFALSE
yes
Evaluation Count:13062
yes
Evaluation Count:80729
partially evaluated: sibling->isWindow()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:80729
0-93791
1644 continue;
executed: continue;
Execution Count:43693
43693
1645 if (!above) {
evaluated: !above
TRUEFALSE
yes
Evaluation Count:32843
yes
Evaluation Count:47886
32843-47886
1646 above = (sibling == w);
executed (the execution status of this line is deduced): above = (sibling == w);
-
1647 continue;
executed: continue;
Execution Count:32843
32843
1648 } -
1649 -
1650 if (qRectIntersects(sibling->d_func()->effectiveRectFor(sibling->data->crect), r)) {
evaluated: qRectIntersects(sibling->d_func()->effectiveRectFor(sibling->data->crect), r)
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:47881
5-47881
1651 const QWExtra *siblingExtra = sibling->d_func()->extra;
executed (the execution status of this line is deduced): const QWExtra *siblingExtra = sibling->d_func()->extra;
-
1652 if (siblingExtra && siblingExtra->hasMask && !sibling->d_func()->graphicsEffect
partially evaluated: siblingExtra
TRUEFALSE
yes
Evaluation Count:5
no
Evaluation Count:0
evaluated: siblingExtra->hasMask
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:4
partially evaluated: !sibling->d_func()->graphicsEffect
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-5
1653 && !siblingExtra->mask.translated(sibling->data->crect.topLeft()).intersects(r)) {
partially evaluated: !siblingExtra->mask.translated(sibling->data->crect.topLeft()).intersects(r)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
1654 continue;
never executed: continue;
0
1655 } -
1656 return true;
executed: return true;
Execution Count:5
5
1657 } -
1658 }
executed: }
Execution Count:47881
47881
1659 w = w->parentWidget();
executed (the execution status of this line is deduced): w = w->parentWidget();
-
1660 r.translate(pd->data.crect.topLeft());
executed (the execution status of this line is deduced): r.translate(pd->data.crect.topLeft());
-
1661 }
executed: }
Execution Count:22699
22699
1662 return false;
never executed: return false;
0
1663} -
1664 -
1665void QWidgetPrivate::syncBackingStore() -
1666{ -
1667 if (paintOnScreen()) {
evaluated: paintOnScreen()
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:8226
6-8226
1668 repaint_sys(dirty);
executed (the execution status of this line is deduced): repaint_sys(dirty);
-
1669 dirty = QRegion();
executed (the execution status of this line is deduced): dirty = QRegion();
-
1670 } else if (QWidgetBackingStore *bs = maybeBackingStore()) {
executed: }
Execution Count:6
partially evaluated: QWidgetBackingStore *bs = maybeBackingStore()
TRUEFALSE
yes
Evaluation Count:8226
no
Evaluation Count:0
0-8226
1671 bs->sync();
executed (the execution status of this line is deduced): bs->sync();
-
1672 }
executed: }
Execution Count:8226
8226
1673} -
1674 -
1675void QWidgetPrivate::syncBackingStore(const QRegion &region) -
1676{ -
1677 if (paintOnScreen())
evaluated: paintOnScreen()
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:3358
7-3358
1678 repaint_sys(region);
executed: repaint_sys(region);
Execution Count:7
7
1679 else if (QWidgetBackingStore *bs = maybeBackingStore()) {
partially evaluated: QWidgetBackingStore *bs = maybeBackingStore()
TRUEFALSE
yes
Evaluation Count:3358
no
Evaluation Count:0
0-3358
1680 bs->sync(q_func(), region);
executed (the execution status of this line is deduced): bs->sync(q_func(), region);
-
1681 }
executed: }
Execution Count:3358
3358
1682} -
1683 -
1684void QWidgetPrivate::setUpdatesEnabled_helper(bool enable) -
1685{ -
1686 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
1687 -
1688 if (enable && !q->isWindow() && q->parentWidget() && !q->parentWidget()->updatesEnabled())
evaluated: enable
TRUEFALSE
yes
Evaluation Count:53560
yes
Evaluation Count:13772
evaluated: !q->isWindow()
TRUEFALSE
yes
Evaluation Count:52578
yes
Evaluation Count:982
partially evaluated: q->parentWidget()
TRUEFALSE
yes
Evaluation Count:52578
no
Evaluation Count:0
partially evaluated: !q->parentWidget()->updatesEnabled()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:52578
0-53560
1689 return; // nothing we can do
never executed: return;
0
1690 -
1691 if (enable != q->testAttribute(Qt::WA_UpdatesDisabled))
evaluated: enable != q->testAttribute(Qt::WA_UpdatesDisabled)
TRUEFALSE
yes
Evaluation Count:40424
yes
Evaluation Count:26908
26908-40424
1692 return; // nothing to do
executed: return;
Execution Count:40424
40424
1693 -
1694 q->setAttribute(Qt::WA_UpdatesDisabled, !enable);
executed (the execution status of this line is deduced): q->setAttribute(Qt::WA_UpdatesDisabled, !enable);
-
1695 if (enable)
evaluated: enable
TRUEFALSE
yes
Evaluation Count:13217
yes
Evaluation Count:13691
13217-13691
1696 q->update();
executed: q->update();
Execution Count:13217
13217
1697 -
1698 Qt::WidgetAttribute attribute = enable ? Qt::WA_ForceUpdatesDisabled : Qt::WA_UpdatesDisabled;
evaluated: enable
TRUEFALSE
yes
Evaluation Count:13217
yes
Evaluation Count:13691
13217-13691
1699 for (int i = 0; i < children.size(); ++i) {
evaluated: i < children.size()
TRUEFALSE
yes
Evaluation Count:35439
yes
Evaluation Count:26908
26908-35439
1700 QWidget *w = qobject_cast<QWidget *>(children.at(i));
executed (the execution status of this line is deduced): QWidget *w = qobject_cast<QWidget *>(children.at(i));
-
1701 if (w && !w->isWindow() && !w->testAttribute(attribute))
evaluated: w
TRUEFALSE
yes
Evaluation Count:24750
yes
Evaluation Count:10689
evaluated: !w->isWindow()
TRUEFALSE
yes
Evaluation Count:24540
yes
Evaluation Count:210
evaluated: !w->testAttribute(attribute)
TRUEFALSE
yes
Evaluation Count:24488
yes
Evaluation Count:52
52-24750
1702 w->d_func()->setUpdatesEnabled_helper(enable);
executed: w->d_func()->setUpdatesEnabled_helper(enable);
Execution Count:24488
24488
1703 }
executed: }
Execution Count:35439
35439
1704}
executed: }
Execution Count:26908
26908
1705 -
1706/*! -
1707 \internal -
1708 -
1709 Propagate this widget's palette to all children, except style sheet -
1710 widgets, and windows that don't enable window propagation (palettes don't -
1711 normally propagate to windows). -
1712*/ -
1713void QWidgetPrivate::propagatePaletteChange() -
1714{ -
1715 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
1716 // Propagate a new inherited mask to all children. -
1717#ifndef QT_NO_GRAPHICSVIEW -
1718 if (!q->parentWidget() && extra && extra->proxyWidget) {
evaluated: !q->parentWidget()
TRUEFALSE
yes
Evaluation Count:1337
yes
Evaluation Count:20379
evaluated: extra
TRUEFALSE
yes
Evaluation Count:205
yes
Evaluation Count:1132
partially evaluated: extra->proxyWidget
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:205
0-20379
1719 QGraphicsProxyWidget *p = extra->proxyWidget;
never executed (the execution status of this line is deduced): QGraphicsProxyWidget *p = extra->proxyWidget;
-
1720 inheritedPaletteResolveMask = p->d_func()->inheritedPaletteResolveMask | p->palette().resolve();
never executed (the execution status of this line is deduced): inheritedPaletteResolveMask = p->d_func()->inheritedPaletteResolveMask | p->palette().resolve();
-
1721 } else
never executed: }
0
1722#endif //QT_NO_GRAPHICSVIEW -
1723 if (q->isWindow() && !q->testAttribute(Qt::WA_WindowPropagation)) {
evaluated: q->isWindow()
TRUEFALSE
yes
Evaluation Count:1352
yes
Evaluation Count:20364
partially evaluated: !q->testAttribute(Qt::WA_WindowPropagation)
TRUEFALSE
yes
Evaluation Count:1352
no
Evaluation Count:0
0-20364
1724 inheritedPaletteResolveMask = 0;
executed (the execution status of this line is deduced): inheritedPaletteResolveMask = 0;
-
1725 }
executed: }
Execution Count:1352
1352
1726 int mask = data.pal.resolve() | inheritedPaletteResolveMask;
executed (the execution status of this line is deduced): int mask = data.pal.resolve() | inheritedPaletteResolveMask;
-
1727 -
1728 QEvent pc(QEvent::PaletteChange);
executed (the execution status of this line is deduced): QEvent pc(QEvent::PaletteChange);
-
1729 QApplication::sendEvent(q, &pc);
executed (the execution status of this line is deduced): QApplication::sendEvent(q, &pc);
-
1730 for (int i = 0; i < children.size(); ++i) {
evaluated: i < children.size()
TRUEFALSE
yes
Evaluation Count:4050
yes
Evaluation Count:21716
4050-21716
1731 QWidget *w = qobject_cast<QWidget*>(children.at(i));
executed (the execution status of this line is deduced): QWidget *w = qobject_cast<QWidget*>(children.at(i));
-
1732 if (w && !w->testAttribute(Qt::WA_StyleSheet)
evaluated: w
TRUEFALSE
yes
Evaluation Count:2753
yes
Evaluation Count:1297
partially evaluated: !w->testAttribute(Qt::WA_StyleSheet)
TRUEFALSE
yes
Evaluation Count:2753
no
Evaluation Count:0
0-2753
1733 && (!w->isWindow() || w->testAttribute(Qt::WA_WindowPropagation))) {
evaluated: !w->isWindow()
TRUEFALSE
yes
Evaluation Count:2635
yes
Evaluation Count:118
partially evaluated: w->testAttribute(Qt::WA_WindowPropagation)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:118
0-2635
1734 QWidgetPrivate *wd = w->d_func();
executed (the execution status of this line is deduced): QWidgetPrivate *wd = w->d_func();
-
1735 wd->inheritedPaletteResolveMask = mask;
executed (the execution status of this line is deduced): wd->inheritedPaletteResolveMask = mask;
-
1736 wd->resolvePalette();
executed (the execution status of this line is deduced): wd->resolvePalette();
-
1737 }
executed: }
Execution Count:2635
2635
1738 }
executed: }
Execution Count:4050
4050
1739}
executed: }
Execution Count:21716
21716
1740 -
1741/* -
1742 Returns the widget's clipping rectangle. -
1743*/ -
1744QRect QWidgetPrivate::clipRect() const -
1745{ -
1746 Q_Q(const QWidget);
executed (the execution status of this line is deduced): const QWidget * const q = q_func();
-
1747 const QWidget * w = q;
executed (the execution status of this line is deduced): const QWidget * w = q;
-
1748 if (!w->isVisible())
evaluated: !w->isVisible()
TRUEFALSE
yes
Evaluation Count:565
yes
Evaluation Count:44665
565-44665
1749 return QRect();
executed: return QRect();
Execution Count:565
565
1750 QRect r = effectiveRectFor(q->rect());
executed (the execution status of this line is deduced): QRect r = effectiveRectFor(q->rect());
-
1751 int ox = 0;
executed (the execution status of this line is deduced): int ox = 0;
-
1752 int oy = 0;
executed (the execution status of this line is deduced): int oy = 0;
-
1753 while (w
partially evaluated: w
TRUEFALSE
yes
Evaluation Count:100295
no
Evaluation Count:0
0-100295
1754 && w->isVisible()
evaluated: w->isVisible()
TRUEFALSE
yes
Evaluation Count:100289
yes
Evaluation Count:6
6-100289
1755 && !w->isWindow()
evaluated: !w->isWindow()
TRUEFALSE
yes
Evaluation Count:55630
yes
Evaluation Count:44659
44659-55630
1756 && w->parentWidget()) {
partially evaluated: w->parentWidget()
TRUEFALSE
yes
Evaluation Count:55630
no
Evaluation Count:0
0-55630
1757 ox -= w->x();
executed (the execution status of this line is deduced): ox -= w->x();
-
1758 oy -= w->y();
executed (the execution status of this line is deduced): oy -= w->y();
-
1759 w = w->parentWidget();
executed (the execution status of this line is deduced): w = w->parentWidget();
-
1760 r &= QRect(ox, oy, w->width(), w->height());
executed (the execution status of this line is deduced): r &= QRect(ox, oy, w->width(), w->height());
-
1761 }
executed: }
Execution Count:55630
55630
1762 return r;
executed: return r;
Execution Count:44665
44665
1763} -
1764 -
1765/* -
1766 Returns the widget's clipping region (without siblings). -
1767*/ -
1768QRegion QWidgetPrivate::clipRegion() const -
1769{ -
1770 Q_Q(const QWidget);
never executed (the execution status of this line is deduced): const QWidget * const q = q_func();
-
1771 if (!q->isVisible())
never evaluated: !q->isVisible()
0
1772 return QRegion();
never executed: return QRegion();
0
1773 QRegion r(q->rect());
never executed (the execution status of this line is deduced): QRegion r(q->rect());
-
1774 const QWidget * w = q;
never executed (the execution status of this line is deduced): const QWidget * w = q;
-
1775 const QWidget *ignoreUpTo;
never executed (the execution status of this line is deduced): const QWidget *ignoreUpTo;
-
1776 int ox = 0;
never executed (the execution status of this line is deduced): int ox = 0;
-
1777 int oy = 0;
never executed (the execution status of this line is deduced): int oy = 0;
-
1778 while (w
never evaluated: w
0
1779 && w->isVisible()
never evaluated: w->isVisible()
0
1780 && !w->isWindow()
never evaluated: !w->isWindow()
0
1781 && w->parentWidget()) {
never evaluated: w->parentWidget()
0
1782 ox -= w->x();
never executed (the execution status of this line is deduced): ox -= w->x();
-
1783 oy -= w->y();
never executed (the execution status of this line is deduced): oy -= w->y();
-
1784 ignoreUpTo = w;
never executed (the execution status of this line is deduced): ignoreUpTo = w;
-
1785 w = w->parentWidget();
never executed (the execution status of this line is deduced): w = w->parentWidget();
-
1786 r &= QRegion(ox, oy, w->width(), w->height());
never executed (the execution status of this line is deduced): r &= QRegion(ox, oy, w->width(), w->height());
-
1787 -
1788 int i = 0;
never executed (the execution status of this line is deduced): int i = 0;
-
1789 while(w->d_func()->children.at(i++) != static_cast<const QObject *>(ignoreUpTo))
never evaluated: w->d_func()->children.at(i++) != static_cast<const QObject *>(ignoreUpTo)
0
1790 ;
never executed: ;
0
1791 for ( ; i < w->d_func()->children.size(); ++i) {
never evaluated: i < w->d_func()->children.size()
0
1792 if(QWidget *sibling = qobject_cast<QWidget *>(w->d_func()->children.at(i))) {
never evaluated: QWidget *sibling = qobject_cast<QWidget *>(w->d_func()->children.at(i))
0
1793 if(sibling->isVisible() && !sibling->isWindow()) {
never evaluated: sibling->isVisible()
never evaluated: !sibling->isWindow()
0
1794 QRect siblingRect(ox+sibling->x(), oy+sibling->y(),
never executed (the execution status of this line is deduced): QRect siblingRect(ox+sibling->x(), oy+sibling->y(),
-
1795 sibling->width(), sibling->height());
never executed (the execution status of this line is deduced): sibling->width(), sibling->height());
-
1796 if (qRectIntersects(siblingRect, q->rect()))
never evaluated: qRectIntersects(siblingRect, q->rect())
0
1797 r -= QRegion(siblingRect);
never executed: r -= QRegion(siblingRect);
0
1798 }
never executed: }
0
1799 }
never executed: }
0
1800 }
never executed: }
0
1801 }
never executed: }
0
1802 return r;
never executed: return r;
0
1803} -
1804 -
1805void QWidgetPrivate::setSystemClip(QPaintDevice *paintDevice, const QRegion &region) -
1806{ -
1807// Transform the system clip region from device-independent pixels to device pixels -
1808// Qt 5.0.0: This is a Mac-only code path for now, can be made cross-platform once -
1809// it has been tested. -
1810 QPaintEngine *paintEngine = paintDevice->paintEngine();
executed (the execution status of this line is deduced): QPaintEngine *paintEngine = paintDevice->paintEngine();
-
1811#ifdef Q_OS_MAC -
1812 const qreal devicePixelRatio = (paintDevice->physicalDpiX() == 0 || paintDevice->logicalDpiX() == 0) ? -
1813 1.0 : (paintDevice->physicalDpiX() / paintDevice->logicalDpiX()); -
1814 QTransform scaleTransform; -
1815 scaleTransform.scale(devicePixelRatio, devicePixelRatio); -
1816 paintEngine->d_func()->systemClip = scaleTransform.map(region); -
1817#else -
1818 paintEngine->d_func()->systemClip = region;
executed (the execution status of this line is deduced): paintEngine->d_func()->systemClip = region;
-
1819#endif -
1820}
executed: }
Execution Count:32844
32844
1821 -
1822#ifndef QT_NO_GRAPHICSEFFECT -
1823void QWidgetPrivate::invalidateGraphicsEffectsRecursively() -
1824{ -
1825 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
1826 QWidget *w = q;
executed (the execution status of this line is deduced): QWidget *w = q;
-
1827 do { -
1828 if (w->graphicsEffect()) {
evaluated: w->graphicsEffect()
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:845095
7-845095
1829 QWidgetEffectSourcePrivate *sourced =
executed (the execution status of this line is deduced): QWidgetEffectSourcePrivate *sourced =
-
1830 static_cast<QWidgetEffectSourcePrivate *>(w->graphicsEffect()->source()->d_func());
executed (the execution status of this line is deduced): static_cast<QWidgetEffectSourcePrivate *>(w->graphicsEffect()->source()->d_func());
-
1831 if (!sourced->updateDueToGraphicsEffect)
partially evaluated: !sourced->updateDueToGraphicsEffect
TRUEFALSE
yes
Evaluation Count:7
no
Evaluation Count:0
0-7
1832 w->graphicsEffect()->source()->d_func()->invalidateCache();
executed: w->graphicsEffect()->source()->d_func()->invalidateCache();
Execution Count:7
7
1833 }
executed: }
Execution Count:7
7
1834 w = w->parentWidget();
executed (the execution status of this line is deduced): w = w->parentWidget();
-
1835 } while (w);
executed: }
Execution Count:845102
evaluated: w
TRUEFALSE
yes
Evaluation Count:505134
yes
Evaluation Count:339968
339968-845102
1836}
executed: }
Execution Count:339968
339968
1837#endif //QT_NO_GRAPHICSEFFECT -
1838 -
1839void QWidgetPrivate::setDirtyOpaqueRegion() -
1840{ -
1841 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
1842 -
1843 dirtyOpaqueChildren = true;
executed (the execution status of this line is deduced): dirtyOpaqueChildren = true;
-
1844 -
1845#ifndef QT_NO_GRAPHICSEFFECT -
1846 invalidateGraphicsEffectsRecursively();
executed (the execution status of this line is deduced): invalidateGraphicsEffectsRecursively();
-
1847#endif //QT_NO_GRAPHICSEFFECT -
1848 -
1849 if (q->isWindow())
evaluated: q->isWindow()
TRUEFALSE
yes
Evaluation Count:29108
yes
Evaluation Count:181145
29108-181145
1850 return;
executed: return;
Execution Count:29108
29108
1851 -
1852 QWidget *parent = q->parentWidget();
executed (the execution status of this line is deduced): QWidget *parent = q->parentWidget();
-
1853 if (!parent)
partially evaluated: !parent
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:181145
0-181145
1854 return;
never executed: return;
0
1855 -
1856 // TODO: instead of setting dirtyflag, manipulate the dirtyregion directly? -
1857 QWidgetPrivate *pd = parent->d_func();
executed (the execution status of this line is deduced): QWidgetPrivate *pd = parent->d_func();
-
1858 if (!pd->dirtyOpaqueChildren)
evaluated: !pd->dirtyOpaqueChildren
TRUEFALSE
yes
Evaluation Count:2448
yes
Evaluation Count:178697
2448-178697
1859 pd->setDirtyOpaqueRegion();
executed: pd->setDirtyOpaqueRegion();
Execution Count:2448
2448
1860}
executed: }
Execution Count:181145
181145
1861 -
1862const QRegion &QWidgetPrivate::getOpaqueChildren() const -
1863{ -
1864 if (!dirtyOpaqueChildren)
evaluated: !dirtyOpaqueChildren
TRUEFALSE
yes
Evaluation Count:8365
yes
Evaluation Count:8054
8054-8365
1865 return opaqueChildren;
executed: return opaqueChildren;
Execution Count:8365
8365
1866 -
1867 QWidgetPrivate *that = const_cast<QWidgetPrivate*>(this);
executed (the execution status of this line is deduced): QWidgetPrivate *that = const_cast<QWidgetPrivate*>(this);
-
1868 that->opaqueChildren = QRegion();
executed (the execution status of this line is deduced): that->opaqueChildren = QRegion();
-
1869 -
1870 for (int i = 0; i < children.size(); ++i) {
evaluated: i < children.size()
TRUEFALSE
yes
Evaluation Count:20952
yes
Evaluation Count:8054
8054-20952
1871 QWidget *child = qobject_cast<QWidget *>(children.at(i));
executed (the execution status of this line is deduced): QWidget *child = qobject_cast<QWidget *>(children.at(i));
-
1872 if (!child || !child->isVisible() || child->isWindow())
evaluated: !child
TRUEFALSE
yes
Evaluation Count:6723
yes
Evaluation Count:14229
evaluated: !child->isVisible()
TRUEFALSE
yes
Evaluation Count:4654
yes
Evaluation Count:9575
evaluated: child->isWindow()
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:9562
13-14229
1873 continue;
executed: continue;
Execution Count:11390
11390
1874 -
1875 const QPoint offset = child->geometry().topLeft();
executed (the execution status of this line is deduced): const QPoint offset = child->geometry().topLeft();
-
1876 QWidgetPrivate *childd = child->d_func();
executed (the execution status of this line is deduced): QWidgetPrivate *childd = child->d_func();
-
1877 QRegion r = childd->isOpaque ? child->rect() : childd->getOpaqueChildren();
evaluated: childd->isOpaque
TRUEFALSE
yes
Evaluation Count:3695
yes
Evaluation Count:5867
3695-5867
1878 if (childd->extra && childd->extra->hasMask)
evaluated: childd->extra
TRUEFALSE
yes
Evaluation Count:5754
yes
Evaluation Count:3808
evaluated: childd->extra->hasMask
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:5741
13-5754
1879 r &= childd->extra->mask;
executed: r &= childd->extra->mask;
Execution Count:13
13
1880 if (r.isEmpty())
evaluated: r.isEmpty()
TRUEFALSE
yes
Evaluation Count:3486
yes
Evaluation Count:6076
3486-6076
1881 continue;
executed: continue;
Execution Count:3486
3486
1882 r.translate(offset);
executed (the execution status of this line is deduced): r.translate(offset);
-
1883 that->opaqueChildren += r;
executed (the execution status of this line is deduced): that->opaqueChildren += r;
-
1884 }
executed: }
Execution Count:6076
6076
1885 -
1886 that->opaqueChildren &= q_func()->rect();
executed (the execution status of this line is deduced): that->opaqueChildren &= q_func()->rect();
-
1887 that->dirtyOpaqueChildren = false;
executed (the execution status of this line is deduced): that->dirtyOpaqueChildren = false;
-
1888 -
1889 return that->opaqueChildren;
executed: return that->opaqueChildren;
Execution Count:8054
8054
1890} -
1891 -
1892void QWidgetPrivate::subtractOpaqueChildren(QRegion &source, const QRect &clipRect) const -
1893{ -
1894 if (children.isEmpty() || clipRect.isEmpty())
evaluated: children.isEmpty()
TRUEFALSE
yes
Evaluation Count:16311
yes
Evaluation Count:10420
evaluated: clipRect.isEmpty()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:10417
3-16311
1895 return;
executed: return;
Execution Count:16314
16314
1896 -
1897 const QRegion &r = getOpaqueChildren();
executed (the execution status of this line is deduced): const QRegion &r = getOpaqueChildren();
-
1898 if (!r.isEmpty())
evaluated: !r.isEmpty()
TRUEFALSE
yes
Evaluation Count:6056
yes
Evaluation Count:4361
4361-6056
1899 source -= (r & clipRect);
executed: source -= (r & clipRect);
Execution Count:6056
6056
1900}
executed: }
Execution Count:10417
10417
1901 -
1902//subtract any relatives that are higher up than me --- this is too expensive !!! -
1903void QWidgetPrivate::subtractOpaqueSiblings(QRegion &sourceRegion, bool *hasDirtySiblingsAbove, -
1904 bool alsoNonOpaque) const -
1905{ -
1906 Q_Q(const QWidget);
executed (the execution status of this line is deduced): const QWidget * const q = q_func();
-
1907 static int disableSubtractOpaqueSiblings = qgetenv("QT_NO_SUBTRACTOPAQUESIBLINGS").toInt(); -
1908 if (disableSubtractOpaqueSiblings || q->isWindow())
partially evaluated: disableSubtractOpaqueSiblings
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13746
evaluated: q->isWindow()
TRUEFALSE
yes
Evaluation Count:1477
yes
Evaluation Count:12269
0-13746
1909 return;
executed: return;
Execution Count:1477
1477
1910 -
1911#ifdef Q_WS_MAC -
1912 if (q->d_func()->isInUnifiedToolbar) -
1913 return; -
1914#endif // Q_WS_MAC -
1915 -
1916 QRect clipBoundingRect;
executed (the execution status of this line is deduced): QRect clipBoundingRect;
-
1917 bool dirtyClipBoundingRect = true;
executed (the execution status of this line is deduced): bool dirtyClipBoundingRect = true;
-
1918 -
1919 QRegion parentClip;
executed (the execution status of this line is deduced): QRegion parentClip;
-
1920 bool dirtyParentClip = true;
executed (the execution status of this line is deduced): bool dirtyParentClip = true;
-
1921 -
1922 QPoint parentOffset = data.crect.topLeft();
executed (the execution status of this line is deduced): QPoint parentOffset = data.crect.topLeft();
-
1923 -
1924 const QWidget *w = q;
executed (the execution status of this line is deduced): const QWidget *w = q;
-
1925 -
1926 while (w) {
partially evaluated: w
TRUEFALSE
yes
Evaluation Count:33819
no
Evaluation Count:0
0-33819
1927 if (w->isWindow())
evaluated: w->isWindow()
TRUEFALSE
yes
Evaluation Count:11980
yes
Evaluation Count:21839
11980-21839
1928 break;
executed: break;
Execution Count:11980
11980
1929 QWidgetPrivate *pd = w->parentWidget()->d_func();
executed (the execution status of this line is deduced): QWidgetPrivate *pd = w->parentWidget()->d_func();
-
1930 const int myIndex = pd->children.indexOf(const_cast<QWidget *>(w));
executed (the execution status of this line is deduced): const int myIndex = pd->children.indexOf(const_cast<QWidget *>(w));
-
1931 const QRect widgetGeometry = w->d_func()->effectiveRectFor(w->data->crect);
executed (the execution status of this line is deduced): const QRect widgetGeometry = w->d_func()->effectiveRectFor(w->data->crect);
-
1932 for (int i = myIndex + 1; i < pd->children.size(); ++i) {
evaluated: i < pd->children.size()
TRUEFALSE
yes
Evaluation Count:31052
yes
Evaluation Count:21550
21550-31052
1933 QWidget *sibling = qobject_cast<QWidget *>(pd->children.at(i));
executed (the execution status of this line is deduced): QWidget *sibling = qobject_cast<QWidget *>(pd->children.at(i));
-
1934 if (!sibling || !sibling->isVisible() || sibling->isWindow())
evaluated: !sibling
TRUEFALSE
yes
Evaluation Count:13155
yes
Evaluation Count:17897
evaluated: !sibling->isVisible()
TRUEFALSE
yes
Evaluation Count:4675
yes
Evaluation Count:13222
evaluated: sibling->isWindow()
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:13209
13-17897
1935 continue;
executed: continue;
Execution Count:17843
17843
1936 -
1937 const QRect siblingGeometry = sibling->d_func()->effectiveRectFor(sibling->data->crect);
executed (the execution status of this line is deduced): const QRect siblingGeometry = sibling->d_func()->effectiveRectFor(sibling->data->crect);
-
1938 if (!qRectIntersects(siblingGeometry, widgetGeometry))
evaluated: !qRectIntersects(siblingGeometry, widgetGeometry)
TRUEFALSE
yes
Evaluation Count:12584
yes
Evaluation Count:625
625-12584
1939 continue;
executed: continue;
Execution Count:12584
12584
1940 -
1941 if (dirtyClipBoundingRect) {
evaluated: dirtyClipBoundingRect
TRUEFALSE
yes
Evaluation Count:585
yes
Evaluation Count:40
40-585
1942 clipBoundingRect = sourceRegion.boundingRect();
executed (the execution status of this line is deduced): clipBoundingRect = sourceRegion.boundingRect();
-
1943 dirtyClipBoundingRect = false;
executed (the execution status of this line is deduced): dirtyClipBoundingRect = false;
-
1944 }
executed: }
Execution Count:585
585
1945 -
1946 if (!qRectIntersects(siblingGeometry, clipBoundingRect.translated(parentOffset)))
evaluated: !qRectIntersects(siblingGeometry, clipBoundingRect.translated(parentOffset))
TRUEFALSE
yes
Evaluation Count:86
yes
Evaluation Count:539
86-539
1947 continue;
executed: continue;
Execution Count:86
86
1948 -
1949 if (dirtyParentClip) {
evaluated: dirtyParentClip
TRUEFALSE
yes
Evaluation Count:524
yes
Evaluation Count:15
15-524
1950 parentClip = sourceRegion.translated(parentOffset);
executed (the execution status of this line is deduced): parentClip = sourceRegion.translated(parentOffset);
-
1951 dirtyParentClip = false;
executed (the execution status of this line is deduced): dirtyParentClip = false;
-
1952 }
executed: }
Execution Count:524
524
1953 -
1954 const QPoint siblingPos(sibling->data->crect.topLeft());
executed (the execution status of this line is deduced): const QPoint siblingPos(sibling->data->crect.topLeft());
-
1955 const QRect siblingClipRect(sibling->d_func()->clipRect());
executed (the execution status of this line is deduced): const QRect siblingClipRect(sibling->d_func()->clipRect());
-
1956 QRegion siblingDirty(parentClip);
executed (the execution status of this line is deduced): QRegion siblingDirty(parentClip);
-
1957 siblingDirty &= (siblingClipRect.translated(siblingPos));
executed (the execution status of this line is deduced): siblingDirty &= (siblingClipRect.translated(siblingPos));
-
1958 const bool hasMask = sibling->d_func()->extra && sibling->d_func()->extra->hasMask
evaluated: sibling->d_func()->extra
TRUEFALSE
yes
Evaluation Count:491
yes
Evaluation Count:48
partially evaluated: sibling->d_func()->extra->hasMask
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:491
0-491
1959 && !sibling->d_func()->graphicsEffect;
never evaluated: !sibling->d_func()->graphicsEffect
0
1960 if (hasMask)
partially evaluated: hasMask
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:539
0-539
1961 siblingDirty &= sibling->d_func()->extra->mask.translated(siblingPos);
never executed: siblingDirty &= sibling->d_func()->extra->mask.translated(siblingPos);
0
1962 if (siblingDirty.isEmpty())
evaluated: siblingDirty.isEmpty()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:536
3-536
1963 continue;
executed: continue;
Execution Count:3
3
1964 -
1965 if (sibling->d_func()->isOpaque || alsoNonOpaque) {
evaluated: sibling->d_func()->isOpaque
TRUEFALSE
yes
Evaluation Count:377
yes
Evaluation Count:159
partially evaluated: alsoNonOpaque
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:159
0-377
1966 if (hasMask) {
partially evaluated: hasMask
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:377
0-377
1967 siblingDirty.translate(-parentOffset);
never executed (the execution status of this line is deduced): siblingDirty.translate(-parentOffset);
-
1968 sourceRegion -= siblingDirty;
never executed (the execution status of this line is deduced): sourceRegion -= siblingDirty;
-
1969 } else {
never executed: }
0
1970 sourceRegion -= siblingGeometry.translated(-parentOffset);
executed (the execution status of this line is deduced): sourceRegion -= siblingGeometry.translated(-parentOffset);
-
1971 }
executed: }
Execution Count:377
377
1972 } else { -
1973 if (hasDirtySiblingsAbove)
evaluated: hasDirtySiblingsAbove
TRUEFALSE
yes
Evaluation Count:28
yes
Evaluation Count:131
28-131
1974 *hasDirtySiblingsAbove = true;
executed: *hasDirtySiblingsAbove = true;
Execution Count:28
28
1975 if (sibling->d_func()->children.isEmpty())
evaluated: sibling->d_func()->children.isEmpty()
TRUEFALSE
yes
Evaluation Count:28
yes
Evaluation Count:131
28-131
1976 continue;
executed: continue;
Execution Count:28
28
1977 QRegion opaqueSiblingChildren(sibling->d_func()->getOpaqueChildren());
executed (the execution status of this line is deduced): QRegion opaqueSiblingChildren(sibling->d_func()->getOpaqueChildren());
-
1978 opaqueSiblingChildren.translate(-parentOffset + siblingPos);
executed (the execution status of this line is deduced): opaqueSiblingChildren.translate(-parentOffset + siblingPos);
-
1979 sourceRegion -= opaqueSiblingChildren;
executed (the execution status of this line is deduced): sourceRegion -= opaqueSiblingChildren;
-
1980 }
executed: }
Execution Count:131
131
1981 if (sourceRegion.isEmpty())
evaluated: sourceRegion.isEmpty()
TRUEFALSE
yes
Evaluation Count:289
yes
Evaluation Count:219
219-289
1982 return;
executed: return;
Execution Count:289
289
1983 -
1984 dirtyClipBoundingRect = true;
executed (the execution status of this line is deduced): dirtyClipBoundingRect = true;
-
1985 dirtyParentClip = true;
executed (the execution status of this line is deduced): dirtyParentClip = true;
-
1986 }
executed: }
Execution Count:219
219
1987 -
1988 w = w->parentWidget();
executed (the execution status of this line is deduced): w = w->parentWidget();
-
1989 parentOffset += pd->data.crect.topLeft();
executed (the execution status of this line is deduced): parentOffset += pd->data.crect.topLeft();
-
1990 dirtyParentClip = true;
executed (the execution status of this line is deduced): dirtyParentClip = true;
-
1991 }
executed: }
Execution Count:21550
21550
1992}
executed: }
Execution Count:11980
11980
1993 -
1994void QWidgetPrivate::clipToEffectiveMask(QRegion &region) const -
1995{ -
1996 Q_Q(const QWidget);
executed (the execution status of this line is deduced): const QWidget * const q = q_func();
-
1997 -
1998 const QWidget *w = q;
executed (the execution status of this line is deduced): const QWidget *w = q;
-
1999 QPoint offset;
executed (the execution status of this line is deduced): QPoint offset;
-
2000 -
2001#ifndef QT_NO_GRAPHICSEFFECT -
2002 if (graphicsEffect) {
partially evaluated: graphicsEffect
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:9602
0-9602
2003 w = q->parentWidget();
never executed (the execution status of this line is deduced): w = q->parentWidget();
-
2004 offset -= data.crect.topLeft();
never executed (the execution status of this line is deduced): offset -= data.crect.topLeft();
-
2005 }
never executed: }
0
2006#endif //QT_NO_GRAPHICSEFFECT -
2007 -
2008 while (w) {
partially evaluated: w
TRUEFALSE
yes
Evaluation Count:26227
no
Evaluation Count:0
0-26227
2009 const QWidgetPrivate *wd = w->d_func();
executed (the execution status of this line is deduced): const QWidgetPrivate *wd = w->d_func();
-
2010 if (wd->extra && wd->extra->hasMask)
evaluated: wd->extra
TRUEFALSE
yes
Evaluation Count:21259
yes
Evaluation Count:4968
evaluated: wd->extra->hasMask
TRUEFALSE
yes
Evaluation Count:27
yes
Evaluation Count:21232
27-21259
2011 region &= (w != q) ? wd->extra->mask.translated(offset) : wd->extra->mask;
executed: region &= (w != q) ? wd->extra->mask.translated(offset) : wd->extra->mask;
Execution Count:27
evaluated: (w != q)
TRUEFALSE
yes
Evaluation Count:16
yes
Evaluation Count:11
11-27
2012 if (w->isWindow())
evaluated: w->isWindow()
TRUEFALSE
yes
Evaluation Count:9602
yes
Evaluation Count:16625
9602-16625
2013 return;
executed: return;
Execution Count:9602
9602
2014 offset -= wd->data.crect.topLeft();
executed (the execution status of this line is deduced): offset -= wd->data.crect.topLeft();
-
2015 w = w->parentWidget();
executed (the execution status of this line is deduced): w = w->parentWidget();
-
2016 }
executed: }
Execution Count:16625
16625
2017}
never executed: }
0
2018 -
2019bool QWidgetPrivate::paintOnScreen() const -
2020{ -
2021#if defined(QT_NO_BACKINGSTORE) -
2022 return true; -
2023#else -
2024 Q_Q(const QWidget);
executed (the execution status of this line is deduced): const QWidget * const q = q_func();
-
2025 if (q->testAttribute(Qt::WA_PaintOnScreen)
evaluated: q->testAttribute(Qt::WA_PaintOnScreen)
TRUEFALSE
yes
Evaluation Count:20
yes
Evaluation Count:176523
20-176523
2026 || (!q->isWindow() && q->window()->testAttribute(Qt::WA_PaintOnScreen))) {
evaluated: !q->isWindow()
TRUEFALSE
yes
Evaluation Count:137568
yes
Evaluation Count:38955
evaluated: q->window()->testAttribute(Qt::WA_PaintOnScreen)
TRUEFALSE
yes
Evaluation Count:15
yes
Evaluation Count:137553
15-137568
2027 return true;
executed: return true;
Execution Count:35
35
2028 } -
2029 -
2030 return !qt_enable_backingstore;
executed: return !qt_enable_backingstore;
Execution Count:176508
176508
2031#endif -
2032} -
2033 -
2034void QWidgetPrivate::updateIsOpaque() -
2035{ -
2036 // hw: todo: only needed if opacity actually changed -
2037 setDirtyOpaqueRegion();
executed (the execution status of this line is deduced): setDirtyOpaqueRegion();
-
2038 -
2039#ifndef QT_NO_GRAPHICSEFFECT -
2040 if (graphicsEffect) {
evaluated: graphicsEffect
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:94442
6-94442
2041 // ### We should probably add QGraphicsEffect::isOpaque at some point. -
2042 setOpaque(false);
executed (the execution status of this line is deduced): setOpaque(false);
-
2043 return;
executed: return;
Execution Count:6
6
2044 } -
2045#endif //QT_NO_GRAPHICSEFFECT -
2046 -
2047 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
2048#ifdef Q_WS_X11 -
2049 if (q->testAttribute(Qt::WA_X11OpenGLOverlay)) { -
2050 setOpaque(false); -
2051 return; -
2052 } -
2053#endif -
2054 -
2055 if (q->testAttribute(Qt::WA_OpaquePaintEvent) || q->testAttribute(Qt::WA_PaintOnScreen)) {
evaluated: q->testAttribute(Qt::WA_OpaquePaintEvent)
TRUEFALSE
yes
Evaluation Count:11501
yes
Evaluation Count:82941
evaluated: q->testAttribute(Qt::WA_PaintOnScreen)
TRUEFALSE
yes
Evaluation Count:283
yes
Evaluation Count:82658
283-82941
2056 setOpaque(true);
executed (the execution status of this line is deduced): setOpaque(true);
-
2057 return;
executed: return;
Execution Count:11784
11784
2058 } -
2059 -
2060 const QPalette &pal = q->palette();
executed (the execution status of this line is deduced): const QPalette &pal = q->palette();
-
2061 -
2062 if (q->autoFillBackground()) {
evaluated: q->autoFillBackground()
TRUEFALSE
yes
Evaluation Count:21143
yes
Evaluation Count:61515
21143-61515
2063 const QBrush &autoFillBrush = pal.brush(q->backgroundRole());
executed (the execution status of this line is deduced): const QBrush &autoFillBrush = pal.brush(q->backgroundRole());
-
2064 if (autoFillBrush.style() != Qt::NoBrush && autoFillBrush.isOpaque()) {
partially evaluated: autoFillBrush.style() != Qt::NoBrush
TRUEFALSE
yes
Evaluation Count:21143
no
Evaluation Count:0
evaluated: autoFillBrush.isOpaque()
TRUEFALSE
yes
Evaluation Count:21128
yes
Evaluation Count:15
0-21143
2065 setOpaque(true);
executed (the execution status of this line is deduced): setOpaque(true);
-
2066 return;
executed: return;
Execution Count:21128
21128
2067 } -
2068 }
executed: }
Execution Count:15
15
2069 -
2070 if (q->isWindow() && !q->testAttribute(Qt::WA_NoSystemBackground)) {
evaluated: q->isWindow()
TRUEFALSE
yes
Evaluation Count:5006
yes
Evaluation Count:56524
evaluated: !q->testAttribute(Qt::WA_NoSystemBackground)
TRUEFALSE
yes
Evaluation Count:4991
yes
Evaluation Count:15
15-56524
2071 const QBrush &windowBrush = q->palette().brush(QPalette::Window);
executed (the execution status of this line is deduced): const QBrush &windowBrush = q->palette().brush(QPalette::Window);
-
2072 if (windowBrush.style() != Qt::NoBrush && windowBrush.isOpaque()) {
partially evaluated: windowBrush.style() != Qt::NoBrush
TRUEFALSE
yes
Evaluation Count:4991
no
Evaluation Count:0
evaluated: windowBrush.isOpaque()
TRUEFALSE
yes
Evaluation Count:4985
yes
Evaluation Count:6
0-4991
2073 setOpaque(true);
executed (the execution status of this line is deduced): setOpaque(true);
-
2074 return;
executed: return;
Execution Count:4985
4985
2075 } -
2076 }
executed: }
Execution Count:6
6
2077 setOpaque(false);
executed (the execution status of this line is deduced): setOpaque(false);
-
2078}
executed: }
Execution Count:56545
56545
2079 -
2080void QWidgetPrivate::setOpaque(bool opaque) -
2081{ -
2082 if (isOpaque != opaque) {
evaluated: isOpaque != opaque
TRUEFALSE
yes
Evaluation Count:28363
yes
Evaluation Count:73914
28363-73914
2083 isOpaque = opaque;
executed (the execution status of this line is deduced): isOpaque = opaque;
-
2084 updateIsTranslucent();
executed (the execution status of this line is deduced): updateIsTranslucent();
-
2085 }
executed: }
Execution Count:28363
28363
2086}
executed: }
Execution Count:102277
102277
2087 -
2088void QWidgetPrivate::updateIsTranslucent() -
2089{ -
2090 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
2091 if (QWindow *window = q->windowHandle()) {
evaluated: QWindow *window = q->windowHandle()
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:28357
10-28357
2092 QSurfaceFormat format = window->format();
executed (the execution status of this line is deduced): QSurfaceFormat format = window->format();
-
2093 const int oldAlpha = format.alphaBufferSize();
executed (the execution status of this line is deduced): const int oldAlpha = format.alphaBufferSize();
-
2094 const int newAlpha = q->testAttribute(Qt::WA_TranslucentBackground)? 8 : 0;
partially evaluated: q->testAttribute(Qt::WA_TranslucentBackground)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:10
0-10
2095 if (oldAlpha != newAlpha) {
partially evaluated: oldAlpha != newAlpha
TRUEFALSE
yes
Evaluation Count:10
no
Evaluation Count:0
0-10
2096 format.setAlphaBufferSize(newAlpha);
executed (the execution status of this line is deduced): format.setAlphaBufferSize(newAlpha);
-
2097 window->setFormat(format);
executed (the execution status of this line is deduced): window->setFormat(format);
-
2098 }
executed: }
Execution Count:10
10
2099 }
executed: }
Execution Count:10
10
2100}
executed: }
Execution Count:28367
28367
2101 -
2102static inline void fillRegion(QPainter *painter, const QRegion &rgn, const QBrush &brush) -
2103{ -
2104 Q_ASSERT(painter);
executed (the execution status of this line is deduced): qt_noop();
-
2105 -
2106 if (brush.style() == Qt::TexturePattern) {
evaluated: brush.style() == Qt::TexturePattern
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:8673
4-8673
2107#ifdef Q_WS_MAC -
2108 // Optimize pattern filling on mac by using HITheme directly -
2109 // when filling with the standard widget background. -
2110 // Defined in qmacstyle_mac.cpp -
2111 extern void qt_mac_fill_background(QPainter *painter, const QRegion &rgn, const QBrush &brush); -
2112 qt_mac_fill_background(painter, rgn, brush); -
2113#else -
2114 { -
2115 const QRect rect(rgn.boundingRect());
executed (the execution status of this line is deduced): const QRect rect(rgn.boundingRect());
-
2116 painter->setClipRegion(rgn);
executed (the execution status of this line is deduced): painter->setClipRegion(rgn);
-
2117 painter->drawTiledPixmap(rect, brush.texture(), rect.topLeft());
executed (the execution status of this line is deduced): painter->drawTiledPixmap(rect, brush.texture(), rect.topLeft());
-
2118 } -
2119#endif // Q_WS_MAC -
2120 -
2121 } else if (brush.gradient()
executed: }
Execution Count:4
evaluated: brush.gradient()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:8669
4-8669
2122 && brush.gradient()->coordinateMode() == QGradient::ObjectBoundingMode) {
partially evaluated: brush.gradient()->coordinateMode() == QGradient::ObjectBoundingMode
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
2123 painter->save();
never executed (the execution status of this line is deduced): painter->save();
-
2124 painter->setClipRegion(rgn);
never executed (the execution status of this line is deduced): painter->setClipRegion(rgn);
-
2125 painter->fillRect(0, 0, painter->device()->width(), painter->device()->height(), brush);
never executed (the execution status of this line is deduced): painter->fillRect(0, 0, painter->device()->width(), painter->device()->height(), brush);
-
2126 painter->restore();
never executed (the execution status of this line is deduced): painter->restore();
-
2127 } else {
never executed: }
0
2128 const QVector<QRect> &rects = rgn.rects();
executed (the execution status of this line is deduced): const QVector<QRect> &rects = rgn.rects();
-
2129 for (int i = 0; i < rects.size(); ++i)
evaluated: i < rects.size()
TRUEFALSE
yes
Evaluation Count:15879
yes
Evaluation Count:8673
8673-15879
2130 painter->fillRect(rects.at(i), brush);
executed: painter->fillRect(rects.at(i), brush);
Execution Count:15879
15879
2131 }
executed: }
Execution Count:8673
8673
2132} -
2133 -
2134void QWidgetPrivate::paintBackground(QPainter *painter, const QRegion &rgn, int flags) const -
2135{ -
2136 Q_Q(const QWidget);
executed (the execution status of this line is deduced): const QWidget * const q = q_func();
-
2137 -
2138#ifndef QT_NO_SCROLLAREA -
2139 bool resetBrushOrigin = false;
executed (the execution status of this line is deduced): bool resetBrushOrigin = false;
-
2140 QPointF oldBrushOrigin;
executed (the execution status of this line is deduced): QPointF oldBrushOrigin;
-
2141 //If we are painting the viewport of a scrollarea, we must apply an offset to the brush in case we are drawing a texture -
2142 QAbstractScrollArea *scrollArea = qobject_cast<QAbstractScrollArea *>(parent);
executed (the execution status of this line is deduced): QAbstractScrollArea *scrollArea = qobject_cast<QAbstractScrollArea *>(parent);
-
2143 if (scrollArea && scrollArea->viewport() == q) {
evaluated: scrollArea
TRUEFALSE
yes
Evaluation Count:4783
yes
Evaluation Count:3896
evaluated: scrollArea->viewport() == q
TRUEFALSE
yes
Evaluation Count:4780
yes
Evaluation Count:3
3-4783
2144 QObjectData *scrollPrivate = static_cast<QWidget *>(scrollArea)->d_ptr.data();
executed (the execution status of this line is deduced): QObjectData *scrollPrivate = static_cast<QWidget *>(scrollArea)->d_ptr.data();
-
2145 QAbstractScrollAreaPrivate *priv = static_cast<QAbstractScrollAreaPrivate *>(scrollPrivate);
executed (the execution status of this line is deduced): QAbstractScrollAreaPrivate *priv = static_cast<QAbstractScrollAreaPrivate *>(scrollPrivate);
-
2146 oldBrushOrigin = painter->brushOrigin();
executed (the execution status of this line is deduced): oldBrushOrigin = painter->brushOrigin();
-
2147 resetBrushOrigin = true;
executed (the execution status of this line is deduced): resetBrushOrigin = true;
-
2148 painter->setBrushOrigin(-priv->contentsOffset());
executed (the execution status of this line is deduced): painter->setBrushOrigin(-priv->contentsOffset());
-
2149 -
2150 }
executed: }
Execution Count:4780
4780
2151#endif // QT_NO_SCROLLAREA -
2152 -
2153 const QBrush autoFillBrush = q->palette().brush(q->backgroundRole());
executed (the execution status of this line is deduced): const QBrush autoFillBrush = q->palette().brush(q->backgroundRole());
-
2154 -
2155 if ((flags & DrawAsRoot) && !(q->autoFillBackground() && autoFillBrush.isOpaque())) {
evaluated: (flags & DrawAsRoot)
TRUEFALSE
yes
Evaluation Count:3471
yes
Evaluation Count:5208
evaluated: q->autoFillBackground()
TRUEFALSE
yes
Evaluation Count:39
yes
Evaluation Count:3432
partially evaluated: autoFillBrush.isOpaque()
TRUEFALSE
yes
Evaluation Count:39
no
Evaluation Count:0
0-5208
2156 const QBrush bg = q->palette().brush(QPalette::Window);
executed (the execution status of this line is deduced): const QBrush bg = q->palette().brush(QPalette::Window);
-
2157 if (!(flags & DontSetCompositionMode)) {
evaluated: !(flags & DontSetCompositionMode)
TRUEFALSE
yes
Evaluation Count:3360
yes
Evaluation Count:72
72-3360
2158 //copy alpha straight in -
2159 QPainter::CompositionMode oldMode = painter->compositionMode();
executed (the execution status of this line is deduced): QPainter::CompositionMode oldMode = painter->compositionMode();
-
2160 painter->setCompositionMode(QPainter::CompositionMode_Source);
executed (the execution status of this line is deduced): painter->setCompositionMode(QPainter::CompositionMode_Source);
-
2161 fillRegion(painter, rgn, bg);
executed (the execution status of this line is deduced): fillRegion(painter, rgn, bg);
-
2162 painter->setCompositionMode(oldMode);
executed (the execution status of this line is deduced): painter->setCompositionMode(oldMode);
-
2163 } else {
executed: }
Execution Count:3360
3360
2164 fillRegion(painter, rgn, bg);
executed (the execution status of this line is deduced): fillRegion(painter, rgn, bg);
-
2165 }
executed: }
Execution Count:72
72
2166 } -
2167 -
2168 if (q->autoFillBackground())
evaluated: q->autoFillBackground()
TRUEFALSE
yes
Evaluation Count:5245
yes
Evaluation Count:3434
3434-5245
2169 fillRegion(painter, rgn, autoFillBrush);
executed: fillRegion(painter, rgn, autoFillBrush);
Execution Count:5245
5245
2170 -
2171 if (q->testAttribute(Qt::WA_StyledBackground)) {
evaluated: q->testAttribute(Qt::WA_StyledBackground)
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:8675
4-8675
2172 painter->setClipRegion(rgn);
executed (the execution status of this line is deduced): painter->setClipRegion(rgn);
-
2173 QStyleOption opt;
executed (the execution status of this line is deduced): QStyleOption opt;
-
2174 opt.initFrom(q);
executed (the execution status of this line is deduced): opt.initFrom(q);
-
2175 q->style()->drawPrimitive(QStyle::PE_Widget, &opt, painter, q);
executed (the execution status of this line is deduced): q->style()->drawPrimitive(QStyle::PE_Widget, &opt, painter, q);
-
2176 }
executed: }
Execution Count:4
4
2177 -
2178#ifndef QT_NO_SCROLLAREA -
2179 if (resetBrushOrigin)
evaluated: resetBrushOrigin
TRUEFALSE
yes
Evaluation Count:4780
yes
Evaluation Count:3899
3899-4780
2180 painter->setBrushOrigin(oldBrushOrigin);
executed: painter->setBrushOrigin(oldBrushOrigin);
Execution Count:4780
4780
2181#endif // QT_NO_SCROLLAREA -
2182}
executed: }
Execution Count:8679
8679
2183 -
2184/* -
2185 \internal -
2186 This function is called when a widget is hidden or destroyed. -
2187 It resets some application global pointers that should only refer active, -
2188 visible widgets. -
2189*/ -
2190 -
2191#ifdef Q_WS_MAC -
2192 extern QPointer<QWidget> qt_button_down; -
2193#else -
2194 extern QWidget *qt_button_down; -
2195#endif -
2196 -
2197void QWidgetPrivate::deactivateWidgetCleanup() -
2198{ -
2199 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
2200 // If this was the active application window, reset it -
2201 if (QApplication::activeWindow() == q)
evaluated: QApplication::activeWindow() == q
TRUEFALSE
yes
Evaluation Count:1343
yes
Evaluation Count:47759
1343-47759
2202 QApplication::setActiveWindow(0);
executed: QApplication::setActiveWindow(0);
Execution Count:1343
1343
2203 // If the is the active mouse press widget, reset it -
2204 if (q == qt_button_down)
partially evaluated: q == qt_button_down
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:49102
0-49102
2205 qt_button_down = 0;
never executed: qt_button_down = 0;
0
2206}
executed: }
Execution Count:49102
49102
2207 -
2208 -
2209/*! -
2210 Returns a pointer to the widget with window identifer/handle \a -
2211 id. -
2212 -
2213 The window identifier type depends on the underlying window -
2214 system, see \c qwindowdefs.h for the actual definition. If there -
2215 is no widget with this identifier, 0 is returned. -
2216*/ -
2217 -
2218QWidget *QWidget::find(WId id) -
2219{ -
2220 return QWidgetPrivate::mapper ? QWidgetPrivate::mapper->value(id, 0) : 0;
never executed: return QWidgetPrivate::mapper ? QWidgetPrivate::mapper->value(id, 0) : 0;
0
2221} -
2222 -
2223 -
2224 -
2225/*! -
2226 \fn WId QWidget::internalWinId() const -
2227 \internal -
2228 Returns the window system identifier of the widget, or 0 if the widget is not created yet. -
2229 -
2230*/ -
2231 -
2232/*! -
2233 \fn WId QWidget::winId() const -
2234 -
2235 Returns the window system identifier of the widget. -
2236 -
2237 Portable in principle, but if you use it you are probably about to -
2238 do something non-portable. Be careful. -
2239 -
2240 If a widget is non-native (alien) and winId() is invoked on it, that widget -
2241 will be provided a native handle. -
2242 -
2243 On Mac OS X, the type returned depends on which framework Qt was linked -
2244 against. If Qt is using Carbon, the {WId} is actually an HIViewRef. If Qt -
2245 is using Cocoa, {WId} is a pointer to an NSView. -
2246 -
2247 This value may change at run-time. An event with type QEvent::WinIdChange -
2248 will be sent to the widget following a change in window system identifier. -
2249 -
2250 \sa find() -
2251*/ -
2252WId QWidget::winId() const -
2253{ -
2254 if (!testAttribute(Qt::WA_WState_Created) || !internalWinId()) {
evaluated: !testAttribute(Qt::WA_WState_Created)
TRUEFALSE
yes
Evaluation Count:19
yes
Evaluation Count:43
evaluated: !internalWinId()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:41
2-43
2255#ifdef ALIEN_DEBUG -
2256 qDebug() << "QWidget::winId: creating native window for" << this; -
2257#endif -
2258 QWidget *that = const_cast<QWidget*>(this);
executed (the execution status of this line is deduced): QWidget *that = const_cast<QWidget*>(this);
-
2259 that->setAttribute(Qt::WA_NativeWindow);
executed (the execution status of this line is deduced): that->setAttribute(Qt::WA_NativeWindow);
-
2260 that->d_func()->createWinId();
executed (the execution status of this line is deduced): that->d_func()->createWinId();
-
2261 return that->data->winid;
executed: return that->data->winid;
Execution Count:21
21
2262 } -
2263 return data->winid;
executed: return data->winid;
Execution Count:41
41
2264} -
2265 -
2266 -
2267void QWidgetPrivate::createWinId(WId winid) -
2268{ -
2269 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
2270 -
2271#ifdef ALIEN_DEBUG -
2272 qDebug() << "QWidgetPrivate::createWinId for" << q << winid; -
2273#endif -
2274 const bool forceNativeWindow = q->testAttribute(Qt::WA_NativeWindow);
executed (the execution status of this line is deduced): const bool forceNativeWindow = q->testAttribute(Qt::WA_NativeWindow);
-
2275 if (!q->testAttribute(Qt::WA_WState_Created) || (forceNativeWindow && !q->internalWinId())) {
evaluated: !q->testAttribute(Qt::WA_WState_Created)
TRUEFALSE
yes
Evaluation Count:108
yes
Evaluation Count:13
evaluated: forceNativeWindow
TRUEFALSE
yes
Evaluation Count:11
yes
Evaluation Count:2
evaluated: !q->internalWinId()
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:2
2-108
2276 if (!q->isWindow()) {
evaluated: !q->isWindow()
TRUEFALSE
yes
Evaluation Count:30
yes
Evaluation Count:87
30-87
2277 QWidget *parent = q->parentWidget();
executed (the execution status of this line is deduced): QWidget *parent = q->parentWidget();
-
2278 QWidgetPrivate *pd = parent->d_func();
executed (the execution status of this line is deduced): QWidgetPrivate *pd = parent->d_func();
-
2279 if (forceNativeWindow && !q->testAttribute(Qt::WA_DontCreateNativeAncestors))
evaluated: forceNativeWindow
TRUEFALSE
yes
Evaluation Count:29
yes
Evaluation Count:1
evaluated: !q->testAttribute(Qt::WA_DontCreateNativeAncestors)
TRUEFALSE
yes
Evaluation Count:28
yes
Evaluation Count:1
1-29
2280 parent->setAttribute(Qt::WA_NativeWindow);
executed: parent->setAttribute(Qt::WA_NativeWindow);
Execution Count:28
28
2281 if (!parent->internalWinId()) {
evaluated: !parent->internalWinId()
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:18
12-18
2282 pd->createWinId();
executed (the execution status of this line is deduced): pd->createWinId();
-
2283 }
executed: }
Execution Count:12
12
2284 -
2285 for (int i = 0; i < pd->children.size(); ++i) {
evaluated: i < pd->children.size()
TRUEFALSE
yes
Evaluation Count:47
yes
Evaluation Count:30
30-47
2286 QWidget *w = qobject_cast<QWidget *>(pd->children.at(i));
executed (the execution status of this line is deduced): QWidget *w = qobject_cast<QWidget *>(pd->children.at(i));
-
2287 if (w && !w->isWindow() && (!w->testAttribute(Qt::WA_WState_Created)
evaluated: w
TRUEFALSE
yes
Evaluation Count:46
yes
Evaluation Count:1
partially evaluated: !w->isWindow()
TRUEFALSE
yes
Evaluation Count:46
no
Evaluation Count:0
evaluated: !w->testAttribute(Qt::WA_WState_Created)
TRUEFALSE
yes
Evaluation Count:26
yes
Evaluation Count:20
0-46
2288 || (!w->internalWinId() && w->testAttribute(Qt::WA_NativeWindow)))) {
evaluated: !w->internalWinId()
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:6
evaluated: w->testAttribute(Qt::WA_NativeWindow)
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:2
2-14
2289 if (w!=q) {
evaluated: w!=q
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:30
8-30
2290 w->create();
executed (the execution status of this line is deduced): w->create();
-
2291 } else {
executed: }
Execution Count:8
8
2292 w->create(winid);
executed (the execution status of this line is deduced): w->create(winid);
-
2293 // if the window has already been created, we -
2294 // need to raise it to its proper stacking position -
2295 if (winid)
partially evaluated: winid
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:30
0-30
2296 w->raise();
never executed: w->raise();
0
2297 }
executed: }
Execution Count:30
30
2298 } -
2299 }
executed: }
Execution Count:47
47
2300 } else {
executed: }
Execution Count:30
30
2301 q->create();
executed (the execution status of this line is deduced): q->create();
-
2302 }
executed: }
Execution Count:87
87
2303 } -
2304}
executed: }
Execution Count:121
121
2305 -
2306 -
2307/*! -
2308\internal -
2309Ensures that the widget has a window system identifier, i.e. that it is known to the windowing system. -
2310 -
2311*/ -
2312 -
2313void QWidget::createWinId() -
2314{ -
2315 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
2316#ifdef ALIEN_DEBUG -
2317 qDebug() << "QWidget::createWinId" << this; -
2318#endif -
2319// qWarning("QWidget::createWinId is obsolete, please fix your code."); -
2320 d->createWinId();
executed (the execution status of this line is deduced): d->createWinId();
-
2321}
executed: }
Execution Count:77
77
2322 -
2323/*! -
2324 \since 4.4 -
2325 -
2326 Returns the effective window system identifier of the widget, i.e. the -
2327 native parent's window system identifier. -
2328 -
2329 If the widget is native, this function returns the native widget ID. -
2330 Otherwise, the window ID of the first native parent widget, i.e., the -
2331 top-level widget that contains this widget, is returned. -
2332 -
2333 \note We recommend that you do not store this value as it is likely to -
2334 change at run-time. -
2335 -
2336 \sa nativeParentWidget() -
2337*/ -
2338WId QWidget::effectiveWinId() const -
2339{ -
2340 const WId id = internalWinId();
executed (the execution status of this line is deduced): const WId id = internalWinId();
-
2341 if (id || !testAttribute(Qt::WA_WState_Created))
evaluated: id
TRUEFALSE
yes
Evaluation Count:112
yes
Evaluation Count:376
evaluated: !testAttribute(Qt::WA_WState_Created)
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:374
2-376
2342 return id;
executed: return id;
Execution Count:114
114
2343 if (const QWidget *realParent = nativeParentWidget())
partially evaluated: const QWidget *realParent = nativeParentWidget()
TRUEFALSE
yes
Evaluation Count:374
no
Evaluation Count:0
0-374
2344 return realParent->internalWinId();
executed: return realParent->internalWinId();
Execution Count:374
374
2345 return 0;
never executed: return 0;
0
2346} -
2347 -
2348#ifndef QT_NO_STYLE_STYLESHEET -
2349 -
2350/*! -
2351 \property QWidget::styleSheet -
2352 \brief the widget's style sheet -
2353 \since 4.2 -
2354 -
2355 The style sheet contains a textual description of customizations to the -
2356 widget's style, as described in the \l{Qt Style Sheets} document. -
2357 -
2358 Since Qt 4.5, Qt style sheets fully supports Mac OS X. -
2359 -
2360 \warning Qt style sheets are currently not supported for custom QStyle -
2361 subclasses. We plan to address this in some future release. -
2362 -
2363 \sa setStyle(), QApplication::styleSheet, {Qt Style Sheets} -
2364*/ -
2365QString QWidget::styleSheet() const -
2366{ -
2367 Q_D(const QWidget);
executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
2368 if (!d->extra)
evaluated: !d->extra
TRUEFALSE
yes
Evaluation Count:42809
yes
Evaluation Count:7923
7923-42809
2369 return QString();
executed: return QString();
Execution Count:42809
42809
2370 return d->extra->styleSheet;
executed: return d->extra->styleSheet;
Execution Count:7923
7923
2371} -
2372 -
2373void QWidget::setStyleSheet(const QString& styleSheet) -
2374{ -
2375 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
2376 d->createExtra();
executed (the execution status of this line is deduced): d->createExtra();
-
2377 -
2378 QStyleSheetStyle *proxy = qobject_cast<QStyleSheetStyle *>(d->extra->style);
executed (the execution status of this line is deduced): QStyleSheetStyle *proxy = qobject_cast<QStyleSheetStyle *>(d->extra->style);
-
2379 d->extra->styleSheet = styleSheet;
executed (the execution status of this line is deduced): d->extra->styleSheet = styleSheet;
-
2380 if (styleSheet.isEmpty()) { // stylesheet removed
evaluated: styleSheet.isEmpty()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:399
2-399
2381 if (!proxy)
partially evaluated: !proxy
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
2382 return;
never executed: return;
0
2383 -
2384 d->inheritStyle();
executed (the execution status of this line is deduced): d->inheritStyle();
-
2385 return;
executed: return;
Execution Count:2
2
2386 } -
2387 -
2388 if (proxy) { // style sheet update
partially evaluated: proxy
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:399
0-399
2389 proxy->repolish(this);
never executed (the execution status of this line is deduced): proxy->repolish(this);
-
2390 return;
never executed: return;
0
2391 } -
2392 -
2393 if (testAttribute(Qt::WA_SetStyle)) {
evaluated: testAttribute(Qt::WA_SetStyle)
TRUEFALSE
yes
Evaluation Count:384
yes
Evaluation Count:15
15-384
2394 d->setStyle_helper(new QStyleSheetStyle(d->extra->style), true);
executed (the execution status of this line is deduced): d->setStyle_helper(new QStyleSheetStyle(d->extra->style), true);
-
2395 } else {
executed: }
Execution Count:384
384
2396 d->setStyle_helper(new QStyleSheetStyle(0), true);
executed (the execution status of this line is deduced): d->setStyle_helper(new QStyleSheetStyle(0), true);
-
2397 }
executed: }
Execution Count:15
15
2398} -
2399 -
2400#endif // QT_NO_STYLE_STYLESHEET -
2401 -
2402/*! -
2403 \sa QWidget::setStyle(), QApplication::setStyle(), QApplication::style() -
2404*/ -
2405 -
2406QStyle *QWidget::style() const -
2407{ -
2408 Q_D(const QWidget);
executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
2409 -
2410 if (d->extra && d->extra->style)
evaluated: d->extra
TRUEFALSE
yes
Evaluation Count:622411
yes
Evaluation Count:918752
evaluated: d->extra->style
TRUEFALSE
yes
Evaluation Count:53624
yes
Evaluation Count:568787
53624-918752
2411 return d->extra->style;
executed: return d->extra->style;
Execution Count:53624
53624
2412 return QApplication::style();
executed: return QApplication::style();
Execution Count:1487539
1487539
2413} -
2414 -
2415/*! -
2416 Sets the widget's GUI style to \a style. The ownership of the style -
2417 object is not transferred. -
2418 -
2419 If no style is set, the widget uses the application's style, -
2420 QApplication::style() instead. -
2421 -
2422 Setting a widget's style has no effect on existing or future child -
2423 widgets. -
2424 -
2425 \warning This function is particularly useful for demonstration -
2426 purposes, where you want to show Qt's styling capabilities. Real -
2427 applications should avoid it and use one consistent GUI style -
2428 instead. -
2429 -
2430 \warning Qt style sheets are currently not supported for custom QStyle -
2431 subclasses. We plan to address this in some future release. -
2432 -
2433 \sa style(), QStyle, QApplication::style(), QApplication::setStyle() -
2434*/ -
2435 -
2436void QWidget::setStyle(QStyle *style) -
2437{ -
2438 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
2439 setAttribute(Qt::WA_SetStyle, style != 0);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_SetStyle, style != 0);
-
2440 d->createExtra();
executed (the execution status of this line is deduced): d->createExtra();
-
2441#ifndef QT_NO_STYLE_STYLESHEET -
2442 if (QStyleSheetStyle *proxy = qobject_cast<QStyleSheetStyle *>(style)) {
partially evaluated: QStyleSheetStyle *proxy = qobject_cast<QStyleSheetStyle *>(style)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:450
0-450
2443 //if for some reason someone try to set a QStyleSheetStyle, ref it -
2444 //(this may happen for exemple in QButtonDialogBox which propagates its style) -
2445 proxy->ref();
never executed (the execution status of this line is deduced): proxy->ref();
-
2446 d->setStyle_helper(style, false);
never executed (the execution status of this line is deduced): d->setStyle_helper(style, false);
-
2447 } else if (qobject_cast<QStyleSheetStyle *>(d->extra->style) || !qApp->styleSheet().isEmpty()) {
never executed: }
partially evaluated: qobject_cast<QStyleSheetStyle *>(d->extra->style)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:450
partially evaluated: !(static_cast<QApplication *>(QCoreApplication::instance()))->styleSheet().isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:450
0-450
2448 // if we have an application stylesheet or have a proxy already, propagate -
2449 d->setStyle_helper(new QStyleSheetStyle(style), true);
never executed (the execution status of this line is deduced): d->setStyle_helper(new QStyleSheetStyle(style), true);
-
2450 } else
never executed: }
0
2451#endif -
2452 d->setStyle_helper(style, false);
executed: d->setStyle_helper(style, false);
Execution Count:450
450
2453} -
2454 -
2455void QWidgetPrivate::setStyle_helper(QStyle *newStyle, bool propagate, bool -
2456#ifdef Q_WS_MAC -
2457 metalHack -
2458#endif -
2459 ) -
2460{ -
2461 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
2462 QStyle *oldStyle = q->style();
executed (the execution status of this line is deduced): QStyle *oldStyle = q->style();
-
2463#ifndef QT_NO_STYLE_STYLESHEET -
2464 QPointer<QStyle> origStyle;
executed (the execution status of this line is deduced): QPointer<QStyle> origStyle;
-
2465#endif -
2466 -
2467#ifdef Q_WS_MAC -
2468 // the metalhack boolean allows Qt/Mac to do a proper re-polish depending -
2469 // on how the Qt::WA_MacBrushedMetal attribute is set. It is only ever -
2470 // set when changing that attribute and passes the widget's CURRENT style. -
2471 // therefore no need to do a reassignment. -
2472 if (!metalHack) -
2473#endif -
2474 { -
2475 createExtra();
executed (the execution status of this line is deduced): createExtra();
-
2476 -
2477#ifndef QT_NO_STYLE_STYLESHEET -
2478 origStyle = extra->style.data();
executed (the execution status of this line is deduced): origStyle = extra->style.data();
-
2479#endif -
2480 extra->style = newStyle;
executed (the execution status of this line is deduced): extra->style = newStyle;
-
2481 } -
2482 -
2483 // repolish -
2484 if (q->windowType() != Qt::Desktop) {
partially evaluated: q->windowType() != Qt::Desktop
TRUEFALSE
yes
Evaluation Count:2844
no
Evaluation Count:0
0-2844
2485 if (polished) {
evaluated: polished
TRUEFALSE
yes
Evaluation Count:814
yes
Evaluation Count:2030
814-2030
2486 oldStyle->unpolish(q);
executed (the execution status of this line is deduced): oldStyle->unpolish(q);
-
2487#ifdef Q_WS_MAC -
2488 if (metalHack) -
2489 macUpdateMetalAttribute(); -
2490#endif -
2491 q->style()->polish(q);
executed (the execution status of this line is deduced): q->style()->polish(q);
-
2492#ifdef Q_WS_MAC -
2493 } else if (metalHack) { -
2494 macUpdateMetalAttribute(); -
2495#endif -
2496 }
executed: }
Execution Count:814
814
2497 }
executed: }
Execution Count:2844
2844
2498 -
2499 if (propagate) {
evaluated: propagate
TRUEFALSE
yes
Evaluation Count:2394
yes
Evaluation Count:450
450-2394
2500 // We copy the list because the order may be modified -
2501 const QObjectList childrenList = children;
executed (the execution status of this line is deduced): const QObjectList childrenList = children;
-
2502 for (int i = 0; i < childrenList.size(); ++i) {
evaluated: i < childrenList.size()
TRUEFALSE
yes
Evaluation Count:2764
yes
Evaluation Count:2394
2394-2764
2503 QWidget *c = qobject_cast<QWidget*>(childrenList.at(i));
executed (the execution status of this line is deduced): QWidget *c = qobject_cast<QWidget*>(childrenList.at(i));
-
2504 if (c)
evaluated: c
TRUEFALSE
yes
Evaluation Count:1977
yes
Evaluation Count:787
787-1977
2505 c->d_func()->inheritStyle();
executed: c->d_func()->inheritStyle();
Execution Count:1977
1977
2506 }
executed: }
Execution Count:2764
2764
2507 }
executed: }
Execution Count:2394
2394
2508 -
2509#ifndef QT_NO_STYLE_STYLESHEET -
2510 if (!qobject_cast<QStyleSheetStyle*>(newStyle)) {
evaluated: !qobject_cast<QStyleSheetStyle*>(newStyle)
TRUEFALSE
yes
Evaluation Count:465
yes
Evaluation Count:2379
465-2379
2511 if (const QStyleSheetStyle* cssStyle = qobject_cast<QStyleSheetStyle*>(origStyle.data())) {
evaluated: const QStyleSheetStyle* cssStyle = qobject_cast<QStyleSheetStyle*>(origStyle.data())
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:463
2-463
2512 cssStyle->clearWidgetFont(q);
executed (the execution status of this line is deduced): cssStyle->clearWidgetFont(q);
-
2513 }
executed: }
Execution Count:2
2
2514 }
executed: }
Execution Count:465
465
2515#endif -
2516 -
2517 QEvent e(QEvent::StyleChange);
executed (the execution status of this line is deduced): QEvent e(QEvent::StyleChange);
-
2518 QApplication::sendEvent(q, &e);
executed (the execution status of this line is deduced): QApplication::sendEvent(q, &e);
-
2519 -
2520#ifndef QT_NO_STYLE_STYLESHEET -
2521 // dereference the old stylesheet style -
2522 if (QStyleSheetStyle *proxy = qobject_cast<QStyleSheetStyle *>(origStyle.data()))
evaluated: QStyleSheetStyle *proxy = qobject_cast<QStyleSheetStyle *>(origStyle.data())
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2842
2-2842
2523 proxy->deref();
executed: proxy->deref();
Execution Count:2
2
2524#endif -
2525}
executed: }
Execution Count:2844
2844
2526 -
2527// Inherits style from the current parent and propagates it as necessary -
2528void QWidgetPrivate::inheritStyle() -
2529{ -
2530#ifndef QT_NO_STYLE_STYLESHEET -
2531 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
2532 -
2533 QStyleSheetStyle *proxy = extra ? qobject_cast<QStyleSheetStyle *>(extra->style) : 0;
evaluated: extra
TRUEFALSE
yes
Evaluation Count:732
yes
Evaluation Count:42787
732-42787
2534 -
2535 if (!q->styleSheet().isEmpty()) {
partially evaluated: !q->styleSheet().isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:43519
0-43519
2536 Q_ASSERT(proxy);
never executed (the execution status of this line is deduced): qt_noop();
-
2537 proxy->repolish(q);
never executed (the execution status of this line is deduced): proxy->repolish(q);
-
2538 return;
never executed: return;
0
2539 } -
2540 -
2541 QStyle *origStyle = proxy ? proxy->base : (extra ? (QStyle*)extra->style : 0);
evaluated: proxy
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:43517
2-43517
2542 QWidget *parent = q->parentWidget();
executed (the execution status of this line is deduced): QWidget *parent = q->parentWidget();
-
2543 QStyle *parentStyle = (parent && parent->d_func()->extra) ? (QStyle*)parent->d_func()->extra->style : 0;
evaluated: parent
TRUEFALSE
yes
Evaluation Count:42949
yes
Evaluation Count:570
evaluated: parent->d_func()->extra
TRUEFALSE
yes
Evaluation Count:5018
yes
Evaluation Count:37931
570-42949
2544 // If we have stylesheet on app or parent has stylesheet style, we need -
2545 // to be running a proxy -
2546 if (!qApp->styleSheet().isEmpty() || qobject_cast<QStyleSheetStyle *>(parentStyle)) {
evaluated: !(static_cast<QApplication *>(QCoreApplication::instance()))->styleSheet().isEmpty()
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:43506
evaluated: qobject_cast<QStyleSheetStyle *>(parentStyle)
TRUEFALSE
yes
Evaluation Count:1980
yes
Evaluation Count:41526
13-43506
2547 QStyle *newStyle = parentStyle;
executed (the execution status of this line is deduced): QStyle *newStyle = parentStyle;
-
2548 if (q->testAttribute(Qt::WA_SetStyle))
partially evaluated: q->testAttribute(Qt::WA_SetStyle)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1993
0-1993
2549 newStyle = new QStyleSheetStyle(origStyle);
never executed: newStyle = new QStyleSheetStyle(origStyle);
0
2550 else if (QStyleSheetStyle *newProxy = qobject_cast<QStyleSheetStyle *>(parentStyle))
evaluated: QStyleSheetStyle *newProxy = qobject_cast<QStyleSheetStyle *>(parentStyle)
TRUEFALSE
yes
Evaluation Count:1980
yes
Evaluation Count:13
13-1980
2551 newProxy->ref();
executed: newProxy->ref();
Execution Count:1980
1980
2552 -
2553 setStyle_helper(newStyle, true);
executed (the execution status of this line is deduced): setStyle_helper(newStyle, true);
-
2554 return;
executed: return;
Execution Count:1993
1993
2555 } -
2556 -
2557 // So, we have no stylesheet on parent/app and we have an empty stylesheet -
2558 // we just need our original style back -
2559 if (origStyle == (extra ? (QStyle*)extra->style : 0)) // is it any different?
evaluated: origStyle == (extra ? (QStyle*)extra->style : 0)
TRUEFALSE
yes
Evaluation Count:41524
yes
Evaluation Count:2
evaluated: extra
TRUEFALSE
yes
Evaluation Count:342
yes
Evaluation Count:41184
2-41524
2560 return;
executed: return;
Execution Count:41524
41524
2561 -
2562 // We could have inherited the proxy from our parent (which has a custom style) -
2563 // In such a case we need to start following the application style (i.e revert -
2564 // the propagation behavior of QStyleSheetStyle) -
2565 if (!q->testAttribute(Qt::WA_SetStyle))
partially evaluated: !q->testAttribute(Qt::WA_SetStyle)
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
2566 origStyle = 0;
executed: origStyle = 0;
Execution Count:2
2
2567 -
2568 setStyle_helper(origStyle, true);
executed (the execution status of this line is deduced): setStyle_helper(origStyle, true);
-
2569#endif // QT_NO_STYLE_STYLESHEET -
2570}
executed: }
Execution Count:2
2
2571 -
2572 -
2573/*! -
2574 \fn bool QWidget::isWindow() const -
2575 -
2576 Returns true if the widget is an independent window, otherwise -
2577 returns false. -
2578 -
2579 A window is a widget that isn't visually the child of any other -
2580 widget and that usually has a frame and a -
2581 \l{QWidget::setWindowTitle()}{window title}. -
2582 -
2583 A window can have a \l{QWidget::parentWidget()}{parent widget}. -
2584 It will then be grouped with its parent and deleted when the -
2585 parent is deleted, minimized when the parent is minimized etc. If -
2586 supported by the window manager, it will also have a common -
2587 taskbar entry with its parent. -
2588 -
2589 QDialog and QMainWindow widgets are by default windows, even if a -
2590 parent widget is specified in the constructor. This behavior is -
2591 specified by the Qt::Window flag. -
2592 -
2593 \sa window(), isModal(), parentWidget() -
2594*/ -
2595 -
2596/*! -
2597 \property QWidget::modal -
2598 \brief whether the widget is a modal widget -
2599 -
2600 This property only makes sense for windows. A modal widget -
2601 prevents widgets in all other windows from getting any input. -
2602 -
2603 By default, this property is false. -
2604 -
2605 \sa isWindow(), windowModality, QDialog -
2606*/ -
2607 -
2608/*! -
2609 \property QWidget::windowModality -
2610 \brief which windows are blocked by the modal widget -
2611 \since 4.1 -
2612 -
2613 This property only makes sense for windows. A modal widget -
2614 prevents widgets in other windows from getting input. The value of -
2615 this property controls which windows are blocked when the widget -
2616 is visible. Changing this property while the window is visible has -
2617 no effect; you must hide() the widget first, then show() it again. -
2618 -
2619 By default, this property is Qt::NonModal. -
2620 -
2621 \sa isWindow(), QWidget::modal, QDialog -
2622*/ -
2623 -
2624Qt::WindowModality QWidget::windowModality() const -
2625{ -
2626 return static_cast<Qt::WindowModality>(data->window_modality);
executed: return static_cast<Qt::WindowModality>(data->window_modality);
Execution Count:2738
2738
2627} -
2628 -
2629void QWidget::setWindowModality(Qt::WindowModality windowModality) -
2630{ -
2631 data->window_modality = windowModality;
executed (the execution status of this line is deduced): data->window_modality = windowModality;
-
2632 // setModal_sys() will be called by setAttribute() -
2633 setAttribute(Qt::WA_ShowModal, (data->window_modality != Qt::NonModal));
executed (the execution status of this line is deduced): setAttribute(Qt::WA_ShowModal, (data->window_modality != Qt::NonModal));
-
2634 setAttribute(Qt::WA_SetWindowModality, true);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_SetWindowModality, true);
-
2635}
executed: }
Execution Count:4
4
2636 -
2637/*! -
2638 \fn bool QWidget::underMouse() const -
2639 -
2640 Returns true if the widget is under the mouse cursor; otherwise -
2641 returns false. -
2642 -
2643 This value is not updated properly during drag and drop -
2644 operations. -
2645 -
2646 \sa enterEvent(), leaveEvent() -
2647*/ -
2648 -
2649/*! -
2650 \property QWidget::minimized -
2651 \brief whether this widget is minimized (iconified) -
2652 -
2653 This property is only relevant for windows. -
2654 -
2655 By default, this property is false. -
2656 -
2657 \sa showMinimized(), visible, show(), hide(), showNormal(), maximized -
2658*/ -
2659bool QWidget::isMinimized() const -
2660{ return data->window_state & Qt::WindowMinimized; }
executed: return data->window_state & Qt::WindowMinimized;
Execution Count:43322
43322
2661 -
2662/*! -
2663 Shows the widget minimized, as an icon. -
2664 -
2665 Calling this function only affects \l{isWindow()}{windows}. -
2666 -
2667 \sa showNormal(), showMaximized(), show(), hide(), isVisible(), -
2668 isMinimized() -
2669*/ -
2670void QWidget::showMinimized() -
2671{ -
2672 bool isMin = isMinimized();
executed (the execution status of this line is deduced): bool isMin = isMinimized();
-
2673 if (isMin && isVisible())
evaluated: isMin
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:51
evaluated: isVisible()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:2
1-51
2674 return;
executed: return;
Execution Count:1
1
2675 -
2676 ensurePolished();
executed (the execution status of this line is deduced): ensurePolished();
-
2677 -
2678 if (!isMin)
evaluated: !isMin
TRUEFALSE
yes
Evaluation Count:51
yes
Evaluation Count:2
2-51
2679 setWindowState((windowState() & ~Qt::WindowActive) | Qt::WindowMinimized);
executed: setWindowState((windowState() & ~Qt::WindowActive) | Qt::WindowMinimized);
Execution Count:51
51
2680 setVisible(true);
executed (the execution status of this line is deduced): setVisible(true);
-
2681}
executed: }
Execution Count:53
53
2682 -
2683/*! -
2684 \property QWidget::maximized -
2685 \brief whether this widget is maximized -
2686 -
2687 This property is only relevant for windows. -
2688 -
2689 \note Due to limitations on some window systems, this does not always -
2690 report the expected results (e.g., if the user on X11 maximizes the -
2691 window via the window manager, Qt has no way of distinguishing this -
2692 from any other resize). This is expected to improve as window manager -
2693 protocols evolve. -
2694 -
2695 By default, this property is false. -
2696 -
2697 \sa windowState(), showMaximized(), visible, show(), hide(), showNormal(), minimized -
2698*/ -
2699bool QWidget::isMaximized() const -
2700{ return data->window_state & Qt::WindowMaximized; }
executed: return data->window_state & Qt::WindowMaximized;
Execution Count:30302
30302
2701 -
2702 -
2703 -
2704/*! -
2705 Returns the current window state. The window state is a OR'ed -
2706 combination of Qt::WindowState: Qt::WindowMinimized, -
2707 Qt::WindowMaximized, Qt::WindowFullScreen, and Qt::WindowActive. -
2708 -
2709 \sa Qt::WindowState, setWindowState() -
2710 */ -
2711Qt::WindowStates QWidget::windowState() const -
2712{ -
2713 return Qt::WindowStates(data->window_state);
executed: return Qt::WindowStates(data->window_state);
Execution Count:37347
37347
2714} -
2715 -
2716/*!\internal -
2717 -
2718 The function sets the window state on child widgets similar to -
2719 setWindowState(). The difference is that the window state changed -
2720 event has the isOverride() flag set. It exists mainly to keep -
2721 QWorkspace working. -
2722 */ -
2723void QWidget::overrideWindowState(Qt::WindowStates newstate) -
2724{ -
2725 QWindowStateChangeEvent e(Qt::WindowStates(data->window_state), true);
executed (the execution status of this line is deduced): QWindowStateChangeEvent e(Qt::WindowStates(data->window_state), true);
-
2726 data->window_state = newstate;
executed (the execution status of this line is deduced): data->window_state = newstate;
-
2727 QApplication::sendEvent(this, &e);
executed (the execution status of this line is deduced): QApplication::sendEvent(this, &e);
-
2728}
executed: }
Execution Count:1918
1918
2729 -
2730/*! -
2731 \fn void QWidget::setWindowState(Qt::WindowStates windowState) -
2732 -
2733 Sets the window state to \a windowState. The window state is a OR'ed -
2734 combination of Qt::WindowState: Qt::WindowMinimized, -
2735 Qt::WindowMaximized, Qt::WindowFullScreen, and Qt::WindowActive. -
2736 -
2737 If the window is not visible (i.e. isVisible() returns false), the -
2738 window state will take effect when show() is called. For visible -
2739 windows, the change is immediate. For example, to toggle between -
2740 full-screen and normal mode, use the following code: -
2741 -
2742 \snippet code/src_gui_kernel_qwidget.cpp 0 -
2743 -
2744 In order to restore and activate a minimized window (while -
2745 preserving its maximized and/or full-screen state), use the following: -
2746 -
2747 \snippet code/src_gui_kernel_qwidget.cpp 1 -
2748 -
2749 Calling this function will hide the widget. You must call show() to make -
2750 the widget visible again. -
2751 -
2752 \note On some window systems Qt::WindowActive is not immediate, and may be -
2753 ignored in certain cases. -
2754 -
2755 When the window state changes, the widget receives a changeEvent() -
2756 of type QEvent::WindowStateChange. -
2757 -
2758 \sa Qt::WindowState, windowState() -
2759*/ -
2760 -
2761/*! -
2762 \property QWidget::fullScreen -
2763 \brief whether the widget is shown in full screen mode -
2764 -
2765 A widget in full screen mode occupies the whole screen area and does not -
2766 display window decorations, such as a title bar. -
2767 -
2768 By default, this property is false. -
2769 -
2770 \sa windowState(), minimized, maximized -
2771*/ -
2772bool QWidget::isFullScreen() const -
2773{ return data->window_state & Qt::WindowFullScreen; }
executed: return data->window_state & Qt::WindowFullScreen;
Execution Count:26
26
2774 -
2775/*! -
2776 Shows the widget in full-screen mode. -
2777 -
2778 Calling this function only affects \l{isWindow()}{windows}. -
2779 -
2780 To return from full-screen mode, call showNormal(). -
2781 -
2782 Full-screen mode works fine under Windows, but has certain -
2783 problems under X. These problems are due to limitations of the -
2784 ICCCM protocol that specifies the communication between X11 -
2785 clients and the window manager. ICCCM simply does not understand -
2786 the concept of non-decorated full-screen windows. Therefore, the -
2787 best we can do is to request a borderless window and place and -
2788 resize it to fill the entire screen. Depending on the window -
2789 manager, this may or may not work. The borderless window is -
2790 requested using MOTIF hints, which are at least partially -
2791 supported by virtually all modern window managers. -
2792 -
2793 An alternative would be to bypass the window manager entirely and -
2794 create a window with the Qt::X11BypassWindowManagerHint flag. This -
2795 has other severe problems though, like totally broken keyboard focus -
2796 and very strange effects on desktop changes or when the user raises -
2797 other windows. -
2798 -
2799 X11 window managers that follow modern post-ICCCM specifications -
2800 support full-screen mode properly. -
2801 -
2802 \sa showNormal(), showMaximized(), show(), hide(), isVisible() -
2803*/ -
2804void QWidget::showFullScreen() -
2805{ -
2806#ifdef Q_WS_MAC -
2807 // If the unified toolbar is enabled, we have to disable it before going fullscreen. -
2808 QMainWindow *mainWindow = qobject_cast<QMainWindow*>(this); -
2809 if (mainWindow && mainWindow->unifiedTitleAndToolBarOnMac()) { -
2810 mainWindow->setUnifiedTitleAndToolBarOnMac(false); -
2811 QMainWindowLayout *mainLayout = qobject_cast<QMainWindowLayout*>(mainWindow->layout()); -
2812 mainLayout->activateUnifiedToolbarAfterFullScreen = true; -
2813 } -
2814#endif // Q_WS_MAC -
2815 ensurePolished();
executed (the execution status of this line is deduced): ensurePolished();
-
2816 -
2817 setWindowState((windowState() & ~(Qt::WindowMinimized | Qt::WindowMaximized))
executed (the execution status of this line is deduced): setWindowState((windowState() & ~(Qt::WindowMinimized | Qt::WindowMaximized))
-
2818 | Qt::WindowFullScreen);
executed (the execution status of this line is deduced): | Qt::WindowFullScreen);
-
2819 setVisible(true);
executed (the execution status of this line is deduced): setVisible(true);
-
2820 activateWindow();
executed (the execution status of this line is deduced): activateWindow();
-
2821}
executed: }
Execution Count:18
18
2822 -
2823/*! -
2824 Shows the widget maximized. -
2825 -
2826 Calling this function only affects \l{isWindow()}{windows}. -
2827 -
2828 On X11, this function may not work properly with certain window -
2829 managers. See the \l{Window Geometry} documentation for an explanation. -
2830 -
2831 \sa setWindowState(), showNormal(), showMinimized(), show(), hide(), isVisible() -
2832*/ -
2833void QWidget::showMaximized() -
2834{ -
2835 ensurePolished();
executed (the execution status of this line is deduced): ensurePolished();
-
2836 -
2837 setWindowState((windowState() & ~(Qt::WindowMinimized | Qt::WindowFullScreen))
executed (the execution status of this line is deduced): setWindowState((windowState() & ~(Qt::WindowMinimized | Qt::WindowFullScreen))
-
2838 | Qt::WindowMaximized);
executed (the execution status of this line is deduced): | Qt::WindowMaximized);
-
2839#ifdef Q_WS_MAC -
2840 // If the unified toolbar was enabled before going fullscreen, we have to enable it back. -
2841 QMainWindow *mainWindow = qobject_cast<QMainWindow*>(this); -
2842 if (mainWindow) -
2843 { -
2844 QMainWindowLayout *mainLayout = qobject_cast<QMainWindowLayout*>(mainWindow->layout()); -
2845 if (mainLayout->activateUnifiedToolbarAfterFullScreen) { -
2846 mainWindow->setUnifiedTitleAndToolBarOnMac(true); -
2847 mainLayout->activateUnifiedToolbarAfterFullScreen = false; -
2848 } -
2849 } -
2850#endif // Q_WS_MAC -
2851 setVisible(true);
executed (the execution status of this line is deduced): setVisible(true);
-
2852}
executed: }
Execution Count:83
83
2853 -
2854/*! -
2855 Restores the widget after it has been maximized or minimized. -
2856 -
2857 Calling this function only affects \l{isWindow()}{windows}. -
2858 -
2859 \sa setWindowState(), showMinimized(), showMaximized(), show(), hide(), isVisible() -
2860*/ -
2861void QWidget::showNormal() -
2862{ -
2863 ensurePolished();
executed (the execution status of this line is deduced): ensurePolished();
-
2864 -
2865 setWindowState(windowState() & ~(Qt::WindowMinimized
executed (the execution status of this line is deduced): setWindowState(windowState() & ~(Qt::WindowMinimized
-
2866 | Qt::WindowMaximized
executed (the execution status of this line is deduced): | Qt::WindowMaximized
-
2867 | Qt::WindowFullScreen));
executed (the execution status of this line is deduced): | Qt::WindowFullScreen));
-
2868#ifdef Q_WS_MAC -
2869 // If the unified toolbar was enabled before going fullscreen, we have to enable it back. -
2870 QMainWindow *mainWindow = qobject_cast<QMainWindow*>(this); -
2871 if (mainWindow) -
2872 { -
2873 QMainWindowLayout *mainLayout = qobject_cast<QMainWindowLayout*>(mainWindow->layout()); -
2874 if (mainLayout->activateUnifiedToolbarAfterFullScreen) { -
2875 mainWindow->setUnifiedTitleAndToolBarOnMac(true); -
2876 mainLayout->activateUnifiedToolbarAfterFullScreen = false; -
2877 } -
2878 } -
2879#endif // Q_WS_MAC -
2880 setVisible(true);
executed (the execution status of this line is deduced): setVisible(true);
-
2881}
executed: }
Execution Count:92
92
2882 -
2883/*! -
2884 Returns true if this widget would become enabled if \a ancestor is -
2885 enabled; otherwise returns false. -
2886 -
2887 -
2888 -
2889 This is the case if neither the widget itself nor every parent up -
2890 to but excluding \a ancestor has been explicitly disabled. -
2891 -
2892 isEnabledTo(0) is equivalent to isEnabled(). -
2893 -
2894 \sa setEnabled(), enabled -
2895*/ -
2896 -
2897bool QWidget::isEnabledTo(const QWidget *ancestor) const -
2898{ -
2899 const QWidget * w = this;
executed (the execution status of this line is deduced): const QWidget * w = this;
-
2900 while (!w->testAttribute(Qt::WA_ForceDisabled)
evaluated: !w->testAttribute(Qt::WA_ForceDisabled)
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:2
2-5
2901 && !w->isWindow()
partially evaluated: !w->isWindow()
TRUEFALSE
yes
Evaluation Count:5
no
Evaluation Count:0
0-5
2902 && w->parentWidget()
partially evaluated: w->parentWidget()
TRUEFALSE
yes
Evaluation Count:5
no
Evaluation Count:0
0-5
2903 && w->parentWidget() != ancestor)
evaluated: w->parentWidget() != ancestor
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:3
2-3
2904 w = w->parentWidget();
executed: w = w->parentWidget();
Execution Count:2
2
2905 return !w->testAttribute(Qt::WA_ForceDisabled);
executed: return !w->testAttribute(Qt::WA_ForceDisabled);
Execution Count:5
5
2906} -
2907 -
2908#ifndef QT_NO_ACTION -
2909/*! -
2910 Appends the action \a action to this widget's list of actions. -
2911 -
2912 All QWidgets have a list of \l{QAction}s, however they can be -
2913 represented graphically in many different ways. The default use of -
2914 the QAction list (as returned by actions()) is to create a context -
2915 QMenu. -
2916 -
2917 A QWidget should only have one of each action and adding an action -
2918 it already has will not cause the same action to be in the widget twice. -
2919 -
2920 The ownership of \a action is not transferred to this QWidget. -
2921 -
2922 \sa removeAction(), insertAction(), actions(), QMenu -
2923*/ -
2924void QWidget::addAction(QAction *action) -
2925{ -
2926 insertAction(0, action);
executed (the execution status of this line is deduced): insertAction(0, action);
-
2927}
executed: }
Execution Count:2656
2656
2928 -
2929/*! -
2930 Appends the actions \a actions to this widget's list of actions. -
2931 -
2932 \sa removeAction(), QMenu, addAction() -
2933*/ -
2934void QWidget::addActions(QList<QAction*> actions) -
2935{ -
2936 for(int i = 0; i < actions.count(); i++)
evaluated: i < actions.count()
TRUEFALSE
yes
Evaluation Count:997
yes
Evaluation Count:162
162-997
2937 insertAction(0, actions.at(i));
executed: insertAction(0, actions.at(i));
Execution Count:997
997
2938}
executed: }
Execution Count:162
162
2939 -
2940/*! -
2941 Inserts the action \a action to this widget's list of actions, -
2942 before the action \a before. It appends the action if \a before is 0 or -
2943 \a before is not a valid action for this widget. -
2944 -
2945 A QWidget should only have one of each action. -
2946 -
2947 \sa removeAction(), addAction(), QMenu, contextMenuPolicy, actions() -
2948*/ -
2949void QWidget::insertAction(QAction *before, QAction *action) -
2950{ -
2951 if(!action) {
partially evaluated: !action
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3653
0-3653
2952 qWarning("QWidget::insertAction: Attempt to insert null action");
never executed (the execution status of this line is deduced): QMessageLogger("kernel/qwidget.cpp", 2952, __PRETTY_FUNCTION__).warning("QWidget::insertAction: Attempt to insert null action");
-
2953 return;
never executed: return;
0
2954 } -
2955 -
2956 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
2957 if(d->actions.contains(action))
partially evaluated: d->actions.contains(action)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3653
0-3653
2958 removeAction(action);
never executed: removeAction(action);
0
2959 -
2960 int pos = d->actions.indexOf(before);
executed (the execution status of this line is deduced): int pos = d->actions.indexOf(before);
-
2961 if (pos < 0) {
partially evaluated: pos < 0
TRUEFALSE
yes
Evaluation Count:3653
no
Evaluation Count:0
0-3653
2962 before = 0;
executed (the execution status of this line is deduced): before = 0;
-
2963 pos = d->actions.size();
executed (the execution status of this line is deduced): pos = d->actions.size();
-
2964 }
executed: }
Execution Count:3653
3653
2965 d->actions.insert(pos, action);
executed (the execution status of this line is deduced): d->actions.insert(pos, action);
-
2966 -
2967 QActionPrivate *apriv = action->d_func();
executed (the execution status of this line is deduced): QActionPrivate *apriv = action->d_func();
-
2968 apriv->widgets.append(this);
executed (the execution status of this line is deduced): apriv->widgets.append(this);
-
2969 -
2970 QActionEvent e(QEvent::ActionAdded, action, before);
executed (the execution status of this line is deduced): QActionEvent e(QEvent::ActionAdded, action, before);
-
2971 QApplication::sendEvent(this, &e);
executed (the execution status of this line is deduced): QApplication::sendEvent(this, &e);
-
2972}
executed: }
Execution Count:3653
3653
2973 -
2974/*! -
2975 Inserts the actions \a actions to this widget's list of actions, -
2976 before the action \a before. It appends the action if \a before is 0 or -
2977 \a before is not a valid action for this widget. -
2978 -
2979 A QWidget can have at most one of each action. -
2980 -
2981 \sa removeAction(), QMenu, insertAction(), contextMenuPolicy -
2982*/ -
2983void QWidget::insertActions(QAction *before, QList<QAction*> actions) -
2984{ -
2985 for(int i = 0; i < actions.count(); ++i)
never evaluated: i < actions.count()
0
2986 insertAction(before, actions.at(i));
never executed: insertAction(before, actions.at(i));
0
2987}
never executed: }
0
2988 -
2989/*! -
2990 Removes the action \a action from this widget's list of actions. -
2991 \sa insertAction(), actions(), insertAction() -
2992*/ -
2993void QWidget::removeAction(QAction *action) -
2994{ -
2995 if (!action)
partially evaluated: !action
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:372
0-372
2996 return;
never executed: return;
0
2997 -
2998 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
2999 -
3000 QActionPrivate *apriv = action->d_func();
executed (the execution status of this line is deduced): QActionPrivate *apriv = action->d_func();
-
3001 apriv->widgets.removeAll(this);
executed (the execution status of this line is deduced): apriv->widgets.removeAll(this);
-
3002 -
3003 if (d->actions.removeAll(action)) {
evaluated: d->actions.removeAll(action)
TRUEFALSE
yes
Evaluation Count:363
yes
Evaluation Count:9
9-363
3004 QActionEvent e(QEvent::ActionRemoved, action);
executed (the execution status of this line is deduced): QActionEvent e(QEvent::ActionRemoved, action);
-
3005 QApplication::sendEvent(this, &e);
executed (the execution status of this line is deduced): QApplication::sendEvent(this, &e);
-
3006 }
executed: }
Execution Count:363
363
3007}
executed: }
Execution Count:372
372
3008 -
3009/*! -
3010 Returns the (possibly empty) list of this widget's actions. -
3011 -
3012 \sa contextMenuPolicy, insertAction(), removeAction() -
3013*/ -
3014QList<QAction*> QWidget::actions() const -
3015{ -
3016 Q_D(const QWidget);
executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
3017 return d->actions;
executed: return d->actions;
Execution Count:766
766
3018} -
3019#endif // QT_NO_ACTION -
3020 -
3021/*! -
3022 \fn bool QWidget::isEnabledToTLW() const -
3023 \obsolete -
3024 -
3025 This function is deprecated. It is equivalent to isEnabled() -
3026*/ -
3027 -
3028/*! -
3029 \property QWidget::enabled -
3030 \brief whether the widget is enabled -
3031 -
3032 In general an enabled widget handles keyboard and mouse events; a disabled -
3033 widget does not. An exception is made with \l{QAbstractButton}. -
3034 -
3035 Some widgets display themselves differently when they are -
3036 disabled. For example a button might draw its label grayed out. If -
3037 your widget needs to know when it becomes enabled or disabled, you -
3038 can use the changeEvent() with type QEvent::EnabledChange. -
3039 -
3040 Disabling a widget implicitly disables all its children. Enabling -
3041 respectively enables all child widgets unless they have been -
3042 explicitly disabled. -
3043 -
3044 By default, this property is true. -
3045 -
3046 \sa isEnabledTo(), QKeyEvent, QMouseEvent, changeEvent() -
3047*/ -
3048void QWidget::setEnabled(bool enable) -
3049{ -
3050 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
3051 setAttribute(Qt::WA_ForceDisabled, !enable);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_ForceDisabled, !enable);
-
3052 d->setEnabled_helper(enable);
executed (the execution status of this line is deduced): d->setEnabled_helper(enable);
-
3053}
executed: }
Execution Count:7270
7270
3054 -
3055void QWidgetPrivate::setEnabled_helper(bool enable) -
3056{ -
3057 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
3058 -
3059 if (enable && !q->isWindow() && q->parentWidget() && !q->parentWidget()->isEnabled())
evaluated: enable
TRUEFALSE
yes
Evaluation Count:44239
yes
Evaluation Count:3604
evaluated: !q->isWindow()
TRUEFALSE
yes
Evaluation Count:44154
yes
Evaluation Count:85
partially evaluated: q->parentWidget()
TRUEFALSE
yes
Evaluation Count:44154
no
Evaluation Count:0
evaluated: !q->parentWidget()->isEnabled()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:44153
0-44239
3060 return; // nothing we can do
executed: return;
Execution Count:1
1
3061 -
3062 if (enable != q->testAttribute(Qt::WA_Disabled))
evaluated: enable != q->testAttribute(Qt::WA_Disabled)
TRUEFALSE
yes
Evaluation Count:44827
yes
Evaluation Count:3015
3015-44827
3063 return; // nothing to do
executed: return;
Execution Count:44827
44827
3064 -
3065 q->setAttribute(Qt::WA_Disabled, !enable);
executed (the execution status of this line is deduced): q->setAttribute(Qt::WA_Disabled, !enable);
-
3066 updateSystemBackground();
executed (the execution status of this line is deduced): updateSystemBackground();
-
3067 -
3068 if (!enable && q->window()->focusWidget() == q) {
evaluated: !enable
TRUEFALSE
yes
Evaluation Count:1900
yes
Evaluation Count:1115
evaluated: q->window()->focusWidget() == q
TRUEFALSE
yes
Evaluation Count:91
yes
Evaluation Count:1809
91-1900
3069 bool parentIsEnabled = (!q->parentWidget() || q->parentWidget()->isEnabled());
evaluated: !q->parentWidget()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:90
evaluated: q->parentWidget()->isEnabled()
TRUEFALSE
yes
Evaluation Count:89
yes
Evaluation Count:1
1-90
3070 if (!parentIsEnabled || !q->focusNextChild())
evaluated: !parentIsEnabled
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:90
evaluated: !q->focusNextChild()
TRUEFALSE
yes
Evaluation Count:89
yes
Evaluation Count:1
1-90
3071 q->clearFocus();
executed: q->clearFocus();
Execution Count:90
90
3072 }
executed: }
Execution Count:91
91
3073 -
3074 Qt::WidgetAttribute attribute = enable ? Qt::WA_ForceDisabled : Qt::WA_Disabled;
evaluated: enable
TRUEFALSE
yes
Evaluation Count:1115
yes
Evaluation Count:1900
1115-1900
3075 for (int i = 0; i < children.size(); ++i) {
evaluated: i < children.size()
TRUEFALSE
yes
Evaluation Count:474
yes
Evaluation Count:3015
474-3015
3076 QWidget *w = qobject_cast<QWidget *>(children.at(i));
executed (the execution status of this line is deduced): QWidget *w = qobject_cast<QWidget *>(children.at(i));
-
3077 if (w && !w->testAttribute(attribute))
evaluated: w
TRUEFALSE
yes
Evaluation Count:263
yes
Evaluation Count:211
evaluated: !w->testAttribute(attribute)
TRUEFALSE
yes
Evaluation Count:251
yes
Evaluation Count:12
12-263
3078 w->d_func()->setEnabled_helper(enable);
executed: w->d_func()->setEnabled_helper(enable);
Execution Count:251
251
3079 }
executed: }
Execution Count:474
474
3080#if defined(Q_WS_X11) -
3081 if (q->testAttribute(Qt::WA_SetCursor) || q->isWindow()) { -
3082 // enforce the windows behavior of clearing the cursor on -
3083 // disabled widgets -
3084 qt_x11_enforce_cursor(q); -
3085 } -
3086#endif -
3087#ifndef QT_NO_CURSOR -
3088 if (q->testAttribute(Qt::WA_SetCursor) || q->isWindow()) {
evaluated: q->testAttribute(Qt::WA_SetCursor)
TRUEFALSE
yes
Evaluation Count:16
yes
Evaluation Count:2999
evaluated: q->isWindow()
TRUEFALSE
yes
Evaluation Count:65
yes
Evaluation Count:2934
16-2999
3089 // enforce the windows behavior of clearing the cursor on -
3090 // disabled widgets -
3091 qt_qpa_set_cursor(q, false);
executed (the execution status of this line is deduced): qt_qpa_set_cursor(q, false);
-
3092 }
executed: }
Execution Count:81
81
3093#endif -
3094#if defined(Q_WS_MAC) -
3095 setEnabled_helper_sys(enable); -
3096#endif -
3097#ifndef QT_NO_IM -
3098 if (q->testAttribute(Qt::WA_InputMethodEnabled) && q->hasFocus()) {
evaluated: q->testAttribute(Qt::WA_InputMethodEnabled)
TRUEFALSE
yes
Evaluation Count:43
yes
Evaluation Count:2972
partially evaluated: q->hasFocus()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:43
0-2972
3099 QWidget *focusWidget = effectiveFocusWidget();
never executed (the execution status of this line is deduced): QWidget *focusWidget = effectiveFocusWidget();
-
3100 -
3101 if (enable) {
never evaluated: enable
0
3102 if (focusWidget->testAttribute(Qt::WA_InputMethodEnabled))
never evaluated: focusWidget->testAttribute(Qt::WA_InputMethodEnabled)
0
3103 qApp->inputMethod()->update(Qt::ImEnabled);
never executed: (static_cast<QApplication *>(QCoreApplication::instance()))->inputMethod()->update(Qt::ImEnabled);
0
3104 } else {
never executed: }
0
3105 qApp->inputMethod()->commit();
never executed (the execution status of this line is deduced): (static_cast<QApplication *>(QCoreApplication::instance()))->inputMethod()->commit();
-
3106 qApp->inputMethod()->update(Qt::ImEnabled);
never executed (the execution status of this line is deduced): (static_cast<QApplication *>(QCoreApplication::instance()))->inputMethod()->update(Qt::ImEnabled);
-
3107 }
never executed: }
0
3108 } -
3109#endif //QT_NO_IM -
3110 QEvent e(QEvent::EnabledChange);
executed (the execution status of this line is deduced): QEvent e(QEvent::EnabledChange);
-
3111 QApplication::sendEvent(q, &e);
executed (the execution status of this line is deduced): QApplication::sendEvent(q, &e);
-
3112}
executed: }
Execution Count:3015
3015
3113 -
3114/*! -
3115 \property QWidget::acceptDrops -
3116 \brief whether drop events are enabled for this widget -
3117 -
3118 Setting this property to true announces to the system that this -
3119 widget \e may be able to accept drop events. -
3120 -
3121 If the widget is the desktop (windowType() == Qt::Desktop), this may -
3122 fail if another application is using the desktop; you can call -
3123 acceptDrops() to test if this occurs. -
3124 -
3125 \warning Do not modify this property in a drag and drop event handler. -
3126 -
3127 By default, this property is false. -
3128 -
3129 \sa {Drag and Drop} -
3130*/ -
3131bool QWidget::acceptDrops() const -
3132{ -
3133 return testAttribute(Qt::WA_AcceptDrops);
executed: return testAttribute(Qt::WA_AcceptDrops);
Execution Count:2531
2531
3134} -
3135 -
3136void QWidget::setAcceptDrops(bool on) -
3137{ -
3138 setAttribute(Qt::WA_AcceptDrops, on);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_AcceptDrops, on);
-
3139 -
3140}
executed: }
Execution Count:6487
6487
3141 -
3142 -
3143/*! -
3144 Disables widget input events if \a disable is true; otherwise -
3145 enables input events. -
3146 -
3147 See the \l enabled documentation for more information. -
3148 -
3149 \sa isEnabledTo(), QKeyEvent, QMouseEvent, changeEvent() -
3150*/ -
3151void QWidget::setDisabled(bool disable) -
3152{ -
3153 setEnabled(!disable);
executed (the execution status of this line is deduced): setEnabled(!disable);
-
3154}
executed: }
Execution Count:14
14
3155 -
3156/*! -
3157 \property QWidget::frameGeometry -
3158 \brief geometry of the widget relative to its parent including any -
3159 window frame -
3160 -
3161 See the \l{Window Geometry} documentation for an overview of geometry -
3162 issues with windows. -
3163 -
3164 By default, this property contains a value that depends on the user's -
3165 platform and screen geometry. -
3166 -
3167 \sa geometry(), x(), y(), pos() -
3168*/ -
3169QRect QWidget::frameGeometry() const -
3170{ -
3171 Q_D(const QWidget);
executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
3172 if (isWindow() && ! (windowType() == Qt::Popup)) {
evaluated: isWindow()
TRUEFALSE
yes
Evaluation Count:1330
yes
Evaluation Count:39
evaluated: ! (windowType() == Qt::Popup)
TRUEFALSE
yes
Evaluation Count:547
yes
Evaluation Count:783
39-1330
3173 QRect fs = d->frameStrut();
executed (the execution status of this line is deduced): QRect fs = d->frameStrut();
-
3174 return QRect(data->crect.x() - fs.left(),
executed: return QRect(data->crect.x() - fs.left(), data->crect.y() - fs.top(), data->crect.width() + fs.left() + fs.right(), data->crect.height() + fs.top() + fs.bottom());
Execution Count:547
547
3175 data->crect.y() - fs.top(),
executed: return QRect(data->crect.x() - fs.left(), data->crect.y() - fs.top(), data->crect.width() + fs.left() + fs.right(), data->crect.height() + fs.top() + fs.bottom());
Execution Count:547
547
3176 data->crect.width() + fs.left() + fs.right(),
executed: return QRect(data->crect.x() - fs.left(), data->crect.y() - fs.top(), data->crect.width() + fs.left() + fs.right(), data->crect.height() + fs.top() + fs.bottom());
Execution Count:547
547
3177 data->crect.height() + fs.top() + fs.bottom());
executed: return QRect(data->crect.x() - fs.left(), data->crect.y() - fs.top(), data->crect.width() + fs.left() + fs.right(), data->crect.height() + fs.top() + fs.bottom());
Execution Count:547
547
3178 } -
3179 return data->crect;
executed: return data->crect;
Execution Count:822
822
3180} -
3181 -
3182/*! -
3183 \property QWidget::x -
3184 -
3185 \brief the x coordinate of the widget relative to its parent including -
3186 any window frame -
3187 -
3188 See the \l{Window Geometry} documentation for an overview of geometry -
3189 issues with windows. -
3190 -
3191 By default, this property has a value of 0. -
3192 -
3193 \sa frameGeometry, y, pos -
3194*/ -
3195int QWidget::x() const -
3196{ -
3197 Q_D(const QWidget);
executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
3198 if (isWindow() && ! (windowType() == Qt::Popup))
evaluated: isWindow()
TRUEFALSE
yes
Evaluation Count:881
yes
Evaluation Count:55792
evaluated: ! (windowType() == Qt::Popup)
TRUEFALSE
yes
Evaluation Count:872
yes
Evaluation Count:9
9-55792
3199 return data->crect.x() - d->frameStrut().left();
executed: return data->crect.x() - d->frameStrut().left();
Execution Count:872
872
3200 return data->crect.x();
executed: return data->crect.x();
Execution Count:55801
55801
3201} -
3202 -
3203/*! -
3204 \property QWidget::y -
3205 \brief the y coordinate of the widget relative to its parent and -
3206 including any window frame -
3207 -
3208 See the \l{Window Geometry} documentation for an overview of geometry -
3209 issues with windows. -
3210 -
3211 By default, this property has a value of 0. -
3212 -
3213 \sa frameGeometry, x, pos -
3214*/ -
3215int QWidget::y() const -
3216{ -
3217 Q_D(const QWidget);
executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
3218 if (isWindow() && ! (windowType() == Qt::Popup))
evaluated: isWindow()
TRUEFALSE
yes
Evaluation Count:873
yes
Evaluation Count:55733
evaluated: ! (windowType() == Qt::Popup)
TRUEFALSE
yes
Evaluation Count:871
yes
Evaluation Count:2
2-55733
3219 return data->crect.y() - d->frameStrut().top();
executed: return data->crect.y() - d->frameStrut().top();
Execution Count:871
871
3220 return data->crect.y();
executed: return data->crect.y();
Execution Count:55735
55735
3221} -
3222 -
3223/*! -
3224 \property QWidget::pos -
3225 \brief the position of the widget within its parent widget -
3226 -
3227 If the widget is a window, the position is that of the widget on -
3228 the desktop, including its frame. -
3229 -
3230 When changing the position, the widget, if visible, receives a -
3231 move event (moveEvent()) immediately. If the widget is not -
3232 currently visible, it is guaranteed to receive an event before it -
3233 is shown. -
3234 -
3235 By default, this property contains a position that refers to the -
3236 origin. -
3237 -
3238 \warning Calling move() or setGeometry() inside moveEvent() can -
3239 lead to infinite recursion. -
3240 -
3241 See the \l{Window Geometry} documentation for an overview of geometry -
3242 issues with windows. -
3243 -
3244 \sa frameGeometry, size, x(), y() -
3245*/ -
3246QPoint QWidget::pos() const -
3247{ -
3248 Q_D(const QWidget);
executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
3249 QPoint result = data->crect.topLeft();
executed (the execution status of this line is deduced): QPoint result = data->crect.topLeft();
-
3250 if (isWindow() && ! (windowType() == Qt::Popup))
evaluated: isWindow()
TRUEFALSE
yes
Evaluation Count:4521
yes
Evaluation Count:11974
evaluated: ! (windowType() == Qt::Popup)
TRUEFALSE
yes
Evaluation Count:4407
yes
Evaluation Count:114
114-11974
3251 if (!d->maybeTopData() || !d->maybeTopData()->posIncludesFrame)
evaluated: !d->maybeTopData()
TRUEFALSE
yes
Evaluation Count:533
yes
Evaluation Count:3874
evaluated: !d->maybeTopData()->posIncludesFrame
TRUEFALSE
yes
Evaluation Count:3548
yes
Evaluation Count:326
326-3874
3252 result -= d->frameStrut().topLeft();
executed: result -= d->frameStrut().topLeft();
Execution Count:4081
4081
3253 return result;
executed: return result;
Execution Count:16495
16495
3254} -
3255 -
3256/*! -
3257 \property QWidget::geometry -
3258 \brief the geometry of the widget relative to its parent and -
3259 excluding the window frame -
3260 -
3261 When changing the geometry, the widget, if visible, receives a -
3262 move event (moveEvent()) and/or a resize event (resizeEvent()) -
3263 immediately. If the widget is not currently visible, it is -
3264 guaranteed to receive appropriate events before it is shown. -
3265 -
3266 The size component is adjusted if it lies outside the range -
3267 defined by minimumSize() and maximumSize(). -
3268 -
3269 \warning Calling setGeometry() inside resizeEvent() or moveEvent() -
3270 can lead to infinite recursion. -
3271 -
3272 See the \l{Window Geometry} documentation for an overview of geometry -
3273 issues with windows. -
3274 -
3275 By default, this property contains a value that depends on the user's -
3276 platform and screen geometry. -
3277 -
3278 \sa frameGeometry(), rect(), move(), resize(), moveEvent(), -
3279 resizeEvent(), minimumSize(), maximumSize() -
3280*/ -
3281 -
3282/*! -
3283 \property QWidget::normalGeometry -
3284 -
3285 \brief the geometry of the widget as it will appear when shown as -
3286 a normal (not maximized or full screen) top-level widget -
3287 -
3288 For child widgets this property always holds an empty rectangle. -
3289 -
3290 By default, this property contains an empty rectangle. -
3291 -
3292 \sa QWidget::windowState(), QWidget::geometry -
3293*/ -
3294 -
3295/*! -
3296 \property QWidget::size -
3297 \brief the size of the widget excluding any window frame -
3298 -
3299 If the widget is visible when it is being resized, it receives a resize event -
3300 (resizeEvent()) immediately. If the widget is not currently -
3301 visible, it is guaranteed to receive an event before it is shown. -
3302 -
3303 The size is adjusted if it lies outside the range defined by -
3304 minimumSize() and maximumSize(). -
3305 -
3306 By default, this property contains a value that depends on the user's -
3307 platform and screen geometry. -
3308 -
3309 \warning Calling resize() or setGeometry() inside resizeEvent() can -
3310 lead to infinite recursion. -
3311 -
3312 \note Setting the size to \c{QSize(0, 0)} will cause the widget to not -
3313 appear on screen. This also applies to windows. -
3314 -
3315 \sa pos, geometry, minimumSize, maximumSize, resizeEvent(), adjustSize() -
3316*/ -
3317 -
3318/*! -
3319 \property QWidget::width -
3320 \brief the width of the widget excluding any window frame -
3321 -
3322 See the \l{Window Geometry} documentation for an overview of geometry -
3323 issues with windows. -
3324 -
3325 \note Do not use this function to find the width of a screen on -
3326 a \l{QDesktopWidget}{multiple screen desktop}. Read -
3327 \l{QDesktopWidget#Screen Geometry}{this note} for details. -
3328 -
3329 By default, this property contains a value that depends on the user's -
3330 platform and screen geometry. -
3331 -
3332 \sa geometry, height, size -
3333*/ -
3334 -
3335/*! -
3336 \property QWidget::height -
3337 \brief the height of the widget excluding any window frame -
3338 -
3339 See the \l{Window Geometry} documentation for an overview of geometry -
3340 issues with windows. -
3341 -
3342 \note Do not use this function to find the height of a screen -
3343 on a \l{QDesktopWidget}{multiple screen desktop}. Read -
3344 \l{QDesktopWidget#Screen Geometry}{this note} for details. -
3345 -
3346 By default, this property contains a value that depends on the user's -
3347 platform and screen geometry. -
3348 -
3349 \sa geometry, width, size -
3350*/ -
3351 -
3352/*! -
3353 \property QWidget::rect -
3354 \brief the internal geometry of the widget excluding any window -
3355 frame -
3356 -
3357 The rect property equals QRect(0, 0, width(), height()). -
3358 -
3359 See the \l{Window Geometry} documentation for an overview of geometry -
3360 issues with windows. -
3361 -
3362 By default, this property contains a value that depends on the user's -
3363 platform and screen geometry. -
3364 -
3365 \sa size -
3366*/ -
3367 -
3368 -
3369QRect QWidget::normalGeometry() const -
3370{ -
3371 Q_D(const QWidget);
executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
3372 if (!d->extra || !d->extra->topextra)
evaluated: !d->extra
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:15
partially evaluated: !d->extra->topextra
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:15
0-15
3373 return QRect();
executed: return QRect();
Execution Count:1
1
3374 -
3375 if (!isMaximized() && !isFullScreen())
evaluated: !isMaximized()
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:5
evaluated: !isFullScreen()
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:1
1-10
3376 return geometry();
executed: return geometry();
Execution Count:9
9
3377 -
3378 return d->topData()->normalGeometry;
executed: return d->topData()->normalGeometry;
Execution Count:6
6
3379} -
3380 -
3381 -
3382/*! -
3383 \property QWidget::childrenRect -
3384 \brief the bounding rectangle of the widget's children -
3385 -
3386 Hidden children are excluded. -
3387 -
3388 By default, for a widget with no children, this property contains a -
3389 rectangle with zero width and height located at the origin. -
3390 -
3391 \sa childrenRegion(), geometry() -
3392*/ -
3393 -
3394QRect QWidget::childrenRect() const -
3395{ -
3396 Q_D(const QWidget);
executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
3397 QRect r(0, 0, 0, 0);
executed (the execution status of this line is deduced): QRect r(0, 0, 0, 0);
-
3398 for (int i = 0; i < d->children.size(); ++i) {
evaluated: i < d->children.size()
TRUEFALSE
yes
Evaluation Count:496
yes
Evaluation Count:919
496-919
3399 QWidget *w = qobject_cast<QWidget *>(d->children.at(i));
executed (the execution status of this line is deduced): QWidget *w = qobject_cast<QWidget *>(d->children.at(i));
-
3400 if (w && !w->isWindow() && !w->isHidden())
evaluated: w
TRUEFALSE
yes
Evaluation Count:491
yes
Evaluation Count:5
evaluated: !w->isWindow()
TRUEFALSE
yes
Evaluation Count:486
yes
Evaluation Count:5
partially evaluated: !w->isHidden()
TRUEFALSE
yes
Evaluation Count:486
no
Evaluation Count:0
0-491
3401 r |= w->geometry();
executed: r |= w->geometry();
Execution Count:486
486
3402 }
executed: }
Execution Count:496
496
3403 return r;
executed: return r;
Execution Count:919
919
3404} -
3405 -
3406/*! -
3407 \property QWidget::childrenRegion -
3408 \brief the combined region occupied by the widget's children -
3409 -
3410 Hidden children are excluded. -
3411 -
3412 By default, for a widget with no children, this property contains an -
3413 empty region. -
3414 -
3415 \sa childrenRect(), geometry(), mask() -
3416*/ -
3417 -
3418QRegion QWidget::childrenRegion() const -
3419{ -
3420 Q_D(const QWidget);
never executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
3421 QRegion r;
never executed (the execution status of this line is deduced): QRegion r;
-
3422 for (int i = 0; i < d->children.size(); ++i) {
never evaluated: i < d->children.size()
0
3423 QWidget *w = qobject_cast<QWidget *>(d->children.at(i));
never executed (the execution status of this line is deduced): QWidget *w = qobject_cast<QWidget *>(d->children.at(i));
-
3424 if (w && !w->isWindow() && !w->isHidden()) {
never evaluated: w
never evaluated: !w->isWindow()
never evaluated: !w->isHidden()
0
3425 QRegion mask = w->mask();
never executed (the execution status of this line is deduced): QRegion mask = w->mask();
-
3426 if (mask.isEmpty())
never evaluated: mask.isEmpty()
0
3427 r |= w->geometry();
never executed: r |= w->geometry();
0
3428 else -
3429 r |= mask.translated(w->pos());
never executed: r |= mask.translated(w->pos());
0
3430 } -
3431 }
never executed: }
0
3432 return r;
never executed: return r;
0
3433} -
3434 -
3435 -
3436/*! -
3437 \property QWidget::minimumSize -
3438 \brief the widget's minimum size -
3439 -
3440 The widget cannot be resized to a smaller size than the minimum -
3441 widget size. The widget's size is forced to the minimum size if -
3442 the current size is smaller. -
3443 -
3444 The minimum size set by this function will override the minimum size -
3445 defined by QLayout. In order to unset the minimum size, use a -
3446 value of \c{QSize(0, 0)}. -
3447 -
3448 By default, this property contains a size with zero width and height. -
3449 -
3450 \sa minimumWidth, minimumHeight, maximumSize, sizeIncrement -
3451*/ -
3452 -
3453QSize QWidget::minimumSize() const -
3454{ -
3455 Q_D(const QWidget);
executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
3456 return d->extra ? QSize(d->extra->minw, d->extra->minh) : QSize(0, 0);
executed: return d->extra ? QSize(d->extra->minw, d->extra->minh) : QSize(0, 0);
Execution Count:84850
84850
3457} -
3458 -
3459/*! -
3460 \property QWidget::maximumSize -
3461 \brief the widget's maximum size in pixels -
3462 -
3463 The widget cannot be resized to a larger size than the maximum -
3464 widget size. -
3465 -
3466 By default, this property contains a size in which both width and height -
3467 have values of 16777215. -
3468 -
3469 \note The definition of the \c QWIDGETSIZE_MAX macro limits the maximum size -
3470 of widgets. -
3471 -
3472 \sa maximumWidth, maximumHeight, minimumSize, sizeIncrement -
3473*/ -
3474 -
3475QSize QWidget::maximumSize() const -
3476{ -
3477 Q_D(const QWidget);
executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
3478 return d->extra ? QSize(d->extra->maxw, d->extra->maxh)
executed: return d->extra ? QSize(d->extra->maxw, d->extra->maxh) : QSize(((1<<24)-1), ((1<<24)-1));
Execution Count:85377
85377
3479 : QSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX);
executed: return d->extra ? QSize(d->extra->maxw, d->extra->maxh) : QSize(((1<<24)-1), ((1<<24)-1));
Execution Count:85377
85377
3480} -
3481 -
3482 -
3483/*! -
3484 \property QWidget::minimumWidth -
3485 \brief the widget's minimum width in pixels -
3486 -
3487 This property corresponds to the width held by the \l minimumSize property. -
3488 -
3489 By default, this property has a value of 0. -
3490 -
3491 \sa minimumSize, minimumHeight -
3492*/ -
3493 -
3494/*! -
3495 \property QWidget::minimumHeight -
3496 \brief the widget's minimum height in pixels -
3497 -
3498 This property corresponds to the height held by the \l minimumSize property. -
3499 -
3500 By default, this property has a value of 0. -
3501 -
3502 \sa minimumSize, minimumWidth -
3503*/ -
3504 -
3505/*! -
3506 \property QWidget::maximumWidth -
3507 \brief the widget's maximum width in pixels -
3508 -
3509 This property corresponds to the width held by the \l maximumSize property. -
3510 -
3511 By default, this property contains a value of 16777215. -
3512 -
3513 \note The definition of the \c QWIDGETSIZE_MAX macro limits the maximum size -
3514 of widgets. -
3515 -
3516 \sa maximumSize, maximumHeight -
3517*/ -
3518 -
3519/*! -
3520 \property QWidget::maximumHeight -
3521 \brief the widget's maximum height in pixels -
3522 -
3523 This property corresponds to the height held by the \l maximumSize property. -
3524 -
3525 By default, this property contains a value of 16777215. -
3526 -
3527 \note The definition of the \c QWIDGETSIZE_MAX macro limits the maximum size -
3528 of widgets. -
3529 -
3530 \sa maximumSize, maximumWidth -
3531*/ -
3532 -
3533/*! -
3534 \property QWidget::sizeIncrement -
3535 \brief the size increment of the widget -
3536 -
3537 When the user resizes the window, the size will move in steps of -
3538 sizeIncrement().width() pixels horizontally and -
3539 sizeIncrement.height() pixels vertically, with baseSize() as the -
3540 basis. Preferred widget sizes are for non-negative integers \e i -
3541 and \e j: -
3542 \snippet code/src_gui_kernel_qwidget.cpp 2 -
3543 -
3544 Note that while you can set the size increment for all widgets, it -
3545 only affects windows. -
3546 -
3547 By default, this property contains a size with zero width and height. -
3548 -
3549 \warning The size increment has no effect under Windows, and may -
3550 be disregarded by the window manager on X11. -
3551 -
3552 \sa size, minimumSize, maximumSize -
3553*/ -
3554QSize QWidget::sizeIncrement() const -
3555{ -
3556 Q_D(const QWidget);
never executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
3557 return (d->extra && d->extra->topextra)
never executed: return (d->extra && d->extra->topextra) ? QSize(d->extra->topextra->incw, d->extra->topextra->inch) : QSize(0, 0);
0
3558 ? QSize(d->extra->topextra->incw, d->extra->topextra->inch)
never executed: return (d->extra && d->extra->topextra) ? QSize(d->extra->topextra->incw, d->extra->topextra->inch) : QSize(0, 0);
0
3559 : QSize(0, 0);
never executed: return (d->extra && d->extra->topextra) ? QSize(d->extra->topextra->incw, d->extra->topextra->inch) : QSize(0, 0);
0
3560} -
3561 -
3562/*! -
3563 \property QWidget::baseSize -
3564 \brief the base size of the widget -
3565 -
3566 The base size is used to calculate a proper widget size if the -
3567 widget defines sizeIncrement(). -
3568 -
3569 By default, for a newly-created widget, this property contains a size with -
3570 zero width and height. -
3571 -
3572 \sa setSizeIncrement() -
3573*/ -
3574 -
3575QSize QWidget::baseSize() const -
3576{ -
3577 Q_D(const QWidget);
never executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
3578 return (d->extra != 0 && d->extra->topextra != 0)
never executed: return (d->extra != 0 && d->extra->topextra != 0) ? QSize(d->extra->topextra->basew, d->extra->topextra->baseh) : QSize(0, 0);
0
3579 ? QSize(d->extra->topextra->basew, d->extra->topextra->baseh)
never executed: return (d->extra != 0 && d->extra->topextra != 0) ? QSize(d->extra->topextra->basew, d->extra->topextra->baseh) : QSize(0, 0);
0
3580 : QSize(0, 0);
never executed: return (d->extra != 0 && d->extra->topextra != 0) ? QSize(d->extra->topextra->basew, d->extra->topextra->baseh) : QSize(0, 0);
0
3581} -
3582 -
3583bool QWidgetPrivate::setMinimumSize_helper(int &minw, int &minh) -
3584{ -
3585 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
3586 -
3587 int mw = minw, mh = minh;
executed (the execution status of this line is deduced): int mw = minw, mh = minh;
-
3588 if (mw == QWIDGETSIZE_MAX)
evaluated: mw == ((1<<24)-1)
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:8166
2-8166
3589 mw = 0;
executed: mw = 0;
Execution Count:2
2
3590 if (mh == QWIDGETSIZE_MAX)
evaluated: mh == ((1<<24)-1)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:8167
1-8167
3591 mh = 0;
executed: mh = 0;
Execution Count:1
1
3592 if (minw > QWIDGETSIZE_MAX || minh > QWIDGETSIZE_MAX) {
evaluated: minw > ((1<<24)-1)
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:8166
evaluated: minh > ((1<<24)-1)
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:8164
2-8166
3593 qWarning("QWidget::setMinimumSize: (%s/%s) "
executed (the execution status of this line is deduced): QMessageLogger("kernel/qwidget.cpp", 3593, __PRETTY_FUNCTION__).warning("QWidget::setMinimumSize: (%s/%s) "
-
3594 "The largest allowed size is (%d,%d)",
executed (the execution status of this line is deduced): "The largest allowed size is (%d,%d)",
-
3595 q->objectName().toLocal8Bit().data(), q->metaObject()->className(), QWIDGETSIZE_MAX,
executed (the execution status of this line is deduced): q->objectName().toLocal8Bit().data(), q->metaObject()->className(), ((1<<24)-1),
-
3596 QWIDGETSIZE_MAX);
executed (the execution status of this line is deduced): ((1<<24)-1));
-
3597 minw = mw = qMin<int>(minw, QWIDGETSIZE_MAX);
executed (the execution status of this line is deduced): minw = mw = qMin<int>(minw, ((1<<24)-1));
-
3598 minh = mh = qMin<int>(minh, QWIDGETSIZE_MAX);
executed (the execution status of this line is deduced): minh = mh = qMin<int>(minh, ((1<<24)-1));
-
3599 }
executed: }
Execution Count:4
4
3600 if (minw < 0 || minh < 0) {
evaluated: minw < 0
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:8166
evaluated: minh < 0
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:8164
2-8166
3601 qWarning("QWidget::setMinimumSize: (%s/%s) Negative sizes (%d,%d) "
executed (the execution status of this line is deduced): QMessageLogger("kernel/qwidget.cpp", 3601, __PRETTY_FUNCTION__).warning("QWidget::setMinimumSize: (%s/%s) Negative sizes (%d,%d) "
-
3602 "are not possible",
executed (the execution status of this line is deduced): "are not possible",
-
3603 q->objectName().toLocal8Bit().data(), q->metaObject()->className(), minw, minh);
executed (the execution status of this line is deduced): q->objectName().toLocal8Bit().data(), q->metaObject()->className(), minw, minh);
-
3604 minw = mw = qMax(minw, 0);
executed (the execution status of this line is deduced): minw = mw = qMax(minw, 0);
-
3605 minh = mh = qMax(minh, 0);
executed (the execution status of this line is deduced): minh = mh = qMax(minh, 0);
-
3606 }
executed: }
Execution Count:4
4
3607 createExtra();
executed (the execution status of this line is deduced): createExtra();
-
3608 if (extra->minw == mw && extra->minh == mh)
evaluated: extra->minw == mw
TRUEFALSE
yes
Evaluation Count:3273
yes
Evaluation Count:4895
evaluated: extra->minh == mh
TRUEFALSE
yes
Evaluation Count:3050
yes
Evaluation Count:223
223-4895
3609 return false;
executed: return false;
Execution Count:3050
3050
3610 extra->minw = mw;
executed (the execution status of this line is deduced): extra->minw = mw;
-
3611 extra->minh = mh;
executed (the execution status of this line is deduced): extra->minh = mh;
-
3612 extra->explicitMinSize = (mw ? Qt::Horizontal : 0) | (mh ? Qt::Vertical : 0);
evaluated: mw
TRUEFALSE
yes
Evaluation Count:4270
yes
Evaluation Count:848
848-4270
3613 return true;
executed: return true;
Execution Count:5118
5118
3614} -
3615 -
3616/*! -
3617 \overload -
3618 -
3619 This function corresponds to setMinimumSize(QSize(minw, minh)). -
3620 Sets the minimum width to \a minw and the minimum height to \a -
3621 minh. -
3622*/ -
3623 -
3624void QWidget::setMinimumSize(int minw, int minh) -
3625{ -
3626 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
3627 if (!d->setMinimumSize_helper(minw, minh))
evaluated: !d->setMinimumSize_helper(minw, minh)
TRUEFALSE
yes
Evaluation Count:2932
yes
Evaluation Count:2973
2932-2973
3628 return;
executed: return;
Execution Count:2932
2932
3629 -
3630 if (isWindow())
evaluated: isWindow()
TRUEFALSE
yes
Evaluation Count:692
yes
Evaluation Count:2281
692-2281
3631 d->setConstraints_sys();
executed: d->setConstraints_sys();
Execution Count:692
692
3632 if (minw > width() || minh > height()) {
evaluated: minw > width()
TRUEFALSE
yes
Evaluation Count:68
yes
Evaluation Count:2905
evaluated: minh > height()
TRUEFALSE
yes
Evaluation Count:41
yes
Evaluation Count:2864
41-2905
3633 bool resized = testAttribute(Qt::WA_Resized);
executed (the execution status of this line is deduced): bool resized = testAttribute(Qt::WA_Resized);
-
3634 bool maximized = isMaximized();
executed (the execution status of this line is deduced): bool maximized = isMaximized();
-
3635 resize(qMax(minw,width()), qMax(minh,height()));
executed (the execution status of this line is deduced): resize(qMax(minw,width()), qMax(minh,height()));
-
3636 setAttribute(Qt::WA_Resized, resized); //not a user resize
executed (the execution status of this line is deduced): setAttribute(Qt::WA_Resized, resized);
-
3637 if (maximized)
partially evaluated: maximized
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:109
0-109
3638 data->window_state = data->window_state | Qt::WindowMaximized;
never executed: data->window_state = data->window_state | Qt::WindowMaximized;
0
3639 }
executed: }
Execution Count:109
109
3640#ifndef QT_NO_GRAPHICSVIEW -
3641 if (d->extra) {
partially evaluated: d->extra
TRUEFALSE
yes
Evaluation Count:2973
no
Evaluation Count:0
0-2973
3642 if (d->extra->proxyWidget)
partially evaluated: d->extra->proxyWidget
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2973
0-2973
3643 d->extra->proxyWidget->setMinimumSize(minw, minh);
never executed: d->extra->proxyWidget->setMinimumSize(minw, minh);
0
3644 }
executed: }
Execution Count:2973
2973
3645#endif -
3646 d->updateGeometry_helper(d->extra->minw == d->extra->maxw && d->extra->minh == d->extra->maxh);
executed (the execution status of this line is deduced): d->updateGeometry_helper(d->extra->minw == d->extra->maxw && d->extra->minh == d->extra->maxh);
-
3647}
executed: }
Execution Count:2973
2973
3648 -
3649bool QWidgetPrivate::setMaximumSize_helper(int &maxw, int &maxh) -
3650{ -
3651 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
3652 if (maxw > QWIDGETSIZE_MAX || maxh > QWIDGETSIZE_MAX) {
evaluated: maxw > ((1<<24)-1)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:4898
evaluated: maxh > ((1<<24)-1)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:4897
1-4898
3653 qWarning("QWidget::setMaximumSize: (%s/%s) "
executed (the execution status of this line is deduced): QMessageLogger("kernel/qwidget.cpp", 3653, __PRETTY_FUNCTION__).warning("QWidget::setMaximumSize: (%s/%s) "
-
3654 "The largest allowed size is (%d,%d)",
executed (the execution status of this line is deduced): "The largest allowed size is (%d,%d)",
-
3655 q->objectName().toLocal8Bit().data(), q->metaObject()->className(), QWIDGETSIZE_MAX,
executed (the execution status of this line is deduced): q->objectName().toLocal8Bit().data(), q->metaObject()->className(), ((1<<24)-1),
-
3656 QWIDGETSIZE_MAX);
executed (the execution status of this line is deduced): ((1<<24)-1));
-
3657 maxw = qMin<int>(maxw, QWIDGETSIZE_MAX);
executed (the execution status of this line is deduced): maxw = qMin<int>(maxw, ((1<<24)-1));
-
3658 maxh = qMin<int>(maxh, QWIDGETSIZE_MAX);
executed (the execution status of this line is deduced): maxh = qMin<int>(maxh, ((1<<24)-1));
-
3659 }
executed: }
Execution Count:2
2
3660 if (maxw < 0 || maxh < 0) {
evaluated: maxw < 0
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:4898
evaluated: maxh < 0
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:4897
1-4898
3661 qWarning("QWidget::setMaximumSize: (%s/%s) Negative sizes (%d,%d) "
executed (the execution status of this line is deduced): QMessageLogger("kernel/qwidget.cpp", 3661, __PRETTY_FUNCTION__).warning("QWidget::setMaximumSize: (%s/%s) Negative sizes (%d,%d) "
-
3662 "are not possible",
executed (the execution status of this line is deduced): "are not possible",
-
3663 q->objectName().toLocal8Bit().data(), q->metaObject()->className(), maxw, maxh);
executed (the execution status of this line is deduced): q->objectName().toLocal8Bit().data(), q->metaObject()->className(), maxw, maxh);
-
3664 maxw = qMax(maxw, 0);
executed (the execution status of this line is deduced): maxw = qMax(maxw, 0);
-
3665 maxh = qMax(maxh, 0);
executed (the execution status of this line is deduced): maxh = qMax(maxh, 0);
-
3666 }
executed: }
Execution Count:2
2
3667 createExtra();
executed (the execution status of this line is deduced): createExtra();
-
3668 if (extra->maxw == maxw && extra->maxh == maxh)
evaluated: extra->maxw == maxw
TRUEFALSE
yes
Evaluation Count:1395
yes
Evaluation Count:3504
evaluated: extra->maxh == maxh
TRUEFALSE
yes
Evaluation Count:1254
yes
Evaluation Count:141
141-3504
3669 return false;
executed: return false;
Execution Count:1254
1254
3670 extra->maxw = maxw;
executed (the execution status of this line is deduced): extra->maxw = maxw;
-
3671 extra->maxh = maxh;
executed (the execution status of this line is deduced): extra->maxh = maxh;
-
3672 extra->explicitMaxSize = (maxw != QWIDGETSIZE_MAX ? Qt::Horizontal : 0) |
evaluated: maxw != ((1<<24)-1)
TRUEFALSE
yes
Evaluation Count:3570
yes
Evaluation Count:75
75-3570
3673 (maxh != QWIDGETSIZE_MAX ? Qt::Vertical : 0);
executed (the execution status of this line is deduced): (maxh != ((1<<24)-1) ? Qt::Vertical : 0);
-
3674 return true;
executed: return true;
Execution Count:3645
3645
3675} -
3676 -
3677/*! -
3678 \overload -
3679 -
3680 This function corresponds to setMaximumSize(QSize(\a maxw, \a -
3681 maxh)). Sets the maximum width to \a maxw and the maximum height -
3682 to \a maxh. -
3683*/ -
3684void QWidget::setMaximumSize(int maxw, int maxh) -
3685{ -
3686 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
3687 if (!d->setMaximumSize_helper(maxw, maxh))
evaluated: !d->setMaximumSize_helper(maxw, maxh)
TRUEFALSE
yes
Evaluation Count:1136
yes
Evaluation Count:1500
1136-1500
3688 return;
executed: return;
Execution Count:1136
1136
3689 -
3690 if (isWindow())
evaluated: isWindow()
TRUEFALSE
yes
Evaluation Count:198
yes
Evaluation Count:1302
198-1302
3691 d->setConstraints_sys();
executed: d->setConstraints_sys();
Execution Count:198
198
3692 if (maxw < width() || maxh < height()) {
evaluated: maxw < width()
TRUEFALSE
yes
Evaluation Count:53
yes
Evaluation Count:1447
evaluated: maxh < height()
TRUEFALSE
yes
Evaluation Count:79
yes
Evaluation Count:1368
53-1447
3693 bool resized = testAttribute(Qt::WA_Resized);
executed (the execution status of this line is deduced): bool resized = testAttribute(Qt::WA_Resized);
-
3694 resize(qMin(maxw,width()), qMin(maxh,height()));
executed (the execution status of this line is deduced): resize(qMin(maxw,width()), qMin(maxh,height()));
-
3695 setAttribute(Qt::WA_Resized, resized); //not a user resize
executed (the execution status of this line is deduced): setAttribute(Qt::WA_Resized, resized);
-
3696 }
executed: }
Execution Count:132
132
3697 -
3698#ifndef QT_NO_GRAPHICSVIEW -
3699 if (d->extra) {
partially evaluated: d->extra
TRUEFALSE
yes
Evaluation Count:1500
no
Evaluation Count:0
0-1500
3700 if (d->extra->proxyWidget)
partially evaluated: d->extra->proxyWidget
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1500
0-1500
3701 d->extra->proxyWidget->setMaximumSize(maxw, maxh);
never executed: d->extra->proxyWidget->setMaximumSize(maxw, maxh);
0
3702 }
executed: }
Execution Count:1500
1500
3703#endif -
3704 -
3705 d->updateGeometry_helper(d->extra->minw == d->extra->maxw && d->extra->minh == d->extra->maxh);
executed (the execution status of this line is deduced): d->updateGeometry_helper(d->extra->minw == d->extra->maxw && d->extra->minh == d->extra->maxh);
-
3706}
executed: }
Execution Count:1500
1500
3707 -
3708/*! -
3709 \overload -
3710 -
3711 Sets the x (width) size increment to \a w and the y (height) size -
3712 increment to \a h. -
3713*/ -
3714void QWidget::setSizeIncrement(int w, int h) -
3715{ -
3716 Q_D(QWidget);
never executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
3717 d->createTLExtra();
never executed (the execution status of this line is deduced): d->createTLExtra();
-
3718 QTLWExtra* x = d->topData();
never executed (the execution status of this line is deduced): QTLWExtra* x = d->topData();
-
3719 if (x->incw == w && x->inch == h)
never evaluated: x->incw == w
never evaluated: x->inch == h
0
3720 return;
never executed: return;
0
3721 x->incw = w;
never executed (the execution status of this line is deduced): x->incw = w;
-
3722 x->inch = h;
never executed (the execution status of this line is deduced): x->inch = h;
-
3723 if (isWindow())
never evaluated: isWindow()
0
3724 d->setConstraints_sys();
never executed: d->setConstraints_sys();
0
3725}
never executed: }
0
3726 -
3727/*! -
3728 \overload -
3729 -
3730 This corresponds to setBaseSize(QSize(\a basew, \a baseh)). Sets -
3731 the widgets base size to width \a basew and height \a baseh. -
3732*/ -
3733void QWidget::setBaseSize(int basew, int baseh) -
3734{ -
3735 Q_D(QWidget);
never executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
3736 d->createTLExtra();
never executed (the execution status of this line is deduced): d->createTLExtra();
-
3737 QTLWExtra* x = d->topData();
never executed (the execution status of this line is deduced): QTLWExtra* x = d->topData();
-
3738 if (x->basew == basew && x->baseh == baseh)
never evaluated: x->basew == basew
never evaluated: x->baseh == baseh
0
3739 return;
never executed: return;
0
3740 x->basew = basew;
never executed (the execution status of this line is deduced): x->basew = basew;
-
3741 x->baseh = baseh;
never executed (the execution status of this line is deduced): x->baseh = baseh;
-
3742 if (isWindow())
never evaluated: isWindow()
0
3743 d->setConstraints_sys();
never executed: d->setConstraints_sys();
0
3744}
never executed: }
0
3745 -
3746/*! -
3747 Sets both the minimum and maximum sizes of the widget to \a s, -
3748 thereby preventing it from ever growing or shrinking. -
3749 -
3750 This will override the default size constraints set by QLayout. -
3751 -
3752 To remove constraints, set the size to QWIDGETSIZE_MAX. -
3753 -
3754 Alternatively, if you want the widget to have a -
3755 fixed size based on its contents, you can call -
3756 QLayout::setSizeConstraint(QLayout::SetFixedSize); -
3757 -
3758 \sa maximumSize, minimumSize -
3759*/ -
3760 -
3761void QWidget::setFixedSize(const QSize & s) -
3762{ -
3763 setFixedSize(s.width(), s.height());
executed (the execution status of this line is deduced): setFixedSize(s.width(), s.height());
-
3764}
executed: }
Execution Count:1295
1295
3765 -
3766 -
3767/*! -
3768 \fn void QWidget::setFixedSize(int w, int h) -
3769 \overload -
3770 -
3771 Sets the width of the widget to \a w and the height to \a h. -
3772*/ -
3773 -
3774void QWidget::setFixedSize(int w, int h) -
3775{ -
3776 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
3777 bool minSizeSet = d->setMinimumSize_helper(w, h);
executed (the execution status of this line is deduced): bool minSizeSet = d->setMinimumSize_helper(w, h);
-
3778 bool maxSizeSet = d->setMaximumSize_helper(w, h);
executed (the execution status of this line is deduced): bool maxSizeSet = d->setMaximumSize_helper(w, h);
-
3779 if (!minSizeSet && !maxSizeSet)
evaluated: !minSizeSet
TRUEFALSE
yes
Evaluation Count:118
yes
Evaluation Count:2145
partially evaluated: !maxSizeSet
TRUEFALSE
yes
Evaluation Count:118
no
Evaluation Count:0
0-2145
3780 return;
executed: return;
Execution Count:118
118
3781 -
3782 if (isWindow())
evaluated: isWindow()
TRUEFALSE
yes
Evaluation Count:993
yes
Evaluation Count:1152
993-1152
3783 d->setConstraints_sys();
executed: d->setConstraints_sys();
Execution Count:993
993
3784 else -
3785 d->updateGeometry_helper(true);
executed: d->updateGeometry_helper(true);
Execution Count:1152
1152
3786 -
3787 if (w != QWIDGETSIZE_MAX || h != QWIDGETSIZE_MAX)
partially evaluated: w != ((1<<24)-1)
TRUEFALSE
yes
Evaluation Count:2145
no
Evaluation Count:0
never evaluated: h != ((1<<24)-1)
0-2145
3788 resize(w, h);
executed: resize(w, h);
Execution Count:2145
2145
3789}
executed: }
Execution Count:2145
2145
3790 -
3791void QWidget::setMinimumWidth(int w) -
3792{ -
3793 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
3794 d->createExtra();
executed (the execution status of this line is deduced): d->createExtra();
-
3795 uint expl = d->extra->explicitMinSize | (w ? Qt::Horizontal : 0);
executed (the execution status of this line is deduced): uint expl = d->extra->explicitMinSize | (w ? Qt::Horizontal : 0);
-
3796 setMinimumSize(w, minimumSize().height());
executed (the execution status of this line is deduced): setMinimumSize(w, minimumSize().height());
-
3797 d->extra->explicitMinSize = expl;
executed (the execution status of this line is deduced): d->extra->explicitMinSize = expl;
-
3798}
executed: }
Execution Count:1723
1723
3799 -
3800void QWidget::setMinimumHeight(int h) -
3801{ -
3802 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
3803 d->createExtra();
executed (the execution status of this line is deduced): d->createExtra();
-
3804 uint expl = d->extra->explicitMinSize | (h ? Qt::Vertical : 0);
executed (the execution status of this line is deduced): uint expl = d->extra->explicitMinSize | (h ? Qt::Vertical : 0);
-
3805 setMinimumSize(minimumSize().width(), h);
executed (the execution status of this line is deduced): setMinimumSize(minimumSize().width(), h);
-
3806 d->extra->explicitMinSize = expl;
executed (the execution status of this line is deduced): d->extra->explicitMinSize = expl;
-
3807}
executed: }
Execution Count:478
478
3808 -
3809void QWidget::setMaximumWidth(int w) -
3810{ -
3811 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
3812 d->createExtra();
executed (the execution status of this line is deduced): d->createExtra();
-
3813 uint expl = d->extra->explicitMaxSize | (w == QWIDGETSIZE_MAX ? 0 : Qt::Horizontal);
executed (the execution status of this line is deduced): uint expl = d->extra->explicitMaxSize | (w == ((1<<24)-1) ? 0 : Qt::Horizontal);
-
3814 setMaximumSize(w, maximumSize().height());
executed (the execution status of this line is deduced): setMaximumSize(w, maximumSize().height());
-
3815 d->extra->explicitMaxSize = expl;
executed (the execution status of this line is deduced): d->extra->explicitMaxSize = expl;
-
3816}
executed: }
Execution Count:528
528
3817 -
3818void QWidget::setMaximumHeight(int h) -
3819{ -
3820 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
3821 d->createExtra();
executed (the execution status of this line is deduced): d->createExtra();
-
3822 uint expl = d->extra->explicitMaxSize | (h == QWIDGETSIZE_MAX ? 0 : Qt::Vertical);
executed (the execution status of this line is deduced): uint expl = d->extra->explicitMaxSize | (h == ((1<<24)-1) ? 0 : Qt::Vertical);
-
3823 setMaximumSize(maximumSize().width(), h);
executed (the execution status of this line is deduced): setMaximumSize(maximumSize().width(), h);
-
3824 d->extra->explicitMaxSize = expl;
executed (the execution status of this line is deduced): d->extra->explicitMaxSize = expl;
-
3825}
executed: }
Execution Count:448
448
3826 -
3827/*! -
3828 Sets both the minimum and maximum width of the widget to \a w -
3829 without changing the heights. Provided for convenience. -
3830 -
3831 \sa sizeHint(), minimumSize(), maximumSize(), setFixedSize() -
3832*/ -
3833 -
3834void QWidget::setFixedWidth(int w) -
3835{ -
3836 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
3837 d->createExtra();
executed (the execution status of this line is deduced): d->createExtra();
-
3838 uint explMin = d->extra->explicitMinSize | Qt::Horizontal;
executed (the execution status of this line is deduced): uint explMin = d->extra->explicitMinSize | Qt::Horizontal;
-
3839 uint explMax = d->extra->explicitMaxSize | Qt::Horizontal;
executed (the execution status of this line is deduced): uint explMax = d->extra->explicitMaxSize | Qt::Horizontal;
-
3840 setMinimumSize(w, minimumSize().height());
executed (the execution status of this line is deduced): setMinimumSize(w, minimumSize().height());
-
3841 setMaximumSize(w, maximumSize().height());
executed (the execution status of this line is deduced): setMaximumSize(w, maximumSize().height());
-
3842 d->extra->explicitMinSize = explMin;
executed (the execution status of this line is deduced): d->extra->explicitMinSize = explMin;
-
3843 d->extra->explicitMaxSize = explMax;
executed (the execution status of this line is deduced): d->extra->explicitMaxSize = explMax;
-
3844}
executed: }
Execution Count:6
6
3845 -
3846 -
3847/*! -
3848 Sets both the minimum and maximum heights of the widget to \a h -
3849 without changing the widths. Provided for convenience. -
3850 -
3851 \sa sizeHint(), minimumSize(), maximumSize(), setFixedSize() -
3852*/ -
3853 -
3854void QWidget::setFixedHeight(int h) -
3855{ -
3856 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
3857 d->createExtra();
executed (the execution status of this line is deduced): d->createExtra();
-
3858 uint explMin = d->extra->explicitMinSize | Qt::Vertical;
executed (the execution status of this line is deduced): uint explMin = d->extra->explicitMinSize | Qt::Vertical;
-
3859 uint explMax = d->extra->explicitMaxSize | Qt::Vertical;
executed (the execution status of this line is deduced): uint explMax = d->extra->explicitMaxSize | Qt::Vertical;
-
3860 setMinimumSize(minimumSize().width(), h);
executed (the execution status of this line is deduced): setMinimumSize(minimumSize().width(), h);
-
3861 setMaximumSize(maximumSize().width(), h);
executed (the execution status of this line is deduced): setMaximumSize(maximumSize().width(), h);
-
3862 d->extra->explicitMinSize = explMin;
executed (the execution status of this line is deduced): d->extra->explicitMinSize = explMin;
-
3863 d->extra->explicitMaxSize = explMax;
executed (the execution status of this line is deduced): d->extra->explicitMaxSize = explMax;
-
3864}
executed: }
Execution Count:83
83
3865 -
3866 -
3867/*! -
3868 Translates the widget coordinate \a pos to the coordinate system -
3869 of \a parent. The \a parent must not be 0 and must be a parent -
3870 of the calling widget. -
3871 -
3872 \sa mapFrom(), mapToParent(), mapToGlobal(), underMouse() -
3873*/ -
3874 -
3875QPoint QWidget::mapTo(const QWidget * parent, const QPoint & pos) const -
3876{ -
3877 QPoint p = pos;
executed (the execution status of this line is deduced): QPoint p = pos;
-
3878 if (parent) {
partially evaluated: parent
TRUEFALSE
yes
Evaluation Count:173505
no
Evaluation Count:0
0-173505
3879 const QWidget * w = this;
executed (the execution status of this line is deduced): const QWidget * w = this;
-
3880 while (w != parent) {
evaluated: w != parent
TRUEFALSE
yes
Evaluation Count:233280
yes
Evaluation Count:173505
173505-233280
3881 Q_ASSERT_X(w, "QWidget::mapTo(const QWidget *parent, const QPoint &pos)",
executed (the execution status of this line is deduced): qt_noop();
-
3882 "parent must be in parent hierarchy"); -
3883 p = w->mapToParent(p);
executed (the execution status of this line is deduced): p = w->mapToParent(p);
-
3884 w = w->parentWidget();
executed (the execution status of this line is deduced): w = w->parentWidget();
-
3885 }
executed: }
Execution Count:233280
233280
3886 }
executed: }
Execution Count:173505
173505
3887 return p;
executed: return p;
Execution Count:173505
173505
3888} -
3889 -
3890 -
3891/*! -
3892 Translates the widget coordinate \a pos from the coordinate system -
3893 of \a parent to this widget's coordinate system. The \a parent -
3894 must not be 0 and must be a parent of the calling widget. -
3895 -
3896 \sa mapTo(), mapFromParent(), mapFromGlobal(), underMouse() -
3897*/ -
3898 -
3899QPoint QWidget::mapFrom(const QWidget * parent, const QPoint & pos) const -
3900{ -
3901 QPoint p(pos);
executed (the execution status of this line is deduced): QPoint p(pos);
-
3902 if (parent) {
partially evaluated: parent
TRUEFALSE
yes
Evaluation Count:478
no
Evaluation Count:0
0-478
3903 const QWidget * w = this;
executed (the execution status of this line is deduced): const QWidget * w = this;
-
3904 while (w != parent) {
evaluated: w != parent
TRUEFALSE
yes
Evaluation Count:924
yes
Evaluation Count:478
478-924
3905 Q_ASSERT_X(w, "QWidget::mapFrom(const QWidget *parent, const QPoint &pos)",
executed (the execution status of this line is deduced): qt_noop();
-
3906 "parent must be in parent hierarchy"); -
3907 -
3908 p = w->mapFromParent(p);
executed (the execution status of this line is deduced): p = w->mapFromParent(p);
-
3909 w = w->parentWidget();
executed (the execution status of this line is deduced): w = w->parentWidget();
-
3910 }
executed: }
Execution Count:924
924
3911 }
executed: }
Execution Count:478
478
3912 return p;
executed: return p;
Execution Count:478
478
3913} -
3914 -
3915 -
3916/*! -
3917 Translates the widget coordinate \a pos to a coordinate in the -
3918 parent widget. -
3919 -
3920 Same as mapToGlobal() if the widget has no parent. -
3921 -
3922 \sa mapFromParent(), mapTo(), mapToGlobal(), underMouse() -
3923*/ -
3924 -
3925QPoint QWidget::mapToParent(const QPoint &pos) const -
3926{ -
3927 return pos + data->crect.topLeft();
executed: return pos + data->crect.topLeft();
Execution Count:234794
234794
3928} -
3929 -
3930/*! -
3931 Translates the parent widget coordinate \a pos to widget -
3932 coordinates. -
3933 -
3934 Same as mapFromGlobal() if the widget has no parent. -
3935 -
3936 \sa mapToParent(), mapFrom(), mapFromGlobal(), underMouse() -
3937*/ -
3938 -
3939QPoint QWidget::mapFromParent(const QPoint &pos) const -
3940{ -
3941 return pos - data->crect.topLeft();
executed: return pos - data->crect.topLeft();
Execution Count:2082
2082
3942} -
3943 -
3944 -
3945/*! -
3946 Returns the window for this widget, i.e. the next ancestor widget -
3947 that has (or could have) a window-system frame. -
3948 -
3949 If the widget is a window, the widget itself is returned. -
3950 -
3951 Typical usage is changing the window title: -
3952 -
3953 \snippet code/src_gui_kernel_qwidget.cpp 3 -
3954 -
3955 \sa isWindow() -
3956*/ -
3957 -
3958QWidget *QWidget::window() const -
3959{ -
3960 QWidget *w = (QWidget *)this;
executed (the execution status of this line is deduced): QWidget *w = (QWidget *)this;
-
3961 QWidget *p = w->parentWidget();
executed (the execution status of this line is deduced): QWidget *p = w->parentWidget();
-
3962 while (!w->isWindow() && p) {
evaluated: !w->isWindow()
TRUEFALSE
yes
Evaluation Count:2754977
yes
Evaluation Count:2280468
evaluated: p
TRUEFALSE
yes
Evaluation Count:2681019
yes
Evaluation Count:73958
73958-2754977
3963 w = p;
executed (the execution status of this line is deduced): w = p;
-
3964 p = p->parentWidget();
executed (the execution status of this line is deduced): p = p->parentWidget();
-
3965 }
executed: }
Execution Count:2681019
2681019
3966 return w;
executed: return w;
Execution Count:2354426
2354426
3967} -
3968 -
3969/*! -
3970 \since 4.4 -
3971 -
3972 Returns the native parent for this widget, i.e. the next ancestor widget -
3973 that has a system identifier, or 0 if it does not have any native parent. -
3974 -
3975 \sa effectiveWinId() -
3976*/ -
3977QWidget *QWidget::nativeParentWidget() const -
3978{ -
3979 QWidget *parent = parentWidget();
executed (the execution status of this line is deduced): QWidget *parent = parentWidget();
-
3980 while (parent && !parent->internalWinId())
evaluated: parent
TRUEFALSE
yes
Evaluation Count:44872
yes
Evaluation Count:2546
evaluated: !parent->internalWinId()
TRUEFALSE
yes
Evaluation Count:18451
yes
Evaluation Count:26421
2546-44872
3981 parent = parent->parentWidget();
executed: parent = parent->parentWidget();
Execution Count:18451
18451
3982 return parent;
executed: return parent;
Execution Count:28967
28967
3983} -
3984 -
3985/*! \fn QWidget *QWidget::topLevelWidget() const -
3986 \obsolete -
3987 -
3988 Use window() instead. -
3989*/ -
3990 -
3991 -
3992 -
3993/*! -
3994 Returns the background role of the widget. -
3995 -
3996 The background role defines the brush from the widget's \l palette that -
3997 is used to render the background. -
3998 -
3999 If no explicit background role is set, the widget inherts its parent -
4000 widget's background role. -
4001 -
4002 \sa setBackgroundRole(), foregroundRole() -
4003 */ -
4004QPalette::ColorRole QWidget::backgroundRole() const -
4005{ -
4006 -
4007 const QWidget *w = this;
executed (the execution status of this line is deduced): const QWidget *w = this;
-
4008 do { -
4009 QPalette::ColorRole role = w->d_func()->bg_role;
executed (the execution status of this line is deduced): QPalette::ColorRole role = w->d_func()->bg_role;
-
4010 if (role != QPalette::NoRole)
evaluated: role != QPalette::NoRole
TRUEFALSE
yes
Evaluation Count:59568
yes
Evaluation Count:53329
53329-59568
4011 return role;
executed: return role;
Execution Count:59568
59568
4012 if (w->isWindow() || w->windowType() == Qt::SubWindow)
evaluated: w->isWindow()
TRUEFALSE
yes
Evaluation Count:19144
yes
Evaluation Count:34185
partially evaluated: w->windowType() == Qt::SubWindow
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:34185
0-34185
4013 break;
executed: break;
Execution Count:19144
19144
4014 w = w->parentWidget();
executed (the execution status of this line is deduced): w = w->parentWidget();
-
4015 } while (w);
executed: }
Execution Count:34185
partially evaluated: w
TRUEFALSE
yes
Evaluation Count:34185
no
Evaluation Count:0
0-34185
4016 return QPalette::Window;
executed: return QPalette::Window;
Execution Count:19144
19144
4017} -
4018 -
4019/*! -
4020 Sets the background role of the widget to \a role. -
4021 -
4022 The background role defines the brush from the widget's \l palette that -
4023 is used to render the background. -
4024 -
4025 If \a role is QPalette::NoRole, then the widget inherits its -
4026 parent's background role. -
4027 -
4028 Note that styles are free to choose any color from the palette. -
4029 You can modify the palette or set a style sheet if you don't -
4030 achieve the result you want with setBackgroundRole(). -
4031 -
4032 \sa backgroundRole(), foregroundRole() -
4033 */ -
4034 -
4035void QWidget::setBackgroundRole(QPalette::ColorRole role) -
4036{ -
4037 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
4038 d->bg_role = role;
executed (the execution status of this line is deduced): d->bg_role = role;
-
4039 d->updateSystemBackground();
executed (the execution status of this line is deduced): d->updateSystemBackground();
-
4040 d->propagatePaletteChange();
executed (the execution status of this line is deduced): d->propagatePaletteChange();
-
4041 d->updateIsOpaque();
executed (the execution status of this line is deduced): d->updateIsOpaque();
-
4042}
executed: }
Execution Count:17372
17372
4043 -
4044/*! -
4045 Returns the foreground role. -
4046 -
4047 The foreground role defines the color from the widget's \l palette that -
4048 is used to draw the foreground. -
4049 -
4050 If no explicit foreground role is set, the function returns a role -
4051 that contrasts with the background role. -
4052 -
4053 \sa setForegroundRole(), backgroundRole() -
4054 */ -
4055QPalette::ColorRole QWidget::foregroundRole() const -
4056{ -
4057 Q_D(const QWidget);
executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
4058 QPalette::ColorRole rl = QPalette::ColorRole(d->fg_role);
executed (the execution status of this line is deduced): QPalette::ColorRole rl = QPalette::ColorRole(d->fg_role);
-
4059 if (rl != QPalette::NoRole)
evaluated: rl != QPalette::NoRole
TRUEFALSE
yes
Evaluation Count:1593
yes
Evaluation Count:25069
1593-25069
4060 return rl;
executed: return rl;
Execution Count:1593
1593
4061 QPalette::ColorRole role = QPalette::WindowText;
executed (the execution status of this line is deduced): QPalette::ColorRole role = QPalette::WindowText;
-
4062 switch (backgroundRole()) { -
4063 case QPalette::Button: -
4064 role = QPalette::ButtonText;
executed (the execution status of this line is deduced): role = QPalette::ButtonText;
-
4065 break;
executed: break;
Execution Count:1747
1747
4066 case QPalette::Base: -
4067 role = QPalette::Text;
executed (the execution status of this line is deduced): role = QPalette::Text;
-
4068 break;
executed: break;
Execution Count:14280
14280
4069 case QPalette::Dark: -
4070 case QPalette::Shadow: -
4071 role = QPalette::Light;
never executed (the execution status of this line is deduced): role = QPalette::Light;
-
4072 break;
never executed: break;
0
4073 case QPalette::Highlight: -
4074 role = QPalette::HighlightedText;
executed (the execution status of this line is deduced): role = QPalette::HighlightedText;
-
4075 break;
executed: break;
Execution Count:84
84
4076 case QPalette::ToolTipBase: -
4077 role = QPalette::ToolTipText;
never executed (the execution status of this line is deduced): role = QPalette::ToolTipText;
-
4078 break;
never executed: break;
0
4079 default: -
4080 ; -
4081 }
executed: }
Execution Count:8958
8958
4082 return role;
executed: return role;
Execution Count:25069
25069
4083} -
4084 -
4085/*! -
4086 Sets the foreground role of the widget to \a role. -
4087 -
4088 The foreground role defines the color from the widget's \l palette that -
4089 is used to draw the foreground. -
4090 -
4091 If \a role is QPalette::NoRole, the widget uses a foreground role -
4092 that contrasts with the background role. -
4093 -
4094 Note that styles are free to choose any color from the palette. -
4095 You can modify the palette or set a style sheet if you don't -
4096 achieve the result you want with setForegroundRole(). -
4097 -
4098 \sa foregroundRole(), backgroundRole() -
4099 */ -
4100void QWidget::setForegroundRole(QPalette::ColorRole role) -
4101{ -
4102 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
4103 d->fg_role = role;
executed (the execution status of this line is deduced): d->fg_role = role;
-
4104 d->updateSystemBackground();
executed (the execution status of this line is deduced): d->updateSystemBackground();
-
4105 d->propagatePaletteChange();
executed (the execution status of this line is deduced): d->propagatePaletteChange();
-
4106}
executed: }
Execution Count:4060
4060
4107 -
4108/*! -
4109 \property QWidget::palette -
4110 \brief the widget's palette -
4111 -
4112 This property describes the widget's palette. The palette is used by the -
4113 widget's style when rendering standard components, and is available as a -
4114 means to ensure that custom widgets can maintain consistency with the -
4115 native platform's look and feel. It's common that different platforms, or -
4116 different styles, have different palettes. -
4117 -
4118 When you assign a new palette to a widget, the color roles from this -
4119 palette are combined with the widget's default palette to form the -
4120 widget's final palette. The palette entry for the widget's background role -
4121 is used to fill the widget's background (see QWidget::autoFillBackground), -
4122 and the foreground role initializes QPainter's pen. -
4123 -
4124 The default depends on the system environment. QApplication maintains a -
4125 system/theme palette which serves as a default for all widgets. There may -
4126 also be special palette defaults for certain types of widgets (e.g., on -
4127 Windows XP and Vista, all classes that derive from QMenuBar have a special -
4128 default palette). You can also define default palettes for widgets -
4129 yourself by passing a custom palette and the name of a widget to -
4130 QApplication::setPalette(). Finally, the style always has the option of -
4131 polishing the palette as it's assigned (see QStyle::polish()). -
4132 -
4133 QWidget propagates explicit palette roles from parent to child. If you -
4134 assign a brush or color to a specific role on a palette and assign that -
4135 palette to a widget, that role will propagate to all the widget's -
4136 children, overriding any system defaults for that role. Note that palettes -
4137 by default don't propagate to windows (see isWindow()) unless the -
4138 Qt::WA_WindowPropagation attribute is enabled. -
4139 -
4140 QWidget's palette propagation is similar to its font propagation. -
4141 -
4142 The current style, which is used to render the content of all standard Qt -
4143 widgets, is free to choose colors and brushes from the widget palette, or -
4144 in some cases, to ignore the palette (partially, or completely). In -
4145 particular, certain styles like GTK style, Mac style, Windows XP, and -
4146 Vista style, depend on third party APIs to render the content of widgets, -
4147 and these styles typically do not follow the palette. Because of this, -
4148 assigning roles to a widget's palette is not guaranteed to change the -
4149 appearance of the widget. Instead, you may choose to apply a \l -
4150 styleSheet. You can refer to our Knowledge Base article -
4151 \l{http://qt.nokia.com/developer/knowledgebase/22}{here} for more -
4152 information. -
4153 -
4154 \warning Do not use this function in conjunction with \l{Qt Style Sheets}. -
4155 When using style sheets, the palette of a widget can be customized using -
4156 the "color", "background-color", "selection-color", -
4157 "selection-background-color" and "alternate-background-color". -
4158 -
4159 \sa QApplication::palette(), QWidget::font() -
4160*/ -
4161const QPalette &QWidget::palette() const -
4162{ -
4163 if (!isEnabled()) {
evaluated: !isEnabled()
TRUEFALSE
yes
Evaluation Count:1392
yes
Evaluation Count:532929
1392-532929
4164 data->pal.setCurrentColorGroup(QPalette::Disabled);
executed (the execution status of this line is deduced): data->pal.setCurrentColorGroup(QPalette::Disabled);
-
4165 } else if ((!isVisible() || isActiveWindow())
executed: }
Execution Count:1392
evaluated: !isVisible()
TRUEFALSE
yes
Evaluation Count:356466
yes
Evaluation Count:176463
evaluated: isActiveWindow()
TRUEFALSE
yes
Evaluation Count:97357
yes
Evaluation Count:79106
1392-356466
4166#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) -
4167 && !QApplicationPrivate::isBlockedByModal(const_cast<QWidget *>(this)) -
4168#endif -
4169 ) { -
4170 data->pal.setCurrentColorGroup(QPalette::Active);
executed (the execution status of this line is deduced): data->pal.setCurrentColorGroup(QPalette::Active);
-
4171 } else {
executed: }
Execution Count:453823
453823
4172#ifdef Q_WS_MAC -
4173 extern bool qt_mac_can_clickThrough(const QWidget *); //qwidget_mac.cpp -
4174 if (qt_mac_can_clickThrough(this)) -
4175 data->pal.setCurrentColorGroup(QPalette::Active); -
4176 else -
4177#endif -
4178 data->pal.setCurrentColorGroup(QPalette::Inactive);
executed (the execution status of this line is deduced): data->pal.setCurrentColorGroup(QPalette::Inactive);
-
4179 }
executed: }
Execution Count:79106
79106
4180 return data->pal;
executed: return data->pal;
Execution Count:534321
534321
4181} -
4182 -
4183void QWidget::setPalette(const QPalette &palette) -
4184{ -
4185 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
4186 setAttribute(Qt::WA_SetPalette, palette.resolve() != 0);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_SetPalette, palette.resolve() != 0);
-
4187 -
4188 // Determine which palette is inherited from this widget's ancestors and -
4189 // QApplication::palette, resolve this against \a palette (attributes from -
4190 // the inherited palette are copied over this widget's palette). Then -
4191 // propagate this palette to this widget's children. -
4192 QPalette naturalPalette = d->naturalWidgetPalette(d->inheritedPaletteResolveMask);
executed (the execution status of this line is deduced): QPalette naturalPalette = d->naturalWidgetPalette(d->inheritedPaletteResolveMask);
-
4193 QPalette resolvedPalette = palette.resolve(naturalPalette);
executed (the execution status of this line is deduced): QPalette resolvedPalette = palette.resolve(naturalPalette);
-
4194 d->setPalette_helper(resolvedPalette);
executed (the execution status of this line is deduced): d->setPalette_helper(resolvedPalette);
-
4195}
executed: }
Execution Count:3188
3188
4196 -
4197/*! -
4198 \internal -
4199 -
4200 Returns the palette that the widget \a w inherits from its ancestors and -
4201 QApplication::palette. \a inheritedMask is the combination of the widget's -
4202 ancestors palette request masks (i.e., which attributes from the parent -
4203 widget's palette are implicitly imposed on this widget by the user). Note -
4204 that this font does not take into account the palette set on \a w itself. -
4205*/ -
4206QPalette QWidgetPrivate::naturalWidgetPalette(uint inheritedMask) const -
4207{ -
4208 Q_Q(const QWidget);
executed (the execution status of this line is deduced): const QWidget * const q = q_func();
-
4209 QPalette naturalPalette = QApplication::palette(q);
executed (the execution status of this line is deduced): QPalette naturalPalette = QApplication::palette(q);
-
4210 if (!q->testAttribute(Qt::WA_StyleSheet)
evaluated: !q->testAttribute(Qt::WA_StyleSheet)
TRUEFALSE
yes
Evaluation Count:45800
yes
Evaluation Count:1971
1971-45800
4211 && (!q->isWindow() || q->testAttribute(Qt::WA_WindowPropagation)
evaluated: !q->isWindow()
TRUEFALSE
yes
Evaluation Count:43564
yes
Evaluation Count:2236
evaluated: q->testAttribute(Qt::WA_WindowPropagation)
TRUEFALSE
yes
Evaluation Count:682
yes
Evaluation Count:1554
682-43564
4212#ifndef QT_NO_GRAPHICSVIEW
executed (the execution status of this line is deduced):
-
4213 || (extra && extra->proxyWidget)
evaluated: extra
TRUEFALSE
yes
Evaluation Count:415
yes
Evaluation Count:1139
evaluated: extra->proxyWidget
TRUEFALSE
yes
Evaluation Count:21
yes
Evaluation Count:394
21-1139
4214#endif //QT_NO_GRAPHICSVIEW
executed (the execution status of this line is deduced):
-
4215 )) {
executed (the execution status of this line is deduced): )) {
-
4216 if (QWidget *p = q->parentWidget()) {
evaluated: QWidget *p = q->parentWidget()
TRUEFALSE
yes
Evaluation Count:44246
yes
Evaluation Count:21
21-44246
4217 if (!p->testAttribute(Qt::WA_StyleSheet)) {
evaluated: !p->testAttribute(Qt::WA_StyleSheet)
TRUEFALSE
yes
Evaluation Count:43855
yes
Evaluation Count:391
391-43855
4218 if (!naturalPalette.isCopyOf(QApplication::palette())) {
evaluated: !naturalPalette.isCopyOf(QApplication::palette())
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:43851
4-43851
4219 QPalette inheritedPalette = p->palette();
executed (the execution status of this line is deduced): QPalette inheritedPalette = p->palette();
-
4220 inheritedPalette.resolve(inheritedMask);
executed (the execution status of this line is deduced): inheritedPalette.resolve(inheritedMask);
-
4221 naturalPalette = inheritedPalette.resolve(naturalPalette);
executed (the execution status of this line is deduced): naturalPalette = inheritedPalette.resolve(naturalPalette);
-
4222 } else {
executed: }
Execution Count:4
4
4223 naturalPalette = p->palette();
executed (the execution status of this line is deduced): naturalPalette = p->palette();
-
4224 }
executed: }
Execution Count:43851
43851
4225 } -
4226 }
executed: }
Execution Count:44246
44246
4227#ifndef QT_NO_GRAPHICSVIEW -
4228 else if (extra && extra->proxyWidget) {
partially evaluated: extra
TRUEFALSE
yes
Evaluation Count:21
no
Evaluation Count:0
partially evaluated: extra->proxyWidget
TRUEFALSE
yes
Evaluation Count:21
no
Evaluation Count:0
0-21
4229 QPalette inheritedPalette = extra->proxyWidget->palette();
executed (the execution status of this line is deduced): QPalette inheritedPalette = extra->proxyWidget->palette();
-
4230 inheritedPalette.resolve(inheritedMask);
executed (the execution status of this line is deduced): inheritedPalette.resolve(inheritedMask);
-
4231 naturalPalette = inheritedPalette.resolve(naturalPalette);
executed (the execution status of this line is deduced): naturalPalette = inheritedPalette.resolve(naturalPalette);
-
4232 }
executed: }
Execution Count:21
21
4233#endif //QT_NO_GRAPHICSVIEW -
4234 } -
4235 naturalPalette.resolve(0);
executed (the execution status of this line is deduced): naturalPalette.resolve(0);
-
4236 return naturalPalette;
executed: return naturalPalette;
Execution Count:47771
47771
4237} -
4238/*! -
4239 \internal -
4240 -
4241 Determine which palette is inherited from this widget's ancestors and -
4242 QApplication::palette, resolve this against this widget's palette -
4243 (attributes from the inherited palette are copied over this widget's -
4244 palette). Then propagate this palette to this widget's children. -
4245*/ -
4246void QWidgetPrivate::resolvePalette() -
4247{ -
4248 QPalette naturalPalette = naturalWidgetPalette(inheritedPaletteResolveMask);
executed (the execution status of this line is deduced): QPalette naturalPalette = naturalWidgetPalette(inheritedPaletteResolveMask);
-
4249 QPalette resolvedPalette = data.pal.resolve(naturalPalette);
executed (the execution status of this line is deduced): QPalette resolvedPalette = data.pal.resolve(naturalPalette);
-
4250 setPalette_helper(resolvedPalette);
executed (the execution status of this line is deduced): setPalette_helper(resolvedPalette);
-
4251}
executed: }
Execution Count:44583
44583
4252 -
4253void QWidgetPrivate::setPalette_helper(const QPalette &palette) -
4254{ -
4255 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
4256 if (data.pal == palette && data.pal.resolve() == palette.resolve())
evaluated: data.pal == palette
TRUEFALSE
yes
Evaluation Count:47500
yes
Evaluation Count:271
evaluated: data.pal.resolve() == palette.resolve()
TRUEFALSE
yes
Evaluation Count:47487
yes
Evaluation Count:13
13-47500
4257 return;
executed: return;
Execution Count:47487
47487
4258 data.pal = palette;
executed (the execution status of this line is deduced): data.pal = palette;
-
4259 updateSystemBackground();
executed (the execution status of this line is deduced): updateSystemBackground();
-
4260 propagatePaletteChange();
executed (the execution status of this line is deduced): propagatePaletteChange();
-
4261 updateIsOpaque();
executed (the execution status of this line is deduced): updateIsOpaque();
-
4262 q->update();
executed (the execution status of this line is deduced): q->update();
-
4263 updateIsOpaque();
executed (the execution status of this line is deduced): updateIsOpaque();
-
4264}
executed: }
Execution Count:284
284
4265 -
4266/*! -
4267 \property QWidget::font -
4268 \brief the font currently set for the widget -
4269 -
4270 This property describes the widget's requested font. The font is used by -
4271 the widget's style when rendering standard components, and is available as -
4272 a means to ensure that custom widgets can maintain consistency with the -
4273 native platform's look and feel. It's common that different platforms, or -
4274 different styles, define different fonts for an application. -
4275 -
4276 When you assign a new font to a widget, the properties from this font are -
4277 combined with the widget's default font to form the widget's final -
4278 font. You can call fontInfo() to get a copy of the widget's final -
4279 font. The final font is also used to initialize QPainter's font. -
4280 -
4281 The default depends on the system environment. QApplication maintains a -
4282 system/theme font which serves as a default for all widgets. There may -
4283 also be special font defaults for certain types of widgets. You can also -
4284 define default fonts for widgets yourself by passing a custom font and the -
4285 name of a widget to QApplication::setFont(). Finally, the font is matched -
4286 against Qt's font database to find the best match. -
4287 -
4288 QWidget propagates explicit font properties from parent to child. If you -
4289 change a specific property on a font and assign that font to a widget, -
4290 that property will propagate to all the widget's children, overriding any -
4291 system defaults for that property. Note that fonts by default don't -
4292 propagate to windows (see isWindow()) unless the Qt::WA_WindowPropagation -
4293 attribute is enabled. -
4294 -
4295 QWidget's font propagation is similar to its palette propagation. -
4296 -
4297 The current style, which is used to render the content of all standard Qt -
4298 widgets, is free to choose to use the widget font, or in some cases, to -
4299 ignore it (partially, or completely). In particular, certain styles like -
4300 GTK style, Mac style, Windows XP, and Vista style, apply special -
4301 modifications to the widget font to match the platform's native look and -
4302 feel. Because of this, assigning properties to a widget's font is not -
4303 guaranteed to change the appearance of the widget. Instead, you may choose -
4304 to apply a \l styleSheet. -
4305 -
4306 \note If \l{Qt Style Sheets} are used on the same widget as setFont(), -
4307 style sheets will take precedence if the settings conflict. -
4308 -
4309 \sa fontInfo(), fontMetrics() -
4310*/ -
4311 -
4312void QWidget::setFont(const QFont &font) -
4313{ -
4314 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
4315 -
4316#ifndef QT_NO_STYLE_STYLESHEET -
4317 const QStyleSheetStyle* style;
executed (the execution status of this line is deduced): const QStyleSheetStyle* style;
-
4318 if (d->extra && (style = qobject_cast<const QStyleSheetStyle*>(d->extra->style))) {
evaluated: d->extra
TRUEFALSE
yes
Evaluation Count:390
yes
Evaluation Count:93
partially evaluated: (style = qobject_cast<const QStyleSheetStyle*>(d->extra->style))
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:390
0-390
4319 style->saveWidgetFont(this, font);
never executed (the execution status of this line is deduced): style->saveWidgetFont(this, font);
-
4320 }
never executed: }
0
4321#endif -
4322 -
4323 setAttribute(Qt::WA_SetFont, font.resolve() != 0);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_SetFont, font.resolve() != 0);
-
4324 -
4325 // Determine which font is inherited from this widget's ancestors and -
4326 // QApplication::font, resolve this against \a font (attributes from the -
4327 // inherited font are copied over). Then propagate this font to this -
4328 // widget's children. -
4329 QFont naturalFont = d->naturalWidgetFont(d->inheritedFontResolveMask);
executed (the execution status of this line is deduced): QFont naturalFont = d->naturalWidgetFont(d->inheritedFontResolveMask);
-
4330 QFont resolvedFont = font.resolve(naturalFont);
executed (the execution status of this line is deduced): QFont resolvedFont = font.resolve(naturalFont);
-
4331 d->setFont_helper(resolvedFont);
executed (the execution status of this line is deduced): d->setFont_helper(resolvedFont);
-
4332}
executed: }
Execution Count:483
483
4333 -
4334/* -
4335 \internal -
4336 -
4337 Returns the font that the widget \a w inherits from its ancestors and -
4338 QApplication::font. \a inheritedMask is the combination of the widget's -
4339 ancestors font request masks (i.e., which attributes from the parent -
4340 widget's font are implicitly imposed on this widget by the user). Note -
4341 that this font does not take into account the font set on \a w itself. -
4342 -
4343 ### Stylesheet has a different font propagation mechanism. When a stylesheet -
4344 is applied, fonts are not propagated anymore -
4345*/ -
4346QFont QWidgetPrivate::naturalWidgetFont(uint inheritedMask) const -
4347{ -
4348 Q_Q(const QWidget);
executed (the execution status of this line is deduced): const QWidget * const q = q_func();
-
4349 QFont naturalFont = QApplication::font(q);
executed (the execution status of this line is deduced): QFont naturalFont = QApplication::font(q);
-
4350 if (!q->testAttribute(Qt::WA_StyleSheet)
evaluated: !q->testAttribute(Qt::WA_StyleSheet)
TRUEFALSE
yes
Evaluation Count:42530
yes
Evaluation Count:16
16-42530
4351 && (!q->isWindow() || q->testAttribute(Qt::WA_WindowPropagation)
evaluated: !q->isWindow()
TRUEFALSE
yes
Evaluation Count:40674
yes
Evaluation Count:1856
evaluated: q->testAttribute(Qt::WA_WindowPropagation)
TRUEFALSE
yes
Evaluation Count:343
yes
Evaluation Count:1513
343-40674
4352#ifndef QT_NO_GRAPHICSVIEW
executed (the execution status of this line is deduced):
-
4353 || (extra && extra->proxyWidget)
evaluated: extra
TRUEFALSE
yes
Evaluation Count:400
yes
Evaluation Count:1113
partially evaluated: extra->proxyWidget
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:400
0-1113
4354#endif //QT_NO_GRAPHICSVIEW
executed (the execution status of this line is deduced):
-
4355 )) {
executed (the execution status of this line is deduced): )) {
-
4356 if (QWidget *p = q->parentWidget()) {
partially evaluated: QWidget *p = q->parentWidget()
TRUEFALSE
yes
Evaluation Count:41017
no
Evaluation Count:0
0-41017
4357 if (!p->testAttribute(Qt::WA_StyleSheet)) {
evaluated: !p->testAttribute(Qt::WA_StyleSheet)
TRUEFALSE
yes
Evaluation Count:41013
yes
Evaluation Count:4
4-41013
4358 if (!naturalFont.isCopyOf(QApplication::font())) {
evaluated: !naturalFont.isCopyOf(QApplication::font())
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:41009
4-41009
4359 QFont inheritedFont = p->font();
executed (the execution status of this line is deduced): QFont inheritedFont = p->font();
-
4360 inheritedFont.resolve(inheritedMask);
executed (the execution status of this line is deduced): inheritedFont.resolve(inheritedMask);
-
4361 naturalFont = inheritedFont.resolve(naturalFont);
executed (the execution status of this line is deduced): naturalFont = inheritedFont.resolve(naturalFont);
-
4362 } else {
executed: }
Execution Count:4
4
4363 naturalFont = p->font();
executed (the execution status of this line is deduced): naturalFont = p->font();
-
4364 }
executed: }
Execution Count:41009
41009
4365 } -
4366 }
executed: }
Execution Count:41017
41017
4367#ifndef QT_NO_GRAPHICSVIEW -
4368 else if (extra && extra->proxyWidget) {
never evaluated: extra
never evaluated: extra->proxyWidget
0
4369 QFont inheritedFont = extra->proxyWidget->font();
never executed (the execution status of this line is deduced): QFont inheritedFont = extra->proxyWidget->font();
-
4370 inheritedFont.resolve(inheritedMask);
never executed (the execution status of this line is deduced): inheritedFont.resolve(inheritedMask);
-
4371 naturalFont = inheritedFont.resolve(naturalFont);
never executed (the execution status of this line is deduced): naturalFont = inheritedFont.resolve(naturalFont);
-
4372 }
never executed: }
0
4373#endif //QT_NO_GRAPHICSVIEW -
4374 } -
4375 naturalFont.resolve(0);
executed (the execution status of this line is deduced): naturalFont.resolve(0);
-
4376 return naturalFont;
executed: return naturalFont;
Execution Count:42546
42546
4377} -
4378 -
4379/*! -
4380 \internal -
4381 -
4382 Determine which font is implicitly imposed on this widget by its ancestors -
4383 and QApplication::font, resolve this against its own font (attributes from -
4384 the implicit font are copied over). Then propagate this font to this -
4385 widget's children. -
4386*/ -
4387void QWidgetPrivate::resolveFont() -
4388{ -
4389 QFont naturalFont = naturalWidgetFont(inheritedFontResolveMask);
executed (the execution status of this line is deduced): QFont naturalFont = naturalWidgetFont(inheritedFontResolveMask);
-
4390 QFont resolvedFont = data.fnt.resolve(naturalFont);
executed (the execution status of this line is deduced): QFont resolvedFont = data.fnt.resolve(naturalFont);
-
4391 setFont_helper(resolvedFont);
executed (the execution status of this line is deduced): setFont_helper(resolvedFont);
-
4392}
executed: }
Execution Count:42063
42063
4393 -
4394/*! -
4395 \internal -
4396 -
4397 Assign \a font to this widget, and propagate it to all children, except -
4398 style sheet widgets (handled differently) and windows that don't enable -
4399 window propagation. \a implicitMask is the union of all ancestor widgets' -
4400 font request masks, and determines which attributes from this widget's -
4401 font should propagate. -
4402*/ -
4403void QWidgetPrivate::updateFont(const QFont &font) -
4404{ -
4405 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
4406#ifndef QT_NO_STYLE_STYLESHEET -
4407 const QStyleSheetStyle* cssStyle;
executed (the execution status of this line is deduced): const QStyleSheetStyle* cssStyle;
-
4408 cssStyle = extra ? qobject_cast<const QStyleSheetStyle*>(extra->style) : 0;
evaluated: extra
TRUEFALSE
yes
Evaluation Count:143
yes
Evaluation Count:264
143-264
4409#endif -
4410 -
4411 data.fnt = QFont(font, q);
executed (the execution status of this line is deduced): data.fnt = QFont(font, q);
-
4412#if defined(Q_WS_X11) -
4413 // make sure the font set on this widget is associated with the correct screen -
4414 data.fnt.x11SetScreen(xinfo.screen()); -
4415#endif -
4416 // Combine new mask with natural mask and propagate to children. -
4417#ifndef QT_NO_GRAPHICSVIEW -
4418 if (!q->parentWidget() && extra && extra->proxyWidget) {
evaluated: !q->parentWidget()
TRUEFALSE
yes
Evaluation Count:35
yes
Evaluation Count:372
evaluated: extra
TRUEFALSE
yes
Evaluation Count:22
yes
Evaluation Count:13
partially evaluated: extra->proxyWidget
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:22
0-372
4419 QGraphicsProxyWidget *p = extra->proxyWidget;
never executed (the execution status of this line is deduced): QGraphicsProxyWidget *p = extra->proxyWidget;
-
4420 inheritedFontResolveMask = p->d_func()->inheritedFontResolveMask | p->font().resolve();
never executed (the execution status of this line is deduced): inheritedFontResolveMask = p->d_func()->inheritedFontResolveMask | p->font().resolve();
-
4421 } else
never executed: }
0
4422#endif //QT_NO_GRAPHICSVIEW -
4423 if (q->isWindow() && !q->testAttribute(Qt::WA_WindowPropagation)) {
evaluated: q->isWindow()
TRUEFALSE
yes
Evaluation Count:35
yes
Evaluation Count:372
partially evaluated: !q->testAttribute(Qt::WA_WindowPropagation)
TRUEFALSE
yes
Evaluation Count:35
no
Evaluation Count:0
0-372
4424 inheritedFontResolveMask = 0;
executed (the execution status of this line is deduced): inheritedFontResolveMask = 0;
-
4425 }
executed: }
Execution Count:35
35
4426 uint newMask = data.fnt.resolve() | inheritedFontResolveMask;
executed (the execution status of this line is deduced): uint newMask = data.fnt.resolve() | inheritedFontResolveMask;
-
4427 -
4428 for (int i = 0; i < children.size(); ++i) {
evaluated: i < children.size()
TRUEFALSE
yes
Evaluation Count:335
yes
Evaluation Count:407
335-407
4429 QWidget *w = qobject_cast<QWidget*>(children.at(i));
executed (the execution status of this line is deduced): QWidget *w = qobject_cast<QWidget*>(children.at(i));
-
4430 if (w) {
evaluated: w
TRUEFALSE
yes
Evaluation Count:192
yes
Evaluation Count:143
143-192
4431 if (0) {
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:192
0-192
4432#ifndef QT_NO_STYLE_STYLESHEET -
4433 } else if (w->testAttribute(Qt::WA_StyleSheet)) {
never executed: }
evaluated: w->testAttribute(Qt::WA_StyleSheet)
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:184
0-184
4434 // Style sheets follow a different font propagation scheme. -
4435 if (cssStyle)
partially evaluated: cssStyle
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
4436 cssStyle->updateStyleSheetFont(w);
never executed: cssStyle->updateStyleSheetFont(w);
0
4437#endif -
4438 } else if ((!w->isWindow() || w->testAttribute(Qt::WA_WindowPropagation))) {
executed: }
Execution Count:8
evaluated: !w->isWindow()
TRUEFALSE
yes
Evaluation Count:157
yes
Evaluation Count:27
partially evaluated: w->testAttribute(Qt::WA_WindowPropagation)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:27
0-157
4439 // Propagate font changes. -
4440 QWidgetPrivate *wd = w->d_func();
executed (the execution status of this line is deduced): QWidgetPrivate *wd = w->d_func();
-
4441 wd->inheritedFontResolveMask = newMask;
executed (the execution status of this line is deduced): wd->inheritedFontResolveMask = newMask;
-
4442 wd->resolveFont();
executed (the execution status of this line is deduced): wd->resolveFont();
-
4443 }
executed: }
Execution Count:157
157
4444 } -
4445 }
executed: }
Execution Count:335
335
4446 -
4447#ifndef QT_NO_STYLE_STYLESHEET -
4448 if (cssStyle) {
partially evaluated: cssStyle
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:407
0-407
4449 cssStyle->updateStyleSheetFont(q);
never executed (the execution status of this line is deduced): cssStyle->updateStyleSheetFont(q);
-
4450 }
never executed: }
0
4451#endif -
4452 -
4453 QEvent e(QEvent::FontChange);
executed (the execution status of this line is deduced): QEvent e(QEvent::FontChange);
-
4454 QApplication::sendEvent(q, &e);
executed (the execution status of this line is deduced): QApplication::sendEvent(q, &e);
-
4455}
executed: }
Execution Count:407
407
4456 -
4457void QWidgetPrivate::setLayoutDirection_helper(Qt::LayoutDirection direction) -
4458{ -
4459 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
4460 -
4461 if ( (direction == Qt::RightToLeft) == q->testAttribute(Qt::WA_RightToLeft))
evaluated: (direction == Qt::RightToLeft) == q->testAttribute(Qt::WA_RightToLeft)
TRUEFALSE
yes
Evaluation Count:50321
yes
Evaluation Count:425
425-50321
4462 return;
executed: return;
Execution Count:50321
50321
4463 q->setAttribute(Qt::WA_RightToLeft, (direction == Qt::RightToLeft));
executed (the execution status of this line is deduced): q->setAttribute(Qt::WA_RightToLeft, (direction == Qt::RightToLeft));
-
4464 if (!children.isEmpty()) {
evaluated: !children.isEmpty()
TRUEFALSE
yes
Evaluation Count:273
yes
Evaluation Count:152
152-273
4465 for (int i = 0; i < children.size(); ++i) {
evaluated: i < children.size()
TRUEFALSE
yes
Evaluation Count:1164
yes
Evaluation Count:273
273-1164
4466 QWidget *w = qobject_cast<QWidget*>(children.at(i));
executed (the execution status of this line is deduced): QWidget *w = qobject_cast<QWidget*>(children.at(i));
-
4467 if (w && !w->isWindow() && !w->testAttribute(Qt::WA_SetLayoutDirection))
evaluated: w
TRUEFALSE
yes
Evaluation Count:359
yes
Evaluation Count:805
evaluated: !w->isWindow()
TRUEFALSE
yes
Evaluation Count:226
yes
Evaluation Count:133
evaluated: !w->testAttribute(Qt::WA_SetLayoutDirection)
TRUEFALSE
yes
Evaluation Count:225
yes
Evaluation Count:1
1-805
4468 w->d_func()->setLayoutDirection_helper(direction);
executed: w->d_func()->setLayoutDirection_helper(direction);
Execution Count:225
225
4469 }
executed: }
Execution Count:1164
1164
4470 }
executed: }
Execution Count:273
273
4471 QEvent e(QEvent::LayoutDirectionChange);
executed (the execution status of this line is deduced): QEvent e(QEvent::LayoutDirectionChange);
-
4472 QApplication::sendEvent(q, &e);
executed (the execution status of this line is deduced): QApplication::sendEvent(q, &e);
-
4473}
executed: }
Execution Count:425
425
4474 -
4475void QWidgetPrivate::resolveLayoutDirection() -
4476{ -
4477 Q_Q(const QWidget);
executed (the execution status of this line is deduced): const QWidget * const q = q_func();
-
4478 if (!q->testAttribute(Qt::WA_SetLayoutDirection))
partially evaluated: !q->testAttribute(Qt::WA_SetLayoutDirection)
TRUEFALSE
yes
Evaluation Count:49548
no
Evaluation Count:0
0-49548
4479 setLayoutDirection_helper(q->isWindow() ? QApplication::layoutDirection() : q->parentWidget()->layoutDirection());
executed: setLayoutDirection_helper(q->isWindow() ? QApplication::layoutDirection() : q->parentWidget()->layoutDirection());
Execution Count:49548
49548
4480}
executed: }
Execution Count:49548
49548
4481 -
4482/*! -
4483 \property QWidget::layoutDirection -
4484 -
4485 \brief the layout direction for this widget -
4486 -
4487 By default, this property is set to Qt::LeftToRight. -
4488 -
4489 When the layout direction is set on a widget, it will propagate to -
4490 the widget's children, but not to a child that is a window and not -
4491 to a child for which setLayoutDirection() has been explicitly -
4492 called. Also, child widgets added \e after setLayoutDirection() -
4493 has been called for the parent do not inherit the parent's layout -
4494 direction. -
4495 -
4496 This method no longer affects text layout direction since Qt 4.7. -
4497 -
4498 \sa QApplication::layoutDirection -
4499*/ -
4500void QWidget::setLayoutDirection(Qt::LayoutDirection direction) -
4501{ -
4502 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
4503 -
4504 if (direction == Qt::LayoutDirectionAuto) {
partially evaluated: direction == Qt::LayoutDirectionAuto
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:678
0-678
4505 unsetLayoutDirection();
never executed (the execution status of this line is deduced): unsetLayoutDirection();
-
4506 return;
never executed: return;
0
4507 } -
4508 -
4509 setAttribute(Qt::WA_SetLayoutDirection);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_SetLayoutDirection);
-
4510 d->setLayoutDirection_helper(direction);
executed (the execution status of this line is deduced): d->setLayoutDirection_helper(direction);
-
4511}
executed: }
Execution Count:678
678
4512 -
4513Qt::LayoutDirection QWidget::layoutDirection() const -
4514{ -
4515 return testAttribute(Qt::WA_RightToLeft) ? Qt::RightToLeft : Qt::LeftToRight;
executed: return testAttribute(Qt::WA_RightToLeft) ? Qt::RightToLeft : Qt::LeftToRight;
Execution Count:648267
648267
4516} -
4517 -
4518void QWidget::unsetLayoutDirection() -
4519{ -
4520 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
4521 setAttribute(Qt::WA_SetLayoutDirection, false);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_SetLayoutDirection, false);
-
4522 d->resolveLayoutDirection();
executed (the execution status of this line is deduced): d->resolveLayoutDirection();
-
4523}
executed: }
Execution Count:2
2
4524 -
4525/*! -
4526 \fn QFontMetrics QWidget::fontMetrics() const -
4527 -
4528 Returns the font metrics for the widget's current font. -
4529 Equivalent to QFontMetrics(widget->font()). -
4530 -
4531 \sa font(), fontInfo(), setFont() -
4532*/ -
4533 -
4534/*! -
4535 \fn QFontInfo QWidget::fontInfo() const -
4536 -
4537 Returns the font info for the widget's current font. -
4538 Equivalent to QFontInto(widget->font()). -
4539 -
4540 \sa font(), fontMetrics(), setFont() -
4541*/ -
4542 -
4543 -
4544/*! -
4545 \property QWidget::cursor -
4546 \brief the cursor shape for this widget -
4547 -
4548 The mouse cursor will assume this shape when it's over this -
4549 widget. See the \l{Qt::CursorShape}{list of predefined cursor objects} for a range of useful shapes. -
4550 -
4551 An editor widget might use an I-beam cursor: -
4552 \snippet code/src_gui_kernel_qwidget.cpp 6 -
4553 -
4554 If no cursor has been set, or after a call to unsetCursor(), the -
4555 parent's cursor is used. -
4556 -
4557 By default, this property contains a cursor with the Qt::ArrowCursor -
4558 shape. -
4559 -
4560 Some underlying window implementations will reset the cursor if it -
4561 leaves a widget even if the mouse is grabbed. If you want to have -
4562 a cursor set for all widgets, even when outside the window, consider -
4563 QApplication::setOverrideCursor(). -
4564 -
4565 \sa QApplication::setOverrideCursor() -
4566*/ -
4567 -
4568#ifndef QT_NO_CURSOR -
4569QCursor QWidget::cursor() const -
4570{ -
4571 Q_D(const QWidget);
executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
4572 if (testAttribute(Qt::WA_SetCursor))
evaluated: testAttribute(Qt::WA_SetCursor)
TRUEFALSE
yes
Evaluation Count:341
yes
Evaluation Count:3530
341-3530
4573 return (d->extra && d->extra->curs)
executed: return (d->extra && d->extra->curs) ? *d->extra->curs : QCursor(Qt::ArrowCursor);
Execution Count:341
341
4574 ? *d->extra->curs
executed: return (d->extra && d->extra->curs) ? *d->extra->curs : QCursor(Qt::ArrowCursor);
Execution Count:341
341
4575 : QCursor(Qt::ArrowCursor);
executed: return (d->extra && d->extra->curs) ? *d->extra->curs : QCursor(Qt::ArrowCursor);
Execution Count:341
341
4576 if (isWindow() || !parentWidget())
evaluated: isWindow()
TRUEFALSE
yes
Evaluation Count:3513
yes
Evaluation Count:17
partially evaluated: !parentWidget()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:17
0-3513
4577 return QCursor(Qt::ArrowCursor);
executed: return QCursor(Qt::ArrowCursor);
Execution Count:3513
3513
4578 return parentWidget()->cursor();
executed: return parentWidget()->cursor();
Execution Count:17
17
4579} -
4580 -
4581void QWidget::setCursor(const QCursor &cursor) -
4582{ -
4583 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
4584// On Mac we must set the cursor even if it is the ArrowCursor. -
4585#if !defined(Q_WS_MAC) -
4586 if (cursor.shape() != Qt::ArrowCursor
evaluated: cursor.shape() != Qt::ArrowCursor
TRUEFALSE
yes
Evaluation Count:2486
yes
Evaluation Count:163
163-2486
4587 || (d->extra && d->extra->curs))
evaluated: d->extra
TRUEFALSE
yes
Evaluation Count:73
yes
Evaluation Count:90
evaluated: d->extra->curs
TRUEFALSE
yes
Evaluation Count:49
yes
Evaluation Count:24
24-90
4588#endif -
4589 { -
4590 d->createExtra();
executed (the execution status of this line is deduced): d->createExtra();
-
4591 QCursor *newCursor = new QCursor(cursor);
executed (the execution status of this line is deduced): QCursor *newCursor = new QCursor(cursor);
-
4592 delete d->extra->curs;
executed (the execution status of this line is deduced): delete d->extra->curs;
-
4593 d->extra->curs = newCursor;
executed (the execution status of this line is deduced): d->extra->curs = newCursor;
-
4594 }
executed: }
Execution Count:2535
2535
4595 setAttribute(Qt::WA_SetCursor);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_SetCursor);
-
4596 d->setCursor_sys(cursor);
executed (the execution status of this line is deduced): d->setCursor_sys(cursor);
-
4597 -
4598 QEvent event(QEvent::CursorChange);
executed (the execution status of this line is deduced): QEvent event(QEvent::CursorChange);
-
4599 QApplication::sendEvent(this, &event);
executed (the execution status of this line is deduced): QApplication::sendEvent(this, &event);
-
4600}
executed: }
Execution Count:2649
2649
4601 -
4602void QWidget::unsetCursor() -
4603{ -
4604 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
4605 if (d->extra) {
evaluated: d->extra
TRUEFALSE
yes
Evaluation Count:118
yes
Evaluation Count:20
20-118
4606 delete d->extra->curs;
executed (the execution status of this line is deduced): delete d->extra->curs;
-
4607 d->extra->curs = 0;
executed (the execution status of this line is deduced): d->extra->curs = 0;
-
4608 }
executed: }
Execution Count:118
118
4609 if (!isWindow())
evaluated: !isWindow()
TRUEFALSE
yes
Evaluation Count:68
yes
Evaluation Count:70
68-70
4610 setAttribute(Qt::WA_SetCursor, false);
executed: setAttribute(Qt::WA_SetCursor, false);
Execution Count:68
68
4611 d->unsetCursor_sys();
executed (the execution status of this line is deduced): d->unsetCursor_sys();
-
4612 -
4613 QEvent event(QEvent::CursorChange);
executed (the execution status of this line is deduced): QEvent event(QEvent::CursorChange);
-
4614 QApplication::sendEvent(this, &event);
executed (the execution status of this line is deduced): QApplication::sendEvent(this, &event);
-
4615}
executed: }
Execution Count:138
138
4616 -
4617#endif -
4618 -
4619/*! -
4620 \enum QWidget::RenderFlag -
4621 -
4622 This enum describes how to render the widget when calling QWidget::render(). -
4623 -
4624 \value DrawWindowBackground If you enable this option, the widget's background -
4625 is rendered into the target even if autoFillBackground is not set. By default, -
4626 this option is enabled. -
4627 -
4628 \value DrawChildren If you enable this option, the widget's children -
4629 are rendered recursively into the target. By default, this option is enabled. -
4630 -
4631 \value IgnoreMask If you enable this option, the widget's QWidget::mask() -
4632 is ignored when rendering into the target. By default, this option is disabled. -
4633 -
4634 \since 4.3 -
4635*/ -
4636 -
4637/*! -
4638 \since 4.3 -
4639 -
4640 Renders the \a sourceRegion of this widget into the \a target -
4641 using \a renderFlags to determine how to render. Rendering -
4642 starts at \a targetOffset in the \a target. For example: -
4643 -
4644 \snippet code/src_gui_kernel_qwidget.cpp 7 -
4645 -
4646 If \a sourceRegion is a null region, this function will use QWidget::rect() as -
4647 the region, i.e. the entire widget. -
4648 -
4649 Ensure that you call QPainter::end() for the \a target device's -
4650 active painter (if any) before rendering. For example: -
4651 -
4652 \snippet code/src_gui_kernel_qwidget.cpp 8 -
4653 -
4654 \note To obtain the contents of an OpenGL widget, use QGLWidget::grabFrameBuffer() -
4655 or QGLWidget::renderPixmap() instead. -
4656*/ -
4657void QWidget::render(QPaintDevice *target, const QPoint &targetOffset, -
4658 const QRegion &sourceRegion, RenderFlags renderFlags) -
4659{ -
4660 d_func()->render(target, targetOffset, sourceRegion, renderFlags, false);
executed (the execution status of this line is deduced): d_func()->render(target, targetOffset, sourceRegion, renderFlags, false);
-
4661}
executed: }
Execution Count:90
90
4662 -
4663/*! -
4664 \overload -
4665 -
4666 Renders the widget into the \a painter's QPainter::device(). -
4667 -
4668 Transformations and settings applied to the \a painter will be used -
4669 when rendering. -
4670 -
4671 \note The \a painter must be active. On Mac OS X the widget will be -
4672 rendered into a QPixmap and then drawn by the \a painter. -
4673 -
4674 \sa QPainter::device() -
4675*/ -
4676void QWidget::render(QPainter *painter, const QPoint &targetOffset, -
4677 const QRegion &sourceRegion, RenderFlags renderFlags) -
4678{ -
4679 if (!painter) {
partially evaluated: !painter
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:26
0-26
4680 qWarning("QWidget::render: Null pointer to painter");
never executed (the execution status of this line is deduced): QMessageLogger("kernel/qwidget.cpp", 4680, __PRETTY_FUNCTION__).warning("QWidget::render: Null pointer to painter");
-
4681 return;
never executed: return;
0
4682 } -
4683 -
4684 if (!painter->isActive()) {
partially evaluated: !painter->isActive()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:26
0-26
4685 qWarning("QWidget::render: Cannot render with an inactive painter");
never executed (the execution status of this line is deduced): QMessageLogger("kernel/qwidget.cpp", 4685, __PRETTY_FUNCTION__).warning("QWidget::render: Cannot render with an inactive painter");
-
4686 return;
never executed: return;
0
4687 } -
4688 -
4689 const qreal opacity = painter->opacity();
executed (the execution status of this line is deduced): const qreal opacity = painter->opacity();
-
4690 if (qFuzzyIsNull(opacity))
partially evaluated: qFuzzyIsNull(opacity)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:26
0-26
4691 return; // Fully transparent.
never executed: return;
0
4692 -
4693 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
4694 const bool inRenderWithPainter = d->extra && d->extra->inRenderWithPainter;
evaluated: d->extra
TRUEFALSE
yes
Evaluation Count:24
yes
Evaluation Count:2
partially evaluated: d->extra->inRenderWithPainter
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:24
0-24
4695 const QRegion toBePainted = !inRenderWithPainter ? d->prepareToRender(sourceRegion, renderFlags)
partially evaluated: !inRenderWithPainter
TRUEFALSE
yes
Evaluation Count:26
no
Evaluation Count:0
0-26
4696 : sourceRegion;
executed (the execution status of this line is deduced): : sourceRegion;
-
4697 if (toBePainted.isEmpty())
partially evaluated: toBePainted.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:26
0-26
4698 return;
never executed: return;
0
4699 -
4700 if (!d->extra)
partially evaluated: !d->extra
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:26
0-26
4701 d->createExtra();
never executed: d->createExtra();
0
4702 d->extra->inRenderWithPainter = true;
executed (the execution status of this line is deduced): d->extra->inRenderWithPainter = true;
-
4703 -
4704#ifdef Q_WS_MAC -
4705 d->render_helper(painter, targetOffset, toBePainted, renderFlags); -
4706#else -
4707 QPaintEngine *engine = painter->paintEngine();
executed (the execution status of this line is deduced): QPaintEngine *engine = painter->paintEngine();
-
4708 Q_ASSERT(engine);
executed (the execution status of this line is deduced): qt_noop();
-
4709 QPaintEnginePrivate *enginePriv = engine->d_func();
executed (the execution status of this line is deduced): QPaintEnginePrivate *enginePriv = engine->d_func();
-
4710 Q_ASSERT(enginePriv);
executed (the execution status of this line is deduced): qt_noop();
-
4711 QPaintDevice *target = engine->paintDevice();
executed (the execution status of this line is deduced): QPaintDevice *target = engine->paintDevice();
-
4712 Q_ASSERT(target);
executed (the execution status of this line is deduced): qt_noop();
-
4713 -
4714 // Render via a pixmap when dealing with non-opaque painters or printers. -
4715 if (!inRenderWithPainter && (opacity < 1.0 || (target->devType() == QInternal::Printer))) {
partially evaluated: !inRenderWithPainter
TRUEFALSE
yes
Evaluation Count:26
no
Evaluation Count:0
evaluated: opacity < 1.0
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:24
partially evaluated: (target->devType() == QInternal::Printer)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:24
0-26
4716 d->render_helper(painter, targetOffset, toBePainted, renderFlags);
executed (the execution status of this line is deduced): d->render_helper(painter, targetOffset, toBePainted, renderFlags);
-
4717 d->extra->inRenderWithPainter = false;
executed (the execution status of this line is deduced): d->extra->inRenderWithPainter = false;
-
4718 return;
executed: return;
Execution Count:2
2
4719 } -
4720 -
4721 // Set new shared painter. -
4722 QPainter *oldPainter = d->sharedPainter();
executed (the execution status of this line is deduced): QPainter *oldPainter = d->sharedPainter();
-
4723 d->setSharedPainter(painter);
executed (the execution status of this line is deduced): d->setSharedPainter(painter);
-
4724 -
4725 // Save current system clip, viewport and transform, -
4726 const QTransform oldTransform = enginePriv->systemTransform;
executed (the execution status of this line is deduced): const QTransform oldTransform = enginePriv->systemTransform;
-
4727 const QRegion oldSystemClip = enginePriv->systemClip;
executed (the execution status of this line is deduced): const QRegion oldSystemClip = enginePriv->systemClip;
-
4728 const QRegion oldSystemViewport = enginePriv->systemViewport;
executed (the execution status of this line is deduced): const QRegion oldSystemViewport = enginePriv->systemViewport;
-
4729 -
4730 // This ensures that all painting triggered by render() is clipped to the current engine clip. -
4731 if (painter->hasClipping()) {
evaluated: painter->hasClipping()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:22
2-22
4732 const QRegion painterClip = painter->deviceTransform().map(painter->clipRegion());
executed (the execution status of this line is deduced): const QRegion painterClip = painter->deviceTransform().map(painter->clipRegion());
-
4733 enginePriv->setSystemViewport(oldSystemClip.isEmpty() ? painterClip : oldSystemClip & painterClip);
executed (the execution status of this line is deduced): enginePriv->setSystemViewport(oldSystemClip.isEmpty() ? painterClip : oldSystemClip & painterClip);
-
4734 } else {
executed: }
Execution Count:2
2
4735 enginePriv->setSystemViewport(oldSystemClip);
executed (the execution status of this line is deduced): enginePriv->setSystemViewport(oldSystemClip);
-
4736 }
executed: }
Execution Count:22
22
4737 -
4738 render(target, targetOffset, toBePainted, renderFlags);
executed (the execution status of this line is deduced): render(target, targetOffset, toBePainted, renderFlags);
-
4739 -
4740 // Restore system clip, viewport and transform. -
4741 enginePriv->systemClip = oldSystemClip;
executed (the execution status of this line is deduced): enginePriv->systemClip = oldSystemClip;
-
4742 enginePriv->setSystemViewport(oldSystemViewport);
executed (the execution status of this line is deduced): enginePriv->setSystemViewport(oldSystemViewport);
-
4743 enginePriv->setSystemTransform(oldTransform);
executed (the execution status of this line is deduced): enginePriv->setSystemTransform(oldTransform);
-
4744 -
4745 // Restore shared painter. -
4746 d->setSharedPainter(oldPainter);
executed (the execution status of this line is deduced): d->setSharedPainter(oldPainter);
-
4747#endif -
4748 -
4749 d->extra->inRenderWithPainter = false;
executed (the execution status of this line is deduced): d->extra->inRenderWithPainter = false;
-
4750}
executed: }
Execution Count:24
24
4751 -
4752static void sendResizeEvents(QWidget *target) -
4753{ -
4754 QResizeEvent e(target->size(), QSize());
executed (the execution status of this line is deduced): QResizeEvent e(target->size(), QSize());
-
4755 QApplication::sendEvent(target, &e);
executed (the execution status of this line is deduced): QApplication::sendEvent(target, &e);
-
4756 -
4757 const QObjectList children = target->children();
executed (the execution status of this line is deduced): const QObjectList children = target->children();
-
4758 for (int i = 0; i < children.size(); ++i) {
evaluated: i < children.size()
TRUEFALSE
yes
Evaluation Count:73
yes
Evaluation Count:64
64-73
4759 QWidget *child = static_cast<QWidget*>(children.at(i));
executed (the execution status of this line is deduced): QWidget *child = static_cast<QWidget*>(children.at(i));
-
4760 if (child->isWidgetType() && !child->isWindow() && child->testAttribute(Qt::WA_PendingResizeEvent))
evaluated: child->isWidgetType()
TRUEFALSE
yes
Evaluation Count:56
yes
Evaluation Count:17
partially evaluated: !child->isWindow()
TRUEFALSE
yes
Evaluation Count:56
no
Evaluation Count:0
evaluated: child->testAttribute(Qt::WA_PendingResizeEvent)
TRUEFALSE
yes
Evaluation Count:55
yes
Evaluation Count:1
0-56
4761 sendResizeEvents(child);
executed: sendResizeEvents(child);
Execution Count:55
55
4762 }
executed: }
Execution Count:73
73
4763}
executed: }
Execution Count:64
64
4764 -
4765/*! -
4766 \since 5.0 -
4767 -
4768 Renders the widget into a pixmap restricted by the -
4769 given \a rectangle. If the widget has any children, then -
4770 they are also painted in the appropriate positions. -
4771 -
4772 If a rectangle with an invalid size is specified (the default), -
4773 the entire widget is painted. -
4774 -
4775 \sa render(), QPixmap -
4776*/ -
4777 -
4778/* INVOKABLE since used by QPixmap::grabWidget(). */ -
4779QPixmap QWidget::grab(const QRect &rectangle) -
4780{ -
4781 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
4782 if (testAttribute(Qt::WA_PendingResizeEvent) || !testAttribute(Qt::WA_WState_Created))
evaluated: testAttribute(Qt::WA_PendingResizeEvent)
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:48
evaluated: !testAttribute(Qt::WA_WState_Created)
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:45
3-48
4783 sendResizeEvents(this);
executed: sendResizeEvents(this);
Execution Count:9
9
4784 -
4785 const QWidget::RenderFlags renderFlags = QWidget::DrawWindowBackground | QWidget::DrawChildren | QWidget::IgnoreMask;
executed (the execution status of this line is deduced): const QWidget::RenderFlags renderFlags = QWidget::DrawWindowBackground | QWidget::DrawChildren | QWidget::IgnoreMask;
-
4786 -
4787 const bool oldDirtyOpaqueChildren = d->dirtyOpaqueChildren;
executed (the execution status of this line is deduced): const bool oldDirtyOpaqueChildren = d->dirtyOpaqueChildren;
-
4788 QRect r(rectangle);
executed (the execution status of this line is deduced): QRect r(rectangle);
-
4789 if (r.width() < 0 || r.height() < 0) {
evaluated: r.width() < 0
TRUEFALSE
yes
Evaluation Count:47
yes
Evaluation Count:7
partially evaluated: r.height() < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7
0-47
4790 // For grabbing widgets that haven't been shown yet, -
4791 // we trigger the layouting mechanism to determine the widget's size. -
4792 r = d->prepareToRender(QRegion(), renderFlags).boundingRect();
executed (the execution status of this line is deduced): r = d->prepareToRender(QRegion(), renderFlags).boundingRect();
-
4793 r.setTopLeft(rectangle.topLeft());
executed (the execution status of this line is deduced): r.setTopLeft(rectangle.topLeft());
-
4794 }
executed: }
Execution Count:47
47
4795 -
4796 if (!r.intersects(rect()))
evaluated: !r.intersects(rect())
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:50
4-50
4797 return QPixmap();
executed: return QPixmap();
Execution Count:4
4
4798 -
4799 QPixmap res(r.size());
executed (the execution status of this line is deduced): QPixmap res(r.size());
-
4800 if (!d->isOpaque)
evaluated: !d->isOpaque
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:45
5-45
4801 res.fill(Qt::transparent);
executed: res.fill(Qt::transparent);
Execution Count:5
5
4802 render(&res, QPoint(), QRegion(r), renderFlags);
executed (the execution status of this line is deduced): render(&res, QPoint(), QRegion(r), renderFlags);
-
4803 -
4804 d->dirtyOpaqueChildren = oldDirtyOpaqueChildren;
executed (the execution status of this line is deduced): d->dirtyOpaqueChildren = oldDirtyOpaqueChildren;
-
4805 return res;
executed: return res;
Execution Count:50
50
4806} -
4807 -
4808/*! -
4809 \brief The graphicsEffect function returns a pointer to the -
4810 widget's graphics effect. -
4811 -
4812 If the widget has no graphics effect, 0 is returned. -
4813 -
4814 \since 4.6 -
4815 -
4816 \sa setGraphicsEffect() -
4817*/ -
4818#ifndef QT_NO_GRAPHICSEFFECT -
4819QGraphicsEffect *QWidget::graphicsEffect() const -
4820{ -
4821 Q_D(const QWidget);
executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
4822 return d->graphicsEffect;
executed: return d->graphicsEffect;
Execution Count:845122
845122
4823} -
4824#endif //QT_NO_GRAPHICSEFFECT -
4825 -
4826/*! -
4827 -
4828 \brief The setGraphicsEffect function is for setting the widget's graphics effect. -
4829 -
4830 Sets \a effect as the widget's effect. If there already is an effect installed -
4831 on this widget, QWidget will delete the existing effect before installing -
4832 the new \a effect. -
4833 -
4834 If \a effect is the installed on a different widget, setGraphicsEffect() will remove -
4835 the effect from the widget and install it on this widget. -
4836 -
4837 QWidget takes ownership of \a effect. -
4838 -
4839 \note This function will apply the effect on itself and all its children. -
4840 -
4841 \since 4.6 -
4842 -
4843 \sa graphicsEffect() -
4844*/ -
4845#ifndef QT_NO_GRAPHICSEFFECT -
4846void QWidget::setGraphicsEffect(QGraphicsEffect *effect) -
4847{ -
4848 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
4849 if (d->graphicsEffect == effect)
partially evaluated: d->graphicsEffect == effect
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7
0-7
4850 return;
never executed: return;
0
4851 -
4852 if (d->graphicsEffect) {
evaluated: d->graphicsEffect
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:4
3-4
4853 d->invalidateBuffer(rect());
executed (the execution status of this line is deduced): d->invalidateBuffer(rect());
-
4854 delete d->graphicsEffect;
executed (the execution status of this line is deduced): delete d->graphicsEffect;
-
4855 d->graphicsEffect = 0;
executed (the execution status of this line is deduced): d->graphicsEffect = 0;
-
4856 }
executed: }
Execution Count:3
3
4857 -
4858 if (effect) {
evaluated: effect
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:1
1-6
4859 // Set new effect. -
4860 QGraphicsEffectSourcePrivate *sourced = new QWidgetEffectSourcePrivate(this);
executed (the execution status of this line is deduced): QGraphicsEffectSourcePrivate *sourced = new QWidgetEffectSourcePrivate(this);
-
4861 QGraphicsEffectSource *source = new QGraphicsEffectSource(*sourced);
executed (the execution status of this line is deduced): QGraphicsEffectSource *source = new QGraphicsEffectSource(*sourced);
-
4862 d->graphicsEffect = effect;
executed (the execution status of this line is deduced): d->graphicsEffect = effect;
-
4863 effect->d_func()->setGraphicsEffectSource(source);
executed (the execution status of this line is deduced): effect->d_func()->setGraphicsEffectSource(source);
-
4864 update();
executed (the execution status of this line is deduced): update();
-
4865 }
executed: }
Execution Count:6
6
4866 -
4867 d->updateIsOpaque();
executed (the execution status of this line is deduced): d->updateIsOpaque();
-
4868}
executed: }
Execution Count:7
7
4869#endif //QT_NO_GRAPHICSEFFECT -
4870 -
4871bool QWidgetPrivate::isAboutToShow() const -
4872{ -
4873 if (data.in_show)
evaluated: data.in_show
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:29
2-29
4874 return true;
executed: return true;
Execution Count:2
2
4875 -
4876 Q_Q(const QWidget);
executed (the execution status of this line is deduced): const QWidget * const q = q_func();
-
4877 if (q->isHidden())
evaluated: q->isHidden()
TRUEFALSE
yes
Evaluation Count:28
yes
Evaluation Count:1
1-28
4878 return false;
executed: return false;
Execution Count:28
28
4879 -
4880 // The widget will be shown if any of its ancestors are about to show. -
4881 QWidget *parent = q->parentWidget();
executed (the execution status of this line is deduced): QWidget *parent = q->parentWidget();
-
4882 return parent ? parent->d_func()->isAboutToShow() : false;
executed: return parent ? parent->d_func()->isAboutToShow() : false;
Execution Count:1
1
4883} -
4884 -
4885QRegion QWidgetPrivate::prepareToRender(const QRegion &region, QWidget::RenderFlags renderFlags) -
4886{ -
4887 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
4888 const bool isVisible = q->isVisible();
executed (the execution status of this line is deduced): const bool isVisible = q->isVisible();
-
4889 -
4890 // Make sure the widget is laid out correctly. -
4891 if (!isVisible && !isAboutToShow()) {
evaluated: !isVisible
TRUEFALSE
yes
Evaluation Count:30
yes
Evaluation Count:107
evaluated: !isAboutToShow()
TRUEFALSE
yes
Evaluation Count:28
yes
Evaluation Count:2
2-107
4892 QWidget *topLevel = q->window();
executed (the execution status of this line is deduced): QWidget *topLevel = q->window();
-
4893 (void)topLevel->d_func()->topData(); // Make sure we at least have top-data.
executed (the execution status of this line is deduced): (void)topLevel->d_func()->topData();
-
4894 topLevel->ensurePolished();
executed (the execution status of this line is deduced): topLevel->ensurePolished();
-
4895 -
4896 // Invalidate the layout of hidden ancestors (incl. myself) and pretend -
4897 // they're not explicitly hidden. -
4898 QWidget *widget = q;
executed (the execution status of this line is deduced): QWidget *widget = q;
-
4899 QWidgetList hiddenWidgets;
executed (the execution status of this line is deduced): QWidgetList hiddenWidgets;
-
4900 while (widget) {
evaluated: widget
TRUEFALSE
yes
Evaluation Count:29
yes
Evaluation Count:28
28-29
4901 if (widget->isHidden()) {
evaluated: widget->isHidden()
TRUEFALSE
yes
Evaluation Count:28
yes
Evaluation Count:1
1-28
4902 widget->setAttribute(Qt::WA_WState_Hidden, false);
executed (the execution status of this line is deduced): widget->setAttribute(Qt::WA_WState_Hidden, false);
-
4903 hiddenWidgets.append(widget);
executed (the execution status of this line is deduced): hiddenWidgets.append(widget);
-
4904 if (!widget->isWindow() && widget->parentWidget()->d_func()->layout)
partially evaluated: !widget->isWindow()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:28
never evaluated: widget->parentWidget()->d_func()->layout
0-28
4905 widget->d_func()->updateGeometry_helper(true);
never executed: widget->d_func()->updateGeometry_helper(true);
0
4906 }
executed: }
Execution Count:28
28
4907 widget = widget->parentWidget();
executed (the execution status of this line is deduced): widget = widget->parentWidget();
-
4908 }
executed: }
Execution Count:29
29
4909 -
4910 // Activate top-level layout. -
4911 if (topLevel->d_func()->layout)
evaluated: topLevel->d_func()->layout
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:26
2-26
4912 topLevel->d_func()->layout->activate();
executed: topLevel->d_func()->layout->activate();
Execution Count:2
2
4913 -
4914 // Adjust size if necessary. -
4915 QTLWExtra *topLevelExtra = topLevel->d_func()->maybeTopData();
executed (the execution status of this line is deduced): QTLWExtra *topLevelExtra = topLevel->d_func()->maybeTopData();
-
4916 if (topLevelExtra && !topLevelExtra->sizeAdjusted
partially evaluated: topLevelExtra
TRUEFALSE
yes
Evaluation Count:28
no
Evaluation Count:0
evaluated: !topLevelExtra->sizeAdjusted
TRUEFALSE
yes
Evaluation Count:27
yes
Evaluation Count:1
0-28
4917 && !topLevel->testAttribute(Qt::WA_Resized)) {
evaluated: !topLevel->testAttribute(Qt::WA_Resized)
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:24
3-24
4918 topLevel->adjustSize();
executed (the execution status of this line is deduced): topLevel->adjustSize();
-
4919 topLevel->setAttribute(Qt::WA_Resized, false);
executed (the execution status of this line is deduced): topLevel->setAttribute(Qt::WA_Resized, false);
-
4920 }
executed: }
Execution Count:3
3
4921 -
4922 // Activate child layouts. -
4923 topLevel->d_func()->activateChildLayoutsRecursively();
executed (the execution status of this line is deduced): topLevel->d_func()->activateChildLayoutsRecursively();
-
4924 -
4925 // We're not cheating with WA_WState_Hidden anymore. -
4926 for (int i = 0; i < hiddenWidgets.size(); ++i) {
evaluated: i < hiddenWidgets.size()
TRUEFALSE
yes
Evaluation Count:28
yes
Evaluation Count:28
28
4927 QWidget *widget = hiddenWidgets.at(i);
executed (the execution status of this line is deduced): QWidget *widget = hiddenWidgets.at(i);
-
4928 widget->setAttribute(Qt::WA_WState_Hidden);
executed (the execution status of this line is deduced): widget->setAttribute(Qt::WA_WState_Hidden);
-
4929 if (!widget->isWindow() && widget->parentWidget()->d_func()->layout)
partially evaluated: !widget->isWindow()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:28
never evaluated: widget->parentWidget()->d_func()->layout
0-28
4930 widget->parentWidget()->d_func()->layout->invalidate();
never executed: widget->parentWidget()->d_func()->layout->invalidate();
0
4931 }
executed: }
Execution Count:28
28
4932 } else if (isVisible) {
executed: }
Execution Count:28
evaluated: isVisible
TRUEFALSE
yes
Evaluation Count:107
yes
Evaluation Count:2
2-107
4933 q->window()->d_func()->sendPendingMoveAndResizeEvents(true, true);
executed (the execution status of this line is deduced): q->window()->d_func()->sendPendingMoveAndResizeEvents(true, true);
-
4934 }
executed: }
Execution Count:107
107
4935 -
4936 // Calculate the region to be painted. -
4937 QRegion toBePainted = !region.isEmpty() ? region : QRegion(q->rect());
evaluated: !region.isEmpty()
TRUEFALSE
yes
Evaluation Count:58
yes
Evaluation Count:79
58-79
4938 if (!(renderFlags & QWidget::IgnoreMask) && extra && extra->hasMask)
evaluated: !(renderFlags & QWidget::IgnoreMask)
TRUEFALSE
yes
Evaluation Count:40
yes
Evaluation Count:97
evaluated: extra
TRUEFALSE
yes
Evaluation Count:37
yes
Evaluation Count:3
partially evaluated: extra->hasMask
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:37
0-97
4939 toBePainted &= extra->mask;
never executed: toBePainted &= extra->mask;
0
4940 return toBePainted;
executed: return toBePainted;
Execution Count:137
137
4941} -
4942 -
4943void QWidgetPrivate::render_helper(QPainter *painter, const QPoint &targetOffset, const QRegion &toBePainted, -
4944 QWidget::RenderFlags renderFlags) -
4945{ -
4946 Q_ASSERT(painter);
executed (the execution status of this line is deduced): qt_noop();
-
4947 Q_ASSERT(!toBePainted.isEmpty());
executed (the execution status of this line is deduced): qt_noop();
-
4948 -
4949 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
4950#ifndef Q_WS_MAC -
4951 const QTransform originalTransform = painter->worldTransform();
executed (the execution status of this line is deduced): const QTransform originalTransform = painter->worldTransform();
-
4952 const bool useDeviceCoordinates = originalTransform.isScaling();
executed (the execution status of this line is deduced): const bool useDeviceCoordinates = originalTransform.isScaling();
-
4953 if (!useDeviceCoordinates) {
partially evaluated: !useDeviceCoordinates
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
4954#endif -
4955 // Render via a pixmap. -
4956 const QRect rect = toBePainted.boundingRect();
executed (the execution status of this line is deduced): const QRect rect = toBePainted.boundingRect();
-
4957 const QSize size = rect.size();
executed (the execution status of this line is deduced): const QSize size = rect.size();
-
4958 if (size.isNull())
partially evaluated: size.isNull()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
4959 return;
never executed: return;
0
4960 -
4961 QPixmap pixmap(size);
executed (the execution status of this line is deduced): QPixmap pixmap(size);
-
4962 if (!(renderFlags & QWidget::DrawWindowBackground) || !isOpaque)
partially evaluated: !(renderFlags & QWidget::DrawWindowBackground)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
partially evaluated: !isOpaque
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
4963 pixmap.fill(Qt::transparent);
never executed: pixmap.fill(Qt::transparent);
0
4964 q->render(&pixmap, QPoint(), toBePainted, renderFlags);
executed (the execution status of this line is deduced): q->render(&pixmap, QPoint(), toBePainted, renderFlags);
-
4965 -
4966 const bool restore = !(painter->renderHints() & QPainter::SmoothPixmapTransform);
executed (the execution status of this line is deduced): const bool restore = !(painter->renderHints() & QPainter::SmoothPixmapTransform);
-
4967 painter->setRenderHints(QPainter::SmoothPixmapTransform, true);
executed (the execution status of this line is deduced): painter->setRenderHints(QPainter::SmoothPixmapTransform, true);
-
4968 -
4969 painter->drawPixmap(targetOffset, pixmap);
executed (the execution status of this line is deduced): painter->drawPixmap(targetOffset, pixmap);
-
4970 -
4971 if (restore)
partially evaluated: restore
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
4972 painter->setRenderHints(QPainter::SmoothPixmapTransform, false);
executed: painter->setRenderHints(QPainter::SmoothPixmapTransform, false);
Execution Count:2
2
4973 -
4974#ifndef Q_WS_MAC -
4975 } else {
executed: }
Execution Count:2
2
4976 // Render via a pixmap in device coordinates (to avoid pixmap scaling). -
4977 QTransform transform = originalTransform;
never executed (the execution status of this line is deduced): QTransform transform = originalTransform;
-
4978 transform.translate(targetOffset.x(), targetOffset.y());
never executed (the execution status of this line is deduced): transform.translate(targetOffset.x(), targetOffset.y());
-
4979 -
4980 QPaintDevice *device = painter->device();
never executed (the execution status of this line is deduced): QPaintDevice *device = painter->device();
-
4981 Q_ASSERT(device);
never executed (the execution status of this line is deduced): qt_noop();
-
4982 -
4983 // Calculate device rect. -
4984 const QRectF rect(toBePainted.boundingRect());
never executed (the execution status of this line is deduced): const QRectF rect(toBePainted.boundingRect());
-
4985 QRect deviceRect = transform.mapRect(QRectF(0, 0, rect.width(), rect.height())).toAlignedRect();
never executed (the execution status of this line is deduced): QRect deviceRect = transform.mapRect(QRectF(0, 0, rect.width(), rect.height())).toAlignedRect();
-
4986 deviceRect &= QRect(0, 0, device->width(), device->height());
never executed (the execution status of this line is deduced): deviceRect &= QRect(0, 0, device->width(), device->height());
-
4987 -
4988 QPixmap pixmap(deviceRect.size());
never executed (the execution status of this line is deduced): QPixmap pixmap(deviceRect.size());
-
4989 pixmap.fill(Qt::transparent);
never executed (the execution status of this line is deduced): pixmap.fill(Qt::transparent);
-
4990 -
4991 // Create a pixmap device coordinate painter. -
4992 QPainter pixmapPainter(&pixmap);
never executed (the execution status of this line is deduced): QPainter pixmapPainter(&pixmap);
-
4993 pixmapPainter.setRenderHints(painter->renderHints());
never executed (the execution status of this line is deduced): pixmapPainter.setRenderHints(painter->renderHints());
-
4994 transform *= QTransform::fromTranslate(-deviceRect.x(), -deviceRect.y());
never executed (the execution status of this line is deduced): transform *= QTransform::fromTranslate(-deviceRect.x(), -deviceRect.y());
-
4995 pixmapPainter.setTransform(transform);
never executed (the execution status of this line is deduced): pixmapPainter.setTransform(transform);
-
4996 -
4997 q->render(&pixmapPainter, QPoint(), toBePainted, renderFlags);
never executed (the execution status of this line is deduced): q->render(&pixmapPainter, QPoint(), toBePainted, renderFlags);
-
4998 pixmapPainter.end();
never executed (the execution status of this line is deduced): pixmapPainter.end();
-
4999 -
5000 // And then draw the pixmap. -
5001 painter->setTransform(QTransform());
never executed (the execution status of this line is deduced): painter->setTransform(QTransform());
-
5002 painter->drawPixmap(deviceRect.topLeft(), pixmap);
never executed (the execution status of this line is deduced): painter->drawPixmap(deviceRect.topLeft(), pixmap);
-
5003 painter->setTransform(originalTransform);
never executed (the execution status of this line is deduced): painter->setTransform(originalTransform);
-
5004 }
never executed: }
0
5005#endif -
5006} -
5007 -
5008void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QPoint &offset, int flags, -
5009 QPainter *sharedPainter, QWidgetBackingStore *backingStore) -
5010{ -
5011 if (rgn.isEmpty())
evaluated: rgn.isEmpty()
TRUEFALSE
yes
Evaluation Count:849
yes
Evaluation Count:18502
849-18502
5012 return;
executed: return;
Execution Count:849
849
5013 -
5014#ifdef Q_WS_MAC -
5015 if (qt_mac_clearDirtyOnWidgetInsideDrawWidget) -
5016 dirtyOnWidget = QRegion(); -
5017 -
5018 // We disable the rendering of QToolBar in the backingStore if -
5019 // it's supposed to be in the unified toolbar on Mac OS X. -
5020 if (backingStore && isInUnifiedToolbar) -
5021 return; -
5022#endif // Q_WS_MAC -
5023 -
5024 -
5025 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
5026#ifndef QT_NO_GRAPHICSEFFECT -
5027 if (graphicsEffect && graphicsEffect->isEnabled()) {
partially evaluated: graphicsEffect
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:18502
never evaluated: graphicsEffect->isEnabled()
0-18502
5028 QGraphicsEffectSource *source = graphicsEffect->d_func()->source;
never executed (the execution status of this line is deduced): QGraphicsEffectSource *source = graphicsEffect->d_func()->source;
-
5029 QWidgetEffectSourcePrivate *sourced = static_cast<QWidgetEffectSourcePrivate *>
never executed (the execution status of this line is deduced): QWidgetEffectSourcePrivate *sourced = static_cast<QWidgetEffectSourcePrivate *>
-
5030 (source->d_func());
never executed (the execution status of this line is deduced): (source->d_func());
-
5031 if (!sourced->context) {
never evaluated: !sourced->context
0
5032 QWidgetPaintContext context(pdev, rgn, offset, flags, sharedPainter, backingStore);
never executed (the execution status of this line is deduced): QWidgetPaintContext context(pdev, rgn, offset, flags, sharedPainter, backingStore);
-
5033 sourced->context = &context;
never executed (the execution status of this line is deduced): sourced->context = &context;
-
5034 if (!sharedPainter) {
never evaluated: !sharedPainter
0
5035 setSystemClip(pdev, rgn.translated(offset));
never executed (the execution status of this line is deduced): setSystemClip(pdev, rgn.translated(offset));
-
5036 QPainter p(pdev);
never executed (the execution status of this line is deduced): QPainter p(pdev);
-
5037 p.translate(offset);
never executed (the execution status of this line is deduced): p.translate(offset);
-
5038 context.painter = &p;
never executed (the execution status of this line is deduced): context.painter = &p;
-
5039 graphicsEffect->draw(&p);
never executed (the execution status of this line is deduced): graphicsEffect->draw(&p);
-
5040 setSystemClip(pdev, QRegion());
never executed (the execution status of this line is deduced): setSystemClip(pdev, QRegion());
-
5041 } else {
never executed: }
0
5042 context.painter = sharedPainter;
never executed (the execution status of this line is deduced): context.painter = sharedPainter;
-
5043 if (sharedPainter->worldTransform() != sourced->lastEffectTransform) {
never evaluated: sharedPainter->worldTransform() != sourced->lastEffectTransform
0
5044 sourced->invalidateCache();
never executed (the execution status of this line is deduced): sourced->invalidateCache();
-
5045 sourced->lastEffectTransform = sharedPainter->worldTransform();
never executed (the execution status of this line is deduced): sourced->lastEffectTransform = sharedPainter->worldTransform();
-
5046 }
never executed: }
0
5047 sharedPainter->save();
never executed (the execution status of this line is deduced): sharedPainter->save();
-
5048 sharedPainter->translate(offset);
never executed (the execution status of this line is deduced): sharedPainter->translate(offset);
-
5049 graphicsEffect->draw(sharedPainter);
never executed (the execution status of this line is deduced): graphicsEffect->draw(sharedPainter);
-
5050 sharedPainter->restore();
never executed (the execution status of this line is deduced): sharedPainter->restore();
-
5051 }
never executed: }
0
5052 sourced->context = 0;
never executed (the execution status of this line is deduced): sourced->context = 0;
-
5053 return;
never executed: return;
0
5054 } -
5055 }
never executed: }
0
5056#endif //QT_NO_GRAFFICSEFFECT -
5057 -
5058 const bool asRoot = flags & DrawAsRoot;
executed (the execution status of this line is deduced): const bool asRoot = flags & DrawAsRoot;
-
5059 const bool alsoOnScreen = flags & DrawPaintOnScreen;
executed (the execution status of this line is deduced): const bool alsoOnScreen = flags & DrawPaintOnScreen;
-
5060 const bool recursive = flags & DrawRecursive;
executed (the execution status of this line is deduced): const bool recursive = flags & DrawRecursive;
-
5061 const bool alsoInvisible = flags & DrawInvisible;
executed (the execution status of this line is deduced): const bool alsoInvisible = flags & DrawInvisible;
-
5062 -
5063 Q_ASSERT(sharedPainter ? sharedPainter->isActive() : true);
executed (the execution status of this line is deduced): qt_noop();
-
5064 -
5065 QRegion toBePainted(rgn);
executed (the execution status of this line is deduced): QRegion toBePainted(rgn);
-
5066 if (asRoot && !alsoInvisible)
evaluated: asRoot
TRUEFALSE
yes
Evaluation Count:4110
yes
Evaluation Count:14392
evaluated: !alsoInvisible
TRUEFALSE
yes
Evaluation Count:4020
yes
Evaluation Count:90
90-14392
5067 toBePainted &= clipRect(); //(rgn & visibleRegion());
executed: toBePainted &= clipRect();
Execution Count:4020
4020
5068 if (!(flags & DontSubtractOpaqueChildren))
partially evaluated: !(flags & DontSubtractOpaqueChildren)
TRUEFALSE
yes
Evaluation Count:18502
no
Evaluation Count:0
0-18502
5069 subtractOpaqueChildren(toBePainted, q->rect());
executed: subtractOpaqueChildren(toBePainted, q->rect());
Execution Count:18502
18502
5070 -
5071 if (!toBePainted.isEmpty()) {
evaluated: !toBePainted.isEmpty()
TRUEFALSE
yes
Evaluation Count:16430
yes
Evaluation Count:2072
2072-16430
5072 bool onScreen = paintOnScreen();
never executed (the execution status of this line is deduced): bool onScreen = paintOnScreen();
-
5073 if (!onScreen || alsoOnScreen) {
evaluated: !onScreen
TRUEFALSE
yes
Evaluation Count:16422
yes
Evaluation Count:8
partially evaluated: alsoOnScreen
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
0-16422
5074 //update the "in paint event" flag -
5075 if (q->testAttribute(Qt::WA_WState_InPaintEvent))
partially evaluated: q->testAttribute(Qt::WA_WState_InPaintEvent)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:16430
0-16430
5076 qWarning("QWidget::repaint: Recursive repaint detected");
never executed: QMessageLogger("kernel/qwidget.cpp", 5076, __PRETTY_FUNCTION__).warning("QWidget::repaint: Recursive repaint detected");
0
5077 q->setAttribute(Qt::WA_WState_InPaintEvent);
executed (the execution status of this line is deduced): q->setAttribute(Qt::WA_WState_InPaintEvent);
-
5078 -
5079 //clip away the new area -
5080#ifndef QT_NO_PAINT_DEBUG -
5081 bool flushed = QWidgetBackingStore::flushPaint(q, toBePainted); -
5082#endif -
5083 QPaintEngine *paintEngine = pdev->paintEngine();
executed (the execution status of this line is deduced): QPaintEngine *paintEngine = pdev->paintEngine();
-
5084 if (paintEngine) {
evaluated: paintEngine
TRUEFALSE
yes
Evaluation Count:16422
yes
Evaluation Count:8
8-16422
5085 setRedirected(pdev, -offset);
executed (the execution status of this line is deduced): setRedirected(pdev, -offset);
-
5086 -
5087#ifdef Q_WS_MAC -
5088 // (Alien support) Special case for Mac when redirecting: If the paint device -
5089 // is of the Widget type we need to set WA_WState_InPaintEvent since painting -
5090 // outside the paint event is not supported on QWidgets. The attributeis -
5091 // restored further down. -
5092 if (pdev->devType() == QInternal::Widget) -
5093 static_cast<QWidget *>(pdev)->setAttribute(Qt::WA_WState_InPaintEvent); -
5094 -
5095#endif -
5096 if (sharedPainter)
evaluated: sharedPainter
TRUEFALSE
yes
Evaluation Count:26
yes
Evaluation Count:16396
26-16396
5097 setSystemClip(pdev, toBePainted);
executed: setSystemClip(pdev, toBePainted);
Execution Count:26
26
5098 else -
5099 paintEngine->d_func()->systemRect = q->data->crect;
executed: paintEngine->d_func()->systemRect = q->data->crect;
Execution Count:16396
16396
5100 -
5101 //paint the background -
5102 if ((asRoot || q->autoFillBackground() || onScreen || q->testAttribute(Qt::WA_StyledBackground))
evaluated: asRoot
TRUEFALSE
yes
Evaluation Count:3480
yes
Evaluation Count:12942
evaluated: q->autoFillBackground()
TRUEFALSE
yes
Evaluation Count:5211
yes
Evaluation Count:7731
partially evaluated: onScreen
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7731
evaluated: q->testAttribute(Qt::WA_StyledBackground)
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:7729
0-12942
5103 && !q->testAttribute(Qt::WA_OpaquePaintEvent) && !q->testAttribute(Qt::WA_NoSystemBackground)) {
evaluated: !q->testAttribute(Qt::WA_OpaquePaintEvent)
TRUEFALSE
yes
Evaluation Count:8683
yes
Evaluation Count:10
evaluated: !q->testAttribute(Qt::WA_NoSystemBackground)
TRUEFALSE
yes
Evaluation Count:8679
yes
Evaluation Count:4
4-8683
5104 QPainter p(q);
executed (the execution status of this line is deduced): QPainter p(q);
-
5105 paintBackground(&p, toBePainted, (asRoot || onScreen) ? flags | DrawAsRoot : 0);
executed (the execution status of this line is deduced): paintBackground(&p, toBePainted, (asRoot || onScreen) ? flags | DrawAsRoot : 0);
-
5106 }
executed: }
Execution Count:8679
8679
5107 -
5108 if (!sharedPainter)
evaluated: !sharedPainter
TRUEFALSE
yes
Evaluation Count:16396
yes
Evaluation Count:26
26-16396
5109 setSystemClip(pdev, toBePainted.translated(offset));
executed: setSystemClip(pdev, toBePainted.translated(offset));
Execution Count:16396
16396
5110 -
5111 if (!onScreen && !asRoot && !isOpaque && q->testAttribute(Qt::WA_TintedBackground)) {
partially evaluated: !onScreen
TRUEFALSE
yes
Evaluation Count:16422
no
Evaluation Count:0
evaluated: !asRoot
TRUEFALSE
yes
Evaluation Count:12942
yes
Evaluation Count:3480
evaluated: !isOpaque
TRUEFALSE
yes
Evaluation Count:4572
yes
Evaluation Count:8370
partially evaluated: q->testAttribute(Qt::WA_TintedBackground)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4572
0-16422
5112 QPainter p(q);
never executed (the execution status of this line is deduced): QPainter p(q);
-
5113 QColor tint = q->palette().window().color();
never executed (the execution status of this line is deduced): QColor tint = q->palette().window().color();
-
5114 tint.setAlphaF(qreal(.6));
never executed (the execution status of this line is deduced): tint.setAlphaF(qreal(.6));
-
5115 p.fillRect(toBePainted.boundingRect(), tint);
never executed (the execution status of this line is deduced): p.fillRect(toBePainted.boundingRect(), tint);
-
5116 }
never executed: }
0
5117 }
executed: }
Execution Count:16422
16422
5118 -
5119#if 0 -
5120 qDebug() << "painting" << q << "opaque ==" << isOpaque(); -
5121 qDebug() << "clipping to" << toBePainted << "location == " << offset -
5122 << "geometry ==" << QRect(q->mapTo(q->window(), QPoint(0, 0)), q->size()); -
5123#endif -
5124 -
5125 //actually send the paint event -
5126 QPaintEvent e(toBePainted);
executed (the execution status of this line is deduced): QPaintEvent e(toBePainted);
-
5127 QCoreApplication::sendSpontaneousEvent(q, &e);
executed (the execution status of this line is deduced): QCoreApplication::sendSpontaneousEvent(q, &e);
-
5128 -
5129 // Native widgets need to be marked dirty on screen so painting will be done in correct context -
5130 if (backingStore && !onScreen && !asRoot && (q->internalWinId() || !q->nativeParentWidget()->isWindow()))
evaluated: backingStore
TRUEFALSE
yes
Evaluation Count:15952
yes
Evaluation Count:478
partially evaluated: !onScreen
TRUEFALSE
yes
Evaluation Count:15952
no
Evaluation Count:0
evaluated: !asRoot
TRUEFALSE
yes
Evaluation Count:12561
yes
Evaluation Count:3391
evaluated: q->internalWinId()
TRUEFALSE
yes
Evaluation Count:23
yes
Evaluation Count:12538
evaluated: !q->nativeParentWidget()->isWindow()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:12536
0-15952
5131 backingStore->markDirtyOnScreen(toBePainted, q, offset);
executed: backingStore->markDirtyOnScreen(toBePainted, q, offset);
Execution Count:25
25
5132 -
5133 //restore -
5134 if (paintEngine) {
evaluated: paintEngine
TRUEFALSE
yes
Evaluation Count:16422
yes
Evaluation Count:8
8-16422
5135#ifdef Q_WS_MAC -
5136 if (pdev->devType() == QInternal::Widget) -
5137 static_cast<QWidget *>(pdev)->setAttribute(Qt::WA_WState_InPaintEvent, false); -
5138#endif -
5139 restoreRedirected();
executed (the execution status of this line is deduced): restoreRedirected();
-
5140 if (!sharedPainter)
evaluated: !sharedPainter
TRUEFALSE
yes
Evaluation Count:16396
yes
Evaluation Count:26
26-16396
5141 paintEngine->d_func()->systemRect = QRect();
executed: paintEngine->d_func()->systemRect = QRect();
Execution Count:16396
16396
5142 else -
5143 paintEngine->d_func()->currentClipDevice = 0;
executed: paintEngine->d_func()->currentClipDevice = 0;
Execution Count:26
26
5144 -
5145 setSystemClip(pdev, QRegion());
executed (the execution status of this line is deduced): setSystemClip(pdev, QRegion());
-
5146 }
executed: }
Execution Count:16422
16422
5147 q->setAttribute(Qt::WA_WState_InPaintEvent, false);
executed (the execution status of this line is deduced): q->setAttribute(Qt::WA_WState_InPaintEvent, false);
-
5148 if (q->paintingActive())
partially evaluated: q->paintingActive()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:16430
0-16430
5149 qWarning("QWidget::repaint: It is dangerous to leave painters active on a widget outside of the PaintEvent");
never executed: QMessageLogger("kernel/qwidget.cpp", 5149, __PRETTY_FUNCTION__).warning("QWidget::repaint: It is dangerous to leave painters active on a widget outside of the PaintEvent");
0
5150 -
5151 if (paintEngine && paintEngine->autoDestruct()) {
evaluated: paintEngine
TRUEFALSE
yes
Evaluation Count:16422
yes
Evaluation Count:8
partially evaluated: paintEngine->autoDestruct()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:16422
0-16422
5152 delete paintEngine;
never executed (the execution status of this line is deduced): delete paintEngine;
-
5153 }
never executed: }
0
5154 -
5155#ifndef QT_NO_PAINT_DEBUG -
5156 if (flushed) -
5157 QWidgetBackingStore::unflushPaint(q, toBePainted); -
5158#endif -
5159 } else if (q->isWindow()) {
executed: }
Execution Count:16430
never evaluated: q->isWindow()
0-16430
5160 QPaintEngine *engine = pdev->paintEngine();
never executed (the execution status of this line is deduced): QPaintEngine *engine = pdev->paintEngine();
-
5161 if (engine) {
never evaluated: engine
0
5162 QPainter p(pdev);
never executed (the execution status of this line is deduced): QPainter p(pdev);
-
5163 p.setClipRegion(toBePainted);
never executed (the execution status of this line is deduced): p.setClipRegion(toBePainted);
-
5164 const QBrush bg = q->palette().brush(QPalette::Window);
never executed (the execution status of this line is deduced): const QBrush bg = q->palette().brush(QPalette::Window);
-
5165 if (bg.style() == Qt::TexturePattern)
never evaluated: bg.style() == Qt::TexturePattern
0
5166 p.drawTiledPixmap(q->rect(), bg.texture());
never executed: p.drawTiledPixmap(q->rect(), bg.texture());
0
5167 else -
5168 p.fillRect(q->rect(), bg);
never executed: p.fillRect(q->rect(), bg);
0
5169 -
5170 if (engine->autoDestruct())
never evaluated: engine->autoDestruct()
0
5171 delete engine;
never executed: delete engine;
0
5172 }
never executed: }
0
5173 }
never executed: }
0
5174 } -
5175 -
5176 if (recursive && !children.isEmpty()) {
evaluated: recursive
TRUEFALSE
yes
Evaluation Count:18494
yes
Evaluation Count:8
evaluated: !children.isEmpty()
TRUEFALSE
yes
Evaluation Count:7860
yes
Evaluation Count:10634
8-18494
5177 paintSiblingsRecursive(pdev, children, children.size() - 1, rgn, offset, flags & ~DrawAsRoot
executed (the execution status of this line is deduced): paintSiblingsRecursive(pdev, children, children.size() - 1, rgn, offset, flags & ~DrawAsRoot
-
5178 , sharedPainter, backingStore);
executed (the execution status of this line is deduced): , sharedPainter, backingStore);
-
5179 }
executed: }
Execution Count:7860
7860
5180}
executed: }
Execution Count:18502
18502
5181 -
5182void QWidgetPrivate::render(QPaintDevice *target, const QPoint &targetOffset, -
5183 const QRegion &sourceRegion, QWidget::RenderFlags renderFlags, -
5184 bool readyToRender) -
5185{ -
5186 if (!target) {
partially evaluated: !target
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:90
0-90
5187 qWarning("QWidget::render: null pointer to paint device");
never executed (the execution status of this line is deduced): QMessageLogger("kernel/qwidget.cpp", 5187, __PRETTY_FUNCTION__).warning("QWidget::render: null pointer to paint device");
-
5188 return;
never executed: return;
0
5189 } -
5190 -
5191 const bool inRenderWithPainter = extra && extra->inRenderWithPainter;
evaluated: extra
TRUEFALSE
yes
Evaluation Count:80
yes
Evaluation Count:10
evaluated: extra->inRenderWithPainter
TRUEFALSE
yes
Evaluation Count:26
yes
Evaluation Count:54
10-80
5192 QRegion paintRegion = !inRenderWithPainter && !readyToRender
evaluated: !inRenderWithPainter
TRUEFALSE
yes
Evaluation Count:64
yes
Evaluation Count:26
partially evaluated: !readyToRender
TRUEFALSE
yes
Evaluation Count:64
no
Evaluation Count:0
0-64
5193 ? prepareToRender(sourceRegion, renderFlags)
executed (the execution status of this line is deduced): ? prepareToRender(sourceRegion, renderFlags)
-
5194 : sourceRegion;
executed (the execution status of this line is deduced): : sourceRegion;
-
5195 if (paintRegion.isEmpty())
partially evaluated: paintRegion.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:90
0-90
5196 return;
never executed: return;
0
5197 -
5198#ifndef Q_WS_MAC -
5199 QPainter *oldSharedPainter = inRenderWithPainter ? sharedPainter() : 0;
evaluated: inRenderWithPainter
TRUEFALSE
yes
Evaluation Count:26
yes
Evaluation Count:64
26-64
5200 -
5201 // Use the target's shared painter if set (typically set when doing -
5202 // "other->render(widget);" in the widget's paintEvent. -
5203 if (target->devType() == QInternal::Widget) {
partially evaluated: target->devType() == QInternal::Widget
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:90
0-90
5204 QWidgetPrivate *targetPrivate = static_cast<QWidget *>(target)->d_func();
never executed (the execution status of this line is deduced): QWidgetPrivate *targetPrivate = static_cast<QWidget *>(target)->d_func();
-
5205 if (targetPrivate->extra && targetPrivate->extra->inRenderWithPainter) {
never evaluated: targetPrivate->extra
never evaluated: targetPrivate->extra->inRenderWithPainter
0
5206 QPainter *targetPainter = targetPrivate->sharedPainter();
never executed (the execution status of this line is deduced): QPainter *targetPainter = targetPrivate->sharedPainter();
-
5207 if (targetPainter && targetPainter->isActive())
never evaluated: targetPainter
never evaluated: targetPainter->isActive()
0
5208 setSharedPainter(targetPainter);
never executed: setSharedPainter(targetPainter);
0
5209 }
never executed: }
0
5210 }
never executed: }
0
5211#endif -
5212 -
5213 // Use the target's redirected device if set and adjust offset and paint -
5214 // region accordingly. This is typically the case when people call render -
5215 // from the paintEvent. -
5216 QPoint offset = targetOffset;
executed (the execution status of this line is deduced): QPoint offset = targetOffset;
-
5217 offset -= paintRegion.boundingRect().topLeft();
executed (the execution status of this line is deduced): offset -= paintRegion.boundingRect().topLeft();
-
5218 QPoint redirectionOffset;
executed (the execution status of this line is deduced): QPoint redirectionOffset;
-
5219 QPaintDevice *redirected = 0;
executed (the execution status of this line is deduced): QPaintDevice *redirected = 0;
-
5220 -
5221 if (target->devType() == QInternal::Widget)
partially evaluated: target->devType() == QInternal::Widget
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:90
0-90
5222 redirected = static_cast<QWidget *>(target)->d_func()->redirected(&redirectionOffset);
never executed: redirected = static_cast<QWidget *>(target)->d_func()->redirected(&redirectionOffset);
0
5223 if (!redirected)
partially evaluated: !redirected
TRUEFALSE
yes
Evaluation Count:90
no
Evaluation Count:0
0-90
5224 redirected = QPainter::redirected(target, &redirectionOffset);
executed: redirected = QPainter::redirected(target, &redirectionOffset);
Execution Count:90
90
5225 -
5226 if (redirected) {
partially evaluated: redirected
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:90
0-90
5227 target = redirected;
never executed (the execution status of this line is deduced): target = redirected;
-
5228 offset -= redirectionOffset;
never executed (the execution status of this line is deduced): offset -= redirectionOffset;
-
5229 }
never executed: }
0
5230 -
5231 if (!inRenderWithPainter) { // Clip handled by shared painter (in qpainter.cpp).
evaluated: !inRenderWithPainter
TRUEFALSE
yes
Evaluation Count:64
yes
Evaluation Count:26
26-64
5232 if (QPaintEngine *targetEngine = target->paintEngine()) {
partially evaluated: QPaintEngine *targetEngine = target->paintEngine()
TRUEFALSE
yes
Evaluation Count:64
no
Evaluation Count:0
0-64
5233 const QRegion targetSystemClip = targetEngine->systemClip();
executed (the execution status of this line is deduced): const QRegion targetSystemClip = targetEngine->systemClip();
-
5234 if (!targetSystemClip.isEmpty())
evaluated: !targetSystemClip.isEmpty()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:61
3-61
5235 paintRegion &= targetSystemClip.translated(-offset);
executed: paintRegion &= targetSystemClip.translated(-offset);
Execution Count:3
3
5236 }
executed: }
Execution Count:64
64
5237 }
executed: }
Execution Count:64
64
5238 -
5239 // Set backingstore flags. -
5240 int flags = DrawPaintOnScreen | DrawInvisible;
executed (the execution status of this line is deduced): int flags = DrawPaintOnScreen | DrawInvisible;
-
5241 if (renderFlags & QWidget::DrawWindowBackground)
partially evaluated: renderFlags & QWidget::DrawWindowBackground
TRUEFALSE
yes
Evaluation Count:90
no
Evaluation Count:0
0-90
5242 flags |= DrawAsRoot;
executed: flags |= DrawAsRoot;
Execution Count:90
90
5243 -
5244 if (renderFlags & QWidget::DrawChildren)
partially evaluated: renderFlags & QWidget::DrawChildren
TRUEFALSE
yes
Evaluation Count:90
no
Evaluation Count:0
0-90
5245 flags |= DrawRecursive;
executed: flags |= DrawRecursive;
Execution Count:90
90
5246 else -
5247 flags |= DontSubtractOpaqueChildren;
never executed: flags |= DontSubtractOpaqueChildren;
0
5248 -
5249 flags |= DontSetCompositionMode;
executed (the execution status of this line is deduced): flags |= DontSetCompositionMode;
-
5250 -
5251 if (target->devType() == QInternal::Printer) {
partially evaluated: target->devType() == QInternal::Printer
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:90
0-90
5252 QPainter p(target);
never executed (the execution status of this line is deduced): QPainter p(target);
-
5253 render_helper(&p, targetOffset, paintRegion, renderFlags);
never executed (the execution status of this line is deduced): render_helper(&p, targetOffset, paintRegion, renderFlags);
-
5254 return;
never executed: return;
0
5255 } -
5256 -
5257#ifndef Q_WS_MAC -
5258 // Render via backingstore. -
5259 drawWidget(target, paintRegion, offset, flags, sharedPainter());
executed (the execution status of this line is deduced): drawWidget(target, paintRegion, offset, flags, sharedPainter());
-
5260 -
5261 // Restore shared painter. -
5262 if (oldSharedPainter)
evaluated: oldSharedPainter
TRUEFALSE
yes
Evaluation Count:24
yes
Evaluation Count:66
24-66
5263 setSharedPainter(oldSharedPainter);
executed: setSharedPainter(oldSharedPainter);
Execution Count:24
24
5264#else -
5265 // Render via backingstore (no shared painter). -
5266 drawWidget(target, paintRegion, offset, flags, 0); -
5267#endif -
5268}
executed: }
Execution Count:90
90
5269 -
5270void QWidgetPrivate::paintSiblingsRecursive(QPaintDevice *pdev, const QObjectList& siblings, int index, const QRegion &rgn, -
5271 const QPoint &offset, int flags -
5272 , QPainter *sharedPainter, QWidgetBackingStore *backingStore) -
5273{ -
5274 QWidget *w = 0;
executed (the execution status of this line is deduced): QWidget *w = 0;
-
5275 QRect boundingRect;
executed (the execution status of this line is deduced): QRect boundingRect;
-
5276 bool dirtyBoundingRect = true;
executed (the execution status of this line is deduced): bool dirtyBoundingRect = true;
-
5277 const bool exludeOpaqueChildren = (flags & DontDrawOpaqueChildren);
executed (the execution status of this line is deduced): const bool exludeOpaqueChildren = (flags & DontDrawOpaqueChildren);
-
5278 const bool excludeNativeChildren = (flags & DontDrawNativeChildren);
executed (the execution status of this line is deduced): const bool excludeNativeChildren = (flags & DontDrawNativeChildren);
-
5279 -
5280 do { -
5281 QWidget *x = qobject_cast<QWidget*>(siblings.at(index));
executed (the execution status of this line is deduced): QWidget *x = qobject_cast<QWidget*>(siblings.at(index));
-
5282 if (x && !(exludeOpaqueChildren && x->d_func()->isOpaque) && !x->isHidden() && !x->isWindow()
evaluated: x
TRUEFALSE
yes
Evaluation Count:20336
yes
Evaluation Count:9311
evaluated: exludeOpaqueChildren
TRUEFALSE
yes
Evaluation Count:2028
yes
Evaluation Count:18308
evaluated: x->d_func()->isOpaque
TRUEFALSE
yes
Evaluation Count:590
yes
Evaluation Count:1438
evaluated: !x->isHidden()
TRUEFALSE
yes
Evaluation Count:13964
yes
Evaluation Count:5782
evaluated: !x->isWindow()
TRUEFALSE
yes
Evaluation Count:13937
yes
Evaluation Count:27
27-20336
5283 && !(excludeNativeChildren && x->internalWinId())) {
partially evaluated: excludeNativeChildren
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13937
never evaluated: x->internalWinId()
0-13937
5284 if (dirtyBoundingRect) {
evaluated: dirtyBoundingRect
TRUEFALSE
yes
Evaluation Count:10569
yes
Evaluation Count:3368
3368-10569
5285 boundingRect = rgn.boundingRect();
executed (the execution status of this line is deduced): boundingRect = rgn.boundingRect();
-
5286 dirtyBoundingRect = false;
executed (the execution status of this line is deduced): dirtyBoundingRect = false;
-
5287 }
executed: }
Execution Count:10569
10569
5288 -
5289 if (qRectIntersects(boundingRect, x->d_func()->effectiveRectFor(x->data->crect))) {
evaluated: qRectIntersects(boundingRect, x->d_func()->effectiveRectFor(x->data->crect))
TRUEFALSE
yes
Evaluation Count:9860
yes
Evaluation Count:4077
4077-9860
5290 w = x;
executed (the execution status of this line is deduced): w = x;
-
5291 break;
executed: break;
Execution Count:9860
9860
5292 } -
5293 }
executed: }
Execution Count:4077
4077
5294 --index;
executed (the execution status of this line is deduced): --index;
-
5295 } while (index >= 0);
executed: }
Execution Count:19787
evaluated: index >= 0
TRUEFALSE
yes
Evaluation Count:15570
yes
Evaluation Count:4217
4217-19787
5296 -
5297 if (!w)
evaluated: !w
TRUEFALSE
yes
Evaluation Count:4217
yes
Evaluation Count:9860
4217-9860
5298 return;
executed: return;
Execution Count:4217
4217
5299 -
5300 QWidgetPrivate *wd = w->d_func();
executed (the execution status of this line is deduced): QWidgetPrivate *wd = w->d_func();
-
5301 const QPoint widgetPos(w->data->crect.topLeft());
executed (the execution status of this line is deduced): const QPoint widgetPos(w->data->crect.topLeft());
-
5302 const bool hasMask = wd->extra && wd->extra->hasMask && !wd->graphicsEffect;
evaluated: wd->extra
TRUEFALSE
yes
Evaluation Count:6108
yes
Evaluation Count:3752
evaluated: wd->extra->hasMask
TRUEFALSE
yes
Evaluation Count:17
yes
Evaluation Count:6091
partially evaluated: !wd->graphicsEffect
TRUEFALSE
yes
Evaluation Count:17
no
Evaluation Count:0
0-6108
5303 if (index > 0) {
evaluated: index > 0
TRUEFALSE
yes
Evaluation Count:6217
yes
Evaluation Count:3643
3643-6217
5304 QRegion wr(rgn);
executed (the execution status of this line is deduced): QRegion wr(rgn);
-
5305 if (wd->isOpaque)
evaluated: wd->isOpaque
TRUEFALSE
yes
Evaluation Count:942
yes
Evaluation Count:5275
942-5275
5306 wr -= hasMask ? wd->extra->mask.translated(widgetPos) : w->data->crect;
executed: wr -= hasMask ? wd->extra->mask.translated(widgetPos) : w->data->crect;
Execution Count:942
partially evaluated: hasMask
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:942
0-942
5307 paintSiblingsRecursive(pdev, siblings, --index, wr, offset, flags
executed (the execution status of this line is deduced): paintSiblingsRecursive(pdev, siblings, --index, wr, offset, flags
-
5308 , sharedPainter, backingStore);
executed (the execution status of this line is deduced): , sharedPainter, backingStore);
-
5309 }
executed: }
Execution Count:6217
6217
5310 -
5311 if (w->updatesEnabled()
partially evaluated: w->updatesEnabled()
TRUEFALSE
yes
Evaluation Count:9860
no
Evaluation Count:0
0-9860
5312#ifndef QT_NO_GRAPHICSVIEW
executed (the execution status of this line is deduced):
-
5313 && (!w->d_func()->extra || !w->d_func()->extra->proxyWidget)
evaluated: !w->d_func()->extra
TRUEFALSE
yes
Evaluation Count:3752
yes
Evaluation Count:6108
partially evaluated: !w->d_func()->extra->proxyWidget
TRUEFALSE
yes
Evaluation Count:6108
no
Evaluation Count:0
0-6108
5314#endif //QT_NO_GRAPHICSVIEW -
5315 ) { -
5316 QRegion wRegion(rgn);
executed (the execution status of this line is deduced): QRegion wRegion(rgn);
-
5317 wRegion &= wd->effectiveRectFor(w->data->crect);
executed (the execution status of this line is deduced): wRegion &= wd->effectiveRectFor(w->data->crect);
-
5318 wRegion.translate(-widgetPos);
executed (the execution status of this line is deduced): wRegion.translate(-widgetPos);
-
5319 if (hasMask)
evaluated: hasMask
TRUEFALSE
yes
Evaluation Count:17
yes
Evaluation Count:9843
17-9843
5320 wRegion &= wd->extra->mask;
executed: wRegion &= wd->extra->mask;
Execution Count:17
17
5321 wd->drawWidget(pdev, wRegion, offset + widgetPos, flags, sharedPainter, backingStore);
executed (the execution status of this line is deduced): wd->drawWidget(pdev, wRegion, offset + widgetPos, flags, sharedPainter, backingStore);
-
5322 }
executed: }
Execution Count:9860
9860
5323}
executed: }
Execution Count:9860
9860
5324 -
5325#ifndef QT_NO_GRAPHICSEFFECT -
5326QRectF QWidgetEffectSourcePrivate::boundingRect(Qt::CoordinateSystem system) const -
5327{ -
5328 if (system != Qt::DeviceCoordinates)
never evaluated: system != Qt::DeviceCoordinates
0
5329 return m_widget->rect();
never executed: return m_widget->rect();
0
5330 -
5331 if (!context) {
never evaluated: !context
0
5332 // Device coordinates without context not yet supported. -
5333 qWarning("QGraphicsEffectSource::boundingRect: Not yet implemented, lacking device context");
never executed (the execution status of this line is deduced): QMessageLogger("kernel/qwidget.cpp", 5333, __PRETTY_FUNCTION__).warning("QGraphicsEffectSource::boundingRect: Not yet implemented, lacking device context");
-
5334 return QRectF();
never executed: return QRectF();
0
5335 } -
5336 -
5337 return context->painter->worldTransform().mapRect(m_widget->rect());
never executed: return context->painter->worldTransform().mapRect(m_widget->rect());
0
5338} -
5339 -
5340void QWidgetEffectSourcePrivate::draw(QPainter *painter) -
5341{ -
5342 if (!context || context->painter != painter) {
never evaluated: !context
never evaluated: context->painter != painter
0
5343 m_widget->render(painter);
never executed (the execution status of this line is deduced): m_widget->render(painter);
-
5344 return;
never executed: return;
0
5345 } -
5346 -
5347 // The region saved in the context is neither clipped to the rect -
5348 // nor the mask, so we have to clip it here before calling drawWidget. -
5349 QRegion toBePainted = context->rgn;
never executed (the execution status of this line is deduced): QRegion toBePainted = context->rgn;
-
5350 toBePainted &= m_widget->rect();
never executed (the execution status of this line is deduced): toBePainted &= m_widget->rect();
-
5351 QWidgetPrivate *wd = qt_widget_private(m_widget);
never executed (the execution status of this line is deduced): QWidgetPrivate *wd = qt_widget_private(m_widget);
-
5352 if (wd->extra && wd->extra->hasMask)
never evaluated: wd->extra
never evaluated: wd->extra->hasMask
0
5353 toBePainted &= wd->extra->mask;
never executed: toBePainted &= wd->extra->mask;
0
5354 -
5355 wd->drawWidget(context->pdev, toBePainted, context->offset, context->flags,
never executed (the execution status of this line is deduced): wd->drawWidget(context->pdev, toBePainted, context->offset, context->flags,
-
5356 context->sharedPainter, context->backingStore);
never executed (the execution status of this line is deduced): context->sharedPainter, context->backingStore);
-
5357}
never executed: }
0
5358 -
5359QPixmap QWidgetEffectSourcePrivate::pixmap(Qt::CoordinateSystem system, QPoint *offset, -
5360 QGraphicsEffect::PixmapPadMode mode) const -
5361{ -
5362 const bool deviceCoordinates = (system == Qt::DeviceCoordinates);
never executed (the execution status of this line is deduced): const bool deviceCoordinates = (system == Qt::DeviceCoordinates);
-
5363 if (!context && deviceCoordinates) {
never evaluated: !context
never evaluated: deviceCoordinates
0
5364 // Device coordinates without context not yet supported. -
5365 qWarning("QGraphicsEffectSource::pixmap: Not yet implemented, lacking device context");
never executed (the execution status of this line is deduced): QMessageLogger("kernel/qwidget.cpp", 5365, __PRETTY_FUNCTION__).warning("QGraphicsEffectSource::pixmap: Not yet implemented, lacking device context");
-
5366 return QPixmap();
never executed: return QPixmap();
0
5367 } -
5368 -
5369 QPoint pixmapOffset;
never executed (the execution status of this line is deduced): QPoint pixmapOffset;
-
5370 QRectF sourceRect = m_widget->rect();
never executed (the execution status of this line is deduced): QRectF sourceRect = m_widget->rect();
-
5371 -
5372 if (deviceCoordinates) {
never evaluated: deviceCoordinates
0
5373 const QTransform &painterTransform = context->painter->worldTransform();
never executed (the execution status of this line is deduced): const QTransform &painterTransform = context->painter->worldTransform();
-
5374 sourceRect = painterTransform.mapRect(sourceRect);
never executed (the execution status of this line is deduced): sourceRect = painterTransform.mapRect(sourceRect);
-
5375 pixmapOffset = painterTransform.map(pixmapOffset);
never executed (the execution status of this line is deduced): pixmapOffset = painterTransform.map(pixmapOffset);
-
5376 }
never executed: }
0
5377 -
5378 QRect effectRect;
never executed (the execution status of this line is deduced): QRect effectRect;
-
5379 -
5380 if (mode == QGraphicsEffect::PadToEffectiveBoundingRect)
never evaluated: mode == QGraphicsEffect::PadToEffectiveBoundingRect
0
5381 effectRect = m_widget->graphicsEffect()->boundingRectFor(sourceRect).toAlignedRect();
never executed: effectRect = m_widget->graphicsEffect()->boundingRectFor(sourceRect).toAlignedRect();
0
5382 else if (mode == QGraphicsEffect::PadToTransparentBorder)
never evaluated: mode == QGraphicsEffect::PadToTransparentBorder
0
5383 effectRect = sourceRect.adjusted(-1, -1, 1, 1).toAlignedRect();
never executed: effectRect = sourceRect.adjusted(-1, -1, 1, 1).toAlignedRect();
0
5384 else -
5385 effectRect = sourceRect.toAlignedRect();
never executed: effectRect = sourceRect.toAlignedRect();
0
5386 -
5387 if (offset)
never evaluated: offset
0
5388 *offset = effectRect.topLeft();
never executed: *offset = effectRect.topLeft();
0
5389 -
5390 pixmapOffset -= effectRect.topLeft();
never executed (the execution status of this line is deduced): pixmapOffset -= effectRect.topLeft();
-
5391 -
5392 QPixmap pixmap(effectRect.size());
never executed (the execution status of this line is deduced): QPixmap pixmap(effectRect.size());
-
5393 pixmap.fill(Qt::transparent);
never executed (the execution status of this line is deduced): pixmap.fill(Qt::transparent);
-
5394 m_widget->render(&pixmap, pixmapOffset, QRegion(), QWidget::DrawChildren);
never executed (the execution status of this line is deduced): m_widget->render(&pixmap, pixmapOffset, QRegion(), QWidget::DrawChildren);
-
5395 return pixmap;
never executed: return pixmap;
0
5396} -
5397#endif //QT_NO_GRAPHICSEFFECT -
5398 -
5399#ifndef QT_NO_GRAPHICSVIEW -
5400/*! -
5401 \internal -
5402 -
5403 Finds the nearest widget embedded in a graphics proxy widget along the chain formed by this -
5404 widget and its ancestors. The search starts at \a origin (inclusive). -
5405 If successful, the function returns the proxy that embeds the widget, or 0 if no embedded -
5406 widget was found. -
5407*/ -
5408QGraphicsProxyWidget * QWidgetPrivate::nearestGraphicsProxyWidget(const QWidget *origin) -
5409{ -
5410 if (origin) {
evaluated: origin
TRUEFALSE
yes
Evaluation Count:40309
yes
Evaluation Count:21246
21246-40309
5411 QWExtra *extra = origin->d_func()->extra;
executed (the execution status of this line is deduced): QWExtra *extra = origin->d_func()->extra;
-
5412 if (extra && extra->proxyWidget)
evaluated: extra
TRUEFALSE
yes
Evaluation Count:33010
yes
Evaluation Count:7299
partially evaluated: extra->proxyWidget
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:33010
0-33010
5413 return extra->proxyWidget;
never executed: return extra->proxyWidget;
0
5414 return nearestGraphicsProxyWidget(origin->parentWidget());
executed: return nearestGraphicsProxyWidget(origin->parentWidget());
Execution Count:40309
40309
5415 } -
5416 return 0;
executed: return 0;
Execution Count:21246
21246
5417} -
5418#endif -
5419 -
5420/*! -
5421 \property QWidget::locale -
5422 \brief the widget's locale -
5423 \since 4.3 -
5424 -
5425 As long as no special locale has been set, this is either -
5426 the parent's locale or (if this widget is a top level widget), -
5427 the default locale. -
5428 -
5429 If the widget displays dates or numbers, these should be formatted -
5430 using the widget's locale. -
5431 -
5432 \sa QLocale, QLocale::setDefault() -
5433*/ -
5434 -
5435void QWidgetPrivate::setLocale_helper(const QLocale &loc, bool forceUpdate) -
5436{ -
5437 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
5438 if (locale == loc && !forceUpdate)
evaluated: locale == loc
TRUEFALSE
yes
Evaluation Count:41900
yes
Evaluation Count:76
partially evaluated: !forceUpdate
TRUEFALSE
yes
Evaluation Count:41900
no
Evaluation Count:0
0-41900
5439 return;
executed: return;
Execution Count:41900
41900
5440 -
5441 locale = loc;
executed (the execution status of this line is deduced): locale = loc;
-
5442 -
5443 if (!children.isEmpty()) {
evaluated: !children.isEmpty()
TRUEFALSE
yes
Evaluation Count:39
yes
Evaluation Count:37
37-39
5444 for (int i = 0; i < children.size(); ++i) {
evaluated: i < children.size()
TRUEFALSE
yes
Evaluation Count:103
yes
Evaluation Count:39
39-103
5445 QWidget *w = qobject_cast<QWidget*>(children.at(i));
executed (the execution status of this line is deduced): QWidget *w = qobject_cast<QWidget*>(children.at(i));
-
5446 if (!w)
evaluated: !w
TRUEFALSE
yes
Evaluation Count:42
yes
Evaluation Count:61
42-61
5447 continue;
executed: continue;
Execution Count:42
42
5448 if (w->testAttribute(Qt::WA_SetLocale))
evaluated: w->testAttribute(Qt::WA_SetLocale)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:60
1-60
5449 continue;
executed: continue;
Execution Count:1
1
5450 if (w->isWindow() && !w->testAttribute(Qt::WA_WindowPropagation))
evaluated: w->isWindow()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:58
partially evaluated: !w->testAttribute(Qt::WA_WindowPropagation)
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-58
5451 continue;
executed: continue;
Execution Count:2
2
5452 w->d_func()->setLocale_helper(loc, forceUpdate);
executed (the execution status of this line is deduced): w->d_func()->setLocale_helper(loc, forceUpdate);
-
5453 }
executed: }
Execution Count:58
58
5454 }
executed: }
Execution Count:39
39
5455 QEvent e(QEvent::LocaleChange);
executed (the execution status of this line is deduced): QEvent e(QEvent::LocaleChange);
-
5456 QApplication::sendEvent(q, &e);
executed (the execution status of this line is deduced): QApplication::sendEvent(q, &e);
-
5457}
executed: }
Execution Count:76
76
5458 -
5459void QWidget::setLocale(const QLocale &locale) -
5460{ -
5461 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
5462 -
5463 setAttribute(Qt::WA_SetLocale);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_SetLocale);
-
5464 d->setLocale_helper(locale);
executed (the execution status of this line is deduced): d->setLocale_helper(locale);
-
5465}
executed: }
Execution Count:11
11
5466 -
5467QLocale QWidget::locale() const -
5468{ -
5469 Q_D(const QWidget);
executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
5470 -
5471 return d->locale;
executed: return d->locale;
Execution Count:92980
92980
5472} -
5473 -
5474void QWidgetPrivate::resolveLocale() -
5475{ -
5476 Q_Q(const QWidget);
executed (the execution status of this line is deduced): const QWidget * const q = q_func();
-
5477 -
5478 if (!q->testAttribute(Qt::WA_SetLocale)) {
evaluated: !q->testAttribute(Qt::WA_SetLocale)
TRUEFALSE
yes
Evaluation Count:41907
yes
Evaluation Count:1
1-41907
5479 setLocale_helper(q->isWindow()
executed (the execution status of this line is deduced): setLocale_helper(q->isWindow()
-
5480 ? QLocale()
executed (the execution status of this line is deduced): ? QLocale()
-
5481 : q->parentWidget()->locale());
executed (the execution status of this line is deduced): : q->parentWidget()->locale());
-
5482 }
executed: }
Execution Count:41907
41907
5483}
executed: }
Execution Count:41908
41908
5484 -
5485void QWidget::unsetLocale() -
5486{ -
5487 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
5488 setAttribute(Qt::WA_SetLocale, false);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_SetLocale, false);
-
5489 d->resolveLocale();
executed (the execution status of this line is deduced): d->resolveLocale();
-
5490}
executed: }
Execution Count:2
2
5491 -
5492/*! -
5493 \property QWidget::windowTitle -
5494 \brief the window title (caption) -
5495 -
5496 This property only makes sense for top-level widgets, such as -
5497 windows and dialogs. If no caption has been set, the title is based of the -
5498 \l windowFilePath. If neither of these is set, then the title is -
5499 an empty string. -
5500 -
5501 If you use the \l windowModified mechanism, the window title must -
5502 contain a "[*]" placeholder, which indicates where the '*' should -
5503 appear. Normally, it should appear right after the file name -
5504 (e.g., "document1.txt[*] - Text Editor"). If the \l -
5505 windowModified property is false (the default), the placeholder -
5506 is simply removed. -
5507 -
5508 On some desktop platforms (including Windows and Unix), the application name -
5509 (from QGuiApplication::applicationDisplayName) is added at the end of the -
5510 window title, if set. This is done by the QPA plugin, so it is shown to the -
5511 user, but isn't part of the \l windowTitle string. -
5512 -
5513 \sa windowIcon, windowIconText, windowModified, windowFilePath -
5514*/ -
5515QString QWidget::windowTitle() const -
5516{ -
5517 Q_D(const QWidget);
executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
5518 if (d->extra && d->extra->topextra) {
evaluated: d->extra
TRUEFALSE
yes
Evaluation Count:7317
yes
Evaluation Count:796
evaluated: d->extra->topextra
TRUEFALSE
yes
Evaluation Count:7055
yes
Evaluation Count:262
262-7317
5519 if (!d->extra->topextra->caption.isEmpty())
evaluated: !d->extra->topextra->caption.isEmpty()
TRUEFALSE
yes
Evaluation Count:1577
yes
Evaluation Count:5478
1577-5478
5520 return d->extra->topextra->caption;
executed: return d->extra->topextra->caption;
Execution Count:1577
1577
5521 if (!d->extra->topextra->filePath.isEmpty())
evaluated: !d->extra->topextra->filePath.isEmpty()
TRUEFALSE
yes
Evaluation Count:20
yes
Evaluation Count:5458
20-5458
5522 return QFileInfo(d->extra->topextra->filePath).fileName() + QLatin1String("[*]");
executed: return QFileInfo(d->extra->topextra->filePath).fileName() + QLatin1String("[*]");
Execution Count:20
20
5523 }
executed: }
Execution Count:5458
5458
5524 return QString();
executed: return QString();
Execution Count:6516
6516
5525} -
5526 -
5527/*! -
5528 Returns a modified window title with the [*] place holder -
5529 replaced according to the rules described in QWidget::setWindowTitle -
5530 -
5531 This function assumes that "[*]" can be quoted by another -
5532 "[*]", so it will replace two place holders by one and -
5533 a single last one by either "*" or nothing depending on -
5534 the modified flag. -
5535 -
5536 \internal -
5537*/ -
5538QString qt_setWindowTitle_helperHelper(const QString &title, const QWidget *widget) -
5539{ -
5540 Q_ASSERT(widget);
executed (the execution status of this line is deduced): qt_noop();
-
5541 -
5542#ifdef QT_EVAL -
5543 extern QString qt_eval_adapt_window_title(const QString &title); -
5544 QString cap = qt_eval_adapt_window_title(title); -
5545#else -
5546 QString cap = title;
executed (the execution status of this line is deduced): QString cap = title;
-
5547#endif -
5548 -
5549 if (cap.isEmpty())
evaluated: cap.isEmpty()
TRUEFALSE
yes
Evaluation Count:5533
yes
Evaluation Count:379
379-5533
5550 return cap;
executed: return cap;
Execution Count:5533
5533
5551 -
5552 QLatin1String placeHolder("[*]");
executed (the execution status of this line is deduced): QLatin1String placeHolder("[*]");
-
5553 int index = cap.indexOf(placeHolder);
executed (the execution status of this line is deduced): int index = cap.indexOf(placeHolder);
-
5554 -
5555 // here the magic begins -
5556 while (index != -1) {
evaluated: index != -1
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:379
3-379
5557 index += placeHolder.size();
executed (the execution status of this line is deduced): index += placeHolder.size();
-
5558 int count = 1;
executed (the execution status of this line is deduced): int count = 1;
-
5559 while (cap.indexOf(placeHolder, index) == index) {
partially evaluated: cap.indexOf(placeHolder, index) == index
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
5560 ++count;
never executed (the execution status of this line is deduced): ++count;
-
5561 index += placeHolder.size();
never executed (the execution status of this line is deduced): index += placeHolder.size();
-
5562 }
never executed: }
0
5563 -
5564 if (count%2) { // odd number of [*] -> replace last one
partially evaluated: count%2
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
5565 int lastIndex = cap.lastIndexOf(placeHolder, index - 1);
executed (the execution status of this line is deduced): int lastIndex = cap.lastIndexOf(placeHolder, index - 1);
-
5566 if (widget->isWindowModified()
partially evaluated: widget->isWindowModified()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
5567 && widget->style()->styleHint(QStyle::SH_TitleBar_ModifyNotification, 0, widget))
never evaluated: widget->style()->styleHint(QStyle::SH_TitleBar_ModifyNotification, 0, widget)
0
5568 cap.replace(lastIndex, 3, QWidget::tr("*"));
never executed: cap.replace(lastIndex, 3, QWidget::tr("*"));
0
5569 else -
5570 cap.remove(lastIndex, 3);
executed: cap.remove(lastIndex, 3);
Execution Count:3
3
5571 } -
5572 -
5573 index = cap.indexOf(placeHolder, index);
executed (the execution status of this line is deduced): index = cap.indexOf(placeHolder, index);
-
5574 }
executed: }
Execution Count:3
3
5575 -
5576 cap.replace(QLatin1String("[*][*]"), placeHolder);
executed (the execution status of this line is deduced): cap.replace(QLatin1String("[*][*]"), placeHolder);
-
5577 -
5578 return cap;
executed: return cap;
Execution Count:379
379
5579} -
5580 -
5581void QWidgetPrivate::setWindowTitle_helper(const QString &title) -
5582{ -
5583 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
5584 if (q->testAttribute(Qt::WA_WState_Created))
evaluated: q->testAttribute(Qt::WA_WState_Created)
TRUEFALSE
yes
Evaluation Count:3047
yes
Evaluation Count:468
468-3047
5585 setWindowTitle_sys(qt_setWindowTitle_helperHelper(title, q));
executed: setWindowTitle_sys(qt_setWindowTitle_helperHelper(title, q));
Execution Count:3047
3047
5586}
executed: }
Execution Count:3515
3515
5587 -
5588void QWidgetPrivate::setWindowIconText_helper(const QString &title) -
5589{ -
5590 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
5591 if (q->testAttribute(Qt::WA_WState_Created))
partially evaluated: q->testAttribute(Qt::WA_WState_Created)
TRUEFALSE
yes
Evaluation Count:2810
no
Evaluation Count:0
0-2810
5592 setWindowIconText_sys(qt_setWindowTitle_helperHelper(title, q));
executed: setWindowIconText_sys(qt_setWindowTitle_helperHelper(title, q));
Execution Count:2810
2810
5593}
executed: }
Execution Count:2810
2810
5594 -
5595void QWidget::setWindowIconText(const QString &iconText) -
5596{ -
5597 if (QWidget::windowIconText() == iconText)
never evaluated: QWidget::windowIconText() == iconText
0
5598 return;
never executed: return;
0
5599 -
5600 Q_D(QWidget);
never executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
5601 d->topData()->iconText = iconText;
never executed (the execution status of this line is deduced): d->topData()->iconText = iconText;
-
5602 d->setWindowIconText_helper(iconText);
never executed (the execution status of this line is deduced): d->setWindowIconText_helper(iconText);
-
5603 -
5604 QEvent e(QEvent::IconTextChange);
never executed (the execution status of this line is deduced): QEvent e(QEvent::IconTextChange);
-
5605 QApplication::sendEvent(this, &e);
never executed (the execution status of this line is deduced): QApplication::sendEvent(this, &e);
-
5606}
never executed: }
0
5607 -
5608void QWidget::setWindowTitle(const QString &title) -
5609{ -
5610 if (QWidget::windowTitle() == title && !title.isEmpty() && !title.isNull())
evaluated: QWidget::windowTitle() == title
TRUEFALSE
yes
Evaluation Count:365
yes
Evaluation Count:459
evaluated: !title.isEmpty()
TRUEFALSE
yes
Evaluation Count:261
yes
Evaluation Count:104
partially evaluated: !title.isNull()
TRUEFALSE
yes
Evaluation Count:261
no
Evaluation Count:0
0-459
5611 return;
executed: return;
Execution Count:261
261
5612 -
5613 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
5614 d->topData()->caption = title;
executed (the execution status of this line is deduced): d->topData()->caption = title;
-
5615 d->setWindowTitle_helper(title);
executed (the execution status of this line is deduced): d->setWindowTitle_helper(title);
-
5616 -
5617 QEvent e(QEvent::WindowTitleChange);
executed (the execution status of this line is deduced): QEvent e(QEvent::WindowTitleChange);
-
5618 QApplication::sendEvent(this, &e);
executed (the execution status of this line is deduced): QApplication::sendEvent(this, &e);
-
5619}
executed: }
Execution Count:563
563
5620 -
5621 -
5622/*! -
5623 \property QWidget::windowIcon -
5624 \brief the widget's icon -
5625 -
5626 This property only makes sense for windows. If no icon -
5627 has been set, windowIcon() returns the application icon -
5628 (QApplication::windowIcon()). -
5629 -
5630 \sa windowIconText, windowTitle -
5631*/ -
5632QIcon QWidget::windowIcon() const -
5633{ -
5634 const QWidget *w = this;
executed (the execution status of this line is deduced): const QWidget *w = this;
-
5635 while (w) {
evaluated: w
TRUEFALSE
yes
Evaluation Count:4238
yes
Evaluation Count:3019
3019-4238
5636 const QWidgetPrivate *d = w->d_func();
executed (the execution status of this line is deduced): const QWidgetPrivate *d = w->d_func();
-
5637 if (d->extra && d->extra->topextra && d->extra->topextra->icon)
evaluated: d->extra
TRUEFALSE
yes
Evaluation Count:3668
yes
Evaluation Count:570
evaluated: d->extra->topextra
TRUEFALSE
yes
Evaluation Count:2965
yes
Evaluation Count:703
evaluated: d->extra->topextra->icon
TRUEFALSE
yes
Evaluation Count:212
yes
Evaluation Count:2753
212-3668
5638 return *d->extra->topextra->icon;
executed: return *d->extra->topextra->icon;
Execution Count:212
212
5639 w = w->parentWidget();
executed (the execution status of this line is deduced): w = w->parentWidget();
-
5640 }
executed: }
Execution Count:4026
4026
5641 return QApplication::windowIcon();
executed: return QApplication::windowIcon();
Execution Count:3019
3019
5642} -
5643 -
5644void QWidgetPrivate::setWindowIcon_helper() -
5645{ -
5646 QEvent e(QEvent::WindowIconChange);
executed (the execution status of this line is deduced): QEvent e(QEvent::WindowIconChange);
-
5647 QApplication::sendEvent(q_func(), &e);
executed (the execution status of this line is deduced): QApplication::sendEvent(q_func(), &e);
-
5648 for (int i = 0; i < children.size(); ++i) {
evaluated: i < children.size()
TRUEFALSE
yes
Evaluation Count:18
yes
Evaluation Count:112
18-112
5649 QWidget *w = qobject_cast<QWidget *>(children.at(i));
executed (the execution status of this line is deduced): QWidget *w = qobject_cast<QWidget *>(children.at(i));
-
5650 if (w && !w->isWindow())
partially evaluated: w
TRUEFALSE
yes
Evaluation Count:18
no
Evaluation Count:0
evaluated: !w->isWindow()
TRUEFALSE
yes
Evaluation Count:15
yes
Evaluation Count:3
0-18
5651 QApplication::sendEvent(w, &e);
executed: QApplication::sendEvent(w, &e);
Execution Count:15
15
5652 }
executed: }
Execution Count:18
18
5653}
executed: }
Execution Count:112
112
5654 -
5655void QWidget::setWindowIcon(const QIcon &icon) -
5656{ -
5657 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
5658 -
5659 setAttribute(Qt::WA_SetWindowIcon, !icon.isNull());
executed (the execution status of this line is deduced): setAttribute(Qt::WA_SetWindowIcon, !icon.isNull());
-
5660 d->createTLExtra();
executed (the execution status of this line is deduced): d->createTLExtra();
-
5661 -
5662 if (!d->extra->topextra->icon)
partially evaluated: !d->extra->topextra->icon
TRUEFALSE
yes
Evaluation Count:104
no
Evaluation Count:0
0-104
5663 d->extra->topextra->icon = new QIcon();
executed: d->extra->topextra->icon = new QIcon();
Execution Count:104
104
5664 *d->extra->topextra->icon = icon;
executed (the execution status of this line is deduced): *d->extra->topextra->icon = icon;
-
5665 -
5666 d->setWindowIcon_sys();
executed (the execution status of this line is deduced): d->setWindowIcon_sys();
-
5667 d->setWindowIcon_helper();
executed (the execution status of this line is deduced): d->setWindowIcon_helper();
-
5668}
executed: }
Execution Count:104
104
5669 -
5670 -
5671/*! -
5672 \property QWidget::windowIconText -
5673 \brief the widget's icon text -
5674 -
5675 This property only makes sense for windows. If no icon -
5676 text has been set, this functions returns an empty string. -
5677 -
5678 \sa windowIcon, windowTitle -
5679*/ -
5680 -
5681QString QWidget::windowIconText() const -
5682{ -
5683 Q_D(const QWidget);
executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
5684 return (d->extra && d->extra->topextra) ? d->extra->topextra->iconText : QString();
executed: return (d->extra && d->extra->topextra) ? d->extra->topextra->iconText : QString();
Execution Count:2810
2810
5685} -
5686 -
5687/*! -
5688 \property QWidget::windowFilePath -
5689 \since 4.4 -
5690 \brief the file path associated with a widget -
5691 -
5692 This property only makes sense for windows. It associates a file path with -
5693 a window. If you set the file path, but have not set the window title, Qt -
5694 sets the window title to the file name of the specified path, obtained using -
5695 QFileInfo::fileName(). -
5696 -
5697 If the window title is set at any point, then the window title takes precedence and -
5698 will be shown instead of the file path string. -
5699 -
5700 Additionally, on Mac OS X, this has an added benefit that it sets the -
5701 \l{http://developer.apple.com/documentation/UserExperience/Conceptual/OSXHIGuidelines/XHIGWindows/chapter_17_section_3.html}{proxy icon} -
5702 for the window, assuming that the file path exists. -
5703 -
5704 If no file path is set, this property contains an empty string. -
5705 -
5706 By default, this property contains an empty string. -
5707 -
5708 \sa windowTitle, windowIcon -
5709*/ -
5710 -
5711QString QWidget::windowFilePath() const -
5712{ -
5713 Q_D(const QWidget);
executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
5714 return (d->extra && d->extra->topextra) ? d->extra->topextra->filePath : QString();
executed: return (d->extra && d->extra->topextra) ? d->extra->topextra->filePath : QString();
Execution Count:66
66
5715} -
5716 -
5717void QWidget::setWindowFilePath(const QString &filePath) -
5718{ -
5719 if (filePath == windowFilePath())
evaluated: filePath == windowFilePath()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:18
3-18
5720 return;
executed: return;
Execution Count:3
3
5721 -
5722 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
5723 -
5724 d->createTLExtra();
executed (the execution status of this line is deduced): d->createTLExtra();
-
5725 d->extra->topextra->filePath = filePath;
executed (the execution status of this line is deduced): d->extra->topextra->filePath = filePath;
-
5726 d->setWindowFilePath_helper(filePath);
executed (the execution status of this line is deduced): d->setWindowFilePath_helper(filePath);
-
5727}
executed: }
Execution Count:18
18
5728 -
5729void QWidgetPrivate::setWindowFilePath_helper(const QString &filePath) -
5730{ -
5731 if (extra->topextra && extra->topextra->caption.isEmpty()) {
partially evaluated: extra->topextra
TRUEFALSE
yes
Evaluation Count:18
no
Evaluation Count:0
evaluated: extra->topextra->caption.isEmpty()
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:4
0-18
5732#ifdef Q_OS_MAC -
5733 setWindowTitle_helper(QFileInfo(filePath).fileName()); -
5734#else -
5735 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
5736 Q_UNUSED(filePath);
executed (the execution status of this line is deduced): (void)filePath;;
-
5737 setWindowTitle_helper(q->windowTitle());
executed (the execution status of this line is deduced): setWindowTitle_helper(q->windowTitle());
-
5738#endif -
5739 }
executed: }
Execution Count:14
14
5740#ifdef Q_OS_MAC -
5741 setWindowFilePath_sys(filePath); -
5742#endif -
5743}
executed: }
Execution Count:18
18
5744 -
5745/*! -
5746 Returns the window's role, or an empty string. -
5747 -
5748 \sa windowIcon, windowTitle -
5749*/ -
5750 -
5751QString QWidget::windowRole() const -
5752{ -
5753 Q_D(const QWidget);
never executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
5754 return (d->extra && d->extra->topextra) ? d->extra->topextra->role : QString();
never executed: return (d->extra && d->extra->topextra) ? d->extra->topextra->role : QString();
0
5755} -
5756 -
5757/*! -
5758 Sets the window's role to \a role. This only makes sense for -
5759 windows on X11. -
5760*/ -
5761void QWidget::setWindowRole(const QString &role) -
5762{ -
5763#if defined(Q_WS_X11) -
5764 Q_D(QWidget); -
5765 d->topData()->role = role; -
5766 d->setWindowRole(); -
5767#else -
5768 Q_UNUSED(role)
never executed (the execution status of this line is deduced): (void)role;
-
5769#endif -
5770}
never executed: }
0
5771 -
5772/*! -
5773 \property QWidget::mouseTracking -
5774 \brief whether mouse tracking is enabled for the widget -
5775 -
5776 If mouse tracking is disabled (the default), the widget only -
5777 receives mouse move events when at least one mouse button is -
5778 pressed while the mouse is being moved. -
5779 -
5780 If mouse tracking is enabled, the widget receives mouse move -
5781 events even if no buttons are pressed. -
5782 -
5783 \sa mouseMoveEvent() -
5784*/ -
5785 -
5786 -
5787/*! -
5788 Sets the widget's focus proxy to widget \a w. If \a w is 0, the -
5789 function resets this widget to have no focus proxy. -
5790 -
5791 Some widgets can "have focus", but create a child widget, such as -
5792 QLineEdit, to actually handle the focus. In this case, the widget -
5793 can set the line edit to be its focus proxy. -
5794 -
5795 setFocusProxy() sets the widget which will actually get focus when -
5796 "this widget" gets it. If there is a focus proxy, setFocus() and -
5797 hasFocus() operate on the focus proxy. -
5798 -
5799 \sa focusProxy() -
5800*/ -
5801 -
5802void QWidget::setFocusProxy(QWidget * w) -
5803{ -
5804 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
5805 if (!w && !d->extra)
evaluated: !w
TRUEFALSE
yes
Evaluation Count:946
yes
Evaluation Count:7393
evaluated: !d->extra
TRUEFALSE
yes
Evaluation Count:565
yes
Evaluation Count:381
381-7393
5806 return;
executed: return;
Execution Count:565
565
5807 -
5808 for (QWidget* fp = w; fp; fp = fp->focusProxy()) {
evaluated: fp
TRUEFALSE
yes
Evaluation Count:7395
yes
Evaluation Count:7774
7395-7774
5809 if (fp == this) {
partially evaluated: fp == this
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7395
0-7395
5810 qWarning("QWidget: %s (%s) already in focus proxy chain", metaObject()->className(), objectName().toLocal8Bit().constData());
never executed (the execution status of this line is deduced): QMessageLogger("kernel/qwidget.cpp", 5810, __PRETTY_FUNCTION__).warning("QWidget: %s (%s) already in focus proxy chain", metaObject()->className(), objectName().toLocal8Bit().constData());
-
5811 return;
never executed: return;
0
5812 } -
5813 }
executed: }
Execution Count:7395
7395
5814 -
5815 d->createExtra();
executed (the execution status of this line is deduced): d->createExtra();
-
5816 d->extra->focus_proxy = w;
executed (the execution status of this line is deduced): d->extra->focus_proxy = w;
-
5817}
executed: }
Execution Count:7774
7774
5818 -
5819 -
5820/*! -
5821 Returns the focus proxy, or 0 if there is no focus proxy. -
5822 -
5823 \sa setFocusProxy() -
5824*/ -
5825 -
5826QWidget * QWidget::focusProxy() const -
5827{ -
5828 Q_D(const QWidget);
executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
5829 return d->extra ? (QWidget *)d->extra->focus_proxy : 0;
executed: return d->extra ? (QWidget *)d->extra->focus_proxy : 0;
Execution Count:15060
15060
5830} -
5831 -
5832 -
5833/*! -
5834 \property QWidget::focus -
5835 \brief whether this widget (or its focus proxy) has the keyboard -
5836 input focus -
5837 -
5838 By default, this property is false. -
5839 -
5840 \note Obtaining the value of this property for a widget is effectively equivalent -
5841 to checking whether QApplication::focusWidget() refers to the widget. -
5842 -
5843 \sa setFocus(), clearFocus(), setFocusPolicy(), QApplication::focusWidget() -
5844*/ -
5845bool QWidget::hasFocus() const -
5846{ -
5847 const QWidget* w = this;
executed (the execution status of this line is deduced): const QWidget* w = this;
-
5848 while (w->d_func()->extra && w->d_func()->extra->focus_proxy)
evaluated: w->d_func()->extra
TRUEFALSE
yes
Evaluation Count:194735
yes
Evaluation Count:303563
evaluated: w->d_func()->extra->focus_proxy
TRUEFALSE
yes
Evaluation Count:33445
yes
Evaluation Count:161290
33445-303563
5849 w = w->d_func()->extra->focus_proxy;
executed: w = w->d_func()->extra->focus_proxy;
Execution Count:33445
33445
5850 if (QWidget *window = w->window()) {
partially evaluated: QWidget *window = w->window()
TRUEFALSE
yes
Evaluation Count:464853
no
Evaluation Count:0
0-464853
5851#ifndef QT_NO_GRAPHICSVIEW -
5852 QWExtra *e = window->d_func()->extra;
executed (the execution status of this line is deduced): QWExtra *e = window->d_func()->extra;
-
5853 if (e && e->proxyWidget && e->proxyWidget->hasFocus() && window->focusWidget() == w)
evaluated: e
TRUEFALSE
yes
Evaluation Count:319494
yes
Evaluation Count:145359
evaluated: e->proxyWidget
TRUEFALSE
yes
Evaluation Count:57
yes
Evaluation Count:319437
partially evaluated: e->proxyWidget->hasFocus()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:57
never evaluated: window->focusWidget() == w
0-319494
5854 return true;
never executed: return true;
0
5855#endif -
5856 }
executed: }
Execution Count:464853
464853
5857 return (QApplication::focusWidget() == w);
executed: return (QApplication::focusWidget() == w);
Execution Count:464853
464853
5858} -
5859 -
5860/*! -
5861 Gives the keyboard input focus to this widget (or its focus -
5862 proxy) if this widget or one of its parents is the \l{isActiveWindow()}{active window}. The \a reason argument will -
5863 be passed into any focus event sent from this function, it is used -
5864 to give an explanation of what caused the widget to get focus. -
5865 If the window is not active, the widget will be given the focus when -
5866 the window becomes active. -
5867 -
5868 First, a focus about to change event is sent to the focus widget (if any) to -
5869 tell it that it is about to lose the focus. Then focus is changed, a -
5870 focus out event is sent to the previous focus item and a focus in event is sent -
5871 to the new item to tell it that it just received the focus. -
5872 (Nothing happens if the focus in and focus out widgets are the -
5873 same.) -
5874 -
5875 \note On embedded platforms, setFocus() will not cause an input panel -
5876 to be opened by the input method. If you want this to happen, you -
5877 have to send a QEvent::RequestSoftwareInputPanel event to the -
5878 widget yourself. -
5879 -
5880 setFocus() gives focus to a widget regardless of its focus policy, -
5881 but does not clear any keyboard grab (see grabKeyboard()). -
5882 -
5883 Be aware that if the widget is hidden, it will not accept focus -
5884 until it is shown. -
5885 -
5886 \warning If you call setFocus() in a function which may itself be -
5887 called from focusOutEvent() or focusInEvent(), you may get an -
5888 infinite recursion. -
5889 -
5890 \sa hasFocus(), clearFocus(), focusInEvent(), focusOutEvent(), -
5891 setFocusPolicy(), focusWidget(), QApplication::focusWidget(), grabKeyboard(), -
5892 grabMouse(), {Keyboard Focus in Widgets}, QEvent::RequestSoftwareInputPanel -
5893*/ -
5894 -
5895void QWidget::setFocus(Qt::FocusReason reason) -
5896{ -
5897 if (!isEnabled())
evaluated: !isEnabled()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:6935
2-6935
5898 return;
executed: return;
Execution Count:2
2
5899 -
5900 QWidget *f = this;
executed (the execution status of this line is deduced): QWidget *f = this;
-
5901 while (f->d_func()->extra && f->d_func()->extra->focus_proxy)
evaluated: f->d_func()->extra
TRUEFALSE
yes
Evaluation Count:6015
yes
Evaluation Count:951
evaluated: f->d_func()->extra->focus_proxy
TRUEFALSE
yes
Evaluation Count:31
yes
Evaluation Count:5984
31-6015
5902 f = f->d_func()->extra->focus_proxy;
executed: f = f->d_func()->extra->focus_proxy;
Execution Count:31
31
5903 -
5904 if (QApplication::focusWidget() == f
evaluated: QApplication::focusWidget() == f
TRUEFALSE
yes
Evaluation Count:5052
yes
Evaluation Count:1883
1883-5052
5905#if defined(Q_WS_WIN) -
5906 && GetFocus() == f->internalWinId() -
5907#endif -
5908 ) -
5909 return;
executed: return;
Execution Count:5052
5052
5910 -
5911#ifndef QT_NO_GRAPHICSVIEW -
5912 QWidget *previousProxyFocus = 0;
executed (the execution status of this line is deduced): QWidget *previousProxyFocus = 0;
-
5913 if (QWExtra *topData = window()->d_func()->extra) {
evaluated: QWExtra *topData = window()->d_func()->extra
TRUEFALSE
yes
Evaluation Count:1774
yes
Evaluation Count:109
109-1774
5914 if (topData->proxyWidget && topData->proxyWidget->hasFocus()) {
partially evaluated: topData->proxyWidget
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1774
never evaluated: topData->proxyWidget->hasFocus()
0-1774
5915 previousProxyFocus = topData->proxyWidget->widget()->focusWidget();
never executed (the execution status of this line is deduced): previousProxyFocus = topData->proxyWidget->widget()->focusWidget();
-
5916 if (previousProxyFocus && previousProxyFocus->focusProxy())
never evaluated: previousProxyFocus
never evaluated: previousProxyFocus->focusProxy()
0
5917 previousProxyFocus = previousProxyFocus->focusProxy();
never executed: previousProxyFocus = previousProxyFocus->focusProxy();
0
5918 if (previousProxyFocus == this && !topData->proxyWidget->d_func()->proxyIsGivingFocus)
never evaluated: previousProxyFocus == this
never evaluated: !topData->proxyWidget->d_func()->proxyIsGivingFocus
0
5919 return;
never executed: return;
0
5920 }
never executed: }
0
5921 }
executed: }
Execution Count:1774
1774
5922#endif -
5923 -
5924#ifndef QT_NO_GRAPHICSVIEW -
5925 // Update proxy state -
5926 if (QWExtra *topData = window()->d_func()->extra) {
evaluated: QWExtra *topData = window()->d_func()->extra
TRUEFALSE
yes
Evaluation Count:1774
yes
Evaluation Count:109
109-1774
5927 if (topData->proxyWidget && !topData->proxyWidget->hasFocus()) {
partially evaluated: topData->proxyWidget
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1774
never evaluated: !topData->proxyWidget->hasFocus()
0-1774
5928 f->d_func()->updateFocusChild();
never executed (the execution status of this line is deduced): f->d_func()->updateFocusChild();
-
5929 topData->proxyWidget->d_func()->focusFromWidgetToProxy = 1;
never executed (the execution status of this line is deduced): topData->proxyWidget->d_func()->focusFromWidgetToProxy = 1;
-
5930 topData->proxyWidget->setFocus(reason);
never executed (the execution status of this line is deduced): topData->proxyWidget->setFocus(reason);
-
5931 topData->proxyWidget->d_func()->focusFromWidgetToProxy = 0;
never executed (the execution status of this line is deduced): topData->proxyWidget->d_func()->focusFromWidgetToProxy = 0;
-
5932 }
never executed: }
0
5933 }
executed: }
Execution Count:1774
1774
5934#endif -
5935 -
5936 if (f->isActiveWindow()) {
evaluated: f->isActiveWindow()
TRUEFALSE
yes
Evaluation Count:897
yes
Evaluation Count:986
897-986
5937 QWidget *prev = QApplicationPrivate::focus_widget;
executed (the execution status of this line is deduced): QWidget *prev = QApplicationPrivate::focus_widget;
-
5938 if (prev) {
evaluated: prev
TRUEFALSE
yes
Evaluation Count:319
yes
Evaluation Count:578
319-578
5939 if (reason != Qt::PopupFocusReason && reason != Qt::MenuBarFocusReason
evaluated: reason != Qt::PopupFocusReason
TRUEFALSE
yes
Evaluation Count:309
yes
Evaluation Count:10
evaluated: reason != Qt::MenuBarFocusReason
TRUEFALSE
yes
Evaluation Count:306
yes
Evaluation Count:3
3-309
5940 && prev->testAttribute(Qt::WA_InputMethodEnabled)) {
evaluated: prev->testAttribute(Qt::WA_InputMethodEnabled)
TRUEFALSE
yes
Evaluation Count:148
yes
Evaluation Count:158
148-158
5941 qApp->inputMethod()->commit();
executed (the execution status of this line is deduced): (static_cast<QApplication *>(QCoreApplication::instance()))->inputMethod()->commit();
-
5942 }
executed: }
Execution Count:148
148
5943 -
5944 if (reason != Qt::NoFocusReason) {
evaluated: reason != Qt::NoFocusReason
TRUEFALSE
yes
Evaluation Count:318
yes
Evaluation Count:1
1-318
5945 QFocusEvent focusAboutToChange(QEvent::FocusAboutToChange, reason);
executed (the execution status of this line is deduced): QFocusEvent focusAboutToChange(QEvent::FocusAboutToChange, reason);
-
5946 QApplication::sendEvent(prev, &focusAboutToChange);
executed (the execution status of this line is deduced): QApplication::sendEvent(prev, &focusAboutToChange);
-
5947 }
executed: }
Execution Count:318
318
5948 }
executed: }
Execution Count:319
319
5949 -
5950 f->d_func()->updateFocusChild();
executed (the execution status of this line is deduced): f->d_func()->updateFocusChild();
-
5951 -
5952 QApplicationPrivate::setFocusWidget(f, reason);
executed (the execution status of this line is deduced): QApplicationPrivate::setFocusWidget(f, reason);
-
5953#ifndef QT_NO_ACCESSIBILITY -
5954# ifdef Q_OS_WIN -
5955 // The negation of the condition in setFocus_sys -
5956 if (!(testAttribute(Qt::WA_WState_Created) && window()->windowType() != Qt::Popup && internalWinId())) -
5957 //setFocusWidget will already post a focus event for us (that the AT client receives) on Windows -
5958# endif -
5959# ifdef Q_OS_UNIX -
5960 // menus update the focus manually and this would create bogus events -
5961 if (!(f->inherits("QMenuBar") || f->inherits("QMenu") || f->inherits("QMenuItem")))
evaluated: f->inherits("QMenuBar")
TRUEFALSE
yes
Evaluation Count:16
yes
Evaluation Count:881
evaluated: f->inherits("QMenu")
TRUEFALSE
yes
Evaluation Count:11
yes
Evaluation Count:870
partially evaluated: f->inherits("QMenuItem")
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:870
0-881
5962# endif -
5963 { -
5964 QAccessibleEvent event(f, QAccessible::Focus);
executed (the execution status of this line is deduced): QAccessibleEvent event(f, QAccessible::Focus);
-
5965 QAccessible::updateAccessibility(&event);
executed (the execution status of this line is deduced): QAccessible::updateAccessibility(&event);
-
5966 }
executed: }
Execution Count:870
870
5967#endif -
5968#ifndef QT_NO_GRAPHICSVIEW -
5969 if (QWExtra *topData = window()->d_func()->extra) {
partially evaluated: QWExtra *topData = window()->d_func()->extra
TRUEFALSE
yes
Evaluation Count:897
no
Evaluation Count:0
0-897
5970 if (topData->proxyWidget) {
partially evaluated: topData->proxyWidget
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:897
0-897
5971 if (previousProxyFocus && previousProxyFocus != f) {
never evaluated: previousProxyFocus
never evaluated: previousProxyFocus != f
0
5972 // Send event to self -
5973 QFocusEvent event(QEvent::FocusOut, reason);
never executed (the execution status of this line is deduced): QFocusEvent event(QEvent::FocusOut, reason);
-
5974 QPointer<QWidget> that = previousProxyFocus;
never executed (the execution status of this line is deduced): QPointer<QWidget> that = previousProxyFocus;
-
5975 QApplication::sendEvent(previousProxyFocus, &event);
never executed (the execution status of this line is deduced): QApplication::sendEvent(previousProxyFocus, &event);
-
5976 if (that)
never evaluated: that
0
5977 QApplication::sendEvent(that->style(), &event);
never executed: QApplication::sendEvent(that->style(), &event);
0
5978 }
never executed: }
0
5979 if (!isHidden()) {
never evaluated: !isHidden()
0
5980#ifndef QT_NO_GRAPHICSVIEW -
5981 // Update proxy state -
5982 if (QWExtra *topData = window()->d_func()->extra)
never evaluated: QWExtra *topData = window()->d_func()->extra
0
5983 if (topData->proxyWidget && topData->proxyWidget->hasFocus())
never evaluated: topData->proxyWidget
never evaluated: topData->proxyWidget->hasFocus()
0
5984 topData->proxyWidget->d_func()->updateProxyInputMethodAcceptanceFromWidget();
never executed: topData->proxyWidget->d_func()->updateProxyInputMethodAcceptanceFromWidget();
0
5985#endif -
5986 // Send event to self -
5987 QFocusEvent event(QEvent::FocusIn, reason);
never executed (the execution status of this line is deduced): QFocusEvent event(QEvent::FocusIn, reason);
-
5988 QPointer<QWidget> that = f;
never executed (the execution status of this line is deduced): QPointer<QWidget> that = f;
-
5989 QApplication::sendEvent(f, &event);
never executed (the execution status of this line is deduced): QApplication::sendEvent(f, &event);
-
5990 if (that)
never evaluated: that
0
5991 QApplication::sendEvent(that->style(), &event);
never executed: QApplication::sendEvent(that->style(), &event);
0
5992 }
never executed: }
0
5993 }
never executed: }
0
5994 }
executed: }
Execution Count:897
897
5995#endif -
5996 } else {
executed: }
Execution Count:897
897
5997 f->d_func()->updateFocusChild();
executed (the execution status of this line is deduced): f->d_func()->updateFocusChild();
-
5998 }
executed: }
Execution Count:986
986
5999 -
6000 if (QTLWExtra *extra = f->window()->d_func()->maybeTopData()) {
evaluated: QTLWExtra *extra = f->window()->d_func()->maybeTopData()
TRUEFALSE
yes
Evaluation Count:1554
yes
Evaluation Count:329
329-1554
6001 if (extra->window)
partially evaluated: extra->window
TRUEFALSE
yes
Evaluation Count:1554
no
Evaluation Count:0
0-1554
6002 emit extra->window->focusObjectChanged(f);
executed: extra->window->focusObjectChanged(f);
Execution Count:1554
1554
6003 }
executed: }
Execution Count:1554
1554
6004}
executed: }
Execution Count:1883
1883
6005 -
6006// updates focus_child on parent widgets to point into this widget -
6007void QWidgetPrivate::updateFocusChild() -
6008{ -
6009 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
6010 -
6011 QWidget *w = q;
executed (the execution status of this line is deduced): QWidget *w = q;
-
6012 if (q->isHidden()) {
evaluated: q->isHidden()
TRUEFALSE
yes
Evaluation Count:98
yes
Evaluation Count:1785
98-1785
6013 while (w && w->isHidden()) {
evaluated: w
TRUEFALSE
yes
Evaluation Count:173
yes
Evaluation Count:59
evaluated: w->isHidden()
TRUEFALSE
yes
Evaluation Count:134
yes
Evaluation Count:39
39-173
6014 w->d_func()->focus_child = q;
executed (the execution status of this line is deduced): w->d_func()->focus_child = q;
-
6015 w = w->isWindow() ? 0 : w->parentWidget();
evaluated: w->isWindow()
TRUEFALSE
yes
Evaluation Count:59
yes
Evaluation Count:75
59-75
6016 }
executed: }
Execution Count:134
134
6017 } else {
executed: }
Execution Count:98
98
6018 while (w) {
evaluated: w
TRUEFALSE
yes
Evaluation Count:4341
yes
Evaluation Count:1785
1785-4341
6019 w->d_func()->focus_child = q;
executed (the execution status of this line is deduced): w->d_func()->focus_child = q;
-
6020 w = w->isWindow() ? 0 : w->parentWidget();
evaluated: w->isWindow()
TRUEFALSE
yes
Evaluation Count:1785
yes
Evaluation Count:2556
1785-2556
6021 }
executed: }
Execution Count:4341
4341
6022 }
executed: }
Execution Count:1785
1785
6023} -
6024 -
6025/*! -
6026 \fn void QWidget::setFocus() -
6027 \overload -
6028 -
6029 Gives the keyboard input focus to this widget (or its focus -
6030 proxy) if this widget or one of its parents is the -
6031 \l{isActiveWindow()}{active window}. -
6032*/ -
6033 -
6034/*! -
6035 Takes keyboard input focus from the widget. -
6036 -
6037 If the widget has active focus, a \l{focusOutEvent()}{focus out event} is sent to this widget to tell it that it has -
6038 lost the focus. -
6039 -
6040 This widget must enable focus setting in order to get the keyboard -
6041 input focus, i.e. it must call setFocusPolicy(). -
6042 -
6043 \sa hasFocus(), setFocus(), focusInEvent(), focusOutEvent(), -
6044 setFocusPolicy(), QApplication::focusWidget() -
6045*/ -
6046 -
6047void QWidget::clearFocus() -
6048{ -
6049 if (hasFocus()) {
evaluated: hasFocus()
TRUEFALSE
yes
Evaluation Count:1004
yes
Evaluation Count:40719
1004-40719
6050 if (testAttribute(Qt::WA_InputMethodEnabled))
evaluated: testAttribute(Qt::WA_InputMethodEnabled)
TRUEFALSE
yes
Evaluation Count:120
yes
Evaluation Count:884
120-884
6051 qApp->inputMethod()->commit();
executed: (static_cast<QApplication *>(QCoreApplication::instance()))->inputMethod()->commit();
Execution Count:120
120
6052 -
6053 QFocusEvent focusAboutToChange(QEvent::FocusAboutToChange);
executed (the execution status of this line is deduced): QFocusEvent focusAboutToChange(QEvent::FocusAboutToChange);
-
6054 QApplication::sendEvent(this, &focusAboutToChange);
executed (the execution status of this line is deduced): QApplication::sendEvent(this, &focusAboutToChange);
-
6055 }
executed: }
Execution Count:1004
1004
6056 -
6057 QWidget *w = this;
executed (the execution status of this line is deduced): QWidget *w = this;
-
6058 while (w) {
evaluated: w
TRUEFALSE
yes
Evaluation Count:129632
yes
Evaluation Count:41723
41723-129632
6059 if (w->d_func()->focus_child == this)
evaluated: w->d_func()->focus_child == this
TRUEFALSE
yes
Evaluation Count:2032
yes
Evaluation Count:127600
2032-127600
6060 w->d_func()->focus_child = 0;
executed: w->d_func()->focus_child = 0;
Execution Count:2032
2032
6061 w = w->parentWidget();
executed (the execution status of this line is deduced): w = w->parentWidget();
-
6062 }
executed: }
Execution Count:129632
129632
6063#ifndef QT_NO_GRAPHICSVIEW -
6064 QWExtra *topData = d_func()->extra;
executed (the execution status of this line is deduced): QWExtra *topData = d_func()->extra;
-
6065 if (topData && topData->proxyWidget)
evaluated: topData
TRUEFALSE
yes
Evaluation Count:16603
yes
Evaluation Count:25120
partially evaluated: topData->proxyWidget
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:16603
0-25120
6066 topData->proxyWidget->clearFocus();
never executed: topData->proxyWidget->clearFocus();
0
6067#endif -
6068 -
6069 if (hasFocus()) {
evaluated: hasFocus()
TRUEFALSE
yes
Evaluation Count:1004
yes
Evaluation Count:40719
1004-40719
6070 // Update proxy state -
6071 QApplicationPrivate::setFocusWidget(0, Qt::OtherFocusReason);
executed (the execution status of this line is deduced): QApplicationPrivate::setFocusWidget(0, Qt::OtherFocusReason);
-
6072#if defined(Q_WS_WIN) -
6073 if (!(windowType() == Qt::Popup) && GetFocus() == internalWinId()) -
6074 SetFocus(0); -
6075 else -
6076#endif -
6077 { -
6078#ifndef QT_NO_ACCESSIBILITY -
6079 QAccessibleEvent event(this, QAccessible::Focus);
executed (the execution status of this line is deduced): QAccessibleEvent event(this, QAccessible::Focus);
-
6080 QAccessible::updateAccessibility(&event);
executed (the execution status of this line is deduced): QAccessible::updateAccessibility(&event);
-
6081#endif -
6082 } -
6083 }
executed: }
Execution Count:1004
1004
6084}
executed: }
Execution Count:41723
41723
6085 -
6086 -
6087/*! -
6088 \fn bool QWidget::focusNextChild() -
6089 -
6090 Finds a new widget to give the keyboard focus to, as appropriate -
6091 for \uicontrol Tab, and returns true if it can find a new widget, or -
6092 false if it can't. -
6093 -
6094 \sa focusPreviousChild() -
6095*/ -
6096 -
6097/*! -
6098 \fn bool QWidget::focusPreviousChild() -
6099 -
6100 Finds a new widget to give the keyboard focus to, as appropriate -
6101 for \uicontrol Shift+Tab, and returns true if it can find a new widget, -
6102 or false if it can't. -
6103 -
6104 \sa focusNextChild() -
6105*/ -
6106 -
6107/*! -
6108 Finds a new widget to give the keyboard focus to, as appropriate -
6109 for Tab and Shift+Tab, and returns true if it can find a new -
6110 widget, or false if it can't. -
6111 -
6112 If \a next is true, this function searches forward, if \a next -
6113 is false, it searches backward. -
6114 -
6115 Sometimes, you will want to reimplement this function. For -
6116 example, a web browser might reimplement it to move its "current -
6117 active link" forward or backward, and call -
6118 focusNextPrevChild() only when it reaches the last or -
6119 first link on the "page". -
6120 -
6121 Child widgets call focusNextPrevChild() on their parent widgets, -
6122 but only the window that contains the child widgets decides where -
6123 to redirect focus. By reimplementing this function for an object, -
6124 you thus gain control of focus traversal for all child widgets. -
6125 -
6126 \sa focusNextChild(), focusPreviousChild() -
6127*/ -
6128 -
6129bool QWidget::focusNextPrevChild(bool next) -
6130{ -
6131 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
6132 QWidget* p = parentWidget();
executed (the execution status of this line is deduced): QWidget* p = parentWidget();
-
6133 bool isSubWindow = (windowType() == Qt::SubWindow);
executed (the execution status of this line is deduced): bool isSubWindow = (windowType() == Qt::SubWindow);
-
6134 if (!isWindow() && !isSubWindow && p)
evaluated: !isWindow()
TRUEFALSE
yes
Evaluation Count:410
yes
Evaluation Count:176
evaluated: !isSubWindow
TRUEFALSE
yes
Evaluation Count:272
yes
Evaluation Count:138
partially evaluated: p
TRUEFALSE
yes
Evaluation Count:272
no
Evaluation Count:0
0-410
6135 return p->focusNextPrevChild(next);
executed: return p->focusNextPrevChild(next);
Execution Count:272
272
6136#ifndef QT_NO_GRAPHICSVIEW -
6137 if (d->extra && d->extra->proxyWidget)
evaluated: d->extra
TRUEFALSE
yes
Evaluation Count:313
yes
Evaluation Count:1
partially evaluated: d->extra->proxyWidget
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:313
0-313
6138 return d->extra->proxyWidget->focusNextPrevChild(next);
never executed: return d->extra->proxyWidget->focusNextPrevChild(next);
0
6139#endif -
6140 QWidget *w = QApplicationPrivate::focusNextPrevChild_helper(this, next);
executed (the execution status of this line is deduced): QWidget *w = QApplicationPrivate::focusNextPrevChild_helper(this, next);
-
6141 if (!w) return false;
executed: return false;
Execution Count:263
evaluated: !w
TRUEFALSE
yes
Evaluation Count:263
yes
Evaluation Count:51
51-263
6142 -
6143 w->setFocus(next ? Qt::TabFocusReason : Qt::BacktabFocusReason);
executed (the execution status of this line is deduced): w->setFocus(next ? Qt::TabFocusReason : Qt::BacktabFocusReason);
-
6144 return true;
executed: return true;
Execution Count:51
51
6145} -
6146 -
6147/*! -
6148 Returns the last child of this widget that setFocus had been -
6149 called on. For top level widgets this is the widget that will get -
6150 focus in case this window gets activated -
6151 -
6152 This is not the same as QApplication::focusWidget(), which returns -
6153 the focus widget in the currently active window. -
6154*/ -
6155 -
6156QWidget *QWidget::focusWidget() const -
6157{ -
6158 return const_cast<QWidget *>(d_func()->focus_child);
executed: return const_cast<QWidget *>(d_func()->focus_child);
Execution Count:64948
64948
6159} -
6160 -
6161/*! -
6162 Returns the next widget in this widget's focus chain. -
6163 -
6164 \sa previousInFocusChain() -
6165*/ -
6166QWidget *QWidget::nextInFocusChain() const -
6167{ -
6168 return const_cast<QWidget *>(d_func()->focus_next);
executed: return const_cast<QWidget *>(d_func()->focus_next);
Execution Count:34153
34153
6169} -
6170 -
6171/*! -
6172 \brief The previousInFocusChain function returns the previous -
6173 widget in this widget's focus chain. -
6174 -
6175 \sa nextInFocusChain() -
6176 -
6177 \since 4.6 -
6178*/ -
6179QWidget *QWidget::previousInFocusChain() const -
6180{ -
6181 return const_cast<QWidget *>(d_func()->focus_prev);
executed: return const_cast<QWidget *>(d_func()->focus_prev);
Execution Count:18
18
6182} -
6183 -
6184/*! -
6185 \property QWidget::isActiveWindow -
6186 \brief whether this widget's window is the active window -
6187 -
6188 The active window is the window that contains the widget that has -
6189 keyboard focus (The window may still have focus if it has no -
6190 widgets or none of its widgets accepts keyboard focus). -
6191 -
6192 When popup windows are visible, this property is true for both the -
6193 active window \e and for the popup. -
6194 -
6195 By default, this property is false. -
6196 -
6197 \sa activateWindow(), QApplication::activeWindow() -
6198*/ -
6199bool QWidget::isActiveWindow() const -
6200{ -
6201 QWidget *tlw = window();
executed (the execution status of this line is deduced): QWidget *tlw = window();
-
6202 if(tlw == QApplication::activeWindow() || (isVisible() && (tlw->windowType() == Qt::Popup)))
evaluated: tlw == QApplication::activeWindow()
TRUEFALSE
yes
Evaluation Count:170902
yes
Evaluation Count:352690
evaluated: isVisible()
TRUEFALSE
yes
Evaluation Count:177825
yes
Evaluation Count:174865
evaluated: (tlw->windowType() == Qt::Popup)
TRUEFALSE
yes
Evaluation Count:7798
yes
Evaluation Count:170027
7798-352690
6203 return true;
executed: return true;
Execution Count:178700
178700
6204 -
6205#ifndef QT_NO_GRAPHICSVIEW -
6206 if (QWExtra *tlwExtra = tlw->d_func()->extra) {
evaluated: QWExtra *tlwExtra = tlw->d_func()->extra
TRUEFALSE
yes
Evaluation Count:225081
yes
Evaluation Count:119811
119811-225081
6207 if (isVisible() && tlwExtra->proxyWidget)
evaluated: isVisible()
TRUEFALSE
yes
Evaluation Count:170027
yes
Evaluation Count:55054
evaluated: tlwExtra->proxyWidget
TRUEFALSE
yes
Evaluation Count:113
yes
Evaluation Count:169914
113-170027
6208 return tlwExtra->proxyWidget->isActiveWindow();
executed: return tlwExtra->proxyWidget->isActiveWindow();
Execution Count:113
113
6209 }
executed: }
Execution Count:224968
224968
6210#endif -
6211 -
6212 if(style()->styleHint(QStyle::SH_Widget_ShareActivation, 0, this)) {
partially evaluated: style()->styleHint(QStyle::SH_Widget_ShareActivation, 0, this)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:344779
0-344779
6213 if(tlw->windowType() == Qt::Tool &&
never evaluated: tlw->windowType() == Qt::Tool
0
6214 !tlw->isModal() &&
never evaluated: !tlw->isModal()
0
6215 (!tlw->parentWidget() || tlw->parentWidget()->isActiveWindow()))
never evaluated: !tlw->parentWidget()
never evaluated: tlw->parentWidget()->isActiveWindow()
0
6216 return true;
never executed: return true;
0
6217 QWidget *w = QApplication::activeWindow();
never executed (the execution status of this line is deduced): QWidget *w = QApplication::activeWindow();
-
6218 while(w && tlw->windowType() == Qt::Tool &&
never evaluated: w
never evaluated: tlw->windowType() == Qt::Tool
0
6219 !w->isModal() && w->parentWidget()) {
never evaluated: !w->isModal()
never evaluated: w->parentWidget()
0
6220 w = w->parentWidget()->window();
never executed (the execution status of this line is deduced): w = w->parentWidget()->window();
-
6221 if(w == tlw)
never evaluated: w == tlw
0
6222 return true;
never executed: return true;
0
6223 }
never executed: }
0
6224 }
never executed: }
0
6225 -
6226 // Check if platform adaptation thinks the window is active. This is necessary for -
6227 // example in case of ActiveQt servers that are embedded into another application. -
6228 // Those are separate processes that are not part of the parent application Qt window/widget -
6229 // hierarchy, so they need to rely on native methods to determine if they are part of the -
6230 // active window. -
6231 if (const QWindow *w = tlw->windowHandle()) {
evaluated: const QWindow *w = tlw->windowHandle()
TRUEFALSE
yes
Evaluation Count:213397
yes
Evaluation Count:131382
131382-213397
6232 if (w->handle())
evaluated: w->handle()
TRUEFALSE
yes
Evaluation Count:194155
yes
Evaluation Count:19242
19242-194155
6233 return w->handle()->isActive();
executed: return w->handle()->isActive();
Execution Count:194155
194155
6234 }
executed: }
Execution Count:19242
19242
6235 -
6236 return false;
executed: return false;
Execution Count:150624
150624
6237} -
6238 -
6239/*! -
6240 Puts the \a second widget after the \a first widget in the focus order. -
6241 -
6242 Note that since the tab order of the \a second widget is changed, you -
6243 should order a chain like this: -
6244 -
6245 \snippet code/src_gui_kernel_qwidget.cpp 9 -
6246 -
6247 \e not like this: -
6248 -
6249 \snippet code/src_gui_kernel_qwidget.cpp 10 -
6250 -
6251 If \a first or \a second has a focus proxy, setTabOrder() -
6252 correctly substitutes the proxy. -
6253 -
6254 \sa setFocusPolicy(), setFocusProxy(), {Keyboard Focus in Widgets} -
6255*/ -
6256void QWidget::setTabOrder(QWidget* first, QWidget *second) -
6257{ -
6258 if (!first || !second || first->focusPolicy() == Qt::NoFocus || second->focusPolicy() == Qt::NoFocus)
partially evaluated: !first
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3863
partially evaluated: !second
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3863
evaluated: first->focusPolicy() == Qt::NoFocus
TRUEFALSE
yes
Evaluation Count:114
yes
Evaluation Count:3749
evaluated: second->focusPolicy() == Qt::NoFocus
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:3742
0-3863
6259 return;
executed: return;
Execution Count:121
121
6260 -
6261 if (first->window() != second->window()) {
partially evaluated: first->window() != second->window()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3742
0-3742
6262 qWarning("QWidget::setTabOrder: 'first' and 'second' must be in the same window");
never executed (the execution status of this line is deduced): QMessageLogger("kernel/qwidget.cpp", 6262, __PRETTY_FUNCTION__).warning("QWidget::setTabOrder: 'first' and 'second' must be in the same window");
-
6263 return;
never executed: return;
0
6264 } -
6265 -
6266 QWidget *fp = first->focusProxy();
executed (the execution status of this line is deduced): QWidget *fp = first->focusProxy();
-
6267 if (fp) {
evaluated: fp
TRUEFALSE
yes
Evaluation Count:194
yes
Evaluation Count:3548
194-3548
6268 // If first is redirected, set first to the last child of first -
6269 // that can take keyboard focus so that second is inserted after -
6270 // that last child, and the focus order within first is (more -
6271 // likely to be) preserved. -
6272 QList<QWidget *> l = first->findChildren<QWidget *>();
executed (the execution status of this line is deduced): QList<QWidget *> l = first->findChildren<QWidget *>();
-
6273 for (int i = l.size()-1; i >= 0; --i) {
partially evaluated: i >= 0
TRUEFALSE
yes
Evaluation Count:198
no
Evaluation Count:0
0-198
6274 QWidget * next = l.at(i);
executed (the execution status of this line is deduced): QWidget * next = l.at(i);
-
6275 if (next->window() == fp->window()) {
partially evaluated: next->window() == fp->window()
TRUEFALSE
yes
Evaluation Count:198
no
Evaluation Count:0
0-198
6276 fp = next;
executed (the execution status of this line is deduced): fp = next;
-
6277 if (fp->focusPolicy() != Qt::NoFocus)
evaluated: fp->focusPolicy() != Qt::NoFocus
TRUEFALSE
yes
Evaluation Count:194
yes
Evaluation Count:4
4-194
6278 break;
executed: break;
Execution Count:194
194
6279 }
executed: }
Execution Count:4
4
6280 }
executed: }
Execution Count:4
4
6281 first = fp;
executed (the execution status of this line is deduced): first = fp;
-
6282 }
executed: }
Execution Count:194
194
6283 -
6284 if (fp == second)
evaluated: fp == second
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:3741
1-3741
6285 return;
executed: return;
Execution Count:1
1
6286 -
6287 if (QWidget *sp = second->focusProxy())
evaluated: QWidget *sp = second->focusProxy()
TRUEFALSE
yes
Evaluation Count:193
yes
Evaluation Count:3548
193-3548
6288 second = sp;
executed: second = sp;
Execution Count:193
193
6289 -
6290// QWidget *fp = first->d_func()->focus_prev; -
6291 QWidget *fn = first->d_func()->focus_next;
executed (the execution status of this line is deduced): QWidget *fn = first->d_func()->focus_next;
-
6292 -
6293 if (fn == second || first == second)
evaluated: fn == second
TRUEFALSE
yes
Evaluation Count:2027
yes
Evaluation Count:1714
partially evaluated: first == second
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1714
0-2027
6294 return;
executed: return;
Execution Count:2027
2027
6295 -
6296 QWidget *sp = second->d_func()->focus_prev;
executed (the execution status of this line is deduced): QWidget *sp = second->d_func()->focus_prev;
-
6297 QWidget *sn = second->d_func()->focus_next;
executed (the execution status of this line is deduced): QWidget *sn = second->d_func()->focus_next;
-
6298 -
6299 fn->d_func()->focus_prev = second;
executed (the execution status of this line is deduced): fn->d_func()->focus_prev = second;
-
6300 first->d_func()->focus_next = second;
executed (the execution status of this line is deduced): first->d_func()->focus_next = second;
-
6301 -
6302 second->d_func()->focus_next = fn;
executed (the execution status of this line is deduced): second->d_func()->focus_next = fn;
-
6303 second->d_func()->focus_prev = first;
executed (the execution status of this line is deduced): second->d_func()->focus_prev = first;
-
6304 -
6305 sp->d_func()->focus_next = sn;
executed (the execution status of this line is deduced): sp->d_func()->focus_next = sn;
-
6306 sn->d_func()->focus_prev = sp;
executed (the execution status of this line is deduced): sn->d_func()->focus_prev = sp;
-
6307 -
6308 -
6309 Q_ASSERT(first->d_func()->focus_next->d_func()->focus_prev == first);
executed (the execution status of this line is deduced): qt_noop();
-
6310 Q_ASSERT(first->d_func()->focus_prev->d_func()->focus_next == first);
executed (the execution status of this line is deduced): qt_noop();
-
6311 -
6312 Q_ASSERT(second->d_func()->focus_next->d_func()->focus_prev == second);
executed (the execution status of this line is deduced): qt_noop();
-
6313 Q_ASSERT(second->d_func()->focus_prev->d_func()->focus_next == second);
executed (the execution status of this line is deduced): qt_noop();
-
6314}
executed: }
Execution Count:1714
1714
6315 -
6316/*!\internal -
6317 -
6318 Moves the relevant subwidgets of this widget from the \a oldtlw's -
6319 tab chain to that of the new parent, if there's anything to move and -
6320 we're really moving -
6321 -
6322 This function is called from QWidget::reparent() *after* the widget -
6323 has been reparented. -
6324 -
6325 \sa reparent() -
6326*/ -
6327 -
6328void QWidgetPrivate::reparentFocusWidgets(QWidget * oldtlw) -
6329{ -
6330 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
6331 if (oldtlw == q->window())
evaluated: oldtlw == q->window()
TRUEFALSE
yes
Evaluation Count:1133
yes
Evaluation Count:40430
1133-40430
6332 return; // nothing to do
executed: return;
Execution Count:1133
1133
6333 -
6334 if(focus_child)
evaluated: focus_child
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:40420
10-40420
6335 focus_child->clearFocus();
executed: focus_child->clearFocus();
Execution Count:10
10
6336 -
6337 // separate the focus chain into new (children of myself) and old (the rest) -
6338 QWidget *firstOld = 0;
executed (the execution status of this line is deduced): QWidget *firstOld = 0;
-
6339 //QWidget *firstNew = q; //invariant -
6340 QWidget *o = 0; // last in the old list
executed (the execution status of this line is deduced): QWidget *o = 0;
-
6341 QWidget *n = q; // last in the new list
executed (the execution status of this line is deduced): QWidget *n = q;
-
6342 -
6343 bool prevWasNew = true;
executed (the execution status of this line is deduced): bool prevWasNew = true;
-
6344 QWidget *w = focus_next;
executed (the execution status of this line is deduced): QWidget *w = focus_next;
-
6345 -
6346 //Note: for efficiency, we do not maintain the list invariant inside the loop -
6347 //we append items to the relevant list, and we optimize by not changing pointers -
6348 //when subsequent items are going into the same list. -
6349 while (w != q) {
evaluated: w != q
TRUEFALSE
yes
Evaluation Count:9584
yes
Evaluation Count:40430
9584-40430
6350 bool currentIsNew = q->isAncestorOf(w);
executed (the execution status of this line is deduced): bool currentIsNew = q->isAncestorOf(w);
-
6351 if (currentIsNew) {
evaluated: currentIsNew
TRUEFALSE
yes
Evaluation Count:6447
yes
Evaluation Count:3137
3137-6447
6352 if (!prevWasNew) {
evaluated: !prevWasNew
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:6446
1-6446
6353 //prev was old -- append to new list -
6354 n->d_func()->focus_next = w;
executed (the execution status of this line is deduced): n->d_func()->focus_next = w;
-
6355 w->d_func()->focus_prev = n;
executed (the execution status of this line is deduced): w->d_func()->focus_prev = n;
-
6356 }
executed: }
Execution Count:1
1
6357 n = w;
executed (the execution status of this line is deduced): n = w;
-
6358 } else {
executed: }
Execution Count:6447
6447
6359 if (prevWasNew) {
evaluated: prevWasNew
TRUEFALSE
yes
Evaluation Count:310
yes
Evaluation Count:2827
310-2827
6360 //prev was new -- append to old list, if there is one -
6361 if (o) {
evaluated: o
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:309
1-309
6362 o->d_func()->focus_next = w;
executed (the execution status of this line is deduced): o->d_func()->focus_next = w;
-
6363 w->d_func()->focus_prev = o;
executed (the execution status of this line is deduced): w->d_func()->focus_prev = o;
-
6364 } else {
executed: }
Execution Count:1
1
6365 // "create" the old list -
6366 firstOld = w;
executed (the execution status of this line is deduced): firstOld = w;
-
6367 }
executed: }
Execution Count:309
309
6368 } -
6369 o = w;
executed (the execution status of this line is deduced): o = w;
-
6370 }
executed: }
Execution Count:3137
3137
6371 w = w->d_func()->focus_next;
executed (the execution status of this line is deduced): w = w->d_func()->focus_next;
-
6372 prevWasNew = currentIsNew;
executed (the execution status of this line is deduced): prevWasNew = currentIsNew;
-
6373 }
executed: }
Execution Count:9584
9584
6374 -
6375 //repair the old list: -
6376 if (firstOld) {
evaluated: firstOld
TRUEFALSE
yes
Evaluation Count:309
yes
Evaluation Count:40121
309-40121
6377 o->d_func()->focus_next = firstOld;
executed (the execution status of this line is deduced): o->d_func()->focus_next = firstOld;
-
6378 firstOld->d_func()->focus_prev = o;
executed (the execution status of this line is deduced): firstOld->d_func()->focus_prev = o;
-
6379 }
executed: }
Execution Count:309
309
6380 -
6381 if (!q->isWindow()) {
evaluated: !q->isWindow()
TRUEFALSE
yes
Evaluation Count:40294
yes
Evaluation Count:136
136-40294
6382 QWidget *topLevel = q->window();
executed (the execution status of this line is deduced): QWidget *topLevel = q->window();
-
6383 //insert new chain into toplevel's chain -
6384 -
6385 QWidget *prev = topLevel->d_func()->focus_prev;
executed (the execution status of this line is deduced): QWidget *prev = topLevel->d_func()->focus_prev;
-
6386 -
6387 topLevel->d_func()->focus_prev = n;
executed (the execution status of this line is deduced): topLevel->d_func()->focus_prev = n;
-
6388 prev->d_func()->focus_next = q;
executed (the execution status of this line is deduced): prev->d_func()->focus_next = q;
-
6389 -
6390 focus_prev = prev;
executed (the execution status of this line is deduced): focus_prev = prev;
-
6391 n->d_func()->focus_next = topLevel;
executed (the execution status of this line is deduced): n->d_func()->focus_next = topLevel;
-
6392 } else {
executed: }
Execution Count:40294
40294
6393 //repair the new list -
6394 n->d_func()->focus_next = q;
executed (the execution status of this line is deduced): n->d_func()->focus_next = q;
-
6395 focus_prev = n;
executed (the execution status of this line is deduced): focus_prev = n;
-
6396 }
executed: }
Execution Count:136
136
6397 -
6398} -
6399 -
6400/*!\internal -
6401 -
6402 Measures the shortest distance from a point to a rect. -
6403 -
6404 This function is called from QDesktopwidget::screen(QPoint) to find the -
6405 closest screen for a point. -
6406 In directional KeypadNavigation, it is called to find the closest -
6407 widget to the current focus widget center. -
6408*/ -
6409int QWidgetPrivate::pointToRect(const QPoint &p, const QRect &r) -
6410{ -
6411 int dx = 0;
never executed (the execution status of this line is deduced): int dx = 0;
-
6412 int dy = 0;
never executed (the execution status of this line is deduced): int dy = 0;
-
6413 if (p.x() < r.left())
never evaluated: p.x() < r.left()
0
6414 dx = r.left() - p.x();
never executed: dx = r.left() - p.x();
0
6415 else if (p.x() > r.right())
never evaluated: p.x() > r.right()
0
6416 dx = p.x() - r.right();
never executed: dx = p.x() - r.right();
0
6417 if (p.y() < r.top())
never evaluated: p.y() < r.top()
0
6418 dy = r.top() - p.y();
never executed: dy = r.top() - p.y();
0
6419 else if (p.y() > r.bottom())
never evaluated: p.y() > r.bottom()
0
6420 dy = p.y() - r.bottom();
never executed: dy = p.y() - r.bottom();
0
6421 return dx + dy;
never executed: return dx + dy;
0
6422} -
6423 -
6424/*! -
6425 \property QWidget::frameSize -
6426 \brief the size of the widget including any window frame -
6427 -
6428 By default, this property contains a value that depends on the user's -
6429 platform and screen geometry. -
6430*/ -
6431QSize QWidget::frameSize() const -
6432{ -
6433 Q_D(const QWidget);
never executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
6434 if (isWindow() && !(windowType() == Qt::Popup)) {
never evaluated: isWindow()
never evaluated: !(windowType() == Qt::Popup)
0
6435 QRect fs = d->frameStrut();
never executed (the execution status of this line is deduced): QRect fs = d->frameStrut();
-
6436 return QSize(data->crect.width() + fs.left() + fs.right(),
never executed: return QSize(data->crect.width() + fs.left() + fs.right(), data->crect.height() + fs.top() + fs.bottom());
0
6437 data->crect.height() + fs.top() + fs.bottom());
never executed: return QSize(data->crect.width() + fs.left() + fs.right(), data->crect.height() + fs.top() + fs.bottom());
0
6438 } -
6439 return data->crect.size();
never executed: return data->crect.size();
0
6440} -
6441 -
6442/*! \fn void QWidget::move(int x, int y) -
6443 -
6444 \overload -
6445 -
6446 This corresponds to move(QPoint(\a x, \a y)). -
6447*/ -
6448 -
6449void QWidget::move(const QPoint &p) -
6450{ -
6451 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
6452 setAttribute(Qt::WA_Moved);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_Moved);
-
6453 if (testAttribute(Qt::WA_WState_Created)) {
evaluated: testAttribute(Qt::WA_WState_Created)
TRUEFALSE
yes
Evaluation Count:661
yes
Evaluation Count:559
559-661
6454 if (isWindow())
evaluated: isWindow()
TRUEFALSE
yes
Evaluation Count:565
yes
Evaluation Count:96
96-565
6455 d->topData()->posIncludesFrame = false;
executed: d->topData()->posIncludesFrame = false;
Execution Count:565
565
6456 d->setGeometry_sys(p.x() + geometry().x() - QWidget::x(),
executed (the execution status of this line is deduced): d->setGeometry_sys(p.x() + geometry().x() - QWidget::x(),
-
6457 p.y() + geometry().y() - QWidget::y(),
executed (the execution status of this line is deduced): p.y() + geometry().y() - QWidget::y(),
-
6458 width(), height(), true);
executed (the execution status of this line is deduced): width(), height(), true);
-
6459 d->setDirtyOpaqueRegion();
executed (the execution status of this line is deduced): d->setDirtyOpaqueRegion();
-
6460 } else {
executed: }
Execution Count:661
661
6461 // no frame yet: see also QWidgetPrivate::fixPosIncludesFrame(), QWindowPrivate::PositionPolicy. -
6462 if (isWindow())
evaluated: isWindow()
TRUEFALSE
yes
Evaluation Count:228
yes
Evaluation Count:331
228-331
6463 d->topData()->posIncludesFrame = true;
executed: d->topData()->posIncludesFrame = true;
Execution Count:228
228
6464 data->crect.moveTopLeft(p); // no frame yet
executed (the execution status of this line is deduced): data->crect.moveTopLeft(p);
-
6465 setAttribute(Qt::WA_PendingMoveEvent);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_PendingMoveEvent);
-
6466 }
executed: }
Execution Count:559
559
6467} -
6468 -
6469/*! \fn void QWidget::resize(int w, int h) -
6470 \overload -
6471 -
6472 This corresponds to resize(QSize(\a w, \a h)). -
6473*/ -
6474 -
6475void QWidget::resize(const QSize &s) -
6476{ -
6477 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
6478 setAttribute(Qt::WA_Resized);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_Resized);
-
6479 if (testAttribute(Qt::WA_WState_Created)) {
evaluated: testAttribute(Qt::WA_WState_Created)
TRUEFALSE
yes
Evaluation Count:2466
yes
Evaluation Count:5286
2466-5286
6480 d->fixPosIncludesFrame();
executed (the execution status of this line is deduced): d->fixPosIncludesFrame();
-
6481 d->setGeometry_sys(geometry().x(), geometry().y(), s.width(), s.height(), false);
executed (the execution status of this line is deduced): d->setGeometry_sys(geometry().x(), geometry().y(), s.width(), s.height(), false);
-
6482 d->setDirtyOpaqueRegion();
executed (the execution status of this line is deduced): d->setDirtyOpaqueRegion();
-
6483 } else {
executed: }
Execution Count:2466
2466
6484 data->crect.setSize(s.boundedTo(maximumSize()).expandedTo(minimumSize()));
executed (the execution status of this line is deduced): data->crect.setSize(s.boundedTo(maximumSize()).expandedTo(minimumSize()));
-
6485 setAttribute(Qt::WA_PendingResizeEvent);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_PendingResizeEvent);
-
6486 }
executed: }
Execution Count:5286
5286
6487} -
6488 -
6489void QWidget::setGeometry(const QRect &r) -
6490{ -
6491 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
6492 setAttribute(Qt::WA_Resized);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_Resized);
-
6493 setAttribute(Qt::WA_Moved);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_Moved);
-
6494 if (isWindow())
evaluated: isWindow()
TRUEFALSE
yes
Evaluation Count:483
yes
Evaluation Count:63197
483-63197
6495 d->topData()->posIncludesFrame = 0;
executed: d->topData()->posIncludesFrame = 0;
Execution Count:483
483
6496 if (testAttribute(Qt::WA_WState_Created)) {
evaluated: testAttribute(Qt::WA_WState_Created)
TRUEFALSE
yes
Evaluation Count:25897
yes
Evaluation Count:37783
25897-37783
6497 d->setGeometry_sys(r.x(), r.y(), r.width(), r.height(), true);
executed (the execution status of this line is deduced): d->setGeometry_sys(r.x(), r.y(), r.width(), r.height(), true);
-
6498 d->setDirtyOpaqueRegion();
executed (the execution status of this line is deduced): d->setDirtyOpaqueRegion();
-
6499 } else {
executed: }
Execution Count:25897
25897
6500 data->crect.setTopLeft(r.topLeft());
executed (the execution status of this line is deduced): data->crect.setTopLeft(r.topLeft());
-
6501 data->crect.setSize(r.size().boundedTo(maximumSize()).expandedTo(minimumSize()));
executed (the execution status of this line is deduced): data->crect.setSize(r.size().boundedTo(maximumSize()).expandedTo(minimumSize()));
-
6502 setAttribute(Qt::WA_PendingMoveEvent);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_PendingMoveEvent);
-
6503 setAttribute(Qt::WA_PendingResizeEvent);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_PendingResizeEvent);
-
6504 }
executed: }
Execution Count:37783
37783
6505} -
6506 -
6507/*! -
6508 \since 4.2 -
6509 Saves the current geometry and state for top-level widgets. -
6510 -
6511 To save the geometry when the window closes, you can -
6512 implement a close event like this: -
6513 -
6514 \snippet code/src_gui_kernel_qwidget.cpp 11 -
6515 -
6516 See the \l{Window Geometry} documentation for an overview of geometry -
6517 issues with windows. -
6518 -
6519 Use QMainWindow::saveState() to save the geometry and the state of -
6520 toolbars and dock widgets. -
6521 -
6522 \sa restoreGeometry(), QMainWindow::saveState(), QMainWindow::restoreState() -
6523*/ -
6524QByteArray QWidget::saveGeometry() const -
6525{ -
6526#ifdef Q_WS_MAC -
6527 // We check if the window was maximized during this invocation. If so, we need to record the -
6528 // starting position as 0,0. -
6529 Q_D(const QWidget); -
6530 QRect newFramePosition = frameGeometry(); -
6531 QRect newNormalPosition = normalGeometry(); -
6532 if(d->topData()->wasMaximized && !(windowState() & Qt::WindowMaximized)) { -
6533 // Change the starting position -
6534 newFramePosition.moveTo(0, 0); -
6535 newNormalPosition.moveTo(0, 0); -
6536 } -
6537#endif // Q_WS_MAC -
6538 QByteArray array;
executed (the execution status of this line is deduced): QByteArray array;
-
6539 QDataStream stream(&array, QIODevice::WriteOnly);
executed (the execution status of this line is deduced): QDataStream stream(&array, QIODevice::WriteOnly);
-
6540 stream.setVersion(QDataStream::Qt_4_0);
executed (the execution status of this line is deduced): stream.setVersion(QDataStream::Qt_4_0);
-
6541 const quint32 magicNumber = 0x1D9D0CB;
executed (the execution status of this line is deduced): const quint32 magicNumber = 0x1D9D0CB;
-
6542 quint16 majorVersion = 1;
executed (the execution status of this line is deduced): quint16 majorVersion = 1;
-
6543 quint16 minorVersion = 0;
executed (the execution status of this line is deduced): quint16 minorVersion = 0;
-
6544 stream << magicNumber
executed (the execution status of this line is deduced): stream << magicNumber
-
6545 << majorVersion
executed (the execution status of this line is deduced): << majorVersion
-
6546 << minorVersion
executed (the execution status of this line is deduced): << minorVersion
-
6547#ifdef Q_WS_MAC
executed (the execution status of this line is deduced):
-
6548 << newFramePosition
executed (the execution status of this line is deduced):
-
6549 << newNormalPosition
executed (the execution status of this line is deduced):
-
6550#else
executed (the execution status of this line is deduced):
-
6551 << frameGeometry()
executed (the execution status of this line is deduced): << frameGeometry()
-
6552 << normalGeometry()
executed (the execution status of this line is deduced): << normalGeometry()
-
6553#endif // Q_WS_MAC
executed (the execution status of this line is deduced):
-
6554 << qint32(QApplication::desktop()->screenNumber(this))
executed (the execution status of this line is deduced): << qint32(QApplication::desktop()->screenNumber(this))
-
6555 << quint8(windowState() & Qt::WindowMaximized)
executed (the execution status of this line is deduced): << quint8(windowState() & Qt::WindowMaximized)
-
6556 << quint8(windowState() & Qt::WindowFullScreen);
executed (the execution status of this line is deduced): << quint8(windowState() & Qt::WindowFullScreen);
-
6557 return array;
executed: return array;
Execution Count:5
5
6558} -
6559 -
6560/*! -
6561 \since 4.2 -
6562 -
6563 Restores the geometry and state top-level widgets stored in the -
6564 byte array \a geometry. Returns true on success; otherwise -
6565 returns false. -
6566 -
6567 If the restored geometry is off-screen, it will be modified to be -
6568 inside the available screen geometry. -
6569 -
6570 To restore geometry saved using QSettings, you can use code like -
6571 this: -
6572 -
6573 \snippet code/src_gui_kernel_qwidget.cpp 12 -
6574 -
6575 See the \l{Window Geometry} documentation for an overview of geometry -
6576 issues with windows. -
6577 -
6578 Use QMainWindow::restoreState() to restore the geometry and the -
6579 state of toolbars and dock widgets. -
6580 -
6581 \sa saveGeometry(), QSettings, QMainWindow::saveState(), QMainWindow::restoreState() -
6582*/ -
6583bool QWidget::restoreGeometry(const QByteArray &geometry) -
6584{ -
6585 if (geometry.size() < 4)
evaluated: geometry.size() < 4
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:10
4-10
6586 return false;
executed: return false;
Execution Count:4
4
6587 QDataStream stream(geometry);
executed (the execution status of this line is deduced): QDataStream stream(geometry);
-
6588 stream.setVersion(QDataStream::Qt_4_0);
executed (the execution status of this line is deduced): stream.setVersion(QDataStream::Qt_4_0);
-
6589 -
6590 const quint32 magicNumber = 0x1D9D0CB;
executed (the execution status of this line is deduced): const quint32 magicNumber = 0x1D9D0CB;
-
6591 quint32 storedMagicNumber;
executed (the execution status of this line is deduced): quint32 storedMagicNumber;
-
6592 stream >> storedMagicNumber;
executed (the execution status of this line is deduced): stream >> storedMagicNumber;
-
6593 if (storedMagicNumber != magicNumber)
evaluated: storedMagicNumber != magicNumber
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:8
2-8
6594 return false;
executed: return false;
Execution Count:2
2
6595 -
6596 const quint16 currentMajorVersion = 1;
executed (the execution status of this line is deduced): const quint16 currentMajorVersion = 1;
-
6597 quint16 majorVersion = 0;
executed (the execution status of this line is deduced): quint16 majorVersion = 0;
-
6598 quint16 minorVersion = 0;
executed (the execution status of this line is deduced): quint16 minorVersion = 0;
-
6599 -
6600 stream >> majorVersion >> minorVersion;
executed (the execution status of this line is deduced): stream >> majorVersion >> minorVersion;
-
6601 -
6602 if (majorVersion != currentMajorVersion)
partially evaluated: majorVersion != currentMajorVersion
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
6603 return false;
never executed: return false;
0
6604 // (Allow all minor versions.) -
6605 -
6606 QRect restoredFrameGeometry;
executed (the execution status of this line is deduced): QRect restoredFrameGeometry;
-
6607 QRect restoredNormalGeometry;
executed (the execution status of this line is deduced): QRect restoredNormalGeometry;
-
6608 qint32 restoredScreenNumber;
executed (the execution status of this line is deduced): qint32 restoredScreenNumber;
-
6609 quint8 maximized;
executed (the execution status of this line is deduced): quint8 maximized;
-
6610 quint8 fullScreen;
executed (the execution status of this line is deduced): quint8 fullScreen;
-
6611 -
6612 stream >> restoredFrameGeometry
executed (the execution status of this line is deduced): stream >> restoredFrameGeometry
-
6613 >> restoredNormalGeometry
executed (the execution status of this line is deduced): >> restoredNormalGeometry
-
6614 >> restoredScreenNumber
executed (the execution status of this line is deduced): >> restoredScreenNumber
-
6615 >> maximized
executed (the execution status of this line is deduced): >> maximized
-
6616 >> fullScreen;
executed (the execution status of this line is deduced): >> fullScreen;
-
6617 -
6618 const int frameHeight = 20;
executed (the execution status of this line is deduced): const int frameHeight = 20;
-
6619 if (!restoredFrameGeometry.isValid())
partially evaluated: !restoredFrameGeometry.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
6620 restoredFrameGeometry = QRect(QPoint(0,0), sizeHint());
never executed: restoredFrameGeometry = QRect(QPoint(0,0), sizeHint());
0
6621 -
6622 if (!restoredNormalGeometry.isValid())
partially evaluated: !restoredNormalGeometry.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
6623 restoredNormalGeometry = QRect(QPoint(0, frameHeight), sizeHint());
never executed: restoredNormalGeometry = QRect(QPoint(0, frameHeight), sizeHint());
0
6624 if (!restoredNormalGeometry.isValid()) {
partially evaluated: !restoredNormalGeometry.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
6625 // use the widget's adjustedSize if the sizeHint() doesn't help -
6626 restoredNormalGeometry.setSize(restoredNormalGeometry
never executed (the execution status of this line is deduced): restoredNormalGeometry.setSize(restoredNormalGeometry
-
6627 .size()
never executed (the execution status of this line is deduced): .size()
-
6628 .expandedTo(d_func()->adjustedSize()));
never executed (the execution status of this line is deduced): .expandedTo(d_func()->adjustedSize()));
-
6629 }
never executed: }
0
6630 -
6631 const QDesktopWidget * const desktop = QApplication::desktop();
executed (the execution status of this line is deduced): const QDesktopWidget * const desktop = QApplication::desktop();
-
6632 if (restoredScreenNumber >= desktop->numScreens())
partially evaluated: restoredScreenNumber >= desktop->numScreens()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
6633 restoredScreenNumber = desktop->primaryScreen();
never executed: restoredScreenNumber = desktop->primaryScreen();
0
6634 -
6635 const QRect availableGeometry = desktop->availableGeometry(restoredScreenNumber);
executed (the execution status of this line is deduced): const QRect availableGeometry = desktop->availableGeometry(restoredScreenNumber);
-
6636 -
6637 // Modify the restored geometry if we are about to restore to coordinates -
6638 // that would make the window "lost". This happens if: -
6639 // - The restored geometry is completely oustside the available geometry -
6640 // - The title bar is outside the available geometry. -
6641 // - (Mac only) The window is higher than the available geometry. It must -
6642 // be possible to bring the size grip on screen by moving the window. -
6643#ifdef Q_WS_MAC -
6644 restoredFrameGeometry.setHeight(qMin(restoredFrameGeometry.height(), availableGeometry.height())); -
6645 restoredNormalGeometry.setHeight(qMin(restoredNormalGeometry.height(), availableGeometry.height() - frameHeight)); -
6646#endif -
6647 -
6648 if (!restoredFrameGeometry.intersects(availableGeometry)) {
partially evaluated: !restoredFrameGeometry.intersects(availableGeometry)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
6649 restoredFrameGeometry.moveBottom(qMin(restoredFrameGeometry.bottom(), availableGeometry.bottom()));
never executed (the execution status of this line is deduced): restoredFrameGeometry.moveBottom(qMin(restoredFrameGeometry.bottom(), availableGeometry.bottom()));
-
6650 restoredFrameGeometry.moveLeft(qMax(restoredFrameGeometry.left(), availableGeometry.left()));
never executed (the execution status of this line is deduced): restoredFrameGeometry.moveLeft(qMax(restoredFrameGeometry.left(), availableGeometry.left()));
-
6651 restoredFrameGeometry.moveRight(qMin(restoredFrameGeometry.right(), availableGeometry.right()));
never executed (the execution status of this line is deduced): restoredFrameGeometry.moveRight(qMin(restoredFrameGeometry.right(), availableGeometry.right()));
-
6652 }
never executed: }
0
6653 restoredFrameGeometry.moveTop(qMax(restoredFrameGeometry.top(), availableGeometry.top()));
executed (the execution status of this line is deduced): restoredFrameGeometry.moveTop(qMax(restoredFrameGeometry.top(), availableGeometry.top()));
-
6654 -
6655 if (!restoredNormalGeometry.intersects(availableGeometry)) {
partially evaluated: !restoredNormalGeometry.intersects(availableGeometry)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
6656 restoredNormalGeometry.moveBottom(qMin(restoredNormalGeometry.bottom(), availableGeometry.bottom()));
never executed (the execution status of this line is deduced): restoredNormalGeometry.moveBottom(qMin(restoredNormalGeometry.bottom(), availableGeometry.bottom()));
-
6657 restoredNormalGeometry.moveLeft(qMax(restoredNormalGeometry.left(), availableGeometry.left()));
never executed (the execution status of this line is deduced): restoredNormalGeometry.moveLeft(qMax(restoredNormalGeometry.left(), availableGeometry.left()));
-
6658 restoredNormalGeometry.moveRight(qMin(restoredNormalGeometry.right(), availableGeometry.right()));
never executed (the execution status of this line is deduced): restoredNormalGeometry.moveRight(qMin(restoredNormalGeometry.right(), availableGeometry.right()));
-
6659 }
never executed: }
0
6660 restoredNormalGeometry.moveTop(qMax(restoredNormalGeometry.top(), availableGeometry.top() + frameHeight));
executed (the execution status of this line is deduced): restoredNormalGeometry.moveTop(qMax(restoredNormalGeometry.top(), availableGeometry.top() + frameHeight));
-
6661 -
6662 if (maximized || fullScreen) {
evaluated: maximized
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:6
evaluated: fullScreen
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:4
2-6
6663 // set geometry before setting the window state to make -
6664 // sure the window is maximized to the right screen. -
6665 // Skip on windows: the window is restored into a broken -
6666 // half-maximized state. -
6667#ifndef Q_OS_WIN -
6668 setGeometry(restoredNormalGeometry);
executed (the execution status of this line is deduced): setGeometry(restoredNormalGeometry);
-
6669#endif -
6670 Qt::WindowStates ws = windowState();
executed (the execution status of this line is deduced): Qt::WindowStates ws = windowState();
-
6671 if (maximized)
evaluated: maximized
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2
2
6672 ws |= Qt::WindowMaximized;
executed: ws |= Qt::WindowMaximized;
Execution Count:2
2
6673 if (fullScreen)
evaluated: fullScreen
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2
2
6674 ws |= Qt::WindowFullScreen;
executed: ws |= Qt::WindowFullScreen;
Execution Count:2
2
6675 setWindowState(ws);
executed (the execution status of this line is deduced): setWindowState(ws);
-
6676 d_func()->topData()->normalGeometry = restoredNormalGeometry;
executed (the execution status of this line is deduced): d_func()->topData()->normalGeometry = restoredNormalGeometry;
-
6677 } else {
executed: }
Execution Count:4
4
6678 QPoint offset;
executed (the execution status of this line is deduced): QPoint offset;
-
6679#ifdef Q_WS_X11 -
6680 if (isFullScreen()) -
6681 offset = d_func()->topData()->fullScreenOffset; -
6682#endif -
6683 setWindowState(windowState() & ~(Qt::WindowMaximized | Qt::WindowFullScreen));
executed (the execution status of this line is deduced): setWindowState(windowState() & ~(Qt::WindowMaximized | Qt::WindowFullScreen));
-
6684 move(restoredFrameGeometry.topLeft() + offset);
executed (the execution status of this line is deduced): move(restoredFrameGeometry.topLeft() + offset);
-
6685 resize(restoredNormalGeometry.size());
executed (the execution status of this line is deduced): resize(restoredNormalGeometry.size());
-
6686 }
executed: }
Execution Count:4
4
6687 return true;
executed: return true;
Execution Count:8
8
6688} -
6689 -
6690/*!\fn void QWidget::setGeometry(int x, int y, int w, int h) -
6691 \overload -
6692 -
6693 This corresponds to setGeometry(QRect(\a x, \a y, \a w, \a h)). -
6694*/ -
6695 -
6696/*! -
6697 Sets the margins around the contents of the widget to have the sizes -
6698 \a left, \a top, \a right, and \a bottom. The margins are used by -
6699 the layout system, and may be used by subclasses to specify the area -
6700 to draw in (e.g. excluding the frame). -
6701 -
6702 Changing the margins will trigger a resizeEvent(). -
6703 -
6704 \sa contentsRect(), getContentsMargins() -
6705*/ -
6706void QWidget::setContentsMargins(int left, int top, int right, int bottom) -
6707{ -
6708 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
6709 if (left == d->leftmargin && top == d->topmargin
evaluated: left == d->leftmargin
TRUEFALSE
yes
Evaluation Count:37120
yes
Evaluation Count:8580
evaluated: top == d->topmargin
TRUEFALSE
yes
Evaluation Count:37014
yes
Evaluation Count:106
106-37120
6710 && right == d->rightmargin && bottom == d->bottommargin)
evaluated: right == d->rightmargin
TRUEFALSE
yes
Evaluation Count:37013
yes
Evaluation Count:1
partially evaluated: bottom == d->bottommargin
TRUEFALSE
yes
Evaluation Count:37013
no
Evaluation Count:0
0-37013
6711 return;
executed: return;
Execution Count:37013
37013
6712 d->leftmargin = left;
executed (the execution status of this line is deduced): d->leftmargin = left;
-
6713 d->topmargin = top;
executed (the execution status of this line is deduced): d->topmargin = top;
-
6714 d->rightmargin = right;
executed (the execution status of this line is deduced): d->rightmargin = right;
-
6715 d->bottommargin = bottom;
executed (the execution status of this line is deduced): d->bottommargin = bottom;
-
6716 -
6717 if (QLayout *l=d->layout)
evaluated: QLayout *l=d->layout
TRUEFALSE
yes
Evaluation Count:590
yes
Evaluation Count:8097
590-8097
6718 l->update(); //force activate; will do updateGeometry
executed: l->update();
Execution Count:590
590
6719 else -
6720 updateGeometry();
executed: updateGeometry();
Execution Count:8097
8097
6721 -
6722 if (isVisible()) {
evaluated: isVisible()
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:8680
7-8680
6723 update();
executed (the execution status of this line is deduced): update();
-
6724 QResizeEvent e(data->crect.size(), data->crect.size());
executed (the execution status of this line is deduced): QResizeEvent e(data->crect.size(), data->crect.size());
-
6725 QApplication::sendEvent(this, &e);
executed (the execution status of this line is deduced): QApplication::sendEvent(this, &e);
-
6726 } else {
executed: }
Execution Count:7
7
6727 setAttribute(Qt::WA_PendingResizeEvent, true);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_PendingResizeEvent, true);
-
6728 }
executed: }
Execution Count:8680
8680
6729 -
6730 QEvent e(QEvent::ContentsRectChange);
executed (the execution status of this line is deduced): QEvent e(QEvent::ContentsRectChange);
-
6731 QApplication::sendEvent(this, &e);
executed (the execution status of this line is deduced): QApplication::sendEvent(this, &e);
-
6732}
executed: }
Execution Count:8687
8687
6733 -
6734/*! -
6735 \overload -
6736 \since 4.6 -
6737 -
6738 \brief The setContentsMargins function sets the margins around the -
6739 widget's contents. -
6740 -
6741 Sets the margins around the contents of the widget to have the -
6742 sizes determined by \a margins. The margins are -
6743 used by the layout system, and may be used by subclasses to -
6744 specify the area to draw in (e.g. excluding the frame). -
6745 -
6746 Changing the margins will trigger a resizeEvent(). -
6747 -
6748 \sa contentsRect(), getContentsMargins() -
6749*/ -
6750void QWidget::setContentsMargins(const QMargins &margins) -
6751{ -
6752 setContentsMargins(margins.left(), margins.top(),
never executed (the execution status of this line is deduced): setContentsMargins(margins.left(), margins.top(),
-
6753 margins.right(), margins.bottom());
never executed (the execution status of this line is deduced): margins.right(), margins.bottom());
-
6754}
never executed: }
0
6755 -
6756/*! -
6757 Returns the widget's contents margins for \a left, \a top, \a -
6758 right, and \a bottom. -
6759 -
6760 \sa setContentsMargins(), contentsRect() -
6761 */ -
6762void QWidget::getContentsMargins(int *left, int *top, int *right, int *bottom) const -
6763{ -
6764 Q_D(const QWidget);
executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
6765 if (left)
evaluated: left
TRUEFALSE
yes
Evaluation Count:3323
yes
Evaluation Count:2
2-3323
6766 *left = d->leftmargin;
executed: *left = d->leftmargin;
Execution Count:3323
3323
6767 if (top)
evaluated: top
TRUEFALSE
yes
Evaluation Count:3240
yes
Evaluation Count:85
85-3240
6768 *top = d->topmargin;
executed: *top = d->topmargin;
Execution Count:3240
3240
6769 if (right)
evaluated: right
TRUEFALSE
yes
Evaluation Count:3323
yes
Evaluation Count:2
2-3323
6770 *right = d->rightmargin;
executed: *right = d->rightmargin;
Execution Count:3323
3323
6771 if (bottom)
evaluated: bottom
TRUEFALSE
yes
Evaluation Count:3240
yes
Evaluation Count:85
85-3240
6772 *bottom = d->bottommargin;
executed: *bottom = d->bottommargin;
Execution Count:3240
3240
6773}
executed: }
Execution Count:3325
3325
6774 -
6775/*! -
6776 \since 4.6 -
6777 -
6778 \brief The contentsMargins function returns the widget's contents margins. -
6779 -
6780 \sa getContentsMargins(), setContentsMargins(), contentsRect() -
6781 */ -
6782QMargins QWidget::contentsMargins() const -
6783{ -
6784 Q_D(const QWidget);
never executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
6785 return QMargins(d->leftmargin, d->topmargin, d->rightmargin, d->bottommargin);
never executed: return QMargins(d->leftmargin, d->topmargin, d->rightmargin, d->bottommargin);
0
6786} -
6787 -
6788 -
6789/*! -
6790 Returns the area inside the widget's margins. -
6791 -
6792 \sa setContentsMargins(), getContentsMargins() -
6793*/ -
6794QRect QWidget::contentsRect() const -
6795{ -
6796 Q_D(const QWidget);
executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
6797 return QRect(QPoint(d->leftmargin, d->topmargin),
executed: return QRect(QPoint(d->leftmargin, d->topmargin), QPoint(data->crect.width() - 1 - d->rightmargin, data->crect.height() - 1 - d->bottommargin));
Execution Count:260960
260960
6798 QPoint(data->crect.width() - 1 - d->rightmargin,
executed: return QRect(QPoint(d->leftmargin, d->topmargin), QPoint(data->crect.width() - 1 - d->rightmargin, data->crect.height() - 1 - d->bottommargin));
Execution Count:260960
260960
6799 data->crect.height() - 1 - d->bottommargin));
executed: return QRect(QPoint(d->leftmargin, d->topmargin), QPoint(data->crect.width() - 1 - d->rightmargin, data->crect.height() - 1 - d->bottommargin));
Execution Count:260960
260960
6800 -
6801} -
6802 -
6803 -
6804 -
6805/*! -
6806 \fn void QWidget::customContextMenuRequested(const QPoint &pos) -
6807 -
6808 This signal is emitted when the widget's \l contextMenuPolicy is -
6809 Qt::CustomContextMenu, and the user has requested a context menu on -
6810 the widget. The position \a pos is the position of the context menu -
6811 event that the widget receives. Normally this is in widget -
6812 coordinates. The exception to this rule is QAbstractScrollArea and -
6813 its subclasses that map the context menu event to coordinates of the -
6814 \l{QAbstractScrollArea::viewport()}{viewport()}. -
6815 -
6816 -
6817 \sa mapToGlobal(), QMenu, contextMenuPolicy -
6818*/ -
6819 -
6820 -
6821/*! -
6822 \property QWidget::contextMenuPolicy -
6823 \brief how the widget shows a context menu -
6824 -
6825 The default value of this property is Qt::DefaultContextMenu, -
6826 which means the contextMenuEvent() handler is called. Other values -
6827 are Qt::NoContextMenu, Qt::PreventContextMenu, -
6828 Qt::ActionsContextMenu, and Qt::CustomContextMenu. With -
6829 Qt::CustomContextMenu, the signal customContextMenuRequested() is -
6830 emitted. -
6831 -
6832 \sa contextMenuEvent(), customContextMenuRequested(), actions() -
6833*/ -
6834 -
6835Qt::ContextMenuPolicy QWidget::contextMenuPolicy() const -
6836{ -
6837 return (Qt::ContextMenuPolicy)data->context_menu_policy;
executed: return (Qt::ContextMenuPolicy)data->context_menu_policy;
Execution Count:34
34
6838} -
6839 -
6840void QWidget::setContextMenuPolicy(Qt::ContextMenuPolicy policy) -
6841{ -
6842 data->context_menu_policy = (uint) policy;
executed (the execution status of this line is deduced): data->context_menu_policy = (uint) policy;
-
6843}
executed: }
Execution Count:1300
1300
6844 -
6845/*! -
6846 \property QWidget::focusPolicy -
6847 \brief the way the widget accepts keyboard focus -
6848 -
6849 The policy is Qt::TabFocus if the widget accepts keyboard -
6850 focus by tabbing, Qt::ClickFocus if the widget accepts -
6851 focus by clicking, Qt::StrongFocus if it accepts both, and -
6852 Qt::NoFocus (the default) if it does not accept focus at -
6853 all. -
6854 -
6855 You must enable keyboard focus for a widget if it processes -
6856 keyboard events. This is normally done from the widget's -
6857 constructor. For instance, the QLineEdit constructor calls -
6858 setFocusPolicy(Qt::StrongFocus). -
6859 -
6860 If the widget has a focus proxy, then the focus policy will -
6861 be propagated to it. -
6862 -
6863 \sa focusInEvent(), focusOutEvent(), keyPressEvent(), keyReleaseEvent(), enabled -
6864*/ -
6865 -
6866 -
6867Qt::FocusPolicy QWidget::focusPolicy() const -
6868{ -
6869 return (Qt::FocusPolicy)data->focus_policy;
executed: return (Qt::FocusPolicy)data->focus_policy;
Execution Count:66995
66995
6870} -
6871 -
6872void QWidget::setFocusPolicy(Qt::FocusPolicy policy) -
6873{ -
6874 data->focus_policy = (uint) policy;
executed (the execution status of this line is deduced): data->focus_policy = (uint) policy;
-
6875 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
6876 if (d->extra && d->extra->focus_proxy)
evaluated: d->extra
TRUEFALSE
yes
Evaluation Count:2115
yes
Evaluation Count:26505
evaluated: d->extra->focus_proxy
TRUEFALSE
yes
Evaluation Count:860
yes
Evaluation Count:1255
860-26505
6877 d->extra->focus_proxy->setFocusPolicy(policy);
executed: d->extra->focus_proxy->setFocusPolicy(policy);
Execution Count:860
860
6878}
executed: }
Execution Count:28620
28620
6879 -
6880/*! -
6881 \property QWidget::updatesEnabled -
6882 \brief whether updates are enabled -
6883 -
6884 An updates enabled widget receives paint events and has a system -
6885 background; a disabled widget does not. This also implies that -
6886 calling update() and repaint() has no effect if updates are -
6887 disabled. -
6888 -
6889 By default, this property is true. -
6890 -
6891 setUpdatesEnabled() is normally used to disable updates for a -
6892 short period of time, for instance to avoid screen flicker during -
6893 large changes. In Qt, widgets normally do not generate screen -
6894 flicker, but on X11 the server might erase regions on the screen -
6895 when widgets get hidden before they can be replaced by other -
6896 widgets. Disabling updates solves this. -
6897 -
6898 Example: -
6899 \snippet code/src_gui_kernel_qwidget.cpp 13 -
6900 -
6901 Disabling a widget implicitly disables all its children. Enabling a widget -
6902 enables all child widgets \e except top-level widgets or those that -
6903 have been explicitly disabled. Re-enabling updates implicitly calls -
6904 update() on the widget. -
6905 -
6906 \sa paintEvent() -
6907*/ -
6908void QWidget::setUpdatesEnabled(bool enable) -
6909{ -
6910 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
6911 setAttribute(Qt::WA_ForceUpdatesDisabled, !enable);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_ForceUpdatesDisabled, !enable);
-
6912 d->setUpdatesEnabled_helper(enable);
executed (the execution status of this line is deduced): d->setUpdatesEnabled_helper(enable);
-
6913}
executed: }
Execution Count:2522
2522
6914 -
6915/*! -
6916 Shows the widget and its child widgets. This function is -
6917 equivalent to setVisible(true) in the normal case, and equivalent -
6918 to showFullScreen() if the QStyleHints::showIsFullScreen() hint -
6919 is true. -
6920 -
6921 \sa raise(), showEvent(), hide(), setVisible(), showMinimized(), showMaximized(), -
6922 showNormal(), isVisible() -
6923*/ -
6924void QWidget::show() -
6925{ -
6926 if (isWindow() && qApp->styleHints()->showIsFullScreen())
evaluated: isWindow()
TRUEFALSE
yes
Evaluation Count:2812
yes
Evaluation Count:11646
partially evaluated: (static_cast<QApplication *>(QCoreApplication::instance()))->styleHints()->showIsFullScreen()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2812
0-11646
6927 showFullScreen();
never executed: showFullScreen();
0
6928 else -
6929 setVisible(true);
executed: setVisible(true);
Execution Count:14458
14458
6930} -
6931 -
6932/*! \internal -
6933 -
6934 Makes the widget visible in the isVisible() meaning of the word. -
6935 It is only called for toplevels or widgets with visible parents. -
6936 */ -
6937void QWidgetPrivate::show_recursive() -
6938{ -
6939 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
6940 // polish if necessary -
6941 -
6942 if (!q->testAttribute(Qt::WA_WState_Created))
evaluated: !q->testAttribute(Qt::WA_WState_Created)
TRUEFALSE
yes
Evaluation Count:725
yes
Evaluation Count:3706
725-3706
6943 createRecursively();
executed: createRecursively();
Execution Count:725
725
6944 q->ensurePolished();
executed (the execution status of this line is deduced): q->ensurePolished();
-
6945 -
6946 if (!q->isWindow() && q->parentWidget()->d_func()->layout && !q->parentWidget()->data->in_show)
partially evaluated: !q->isWindow()
TRUEFALSE
yes
Evaluation Count:4431
no
Evaluation Count:0
evaluated: q->parentWidget()->d_func()->layout
TRUEFALSE
yes
Evaluation Count:3339
yes
Evaluation Count:1092
partially evaluated: !q->parentWidget()->data->in_show
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3339
0-4431
6947 q->parentWidget()->d_func()->layout->activate();
never executed: q->parentWidget()->d_func()->layout->activate();
0
6948 // activate our layout before we and our children become visible -
6949 if (layout)
evaluated: layout
TRUEFALSE
yes
Evaluation Count:1073
yes
Evaluation Count:3358
1073-3358
6950 layout->activate();
executed: layout->activate();
Execution Count:1073
1073
6951 -
6952 show_helper();
executed (the execution status of this line is deduced): show_helper();
-
6953}
executed: }
Execution Count:4431
4431
6954 -
6955void QWidgetPrivate::sendPendingMoveAndResizeEvents(bool recursive, bool disableUpdates) -
6956{ -
6957 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
6958 -
6959 disableUpdates = disableUpdates && q->updatesEnabled();
evaluated: disableUpdates
TRUEFALSE
yes
Evaluation Count:1568
yes
Evaluation Count:14991
partially evaluated: q->updatesEnabled()
TRUEFALSE
yes
Evaluation Count:1568
no
Evaluation Count:0
0-14991
6960 if (disableUpdates)
evaluated: disableUpdates
TRUEFALSE
yes
Evaluation Count:1568
yes
Evaluation Count:14991
1568-14991
6961 q->setAttribute(Qt::WA_UpdatesDisabled);
executed: q->setAttribute(Qt::WA_UpdatesDisabled);
Execution Count:1568
1568
6962 -
6963 if (q->testAttribute(Qt::WA_PendingMoveEvent)) {
evaluated: q->testAttribute(Qt::WA_PendingMoveEvent)
TRUEFALSE
yes
Evaluation Count:11797
yes
Evaluation Count:4762
4762-11797
6964 QMoveEvent e(data.crect.topLeft(), data.crect.topLeft());
executed (the execution status of this line is deduced): QMoveEvent e(data.crect.topLeft(), data.crect.topLeft());
-
6965 QApplication::sendEvent(q, &e);
executed (the execution status of this line is deduced): QApplication::sendEvent(q, &e);
-
6966 q->setAttribute(Qt::WA_PendingMoveEvent, false);
executed (the execution status of this line is deduced): q->setAttribute(Qt::WA_PendingMoveEvent, false);
-
6967 }
executed: }
Execution Count:11797
11797
6968 -
6969 if (q->testAttribute(Qt::WA_PendingResizeEvent)) {
evaluated: q->testAttribute(Qt::WA_PendingResizeEvent)
TRUEFALSE
yes
Evaluation Count:11993
yes
Evaluation Count:4566
4566-11993
6970 QResizeEvent e(data.crect.size(), QSize());
executed (the execution status of this line is deduced): QResizeEvent e(data.crect.size(), QSize());
-
6971 QApplication::sendEvent(q, &e);
executed (the execution status of this line is deduced): QApplication::sendEvent(q, &e);
-
6972 q->setAttribute(Qt::WA_PendingResizeEvent, false);
executed (the execution status of this line is deduced): q->setAttribute(Qt::WA_PendingResizeEvent, false);
-
6973 }
executed: }
Execution Count:11993
11993
6974 -
6975 if (disableUpdates)
evaluated: disableUpdates
TRUEFALSE
yes
Evaluation Count:1568
yes
Evaluation Count:14991
1568-14991
6976 q->setAttribute(Qt::WA_UpdatesDisabled, false);
executed: q->setAttribute(Qt::WA_UpdatesDisabled, false);
Execution Count:1568
1568
6977 -
6978 if (!recursive)
evaluated: !recursive
TRUEFALSE
yes
Evaluation Count:15150
yes
Evaluation Count:1409
1409-15150
6979 return;
executed: return;
Execution Count:15150
15150
6980 -
6981 for (int i = 0; i < children.size(); ++i) {
evaluated: i < children.size()
TRUEFALSE
yes
Evaluation Count:1618
yes
Evaluation Count:1409
1409-1618
6982 if (QWidget *child = qobject_cast<QWidget *>(children.at(i)))
evaluated: QWidget *child = qobject_cast<QWidget *>(children.at(i))
TRUEFALSE
yes
Evaluation Count:1302
yes
Evaluation Count:316
316-1302
6983 child->d_func()->sendPendingMoveAndResizeEvents(recursive, disableUpdates);
executed: child->d_func()->sendPendingMoveAndResizeEvents(recursive, disableUpdates);
Execution Count:1302
1302
6984 }
executed: }
Execution Count:1618
1618
6985}
executed: }
Execution Count:1409
1409
6986 -
6987void QWidgetPrivate::activateChildLayoutsRecursively() -
6988{ -
6989 sendPendingMoveAndResizeEvents(false, true);
executed (the execution status of this line is deduced): sendPendingMoveAndResizeEvents(false, true);
-
6990 -
6991 for (int i = 0; i < children.size(); ++i) {
evaluated: i < children.size()
TRUEFALSE
yes
Evaluation Count:137
yes
Evaluation Count:159
137-159
6992 QWidget *child = qobject_cast<QWidget *>(children.at(i));
executed (the execution status of this line is deduced): QWidget *child = qobject_cast<QWidget *>(children.at(i));
-
6993 if (!child || child->isHidden() || child->isWindow())
evaluated: !child
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:135
evaluated: child->isHidden()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:131
partially evaluated: child->isWindow()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:131
0-135
6994 continue;
executed: continue;
Execution Count:6
6
6995 -
6996 child->ensurePolished();
executed (the execution status of this line is deduced): child->ensurePolished();
-
6997 -
6998 // Activate child's layout -
6999 QWidgetPrivate *childPrivate = child->d_func();
executed (the execution status of this line is deduced): QWidgetPrivate *childPrivate = child->d_func();
-
7000 if (childPrivate->layout)
partially evaluated: childPrivate->layout
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:131
0-131
7001 childPrivate->layout->activate();
never executed: childPrivate->layout->activate();
0
7002 -
7003 // Pretend we're visible. -
7004 const bool wasVisible = child->isVisible();
executed (the execution status of this line is deduced): const bool wasVisible = child->isVisible();
-
7005 if (!wasVisible)
partially evaluated: !wasVisible
TRUEFALSE
yes
Evaluation Count:131
no
Evaluation Count:0
0-131
7006 child->setAttribute(Qt::WA_WState_Visible);
executed: child->setAttribute(Qt::WA_WState_Visible);
Execution Count:131
131
7007 -
7008 // Do the same for all my children. -
7009 childPrivate->activateChildLayoutsRecursively();
executed (the execution status of this line is deduced): childPrivate->activateChildLayoutsRecursively();
-
7010 -
7011 // We're not cheating anymore. -
7012 if (!wasVisible)
partially evaluated: !wasVisible
TRUEFALSE
yes
Evaluation Count:131
no
Evaluation Count:0
0-131
7013 child->setAttribute(Qt::WA_WState_Visible, false);
executed: child->setAttribute(Qt::WA_WState_Visible, false);
Execution Count:131
131
7014 }
executed: }
Execution Count:131
131
7015}
executed: }
Execution Count:159
159
7016 -
7017void QWidgetPrivate::show_helper() -
7018{ -
7019 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
7020 data.in_show = true; // qws optimization
executed (the execution status of this line is deduced): data.in_show = true;
-
7021 // make sure we receive pending move and resize events -
7022 sendPendingMoveAndResizeEvents();
executed (the execution status of this line is deduced): sendPendingMoveAndResizeEvents();
-
7023 -
7024 // become visible before showing all children -
7025 q->setAttribute(Qt::WA_WState_Visible);
executed (the execution status of this line is deduced): q->setAttribute(Qt::WA_WState_Visible);
-
7026 -
7027 // finally show all children recursively -
7028 showChildren(false);
executed (the execution status of this line is deduced): showChildren(false);
-
7029 -
7030 -
7031 -
7032 // popup handling: new popups and tools need to be raised, and -
7033 // existing popups must be closed. Also propagate the current -
7034 // windows's KeyboardFocusChange status. -
7035 if (q->isWindow()) {
evaluated: q->isWindow()
TRUEFALSE
yes
Evaluation Count:2545
yes
Evaluation Count:12446
2545-12446
7036 if ((q->windowType() == Qt::Tool) || (q->windowType() == Qt::Popup) || q->windowType() == Qt::ToolTip) {
evaluated: (q->windowType() == Qt::Tool)
TRUEFALSE
yes
Evaluation Count:16
yes
Evaluation Count:2529
evaluated: (q->windowType() == Qt::Popup)
TRUEFALSE
yes
Evaluation Count:96
yes
Evaluation Count:2433
evaluated: q->windowType() == Qt::ToolTip
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:2420
13-2529
7037 q->raise();
executed (the execution status of this line is deduced): q->raise();
-
7038 if (q->parentWidget() && q->parentWidget()->window()->testAttribute(Qt::WA_KeyboardFocusChange))
evaluated: q->parentWidget()
TRUEFALSE
yes
Evaluation Count:60
yes
Evaluation Count:65
evaluated: q->parentWidget()->window()->testAttribute(Qt::WA_KeyboardFocusChange)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:59
1-65
7039 q->setAttribute(Qt::WA_KeyboardFocusChange);
executed: q->setAttribute(Qt::WA_KeyboardFocusChange);
Execution Count:1
1
7040 } else {
executed: }
Execution Count:125
125
7041 while (QApplication::activePopupWidget()) {
evaluated: QApplication::activePopupWidget()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:2420
1-2420
7042 if (!QApplication::activePopupWidget()->close())
partially evaluated: !QApplication::activePopupWidget()->close()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
7043 break;
never executed: break;
0
7044 }
executed: }
Execution Count:1
1
7045 }
executed: }
Execution Count:2420
2420
7046 } -
7047 -
7048 // Automatic embedding of child windows of widgets already embedded into -
7049 // QGraphicsProxyWidget when they are shown the first time. -
7050 bool isEmbedded = false;
executed (the execution status of this line is deduced): bool isEmbedded = false;
-
7051#ifndef QT_NO_GRAPHICSVIEW -
7052 if (q->isWindow()) {
evaluated: q->isWindow()
TRUEFALSE
yes
Evaluation Count:2545
yes
Evaluation Count:12446
2545-12446
7053 isEmbedded = q->graphicsProxyWidget() ? true : false;
evaluated: q->graphicsProxyWidget()
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:2537
8-2537
7054 if (!isEmbedded && !bypassGraphicsProxyWidget(q)) {
evaluated: !isEmbedded
TRUEFALSE
yes
Evaluation Count:2537
yes
Evaluation Count:8
evaluated: !bypassGraphicsProxyWidget(q)
TRUEFALSE
yes
Evaluation Count:2529
yes
Evaluation Count:8
8-2537
7055 QGraphicsProxyWidget *ancestorProxy = nearestGraphicsProxyWidget(q->parentWidget());
executed (the execution status of this line is deduced): QGraphicsProxyWidget *ancestorProxy = nearestGraphicsProxyWidget(q->parentWidget());
-
7056 if (ancestorProxy) {
partially evaluated: ancestorProxy
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2529
0-2529
7057 isEmbedded = true;
never executed (the execution status of this line is deduced): isEmbedded = true;
-
7058 ancestorProxy->d_func()->embedSubWindow(q);
never executed (the execution status of this line is deduced): ancestorProxy->d_func()->embedSubWindow(q);
-
7059 }
never executed: }
0
7060 }
executed: }
Execution Count:2529
2529
7061 }
executed: }
Execution Count:2545
2545
7062#else -
7063 Q_UNUSED(isEmbedded); -
7064#endif -
7065 -
7066 // On Windows, show the popup now so that our own focus handling -
7067 // stores the correct old focus widget even if it's stolen in the -
7068 // showevent -
7069#if defined(Q_WS_WIN) || defined(Q_WS_MAC) -
7070 if (!isEmbedded && q->windowType() == Qt::Popup) -
7071 qApp->d_func()->openPopup(q); -
7072#endif -
7073 -
7074 // send the show event before showing the window -
7075 QShowEvent showEvent;
executed (the execution status of this line is deduced): QShowEvent showEvent;
-
7076 QApplication::sendEvent(q, &showEvent);
executed (the execution status of this line is deduced): QApplication::sendEvent(q, &showEvent);
-
7077 -
7078 show_sys();
executed (the execution status of this line is deduced): show_sys();
-
7079 -
7080 if (!isEmbedded && q->windowType() == Qt::Popup)
evaluated: !isEmbedded
TRUEFALSE
yes
Evaluation Count:14983
yes
Evaluation Count:8
evaluated: q->windowType() == Qt::Popup
TRUEFALSE
yes
Evaluation Count:96
yes
Evaluation Count:14887
8-14983
7081 qApp->d_func()->openPopup(q);
executed: (static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->openPopup(q);
Execution Count:96
96
7082 -
7083#ifndef QT_NO_ACCESSIBILITY -
7084 if (q->windowType() != Qt::ToolTip) { // Tooltips are read aloud twice in MS narrator.
evaluated: q->windowType() != Qt::ToolTip
TRUEFALSE
yes
Evaluation Count:14978
yes
Evaluation Count:13
13-14978
7085 QAccessibleEvent event(q, QAccessible::ObjectShow);
executed (the execution status of this line is deduced): QAccessibleEvent event(q, QAccessible::ObjectShow);
-
7086 QAccessible::updateAccessibility(&event);
executed (the execution status of this line is deduced): QAccessible::updateAccessibility(&event);
-
7087 }
executed: }
Execution Count:14978
14978
7088#endif -
7089 -
7090 if (QApplicationPrivate::hidden_focus_widget == q) {
evaluated: QApplicationPrivate::hidden_focus_widget == q
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:14986
5-14986
7091 QApplicationPrivate::hidden_focus_widget = 0;
executed (the execution status of this line is deduced): QApplicationPrivate::hidden_focus_widget = 0;
-
7092 q->setFocus(Qt::OtherFocusReason);
executed (the execution status of this line is deduced): q->setFocus(Qt::OtherFocusReason);
-
7093 }
executed: }
Execution Count:5
5
7094 -
7095 // Process events when showing a Qt::SplashScreen widget before the event loop -
7096 // is spinnning; otherwise it might not show up on particular platforms. -
7097 // This makes QSplashScreen behave the same on all platforms. -
7098 if (!qApp->d_func()->in_exec && q->windowType() == Qt::SplashScreen)
evaluated: !(static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->in_exec
TRUEFALSE
yes
Evaluation Count:14856
yes
Evaluation Count:135
evaluated: q->windowType() == Qt::SplashScreen
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:14855
1-14856
7099 QApplication::processEvents();
executed: QApplication::processEvents();
Execution Count:1
1
7100 -
7101 data.in_show = false; // reset qws optimization
executed (the execution status of this line is deduced): data.in_show = false;
-
7102}
executed: }
Execution Count:14991
14991
7103 -
7104/*! -
7105 Hides the widget. This function is equivalent to -
7106 setVisible(false). -
7107 -
7108 -
7109 \note If you are working with QDialog or its subclasses and you invoke -
7110 the show() function after this function, the dialog will be displayed in -
7111 its original position. -
7112 -
7113 \sa hideEvent(), isHidden(), show(), setVisible(), isVisible(), close() -
7114*/ -
7115void QWidget::hide() -
7116{ -
7117 setVisible(false);
executed (the execution status of this line is deduced): setVisible(false);
-
7118}
executed: }
Execution Count:7397
7397
7119 -
7120/*!\internal -
7121 */ -
7122void QWidgetPrivate::hide_helper() -
7123{ -
7124 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
7125 -
7126 bool isEmbedded = false;
executed (the execution status of this line is deduced): bool isEmbedded = false;
-
7127#if !defined QT_NO_GRAPHICSVIEW -
7128 isEmbedded = q->isWindow() && !bypassGraphicsProxyWidget(q) && nearestGraphicsProxyWidget(q->parentWidget()) != 0;
evaluated: q->isWindow()
TRUEFALSE
yes
Evaluation Count:2511
yes
Evaluation Count:1380
evaluated: !bypassGraphicsProxyWidget(q)
TRUEFALSE
yes
Evaluation Count:2504
yes
Evaluation Count:7
partially evaluated: nearestGraphicsProxyWidget(q->parentWidget()) != 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2504
0-2511
7129#else -
7130 Q_UNUSED(isEmbedded); -
7131#endif -
7132 -
7133 if (!isEmbedded && (q->windowType() == Qt::Popup))
partially evaluated: !isEmbedded
TRUEFALSE
yes
Evaluation Count:3891
no
Evaluation Count:0
evaluated: (q->windowType() == Qt::Popup)
TRUEFALSE
yes
Evaluation Count:95
yes
Evaluation Count:3796
0-3891
7134 qApp->d_func()->closePopup(q);
executed: (static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->closePopup(q);
Execution Count:95
95
7135 -
7136#if defined(Q_WS_WIN) -
7137 if (q->isWindow() && !(q->windowType() == Qt::Popup) && q->parentWidget() -
7138 && !q->parentWidget()->isHidden() && q->isActiveWindow()) -
7139 q->parentWidget()->activateWindow(); // Activate parent -
7140#endif -
7141 -
7142 q->setAttribute(Qt::WA_Mapped, false);
executed (the execution status of this line is deduced): q->setAttribute(Qt::WA_Mapped, false);
-
7143 hide_sys();
executed (the execution status of this line is deduced): hide_sys();
-
7144 -
7145 bool wasVisible = q->testAttribute(Qt::WA_WState_Visible);
executed (the execution status of this line is deduced): bool wasVisible = q->testAttribute(Qt::WA_WState_Visible);
-
7146 -
7147 if (wasVisible) {
evaluated: wasVisible
TRUEFALSE
yes
Evaluation Count:3527
yes
Evaluation Count:364
364-3527
7148 q->setAttribute(Qt::WA_WState_Visible, false);
executed (the execution status of this line is deduced): q->setAttribute(Qt::WA_WState_Visible, false);
-
7149 -
7150 }
executed: }
Execution Count:3527
3527
7151 -
7152 QHideEvent hideEvent;
executed (the execution status of this line is deduced): QHideEvent hideEvent;
-
7153 QApplication::sendEvent(q, &hideEvent);
executed (the execution status of this line is deduced): QApplication::sendEvent(q, &hideEvent);
-
7154 hideChildren(false);
executed (the execution status of this line is deduced): hideChildren(false);
-
7155 -
7156 // next bit tries to move the focus if the focus widget is now -
7157 // hidden. -
7158 if (wasVisible) {
evaluated: wasVisible
TRUEFALSE
yes
Evaluation Count:3527
yes
Evaluation Count:364
364-3527
7159 qApp->d_func()->sendSyntheticEnterLeave(q);
executed (the execution status of this line is deduced): (static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->sendSyntheticEnterLeave(q);
-
7160 QWidget *fw = QApplication::focusWidget();
executed (the execution status of this line is deduced): QWidget *fw = QApplication::focusWidget();
-
7161 while (fw && !fw->isWindow()) {
evaluated: fw
TRUEFALSE
yes
Evaluation Count:1128
yes
Evaluation Count:3012
evaluated: !fw->isWindow()
TRUEFALSE
yes
Evaluation Count:787
yes
Evaluation Count:341
341-3012
7162 if (fw == q) {
evaluated: fw == q
TRUEFALSE
yes
Evaluation Count:174
yes
Evaluation Count:613
174-613
7163 q->focusNextPrevChild(true);
executed (the execution status of this line is deduced): q->focusNextPrevChild(true);
-
7164 break;
executed: break;
Execution Count:174
174
7165 } -
7166 fw = fw->parentWidget();
executed (the execution status of this line is deduced): fw = fw->parentWidget();
-
7167 }
executed: }
Execution Count:613
613
7168 }
executed: }
Execution Count:3527
3527
7169 -
7170 if (QWidgetBackingStore *bs = maybeBackingStore())
partially evaluated: QWidgetBackingStore *bs = maybeBackingStore()
TRUEFALSE
yes
Evaluation Count:3891
no
Evaluation Count:0
0-3891
7171 bs->removeDirtyWidget(q);
executed: bs->removeDirtyWidget(q);
Execution Count:3891
3891
7172 -
7173#ifndef QT_NO_ACCESSIBILITY -
7174 if (wasVisible) {
evaluated: wasVisible
TRUEFALSE
yes
Evaluation Count:3527
yes
Evaluation Count:364
364-3527
7175 QAccessibleEvent event(q, QAccessible::ObjectHide);
executed (the execution status of this line is deduced): QAccessibleEvent event(q, QAccessible::ObjectHide);
-
7176 QAccessible::updateAccessibility(&event);
executed (the execution status of this line is deduced): QAccessible::updateAccessibility(&event);
-
7177 }
executed: }
Execution Count:3527
3527
7178#endif -
7179}
executed: }
Execution Count:3891
3891
7180 -
7181/*! -
7182 \fn bool QWidget::isHidden() const -
7183 -
7184 Returns true if the widget is hidden, otherwise returns false. -
7185 -
7186 A hidden widget will only become visible when show() is called on -
7187 it. It will not be automatically shown when the parent is shown. -
7188 -
7189 To check visibility, use !isVisible() instead (notice the exclamation mark). -
7190 -
7191 isHidden() implies !isVisible(), but a widget can be not visible -
7192 and not hidden at the same time. This is the case for widgets that are children of -
7193 widgets that are not visible. -
7194 -
7195 -
7196 Widgets are hidden if: -
7197 \list -
7198 \li they were created as independent windows, -
7199 \li they were created as children of visible widgets, -
7200 \li hide() or setVisible(false) was called. -
7201 \endlist -
7202*/ -
7203 -
7204 -
7205void QWidget::setVisible(bool visible) -
7206{ -
7207 if (visible) { // show
evaluated: visible
TRUEFALSE
yes
Evaluation Count:26431
yes
Evaluation Count:72501
26431-72501
7208 if (testAttribute(Qt::WA_WState_ExplicitShowHide) && !testAttribute(Qt::WA_WState_Hidden))
evaluated: testAttribute(Qt::WA_WState_ExplicitShowHide)
TRUEFALSE
yes
Evaluation Count:14265
yes
Evaluation Count:12166
evaluated: !testAttribute(Qt::WA_WState_Hidden)
TRUEFALSE
yes
Evaluation Count:10348
yes
Evaluation Count:3917
3917-14265
7209 return;
executed: return;
Execution Count:10348
10348
7210 -
7211 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
7212 -
7213 // Designer uses a trick to make grabWidget work without showing -
7214 if (!isWindow() && parentWidget() && parentWidget()->isVisible()
evaluated: !isWindow()
TRUEFALSE
yes
Evaluation Count:13538
yes
Evaluation Count:2545
partially evaluated: parentWidget()
TRUEFALSE
yes
Evaluation Count:13538
no
Evaluation Count:0
evaluated: parentWidget()->isVisible()
TRUEFALSE
yes
Evaluation Count:8015
yes
Evaluation Count:5523
0-13538
7215 && !parentWidget()->testAttribute(Qt::WA_WState_Created))
partially evaluated: !parentWidget()->testAttribute(Qt::WA_WState_Created)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8015
0-8015
7216 parentWidget()->window()->d_func()->createRecursively();
never executed: parentWidget()->window()->d_func()->createRecursively();
0
7217 -
7218 //we have to at least create toplevels before applyX11SpecificCommandLineArguments -
7219 //but not children of non-visible parents -
7220 QWidget *pw = parentWidget();
executed (the execution status of this line is deduced): QWidget *pw = parentWidget();
-
7221 if (!testAttribute(Qt::WA_WState_Created)
evaluated: !testAttribute(Qt::WA_WState_Created)
TRUEFALSE
yes
Evaluation Count:13819
yes
Evaluation Count:2264
2264-13819
7222 && (isWindow() || pw->testAttribute(Qt::WA_WState_Created))) {
evaluated: isWindow()
TRUEFALSE
yes
Evaluation Count:2390
yes
Evaluation Count:11429
evaluated: pw->testAttribute(Qt::WA_WState_Created)
TRUEFALSE
yes
Evaluation Count:6674
yes
Evaluation Count:4755
2390-11429
7223 create();
executed (the execution status of this line is deduced): create();
-
7224 }
executed: }
Execution Count:9064
9064
7225 -
7226#if defined(Q_WS_X11) -
7227 if (windowType() == Qt::Window) -
7228 QApplicationPrivate::applyX11SpecificCommandLineArguments(this); -
7229#endif -
7230 -
7231 bool wasResized = testAttribute(Qt::WA_Resized);
executed (the execution status of this line is deduced): bool wasResized = testAttribute(Qt::WA_Resized);
-
7232 Qt::WindowStates initialWindowState = windowState();
executed (the execution status of this line is deduced): Qt::WindowStates initialWindowState = windowState();
-
7233 -
7234 // polish if necessary -
7235 ensurePolished();
executed (the execution status of this line is deduced): ensurePolished();
-
7236 -
7237 // remember that show was called explicitly -
7238 setAttribute(Qt::WA_WState_ExplicitShowHide);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_WState_ExplicitShowHide);
-
7239 // whether we need to inform the parent widget immediately -
7240 bool needUpdateGeometry = !isWindow() && testAttribute(Qt::WA_WState_Hidden);
evaluated: !isWindow()
TRUEFALSE
yes
Evaluation Count:13538
yes
Evaluation Count:2545
evaluated: testAttribute(Qt::WA_WState_Hidden)
TRUEFALSE
yes
Evaluation Count:4111
yes
Evaluation Count:9427
2545-13538
7241 // we are no longer hidden -
7242 setAttribute(Qt::WA_WState_Hidden, false);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_WState_Hidden, false);
-
7243 -
7244 if (needUpdateGeometry)
evaluated: needUpdateGeometry
TRUEFALSE
yes
Evaluation Count:4111
yes
Evaluation Count:11972
4111-11972
7245 d->updateGeometry_helper(true);
executed: d->updateGeometry_helper(true);
Execution Count:4111
4111
7246 -
7247 // activate our layout before we and our children become visible -
7248 if (d->layout)
evaluated: d->layout
TRUEFALSE
yes
Evaluation Count:3334
yes
Evaluation Count:12749
3334-12749
7249 d->layout->activate();
executed: d->layout->activate();
Execution Count:3334
3334
7250 -
7251 if (!isWindow()) {
evaluated: !isWindow()
TRUEFALSE
yes
Evaluation Count:13538
yes
Evaluation Count:2545
2545-13538
7252 QWidget *parent = parentWidget();
executed (the execution status of this line is deduced): QWidget *parent = parentWidget();
-
7253 while (parent && parent->isVisible() && parent->d_func()->layout && !parent->data->in_show) {
partially evaluated: parent
TRUEFALSE
yes
Evaluation Count:13616
no
Evaluation Count:0
evaluated: parent->isVisible()
TRUEFALSE
yes
Evaluation Count:8093
yes
Evaluation Count:5523
evaluated: parent->d_func()->layout
TRUEFALSE
yes
Evaluation Count:2876
yes
Evaluation Count:5217
evaluated: !parent->data->in_show
TRUEFALSE
yes
Evaluation Count:182
yes
Evaluation Count:2694
0-13616
7254 parent->d_func()->layout->activate();
executed (the execution status of this line is deduced): parent->d_func()->layout->activate();
-
7255 if (parent->isWindow())
evaluated: parent->isWindow()
TRUEFALSE
yes
Evaluation Count:104
yes
Evaluation Count:78
78-104
7256 break;
executed: break;
Execution Count:104
104
7257 parent = parent->parentWidget();
executed (the execution status of this line is deduced): parent = parent->parentWidget();
-
7258 }
executed: }
Execution Count:78
78
7259 if (parent)
partially evaluated: parent
TRUEFALSE
yes
Evaluation Count:13538
no
Evaluation Count:0
0-13538
7260 parent->d_func()->setDirtyOpaqueRegion();
executed: parent->d_func()->setDirtyOpaqueRegion();
Execution Count:13538
13538
7261 }
executed: }
Execution Count:13538
13538
7262 -
7263 // adjust size if necessary -
7264 if (!wasResized
evaluated: !wasResized
TRUEFALSE
yes
Evaluation Count:6150
yes
Evaluation Count:9933
6150-9933
7265 && (isWindow() || !parentWidget()->d_func()->layout)) {
evaluated: isWindow()
TRUEFALSE
yes
Evaluation Count:1598
yes
Evaluation Count:4552
evaluated: !parentWidget()->d_func()->layout
TRUEFALSE
yes
Evaluation Count:1875
yes
Evaluation Count:2677
1598-4552
7266 if (isWindow()) {
evaluated: isWindow()
TRUEFALSE
yes
Evaluation Count:1598
yes
Evaluation Count:1875
1598-1875
7267 adjustSize();
executed (the execution status of this line is deduced): adjustSize();
-
7268 if (windowState() != initialWindowState)
partially evaluated: windowState() != initialWindowState
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1598
0-1598
7269 setWindowState(initialWindowState);
never executed: setWindowState(initialWindowState);
0
7270 } else {
executed: }
Execution Count:1598
1598
7271 adjustSize();
executed (the execution status of this line is deduced): adjustSize();
-
7272 }
executed: }
Execution Count:1875
1875
7273 setAttribute(Qt::WA_Resized, false);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_Resized, false);
-
7274 }
executed: }
Execution Count:3473
3473
7275 -
7276 setAttribute(Qt::WA_KeyboardFocusChange, false);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_KeyboardFocusChange, false);
-
7277 -
7278 if (isWindow() || parentWidget()->isVisible()) {
evaluated: isWindow()
TRUEFALSE
yes
Evaluation Count:2545
yes
Evaluation Count:13538
evaluated: parentWidget()->isVisible()
TRUEFALSE
yes
Evaluation Count:8015
yes
Evaluation Count:5523
2545-13538
7279 d->show_helper();
executed (the execution status of this line is deduced): d->show_helper();
-
7280 -
7281 qApp->d_func()->sendSyntheticEnterLeave(this);
executed (the execution status of this line is deduced): (static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->sendSyntheticEnterLeave(this);
-
7282 }
executed: }
Execution Count:10560
10560
7283 -
7284 QEvent showToParentEvent(QEvent::ShowToParent);
executed (the execution status of this line is deduced): QEvent showToParentEvent(QEvent::ShowToParent);
-
7285 QApplication::sendEvent(this, &showToParentEvent);
executed (the execution status of this line is deduced): QApplication::sendEvent(this, &showToParentEvent);
-
7286 } else { // hide
executed: }
Execution Count:16083
16083
7287 if (testAttribute(Qt::WA_WState_ExplicitShowHide) && testAttribute(Qt::WA_WState_Hidden))
evaluated: testAttribute(Qt::WA_WState_ExplicitShowHide)
TRUEFALSE
yes
Evaluation Count:60166
yes
Evaluation Count:12335
evaluated: testAttribute(Qt::WA_WState_Hidden)
TRUEFALSE
yes
Evaluation Count:54991
yes
Evaluation Count:5175
5175-60166
7288 return;
executed: return;
Execution Count:54991
54991
7289#if defined(Q_WS_WIN) -
7290 // reset WS_DISABLED style in a Blocked window -
7291 if(isWindow() && testAttribute(Qt::WA_WState_Created) -
7292 && QApplicationPrivate::isBlockedByModal(this)) -
7293 { -
7294 LONG dwStyle = GetWindowLong(winId(), GWL_STYLE); -
7295 dwStyle &= ~WS_DISABLED; -
7296 SetWindowLong(winId(), GWL_STYLE, dwStyle); -
7297 } -
7298#endif -
7299 if (QApplicationPrivate::hidden_focus_widget == this)
evaluated: QApplicationPrivate::hidden_focus_widget == this
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:17508
2-17508
7300 QApplicationPrivate::hidden_focus_widget = 0;
executed: QApplicationPrivate::hidden_focus_widget = 0;
Execution Count:2
2
7301 -
7302 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
7303 -
7304 // hw: The test on getOpaqueRegion() needs to be more intelligent -
7305 // currently it doesn't work if the widget is hidden (the region will -
7306 // be clipped). The real check should be testing the cached region -
7307 // (and dirty flag) directly. -
7308 if (!isWindow() && parentWidget()) // && !d->getOpaqueRegion().isEmpty())
evaluated: !isWindow()
TRUEFALSE
yes
Evaluation Count:14586
yes
Evaluation Count:2924
partially evaluated: parentWidget()
TRUEFALSE
yes
Evaluation Count:14586
no
Evaluation Count:0
0-14586
7309 parentWidget()->d_func()->setDirtyOpaqueRegion();
executed: parentWidget()->d_func()->setDirtyOpaqueRegion();
Execution Count:14586
14586
7310 -
7311 setAttribute(Qt::WA_WState_Hidden);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_WState_Hidden);
-
7312 setAttribute(Qt::WA_WState_ExplicitShowHide);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_WState_ExplicitShowHide);
-
7313 if (testAttribute(Qt::WA_WState_Created))
evaluated: testAttribute(Qt::WA_WState_Created)
TRUEFALSE
yes
Evaluation Count:3891
yes
Evaluation Count:13619
3891-13619
7314 d->hide_helper();
executed: d->hide_helper();
Execution Count:3891
3891
7315 -
7316 // invalidate layout similar to updateGeometry() -
7317 if (!isWindow() && parentWidget()) {
evaluated: !isWindow()
TRUEFALSE
yes
Evaluation Count:14586
yes
Evaluation Count:2924
partially evaluated: parentWidget()
TRUEFALSE
yes
Evaluation Count:14586
no
Evaluation Count:0
0-14586
7318 if (parentWidget()->d_func()->layout)
evaluated: parentWidget()->d_func()->layout
TRUEFALSE
yes
Evaluation Count:1959
yes
Evaluation Count:12627
1959-12627
7319 parentWidget()->d_func()->layout->invalidate();
executed: parentWidget()->d_func()->layout->invalidate();
Execution Count:1959
1959
7320 else if (parentWidget()->isVisible())
evaluated: parentWidget()->isVisible()
TRUEFALSE
yes
Evaluation Count:882
yes
Evaluation Count:11745
882-11745
7321 QApplication::postEvent(parentWidget(), new QEvent(QEvent::LayoutRequest));
executed: QApplication::postEvent(parentWidget(), new QEvent(QEvent::LayoutRequest));
Execution Count:882
882
7322 } -
7323 -
7324 QEvent hideToParentEvent(QEvent::HideToParent);
executed (the execution status of this line is deduced): QEvent hideToParentEvent(QEvent::HideToParent);
-
7325 QApplication::sendEvent(this, &hideToParentEvent);
executed (the execution status of this line is deduced): QApplication::sendEvent(this, &hideToParentEvent);
-
7326 }
executed: }
Execution Count:17510
17510
7327} -
7328 -
7329/*! -
7330 Convenience function, equivalent to setVisible(!\a hidden). -
7331*/ -
7332void QWidget::setHidden(bool hidden) -
7333{ -
7334 setVisible(!hidden);
executed (the execution status of this line is deduced): setVisible(!hidden);
-
7335}
executed: }
Execution Count:6919
6919
7336 -
7337void QWidgetPrivate::_q_showIfNotHidden() -
7338{ -
7339 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
7340 if ( !(q->isHidden() && q->testAttribute(Qt::WA_WState_ExplicitShowHide)) )
evaluated: q->isHidden()
TRUEFALSE
yes
Evaluation Count:23
yes
Evaluation Count:14
evaluated: q->testAttribute(Qt::WA_WState_ExplicitShowHide)
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:19
4-23
7341 q->setVisible(true);
executed: q->setVisible(true);
Execution Count:33
33
7342}
executed: }
Execution Count:37
37
7343 -
7344void QWidgetPrivate::showChildren(bool spontaneous) -
7345{ -
7346 QList<QObject*> childList = children;
executed (the execution status of this line is deduced): QList<QObject*> childList = children;
-
7347 for (int i = 0; i < childList.size(); ++i) {
evaluated: i < childList.size()
TRUEFALSE
yes
Evaluation Count:25307
yes
Evaluation Count:14991
14991-25307
7348 QWidget *widget = qobject_cast<QWidget*>(childList.at(i));
executed (the execution status of this line is deduced): QWidget *widget = qobject_cast<QWidget*>(childList.at(i));
-
7349 if (!widget
evaluated: !widget
TRUEFALSE
yes
Evaluation Count:7440
yes
Evaluation Count:17867
7440-17867
7350 || widget->isWindow()
evaluated: widget->isWindow()
TRUEFALSE
yes
Evaluation Count:736
yes
Evaluation Count:17131
736-17131
7351 || widget->testAttribute(Qt::WA_WState_Hidden))
evaluated: widget->testAttribute(Qt::WA_WState_Hidden)
TRUEFALSE
yes
Evaluation Count:6359
yes
Evaluation Count:10772
6359-10772
7352 continue;
executed: continue;
Execution Count:14535
14535
7353 if (spontaneous) {
partially evaluated: spontaneous
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:10772
0-10772
7354 widget->setAttribute(Qt::WA_Mapped);
never executed (the execution status of this line is deduced): widget->setAttribute(Qt::WA_Mapped);
-
7355 widget->d_func()->showChildren(true);
never executed (the execution status of this line is deduced): widget->d_func()->showChildren(true);
-
7356 QShowEvent e;
never executed (the execution status of this line is deduced): QShowEvent e;
-
7357 QApplication::sendSpontaneousEvent(widget, &e);
never executed (the execution status of this line is deduced): QApplication::sendSpontaneousEvent(widget, &e);
-
7358 } else {
never executed: }
0
7359 if (widget->testAttribute(Qt::WA_WState_ExplicitShowHide))
evaluated: widget->testAttribute(Qt::WA_WState_ExplicitShowHide)
TRUEFALSE
yes
Evaluation Count:4431
yes
Evaluation Count:6341
4431-6341
7360 widget->d_func()->show_recursive();
executed: widget->d_func()->show_recursive();
Execution Count:4431
4431
7361 else -
7362 widget->show();
executed: widget->show();
Execution Count:6341
6341
7363 } -
7364 } -
7365}
executed: }
Execution Count:14991
14991
7366 -
7367void QWidgetPrivate::hideChildren(bool spontaneous) -
7368{ -
7369 QList<QObject*> childList = children;
executed (the execution status of this line is deduced): QList<QObject*> childList = children;
-
7370 for (int i = 0; i < childList.size(); ++i) {
evaluated: i < childList.size()
TRUEFALSE
yes
Evaluation Count:24659
yes
Evaluation Count:14628
14628-24659
7371 QWidget *widget = qobject_cast<QWidget*>(childList.at(i));
executed (the execution status of this line is deduced): QWidget *widget = qobject_cast<QWidget*>(childList.at(i));
-
7372 if (!widget || widget->isWindow() || widget->testAttribute(Qt::WA_WState_Hidden))
evaluated: !widget
TRUEFALSE
yes
Evaluation Count:7297
yes
Evaluation Count:17362
evaluated: widget->isWindow()
TRUEFALSE
yes
Evaluation Count:784
yes
Evaluation Count:16578
evaluated: widget->testAttribute(Qt::WA_WState_Hidden)
TRUEFALSE
yes
Evaluation Count:5841
yes
Evaluation Count:10737
784-17362
7373 continue;
executed: continue;
Execution Count:13922
13922
7374#ifdef Q_WS_MAC -
7375 // Before doing anything we need to make sure that we don't leave anything in a non-consistent state. -
7376 // When hiding a widget we need to make sure that no mouse_down events are active, because -
7377 // the mouse_up event will never be received by a hidden widget or one of its descendants. -
7378 // The solution is simple, before going through with this we check if there are any mouse_down events in -
7379 // progress, if so we check if it is related to this widget or not. If so, we just reset the mouse_down and -
7380 // then we continue. -
7381 // In X11 and Windows we send a mouse_release event, however we don't do that here because we were already -
7382 // ignoring that from before. I.e. Carbon did not send the mouse release event, so we will not send the -
7383 // mouse release event. There are two ways to interpret this: -
7384 // 1. If we don't send the mouse release event, the widget might get into an inconsistent state, i.e. it -
7385 // might be waiting for a release event that will never arrive. -
7386 // 2. If we send the mouse release event, then the widget might decide to trigger an action that is not -
7387 // supposed to trigger because it is not visible. -
7388 if(widget == qt_button_down) -
7389 qt_button_down = 0; -
7390#endif // Q_WS_MAC -
7391 if (spontaneous)
partially evaluated: spontaneous
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:10737
0-10737
7392 widget->setAttribute(Qt::WA_Mapped, false);
never executed: widget->setAttribute(Qt::WA_Mapped, false);
0
7393 else -
7394 widget->setAttribute(Qt::WA_WState_Visible, false);
executed: widget->setAttribute(Qt::WA_WState_Visible, false);
Execution Count:10737
10737
7395 widget->d_func()->hideChildren(spontaneous);
executed (the execution status of this line is deduced): widget->d_func()->hideChildren(spontaneous);
-
7396 QHideEvent e;
executed (the execution status of this line is deduced): QHideEvent e;
-
7397 if (spontaneous) {
partially evaluated: spontaneous
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:10737
0-10737
7398 QApplication::sendSpontaneousEvent(widget, &e);
never executed (the execution status of this line is deduced): QApplication::sendSpontaneousEvent(widget, &e);
-
7399 } else {
never executed: }
0
7400 QApplication::sendEvent(widget, &e);
executed (the execution status of this line is deduced): QApplication::sendEvent(widget, &e);
-
7401 if (widget->internalWinId()
evaluated: widget->internalWinId()
TRUEFALSE
yes
Evaluation Count:23
yes
Evaluation Count:10714
23-10714
7402 && widget->testAttribute(Qt::WA_DontCreateNativeAncestors)) {
evaluated: widget->testAttribute(Qt::WA_DontCreateNativeAncestors)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:22
1-22
7403 // hide_sys() on an ancestor won't have any affect on this -
7404 // widget, so it needs an explicit hide_sys() of its own -
7405 widget->d_func()->hide_sys();
executed (the execution status of this line is deduced): widget->d_func()->hide_sys();
-
7406 }
executed: }
Execution Count:1
1
7407 }
executed: }
Execution Count:10737
10737
7408 qApp->d_func()->sendSyntheticEnterLeave(widget);
executed (the execution status of this line is deduced): (static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->sendSyntheticEnterLeave(widget);
-
7409#ifndef QT_NO_ACCESSIBILITY -
7410 if (!spontaneous) {
partially evaluated: !spontaneous
TRUEFALSE
yes
Evaluation Count:10737
no
Evaluation Count:0
0-10737
7411 QAccessibleEvent event(widget, QAccessible::ObjectHide);
executed (the execution status of this line is deduced): QAccessibleEvent event(widget, QAccessible::ObjectHide);
-
7412 QAccessible::updateAccessibility(&event);
executed (the execution status of this line is deduced): QAccessible::updateAccessibility(&event);
-
7413 }
executed: }
Execution Count:10737
10737
7414#endif -
7415 }
executed: }
Execution Count:10737
10737
7416}
executed: }
Execution Count:14628
14628
7417 -
7418bool QWidgetPrivate::close_helper(CloseMode mode) -
7419{ -
7420 if (data.is_closing)
evaluated: data.is_closing
TRUEFALSE
yes
Evaluation Count:26
yes
Evaluation Count:2281
26-2281
7421 return true;
executed: return true;
Execution Count:26
26
7422 -
7423 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
7424 data.is_closing = 1;
executed (the execution status of this line is deduced): data.is_closing = 1;
-
7425 -
7426 QPointer<QWidget> that = q;
executed (the execution status of this line is deduced): QPointer<QWidget> that = q;
-
7427 QPointer<QWidget> parentWidget = q->parentWidget();
executed (the execution status of this line is deduced): QPointer<QWidget> parentWidget = q->parentWidget();
-
7428 -
7429 bool quitOnClose = q->testAttribute(Qt::WA_QuitOnClose);
executed (the execution status of this line is deduced): bool quitOnClose = q->testAttribute(Qt::WA_QuitOnClose);
-
7430 if (mode != CloseNoEvent) {
evaluated: mode != CloseNoEvent
TRUEFALSE
yes
Evaluation Count:98
yes
Evaluation Count:2183
98-2183
7431 QCloseEvent e;
executed (the execution status of this line is deduced): QCloseEvent e;
-
7432 if (mode == CloseWithSpontaneousEvent)
partially evaluated: mode == CloseWithSpontaneousEvent
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:98
0-98
7433 QApplication::sendSpontaneousEvent(q, &e);
never executed: QApplication::sendSpontaneousEvent(q, &e);
0
7434 else -
7435 QApplication::sendEvent(q, &e);
executed: QApplication::sendEvent(q, &e);
Execution Count:98
98
7436 if (!that.isNull() && !e.isAccepted()) {
evaluated: !that.isNull()
TRUEFALSE
yes
Evaluation Count:97
yes
Evaluation Count:1
evaluated: !e.isAccepted()
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:91
1-97
7437 data.is_closing = 0;
executed (the execution status of this line is deduced): data.is_closing = 0;
-
7438 return false;
executed: return false;
Execution Count:6
6
7439 } -
7440 }
executed: }
Execution Count:92
92
7441 -
7442 if (!that.isNull() && !q->isHidden())
evaluated: !that.isNull()
TRUEFALSE
yes
Evaluation Count:2274
yes
Evaluation Count:1
evaluated: !q->isHidden()
TRUEFALSE
yes
Evaluation Count:2159
yes
Evaluation Count:115
1-2274
7443 q->hide();
executed: q->hide();
Execution Count:2159
2159
7444 -
7445 // Attempt to close the application only if this has WA_QuitOnClose set and a non-visible parent -
7446 quitOnClose = quitOnClose && (parentWidget.isNull() || !parentWidget->isVisible());
evaluated: quitOnClose
TRUEFALSE
yes
Evaluation Count:2197
yes
Evaluation Count:78
evaluated: parentWidget.isNull()
TRUEFALSE
yes
Evaluation Count:2148
yes
Evaluation Count:49
evaluated: !parentWidget->isVisible()
TRUEFALSE
yes
Evaluation Count:33
yes
Evaluation Count:16
16-2197
7447 -
7448 if (quitOnClose) {
evaluated: quitOnClose
TRUEFALSE
yes
Evaluation Count:2181
yes
Evaluation Count:94
94-2181
7449 /* if there is no non-withdrawn primary window left (except -
7450 the ones without QuitOnClose), we emit the lastWindowClosed -
7451 signal */ -
7452 QWidgetList list = QApplication::topLevelWidgets();
executed (the execution status of this line is deduced): QWidgetList list = QApplication::topLevelWidgets();
-
7453 bool lastWindowClosed = true;
executed (the execution status of this line is deduced): bool lastWindowClosed = true;
-
7454 for (int i = 0; i < list.size(); ++i) {
evaluated: i < list.size()
TRUEFALSE
yes
Evaluation Count:3611
yes
Evaluation Count:1728
1728-3611
7455 QWidget *w = list.at(i);
executed (the execution status of this line is deduced): QWidget *w = list.at(i);
-
7456 if (!w->isVisible() || w->parentWidget() || !w->testAttribute(Qt::WA_QuitOnClose))
evaluated: !w->isVisible()
TRUEFALSE
yes
Evaluation Count:3079
yes
Evaluation Count:532
evaluated: w->parentWidget()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:527
evaluated: !w->testAttribute(Qt::WA_QuitOnClose)
TRUEFALSE
yes
Evaluation Count:74
yes
Evaluation Count:453
5-3079
7457 continue;
executed: continue;
Execution Count:3158
3158
7458 lastWindowClosed = false;
executed (the execution status of this line is deduced): lastWindowClosed = false;
-
7459 break;
executed: break;
Execution Count:453
453
7460 } -
7461 if (lastWindowClosed) {
evaluated: lastWindowClosed
TRUEFALSE
yes
Evaluation Count:1728
yes
Evaluation Count:453
453-1728
7462 QGuiApplicationPrivate::emitLastWindowClosed();
executed (the execution status of this line is deduced): QGuiApplicationPrivate::emitLastWindowClosed();
-
7463 QCoreApplicationPrivate *applicationPrivate = static_cast<QCoreApplicationPrivate*>(QObjectPrivate::get(QCoreApplication::instance()));
executed (the execution status of this line is deduced): QCoreApplicationPrivate *applicationPrivate = static_cast<QCoreApplicationPrivate*>(QObjectPrivate::get(QCoreApplication::instance()));
-
7464 applicationPrivate->maybeQuit();
executed (the execution status of this line is deduced): applicationPrivate->maybeQuit();
-
7465 }
executed: }
Execution Count:1728
1728
7466 }
executed: }
Execution Count:2181
2181
7467 -
7468 -
7469 if (!that.isNull()) {
evaluated: !that.isNull()
TRUEFALSE
yes
Evaluation Count:2274
yes
Evaluation Count:1
1-2274
7470 data.is_closing = 0;
executed (the execution status of this line is deduced): data.is_closing = 0;
-
7471 if (q->testAttribute(Qt::WA_DeleteOnClose)) {
evaluated: q->testAttribute(Qt::WA_DeleteOnClose)
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:2260
14-2260
7472 q->setAttribute(Qt::WA_DeleteOnClose, false);
executed (the execution status of this line is deduced): q->setAttribute(Qt::WA_DeleteOnClose, false);
-
7473 q->deleteLater();
executed (the execution status of this line is deduced): q->deleteLater();
-
7474 }
executed: }
Execution Count:14
14
7475 }
executed: }
Execution Count:2274
2274
7476 return true;
executed: return true;
Execution Count:2275
2275
7477} -
7478 -
7479 -
7480/*! -
7481 Closes this widget. Returns true if the widget was closed; -
7482 otherwise returns false. -
7483 -
7484 First it sends the widget a QCloseEvent. The widget is -
7485 \l{hide()}{hidden} if it \l{QCloseEvent::accept()}{accepts} -
7486 the close event. If it \l{QCloseEvent::ignore()}{ignores} -
7487 the event, nothing happens. The default -
7488 implementation of QWidget::closeEvent() accepts the close event. -
7489 -
7490 If the widget has the Qt::WA_DeleteOnClose flag, the widget -
7491 is also deleted. A close events is delivered to the widget no -
7492 matter if the widget is visible or not. -
7493 -
7494 The \l QApplication::lastWindowClosed() signal is emitted when the -
7495 last visible primary window (i.e. window with no parent) with the -
7496 Qt::WA_QuitOnClose attribute set is closed. By default this -
7497 attribute is set for all widgets except transient windows such as -
7498 splash screens, tool windows, and popup menus. -
7499 -
7500*/ -
7501 -
7502bool QWidget::close() -
7503{ -
7504 return d_func()->close_helper(QWidgetPrivate::CloseWithEvent);
executed: return d_func()->close_helper(QWidgetPrivate::CloseWithEvent);
Execution Count:98
98
7505} -
7506 -
7507/*! -
7508 \property QWidget::visible -
7509 \brief whether the widget is visible -
7510 -
7511 Calling setVisible(true) or show() sets the widget to visible -
7512 status if all its parent widgets up to the window are visible. If -
7513 an ancestor is not visible, the widget won't become visible until -
7514 all its ancestors are shown. If its size or position has changed, -
7515 Qt guarantees that a widget gets move and resize events just -
7516 before it is shown. If the widget has not been resized yet, Qt -
7517 will adjust the widget's size to a useful default using -
7518 adjustSize(). -
7519 -
7520 Calling setVisible(false) or hide() hides a widget explicitly. An -
7521 explicitly hidden widget will never become visible, even if all -
7522 its ancestors become visible, unless you show it. -
7523 -
7524 A widget receives show and hide events when its visibility status -
7525 changes. Between a hide and a show event, there is no need to -
7526 waste CPU cycles preparing or displaying information to the user. -
7527 A video application, for example, might simply stop generating new -
7528 frames. -
7529 -
7530 A widget that happens to be obscured by other windows on the -
7531 screen is considered to be visible. The same applies to iconified -
7532 windows and windows that exist on another virtual -
7533 desktop (on platforms that support this concept). A widget -
7534 receives spontaneous show and hide events when its mapping status -
7535 is changed by the window system, e.g. a spontaneous hide event -
7536 when the user minimizes the window, and a spontaneous show event -
7537 when the window is restored again. -
7538 -
7539 You almost never have to reimplement the setVisible() function. If -
7540 you need to change some settings before a widget is shown, use -
7541 showEvent() instead. If you need to do some delayed initialization -
7542 use the Polish event delivered to the event() function. -
7543 -
7544 \sa show(), hide(), isHidden(), isVisibleTo(), isMinimized(), -
7545 showEvent(), hideEvent() -
7546*/ -
7547 -
7548 -
7549/*! -
7550 Returns true if this widget would become visible if \a ancestor is -
7551 shown; otherwise returns false. -
7552 -
7553 The true case occurs if neither the widget itself nor any parent -
7554 up to but excluding \a ancestor has been explicitly hidden. -
7555 -
7556 This function will still return true if the widget is obscured by -
7557 other windows on the screen, but could be physically visible if it -
7558 or they were to be moved. -
7559 -
7560 isVisibleTo(0) is identical to isVisible(). -
7561 -
7562 \sa show(), hide(), isVisible() -
7563*/ -
7564 -
7565bool QWidget::isVisibleTo(const QWidget *ancestor) const -
7566{ -
7567 if (!ancestor)
partially evaluated: !ancestor
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1801
0-1801
7568 return isVisible();
never executed: return isVisible();
0
7569 const QWidget * w = this;
executed (the execution status of this line is deduced): const QWidget * w = this;
-
7570 while (!w->isHidden()
evaluated: !w->isHidden()
TRUEFALSE
yes
Evaluation Count:3292
yes
Evaluation Count:733
733-3292
7571 && !w->isWindow()
evaluated: !w->isWindow()
TRUEFALSE
yes
Evaluation Count:2899
yes
Evaluation Count:393
393-2899
7572 && w->parentWidget()
partially evaluated: w->parentWidget()
TRUEFALSE
yes
Evaluation Count:2899
no
Evaluation Count:0
0-2899
7573 && w->parentWidget() != ancestor)
evaluated: w->parentWidget() != ancestor
TRUEFALSE
yes
Evaluation Count:2224
yes
Evaluation Count:675
675-2224
7574 w = w->parentWidget();
executed: w = w->parentWidget();
Execution Count:2224
2224
7575 return !w->isHidden();
executed: return !w->isHidden();
Execution Count:1801
1801
7576} -
7577 -
7578 -
7579/*! -
7580 Returns the unobscured region where paint events can occur. -
7581 -
7582 For visible widgets, this is an approximation of the area not -
7583 covered by other widgets; otherwise, this is an empty region. -
7584 -
7585 The repaint() function calls this function if necessary, so in -
7586 general you do not need to call it. -
7587 -
7588*/ -
7589QRegion QWidget::visibleRegion() const -
7590{ -
7591 Q_D(const QWidget);
executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
7592 -
7593 QRect clipRect = d->clipRect();
executed (the execution status of this line is deduced): QRect clipRect = d->clipRect();
-
7594 if (clipRect.isEmpty())
partially evaluated: clipRect.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:27
0-27
7595 return QRegion();
never executed: return QRegion();
0
7596 QRegion r(clipRect);
executed (the execution status of this line is deduced): QRegion r(clipRect);
-
7597 d->subtractOpaqueChildren(r, clipRect);
executed (the execution status of this line is deduced): d->subtractOpaqueChildren(r, clipRect);
-
7598 d->subtractOpaqueSiblings(r);
executed (the execution status of this line is deduced): d->subtractOpaqueSiblings(r);
-
7599 return r;
executed: return r;
Execution Count:27
27
7600} -
7601 -
7602 -
7603QSize QWidgetPrivate::adjustedSize() const -
7604{ -
7605 Q_Q(const QWidget);
executed (the execution status of this line is deduced): const QWidget * const q = q_func();
-
7606 -
7607 QSize s = q->sizeHint();
executed (the execution status of this line is deduced): QSize s = q->sizeHint();
-
7608 -
7609 if (q->isWindow()) {
evaluated: q->isWindow()
TRUEFALSE
yes
Evaluation Count:1802
yes
Evaluation Count:1890
1802-1890
7610 Qt::Orientations exp;
executed (the execution status of this line is deduced): Qt::Orientations exp;
-
7611 if (layout) {
evaluated: layout
TRUEFALSE
yes
Evaluation Count:279
yes
Evaluation Count:1523
279-1523
7612 if (layout->hasHeightForWidth())
evaluated: layout->hasHeightForWidth()
TRUEFALSE
yes
Evaluation Count:17
yes
Evaluation Count:262
17-262
7613 s.setHeight(layout->totalHeightForWidth(s.width()));
executed: s.setHeight(layout->totalHeightForWidth(s.width()));
Execution Count:17
17
7614 exp = layout->expandingDirections();
executed (the execution status of this line is deduced): exp = layout->expandingDirections();
-
7615 } else
executed: }
Execution Count:279
279
7616 { -
7617 if (q->sizePolicy().hasHeightForWidth())
evaluated: q->sizePolicy().hasHeightForWidth()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:1519
4-1519
7618 s.setHeight(q->heightForWidth(s.width()));
executed: s.setHeight(q->heightForWidth(s.width()));
Execution Count:4
4
7619 exp = q->sizePolicy().expandingDirections();
executed (the execution status of this line is deduced): exp = q->sizePolicy().expandingDirections();
-
7620 }
executed: }
Execution Count:1523
1523
7621 if (exp & Qt::Horizontal)
evaluated: exp & Qt::Horizontal
TRUEFALSE
yes
Evaluation Count:967
yes
Evaluation Count:835
835-967
7622 s.setWidth(qMax(s.width(), 200));
executed: s.setWidth(qMax(s.width(), 200));
Execution Count:967
967
7623 if (exp & Qt::Vertical)
evaluated: exp & Qt::Vertical
TRUEFALSE
yes
Evaluation Count:852
yes
Evaluation Count:950
852-950
7624 s.setHeight(qMax(s.height(), 100));
executed: s.setHeight(qMax(s.height(), 100));
Execution Count:852
852
7625#if defined(Q_WS_X11) -
7626 QRect screen = QApplication::desktop()->screenGeometry(q->x11Info().screen()); -
7627#else // all others -
7628 QRect screen = QApplication::desktop()->screenGeometry(q->pos());
executed (the execution status of this line is deduced): QRect screen = QApplication::desktop()->screenGeometry(q->pos());
-
7629#endif -
7630#if defined (Q_OS_WINCE) -
7631 s.setWidth(qMin(s.width(), screen.width())); -
7632 s.setHeight(qMin(s.height(), screen.height())); -
7633#else -
7634 s.setWidth(qMin(s.width(), screen.width()*2/3));
executed (the execution status of this line is deduced): s.setWidth(qMin(s.width(), screen.width()*2/3));
-
7635 s.setHeight(qMin(s.height(), screen.height()*2/3));
executed (the execution status of this line is deduced): s.setHeight(qMin(s.height(), screen.height()*2/3));
-
7636#endif -
7637 if (QTLWExtra *extra = maybeTopData())
evaluated: QTLWExtra *extra = maybeTopData()
TRUEFALSE
yes
Evaluation Count:1660
yes
Evaluation Count:142
142-1660
7638 extra->sizeAdjusted = true;
executed: extra->sizeAdjusted = true;
Execution Count:1660
1660
7639 }
executed: }
Execution Count:1802
1802
7640 -
7641 if (!s.isValid()) {
evaluated: !s.isValid()
TRUEFALSE
yes
Evaluation Count:846
yes
Evaluation Count:2846
846-2846
7642 QRect r = q->childrenRect(); // get children rectangle
executed (the execution status of this line is deduced): QRect r = q->childrenRect();
-
7643 if (r.isNull())
evaluated: r.isNull()
TRUEFALSE
yes
Evaluation Count:659
yes
Evaluation Count:187
187-659
7644 return s;
executed: return s;
Execution Count:659
659
7645 s = r.size() + QSize(2 * r.x(), 2 * r.y());
executed (the execution status of this line is deduced): s = r.size() + QSize(2 * r.x(), 2 * r.y());
-
7646 }
executed: }
Execution Count:187
187
7647 -
7648 return s;
executed: return s;
Execution Count:3033
3033
7649} -
7650 -
7651/*! -
7652 Adjusts the size of the widget to fit its contents. -
7653 -
7654 This function uses sizeHint() if it is valid, i.e., the size hint's width -
7655 and height are \>= 0. Otherwise, it sets the size to the children -
7656 rectangle that covers all child widgets (the union of all child widget -
7657 rectangles). -
7658 -
7659 For windows, the screen size is also taken into account. If the sizeHint() -
7660 is less than (200, 100) and the size policy is \l{QSizePolicy::Expanding} -
7661 {expanding}, the window will be at least (200, 100). The maximum size of -
7662 a window is 2/3 of the screen's width and height. -
7663 -
7664 \sa sizeHint(), childrenRect() -
7665*/ -
7666 -
7667void QWidget::adjustSize() -
7668{ -
7669 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
7670 ensurePolished();
executed (the execution status of this line is deduced): ensurePolished();
-
7671 QSize s = d->adjustedSize();
executed (the execution status of this line is deduced): QSize s = d->adjustedSize();
-
7672 -
7673 if (d->layout)
evaluated: d->layout
TRUEFALSE
yes
Evaluation Count:823
yes
Evaluation Count:2869
823-2869
7674 d->layout->activate();
executed: d->layout->activate();
Execution Count:823
823
7675 -
7676 if (s.isValid())
evaluated: s.isValid()
TRUEFALSE
yes
Evaluation Count:3033
yes
Evaluation Count:659
659-3033
7677 resize(s);
executed: resize(s);
Execution Count:3033
3033
7678}
executed: }
Execution Count:3692
3692
7679 -
7680 -
7681/*! -
7682 \property QWidget::sizeHint -
7683 \brief the recommended size for the widget -
7684 -
7685 If the value of this property is an invalid size, no size is -
7686 recommended. -
7687 -
7688 The default implementation of sizeHint() returns an invalid size -
7689 if there is no layout for this widget, and returns the layout's -
7690 preferred size otherwise. -
7691 -
7692 \sa QSize::isValid(), minimumSizeHint(), sizePolicy(), -
7693 setMinimumSize(), updateGeometry() -
7694*/ -
7695 -
7696QSize QWidget::sizeHint() const -
7697{ -
7698 Q_D(const QWidget);
executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
7699 if (d->layout)
evaluated: d->layout
TRUEFALSE
yes
Evaluation Count:10701
yes
Evaluation Count:10389
10389-10701
7700 return d->layout->totalSizeHint();
executed: return d->layout->totalSizeHint();
Execution Count:10701
10701
7701 return QSize(-1, -1);
executed: return QSize(-1, -1);
Execution Count:10389
10389
7702} -
7703 -
7704/*! -
7705 \property QWidget::minimumSizeHint -
7706 \brief the recommended minimum size for the widget -
7707 -
7708 If the value of this property is an invalid size, no minimum size -
7709 is recommended. -
7710 -
7711 The default implementation of minimumSizeHint() returns an invalid -
7712 size if there is no layout for this widget, and returns the -
7713 layout's minimum size otherwise. Most built-in widgets reimplement -
7714 minimumSizeHint(). -
7715 -
7716 \l QLayout will never resize a widget to a size smaller than the -
7717 minimum size hint unless minimumSize() is set or the size policy is -
7718 set to QSizePolicy::Ignore. If minimumSize() is set, the minimum -
7719 size hint will be ignored. -
7720 -
7721 \sa QSize::isValid(), resize(), setMinimumSize(), sizePolicy() -
7722*/ -
7723QSize QWidget::minimumSizeHint() const -
7724{ -
7725 Q_D(const QWidget);
executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
7726 if (d->layout)
evaluated: d->layout
TRUEFALSE
yes
Evaluation Count:3603
yes
Evaluation Count:11680
3603-11680
7727 return d->layout->totalMinimumSize();
executed: return d->layout->totalMinimumSize();
Execution Count:3603
3603
7728 return QSize(-1, -1);
executed: return QSize(-1, -1);
Execution Count:11680
11680
7729} -
7730 -
7731 -
7732/*! -
7733 \fn QWidget *QWidget::parentWidget() const -
7734 -
7735 Returns the parent of this widget, or 0 if it does not have any -
7736 parent widget. -
7737*/ -
7738 -
7739 -
7740/*! -
7741 Returns true if this widget is a parent, (or grandparent and so on -
7742 to any level), of the given \a child, and both widgets are within -
7743 the same window; otherwise returns false. -
7744*/ -
7745 -
7746bool QWidget::isAncestorOf(const QWidget *child) const -
7747{ -
7748 while (child) {
evaluated: child
TRUEFALSE
yes
Evaluation Count:80360
yes
Evaluation Count:42085
42085-80360
7749 if (child == this)
evaluated: child == this
TRUEFALSE
yes
Evaluation Count:7244
yes
Evaluation Count:73116
7244-73116
7750 return true;
executed: return true;
Execution Count:7244
7244
7751 if (child->isWindow())
evaluated: child->isWindow()
TRUEFALSE
yes
Evaluation Count:17074
yes
Evaluation Count:56042
17074-56042
7752 return false;
executed: return false;
Execution Count:17074
17074
7753 child = child->parentWidget();
executed (the execution status of this line is deduced): child = child->parentWidget();
-
7754 }
executed: }
Execution Count:56042
56042
7755 return false;
executed: return false;
Execution Count:42085
42085
7756} -
7757 -
7758#if defined(Q_WS_WIN) -
7759inline void setDisabledStyle(QWidget *w, bool setStyle) -
7760{ -
7761 // set/reset WS_DISABLED style. -
7762 if(w && w->isWindow() && w->isVisible() && w->isEnabled()) { -
7763 LONG dwStyle = GetWindowLong(w->winId(), GWL_STYLE); -
7764 LONG newStyle = dwStyle; -
7765 if (setStyle) -
7766 newStyle |= WS_DISABLED; -
7767 else -
7768 newStyle &= ~WS_DISABLED; -
7769 if (newStyle != dwStyle) { -
7770 SetWindowLong(w->winId(), GWL_STYLE, newStyle); -
7771 // we might need to repaint in some situations (eg. menu) -
7772 w->repaint(); -
7773 } -
7774 } -
7775} -
7776#endif -
7777 -
7778/***************************************************************************** -
7779 QWidget event handling -
7780 *****************************************************************************/ -
7781 -
7782/*! -
7783 This is the main event handler; it handles event \a event. You can -
7784 reimplement this function in a subclass, but we recommend using -
7785 one of the specialized event handlers instead. -
7786 -
7787 Key press and release events are treated differently from other -
7788 events. event() checks for Tab and Shift+Tab and tries to move the -
7789 focus appropriately. If there is no widget to move the focus to -
7790 (or the key press is not Tab or Shift+Tab), event() calls -
7791 keyPressEvent(). -
7792 -
7793 Mouse and tablet event handling is also slightly special: only -
7794 when the widget is \l enabled, event() will call the specialized -
7795 handlers such as mousePressEvent(); otherwise it will discard the -
7796 event. -
7797 -
7798 This function returns true if the event was recognized, otherwise -
7799 it returns false. If the recognized event was accepted (see \l -
7800 QEvent::accepted), any further processing such as event -
7801 propagation to the parent widget stops. -
7802 -
7803 \sa closeEvent(), focusInEvent(), focusOutEvent(), enterEvent(), -
7804 keyPressEvent(), keyReleaseEvent(), leaveEvent(), -
7805 mouseDoubleClickEvent(), mouseMoveEvent(), mousePressEvent(), -
7806 mouseReleaseEvent(), moveEvent(), paintEvent(), resizeEvent(), -
7807 QObject::event(), QObject::timerEvent() -
7808*/ -
7809 -
7810bool QWidget::event(QEvent *event) -
7811{ -
7812 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
7813 -
7814 // ignore mouse and key events when disabled -
7815 if (!isEnabled()) {
evaluated: !isEnabled()
TRUEFALSE
yes
Evaluation Count:6410
yes
Evaluation Count:582366
6410-582366
7816 switch(event->type()) { -
7817 case QEvent::TabletPress: -
7818 case QEvent::TabletRelease: -
7819 case QEvent::TabletMove: -
7820 case QEvent::MouseButtonPress: -
7821 case QEvent::MouseButtonRelease: -
7822 case QEvent::MouseButtonDblClick: -
7823 case QEvent::MouseMove: -
7824 case QEvent::TouchBegin: -
7825 case QEvent::TouchUpdate: -
7826 case QEvent::TouchEnd: -
7827 case QEvent::TouchCancel: -
7828 case QEvent::ContextMenu: -
7829 case QEvent::KeyPress: -
7830 case QEvent::KeyRelease: -
7831#ifndef QT_NO_WHEELEVENT -
7832 case QEvent::Wheel: -
7833#endif -
7834 return false;
executed: return false;
Execution Count:3
3
7835 default: -
7836 break;
executed: break;
Execution Count:6407
6407
7837 } -
7838 }
executed: }
Execution Count:6407
6407
7839 switch (event->type()) { -
7840 case QEvent::MouseMove: -
7841 mouseMoveEvent((QMouseEvent*)event);
executed (the execution status of this line is deduced): mouseMoveEvent((QMouseEvent*)event);
-
7842 break;
executed: break;
Execution Count:598
598
7843 -
7844 case QEvent::MouseButtonPress: -
7845 mousePressEvent((QMouseEvent*)event);
executed (the execution status of this line is deduced): mousePressEvent((QMouseEvent*)event);
-
7846 break;
executed: break;
Execution Count:5517
5517
7847 -
7848 case QEvent::MouseButtonRelease: -
7849 mouseReleaseEvent((QMouseEvent*)event);
executed (the execution status of this line is deduced): mouseReleaseEvent((QMouseEvent*)event);
-
7850 break;
executed: break;
Execution Count:5474
5474
7851 -
7852 case QEvent::MouseButtonDblClick: -
7853 mouseDoubleClickEvent((QMouseEvent*)event);
executed (the execution status of this line is deduced): mouseDoubleClickEvent((QMouseEvent*)event);
-
7854 break;
executed: break;
Execution Count:394
394
7855#ifndef QT_NO_WHEELEVENT -
7856 case QEvent::Wheel: -
7857 wheelEvent((QWheelEvent*)event);
executed (the execution status of this line is deduced): wheelEvent((QWheelEvent*)event);
-
7858 break;
executed: break;
Execution Count:38
38
7859#endif -
7860#ifndef QT_NO_TABLETEVENT -
7861 case QEvent::TabletMove: -
7862 case QEvent::TabletPress: -
7863 case QEvent::TabletRelease: -
7864 tabletEvent((QTabletEvent*)event);
never executed (the execution status of this line is deduced): tabletEvent((QTabletEvent*)event);
-
7865 break;
never executed: break;
0
7866#endif -
7867 case QEvent::KeyPress: { -
7868 QKeyEvent *k = (QKeyEvent *)event;
executed (the execution status of this line is deduced): QKeyEvent *k = (QKeyEvent *)event;
-
7869 bool res = false;
executed (the execution status of this line is deduced): bool res = false;
-
7870 if (!(k->modifiers() & (Qt::ControlModifier | Qt::AltModifier))) { //### Add MetaModifier?
evaluated: !(k->modifiers() & (Qt::ControlModifier | Qt::AltModifier))
TRUEFALSE
yes
Evaluation Count:6748
yes
Evaluation Count:183
183-6748
7871 if (k->key() == Qt::Key_Backtab
evaluated: k->key() == Qt::Key_Backtab
TRUEFALSE
yes
Evaluation Count:20
yes
Evaluation Count:6728
20-6728
7872 || (k->key() == Qt::Key_Tab && (k->modifiers() & Qt::ShiftModifier)))
evaluated: k->key() == Qt::Key_Tab
TRUEFALSE
yes
Evaluation Count:130
yes
Evaluation Count:6598
evaluated: (k->modifiers() & Qt::ShiftModifier)
TRUEFALSE
yes
Evaluation Count:11
yes
Evaluation Count:119
11-6598
7873 res = focusNextPrevChild(false);
executed: res = focusNextPrevChild(false);
Execution Count:31
31
7874 else if (k->key() == Qt::Key_Tab)
evaluated: k->key() == Qt::Key_Tab
TRUEFALSE
yes
Evaluation Count:119
yes
Evaluation Count:6598
119-6598
7875 res = focusNextPrevChild(true);
executed: res = focusNextPrevChild(true);
Execution Count:119
119
7876 if (res)
evaluated: res
TRUEFALSE
yes
Evaluation Count:37
yes
Evaluation Count:6711
37-6711
7877 break;
executed: break;
Execution Count:37
37
7878 }
executed: }
Execution Count:6711
6711
7879 keyPressEvent(k);
executed (the execution status of this line is deduced): keyPressEvent(k);
-
7880#ifdef QT_KEYPAD_NAVIGATION -
7881 if (!k->isAccepted() && QApplication::keypadNavigationEnabled() -
7882 && !(k->modifiers() & (Qt::ControlModifier | Qt::AltModifier | Qt::ShiftModifier))) { -
7883 if (QApplication::navigationMode() == Qt::NavigationModeKeypadTabOrder) { -
7884 if (k->key() == Qt::Key_Up) -
7885 res = focusNextPrevChild(false); -
7886 else if (k->key() == Qt::Key_Down) -
7887 res = focusNextPrevChild(true); -
7888 } else if (QApplication::navigationMode() == Qt::NavigationModeKeypadDirectional) { -
7889 if (k->key() == Qt::Key_Up) -
7890 res = QWidgetPrivate::navigateToDirection(QWidgetPrivate::DirectionNorth); -
7891 else if (k->key() == Qt::Key_Right) -
7892 res = QWidgetPrivate::navigateToDirection(QWidgetPrivate::DirectionEast); -
7893 else if (k->key() == Qt::Key_Down) -
7894 res = QWidgetPrivate::navigateToDirection(QWidgetPrivate::DirectionSouth); -
7895 else if (k->key() == Qt::Key_Left) -
7896 res = QWidgetPrivate::navigateToDirection(QWidgetPrivate::DirectionWest); -
7897 } -
7898 if (res) { -
7899 k->accept(); -
7900 break; -
7901 } -
7902 } -
7903#endif -
7904#ifndef QT_NO_WHATSTHIS -
7905 if (!k->isAccepted()
evaluated: !k->isAccepted()
TRUEFALSE
yes
Evaluation Count:1412
yes
Evaluation Count:5482
1412-5482
7906 && k->modifiers() & Qt::ShiftModifier && k->key() == Qt::Key_F1
evaluated: k->modifiers() & Qt::ShiftModifier
TRUEFALSE
yes
Evaluation Count:178
yes
Evaluation Count:1234
partially evaluated: k->key() == Qt::Key_F1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:178
0-1234
7907 && d->whatsThis.size()) {
never evaluated: d->whatsThis.size()
0
7908 QWhatsThis::showText(mapToGlobal(inputMethodQuery(Qt::ImCursorRectangle).toRect().center()), d->whatsThis, this);
never executed (the execution status of this line is deduced): QWhatsThis::showText(mapToGlobal(inputMethodQuery(Qt::ImCursorRectangle).toRect().center()), d->whatsThis, this);
-
7909 k->accept();
never executed (the execution status of this line is deduced): k->accept();
-
7910 }
never executed: }
0
7911#endif -
7912 } -
7913 break;
executed: break;
Execution Count:6894
6894
7914 -
7915 case QEvent::KeyRelease: -
7916 keyReleaseEvent((QKeyEvent*)event);
executed (the execution status of this line is deduced): keyReleaseEvent((QKeyEvent*)event);
-
7917 // fall through -
7918 case QEvent::ShortcutOverride: -
7919 break;
executed: break;
Execution Count:15114
15114
7920 -
7921 case QEvent::InputMethod: -
7922 inputMethodEvent((QInputMethodEvent *) event);
executed (the execution status of this line is deduced): inputMethodEvent((QInputMethodEvent *) event);
-
7923 break;
executed: break;
Execution Count:79
79
7924 -
7925 case QEvent::InputMethodQuery: -
7926 if (testAttribute(Qt::WA_InputMethodEnabled)) {
evaluated: testAttribute(Qt::WA_InputMethodEnabled)
TRUEFALSE
yes
Evaluation Count:3946
yes
Evaluation Count:2845
2845-3946
7927 QInputMethodQueryEvent *query = static_cast<QInputMethodQueryEvent *>(event);
executed (the execution status of this line is deduced): QInputMethodQueryEvent *query = static_cast<QInputMethodQueryEvent *>(event);
-
7928 Qt::InputMethodQueries queries = query->queries();
executed (the execution status of this line is deduced): Qt::InputMethodQueries queries = query->queries();
-
7929 for (uint i = 0; i < 32; ++i) {
evaluated: i < 32
TRUEFALSE
yes
Evaluation Count:126272
yes
Evaluation Count:3946
3946-126272
7930 Qt::InputMethodQuery q = (Qt::InputMethodQuery)(int)(queries & (1<<i));
executed (the execution status of this line is deduced): Qt::InputMethodQuery q = (Qt::InputMethodQuery)(int)(queries & (1<<i));
-
7931 if (q) {
evaluated: q
TRUEFALSE
yes
Evaluation Count:3946
yes
Evaluation Count:122326
3946-122326
7932 QVariant v = inputMethodQuery(q);
executed (the execution status of this line is deduced): QVariant v = inputMethodQuery(q);
-
7933 if (q == Qt::ImEnabled && !v.isValid() && isEnabled())
partially evaluated: q == Qt::ImEnabled
TRUEFALSE
yes
Evaluation Count:3946
no
Evaluation Count:0
evaluated: !v.isValid()
TRUEFALSE
yes
Evaluation Count:3945
yes
Evaluation Count:1
evaluated: isEnabled()
TRUEFALSE
yes
Evaluation Count:3944
yes
Evaluation Count:1
0-3946
7934 v = QVariant(true); // special case for Qt4 compatibility
executed: v = QVariant(true);
Execution Count:3944
3944
7935 query->setValue(q, v);
executed (the execution status of this line is deduced): query->setValue(q, v);
-
7936 }
executed: }
Execution Count:3946
3946
7937 }
executed: }
Execution Count:126272
126272
7938 query->accept();
executed (the execution status of this line is deduced): query->accept();
-
7939 }
executed: }
Execution Count:3946
3946
7940 break;
executed: break;
Execution Count:6791
6791
7941 -
7942 case QEvent::PolishRequest: -
7943 ensurePolished();
executed (the execution status of this line is deduced): ensurePolished();
-
7944 break;
executed: break;
Execution Count:13755
13755
7945 -
7946 case QEvent::Polish: { -
7947 style()->polish(this);
executed (the execution status of this line is deduced): style()->polish(this);
-
7948 setAttribute(Qt::WA_WState_Polished);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_WState_Polished);
-
7949 if (!QApplication::font(this).isCopyOf(QApplication::font()))
evaluated: !QApplication::font(this).isCopyOf(QApplication::font())
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:37232
2-37232
7950 d->resolveFont();
executed: d->resolveFont();
Execution Count:2
2
7951 if (!QApplication::palette(this).isCopyOf(QApplication::palette()))
evaluated: !QApplication::palette(this).isCopyOf(QApplication::palette())
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:37232
2-37232
7952 d->resolvePalette();
executed: d->resolvePalette();
Execution Count:2
2
7953 } -
7954 break;
executed: break;
Execution Count:37234
37234
7955 -
7956 case QEvent::ApplicationWindowIconChange: -
7957 if (isWindow() && !testAttribute(Qt::WA_SetWindowIcon)) {
partially evaluated: isWindow()
TRUEFALSE
yes
Evaluation Count:10
no
Evaluation Count:0
evaluated: !testAttribute(Qt::WA_SetWindowIcon)
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:2
0-10
7958 d->setWindowIcon_sys();
executed (the execution status of this line is deduced): d->setWindowIcon_sys();
-
7959 d->setWindowIcon_helper();
executed (the execution status of this line is deduced): d->setWindowIcon_helper();
-
7960 }
executed: }
Execution Count:8
8
7961 break;
executed: break;
Execution Count:10
10
7962 case QEvent::FocusIn: -
7963 focusInEvent((QFocusEvent*)event);
executed (the execution status of this line is deduced): focusInEvent((QFocusEvent*)event);
-
7964 d->updateWidgetTransform();
executed (the execution status of this line is deduced): d->updateWidgetTransform();
-
7965 break;
executed: break;
Execution Count:2062
2062
7966 -
7967 case QEvent::FocusOut: -
7968 focusOutEvent((QFocusEvent*)event);
executed (the execution status of this line is deduced): focusOutEvent((QFocusEvent*)event);
-
7969 break;
executed: break;
Execution Count:1959
1959
7970 -
7971 case QEvent::Enter: -
7972#ifndef QT_NO_STATUSTIP -
7973 if (d->statusTip.size()) {
partially evaluated: d->statusTip.size()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2847
0-2847
7974 QStatusTipEvent tip(d->statusTip);
never executed (the execution status of this line is deduced): QStatusTipEvent tip(d->statusTip);
-
7975 QApplication::sendEvent(const_cast<QWidget *>(this), &tip);
never executed (the execution status of this line is deduced): QApplication::sendEvent(const_cast<QWidget *>(this), &tip);
-
7976 }
never executed: }
0
7977#endif -
7978 enterEvent(event);
executed (the execution status of this line is deduced): enterEvent(event);
-
7979 break;
executed: break;
Execution Count:2847
2847
7980 -
7981 case QEvent::Leave: -
7982#ifndef QT_NO_STATUSTIP -
7983 if (d->statusTip.size()) {
partially evaluated: d->statusTip.size()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:964
0-964
7984 QString empty;
never executed (the execution status of this line is deduced): QString empty;
-
7985 QStatusTipEvent tip(empty);
never executed (the execution status of this line is deduced): QStatusTipEvent tip(empty);
-
7986 QApplication::sendEvent(const_cast<QWidget *>(this), &tip);
never executed (the execution status of this line is deduced): QApplication::sendEvent(const_cast<QWidget *>(this), &tip);
-
7987 }
never executed: }
0
7988#endif -
7989 leaveEvent(event);
executed (the execution status of this line is deduced): leaveEvent(event);
-
7990 break;
executed: break;
Execution Count:964
964
7991 -
7992 case QEvent::HoverEnter: -
7993 case QEvent::HoverLeave: -
7994 update();
executed (the execution status of this line is deduced): update();
-
7995 break;
executed: break;
Execution Count:5
5
7996 -
7997 case QEvent::Paint: -
7998 // At this point the event has to be delivered, regardless -
7999 // whether the widget isVisible() or not because it -
8000 // already went through the filters -
8001 paintEvent((QPaintEvent*)event);
executed (the execution status of this line is deduced): paintEvent((QPaintEvent*)event);
-
8002 break;
executed: break;
Execution Count:14733
14733
8003 -
8004 case QEvent::Move: -
8005 moveEvent((QMoveEvent*)event);
executed (the execution status of this line is deduced): moveEvent((QMoveEvent*)event);
-
8006 d->updateWidgetTransform();
executed (the execution status of this line is deduced): d->updateWidgetTransform();
-
8007 break;
executed: break;
Execution Count:14417
14417
8008 -
8009 case QEvent::Resize: -
8010 resizeEvent((QResizeEvent*)event);
executed (the execution status of this line is deduced): resizeEvent((QResizeEvent*)event);
-
8011 d->updateWidgetTransform();
executed (the execution status of this line is deduced): d->updateWidgetTransform();
-
8012 break;
executed: break;
Execution Count:13887
13887
8013 -
8014 case QEvent::Close: -
8015 closeEvent((QCloseEvent *)event);
executed (the execution status of this line is deduced): closeEvent((QCloseEvent *)event);
-
8016 break;
executed: break;
Execution Count:98
98
8017 -
8018#ifndef QT_NO_CONTEXTMENU -
8019 case QEvent::ContextMenu: -
8020 switch (data->context_menu_policy) { -
8021 case Qt::PreventContextMenu: -
8022 break;
never executed: break;
0
8023 case Qt::DefaultContextMenu: -
8024 contextMenuEvent(static_cast<QContextMenuEvent *>(event));
executed (the execution status of this line is deduced): contextMenuEvent(static_cast<QContextMenuEvent *>(event));
-
8025 break;
executed: break;
Execution Count:202
202
8026 case Qt::CustomContextMenu: -
8027 emit customContextMenuRequested(static_cast<QContextMenuEvent *>(event)->pos());
executed (the execution status of this line is deduced): customContextMenuRequested(static_cast<QContextMenuEvent *>(event)->pos());
-
8028 break;
executed: break;
Execution Count:3
3
8029#ifndef QT_NO_MENU -
8030 case Qt::ActionsContextMenu: -
8031 if (d->actions.count()) {
never evaluated: d->actions.count()
0
8032 QMenu::exec(d->actions, static_cast<QContextMenuEvent *>(event)->globalPos(),
never executed (the execution status of this line is deduced): QMenu::exec(d->actions, static_cast<QContextMenuEvent *>(event)->globalPos(),
-
8033 0, this);
never executed (the execution status of this line is deduced): 0, this);
-
8034 break;
never executed: break;
0
8035 } -
8036 // fall through -
8037#endif -
8038 default:
code before this statement never executed: default:
0
8039 event->ignore();
never executed (the execution status of this line is deduced): event->ignore();
-
8040 break;
never executed: break;
0
8041 } -
8042 break;
executed: break;
Execution Count:205
205
8043#endif // QT_NO_CONTEXTMENU -
8044 -
8045#ifndef QT_NO_DRAGANDDROP -
8046 case QEvent::Drop: -
8047 dropEvent((QDropEvent*) event);
executed (the execution status of this line is deduced): dropEvent((QDropEvent*) event);
-
8048 break;
executed: break;
Execution Count:2
2
8049 -
8050 case QEvent::DragEnter: -
8051 dragEnterEvent((QDragEnterEvent*) event);
executed (the execution status of this line is deduced): dragEnterEvent((QDragEnterEvent*) event);
-
8052 break;
executed: break;
Execution Count:3
3
8053 -
8054 case QEvent::DragMove: -
8055 dragMoveEvent((QDragMoveEvent*) event);
executed (the execution status of this line is deduced): dragMoveEvent((QDragMoveEvent*) event);
-
8056 break;
executed: break;
Execution Count:5
5
8057 -
8058 case QEvent::DragLeave: -
8059 dragLeaveEvent((QDragLeaveEvent*) event);
executed (the execution status of this line is deduced): dragLeaveEvent((QDragLeaveEvent*) event);
-
8060 break;
executed: break;
Execution Count:1
1
8061#endif -
8062 -
8063 case QEvent::Show: -
8064 showEvent((QShowEvent*) event);
executed (the execution status of this line is deduced): showEvent((QShowEvent*) event);
-
8065 break;
executed: break;
Execution Count:14991
14991
8066 -
8067 case QEvent::Hide: -
8068 hideEvent((QHideEvent*) event);
executed (the execution status of this line is deduced): hideEvent((QHideEvent*) event);
-
8069 break;
executed: break;
Execution Count:14628
14628
8070 -
8071 case QEvent::ShowWindowRequest: -
8072 if (!isHidden())
never evaluated: !isHidden()
0
8073 d->show_sys();
never executed: d->show_sys();
0
8074 break;
never executed: break;
0
8075 -
8076 case QEvent::ApplicationFontChange: -
8077 d->resolveFont();
executed (the execution status of this line is deduced): d->resolveFont();
-
8078 break;
executed: break;
Execution Count:8
8
8079 case QEvent::ApplicationPaletteChange: -
8080 if (!(windowType() == Qt::Desktop))
evaluated: !(windowType() == Qt::Desktop)
TRUEFALSE
yes
Evaluation Count:29
yes
Evaluation Count:4
4-29
8081 d->resolvePalette();
executed: d->resolvePalette();
Execution Count:29
29
8082 break;
executed: break;
Execution Count:33
33
8083 -
8084 case QEvent::ToolBarChange: -
8085 case QEvent::ActivationChange: -
8086 case QEvent::EnabledChange: -
8087 case QEvent::FontChange: -
8088 case QEvent::StyleChange: -
8089 case QEvent::PaletteChange: -
8090 case QEvent::WindowTitleChange: -
8091 case QEvent::IconTextChange: -
8092 case QEvent::ModifiedChange: -
8093 case QEvent::MouseTrackingChange: -
8094 case QEvent::ParentChange: -
8095 case QEvent::WindowStateChange: -
8096 case QEvent::LocaleChange: -
8097 case QEvent::MacSizeChange: -
8098 case QEvent::ContentsRectChange: -
8099 case QEvent::ThemeChange: -
8100 changeEvent(event);
executed (the execution status of this line is deduced): changeEvent(event);
-
8101 break;
executed: break;
Execution Count:91818
91818
8102 -
8103 case QEvent::WindowActivate: -
8104 case QEvent::WindowDeactivate: { -
8105 if (isVisible() && !palette().isEqual(QPalette::Active, QPalette::Inactive))
evaluated: isVisible()
TRUEFALSE
yes
Evaluation Count:14152
yes
Evaluation Count:26
evaluated: !palette().isEqual(QPalette::Active, QPalette::Inactive)
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:14148
4-14152
8106 update();
executed: update();
Execution Count:4
4
8107 QList<QObject*> childList = d->children;
executed (the execution status of this line is deduced): QList<QObject*> childList = d->children;
-
8108 for (int i = 0; i < childList.size(); ++i) {
evaluated: i < childList.size()
TRUEFALSE
yes
Evaluation Count:23768
yes
Evaluation Count:14178
14178-23768
8109 QWidget *w = qobject_cast<QWidget *>(childList.at(i));
executed (the execution status of this line is deduced): QWidget *w = qobject_cast<QWidget *>(childList.at(i));
-
8110 if (w && w->isVisible() && !w->isWindow())
evaluated: w
TRUEFALSE
yes
Evaluation Count:17006
yes
Evaluation Count:6762
evaluated: w->isVisible()
TRUEFALSE
yes
Evaluation Count:10852
yes
Evaluation Count:6154
evaluated: !w->isWindow()
TRUEFALSE
yes
Evaluation Count:10831
yes
Evaluation Count:21
21-17006
8111 QApplication::sendEvent(w, event);
executed: QApplication::sendEvent(w, event);
Execution Count:10831
10831
8112 }
executed: }
Execution Count:23768
23768
8113 break; }
executed: break;
Execution Count:14178
14178
8114 -
8115 case QEvent::LanguageChange: -
8116 changeEvent(event);
executed (the execution status of this line is deduced): changeEvent(event);
-
8117 { -
8118 QList<QObject*> childList = d->children;
executed (the execution status of this line is deduced): QList<QObject*> childList = d->children;
-
8119 for (int i = 0; i < childList.size(); ++i) {
evaluated: i < childList.size()
TRUEFALSE
yes
Evaluation Count:19
yes
Evaluation Count:14
14-19
8120 QObject *o = childList.at(i);
executed (the execution status of this line is deduced): QObject *o = childList.at(i);
-
8121 if (o)
partially evaluated: o
TRUEFALSE
yes
Evaluation Count:19
no
Evaluation Count:0
0-19
8122 QApplication::sendEvent(o, event);
executed: QApplication::sendEvent(o, event);
Execution Count:19
19
8123 }
executed: }
Execution Count:19
19
8124 } -
8125 update();
executed (the execution status of this line is deduced): update();
-
8126 break;
executed: break;
Execution Count:14
14
8127 -
8128 case QEvent::ApplicationLayoutDirectionChange: -
8129 d->resolveLayoutDirection();
executed (the execution status of this line is deduced): d->resolveLayoutDirection();
-
8130 break;
executed: break;
Execution Count:154
154
8131 -
8132 case QEvent::LayoutDirectionChange: -
8133 if (d->layout)
evaluated: d->layout
TRUEFALSE
yes
Evaluation Count:75
yes
Evaluation Count:350
75-350
8134 d->layout->invalidate();
executed: d->layout->invalidate();
Execution Count:75
75
8135 update();
executed (the execution status of this line is deduced): update();
-
8136 changeEvent(event);
executed (the execution status of this line is deduced): changeEvent(event);
-
8137 break;
executed: break;
Execution Count:425
425
8138 case QEvent::UpdateRequest: -
8139 d->syncBackingStore();
executed (the execution status of this line is deduced): d->syncBackingStore();
-
8140 break;
executed: break;
Execution Count:6651
6651
8141 case QEvent::UpdateLater: -
8142 update(static_cast<QUpdateLaterEvent*>(event)->region());
executed (the execution status of this line is deduced): update(static_cast<QUpdateLaterEvent*>(event)->region());
-
8143 break;
executed: break;
Execution Count:8841
8841
8144 case QEvent::StyleAnimationUpdate: -
8145 update();
executed (the execution status of this line is deduced): update();
-
8146 break;
executed: break;
Execution Count:15
15
8147 -
8148 case QEvent::WindowBlocked: -
8149 case QEvent::WindowUnblocked: -
8150 if (!d->children.isEmpty()) {
evaluated: !d->children.isEmpty()
TRUEFALSE
yes
Evaluation Count:174
yes
Evaluation Count:509
174-509
8151 QWidget *modalWidget = QApplication::activeModalWidget();
executed (the execution status of this line is deduced): QWidget *modalWidget = QApplication::activeModalWidget();
-
8152 for (int i = 0; i < d->children.size(); ++i) {
evaluated: i < d->children.size()
TRUEFALSE
yes
Evaluation Count:304
yes
Evaluation Count:174
174-304
8153 QObject *o = d->children.at(i);
executed (the execution status of this line is deduced): QObject *o = d->children.at(i);
-
8154 if (o && o != modalWidget && o->isWidgetType()) {
evaluated: o
TRUEFALSE
yes
Evaluation Count:302
yes
Evaluation Count:2
evaluated: o != modalWidget
TRUEFALSE
yes
Evaluation Count:264
yes
Evaluation Count:38
evaluated: o->isWidgetType()
TRUEFALSE
yes
Evaluation Count:211
yes
Evaluation Count:53
2-302
8155 QWidget *w = static_cast<QWidget *>(o);
executed (the execution status of this line is deduced): QWidget *w = static_cast<QWidget *>(o);
-
8156 // do not forward the event to child windows; QApplication does this for us -
8157 if (!w->isWindow())
evaluated: !w->isWindow()
TRUEFALSE
yes
Evaluation Count:173
yes
Evaluation Count:38
38-173
8158 QApplication::sendEvent(w, event);
executed: QApplication::sendEvent(w, event);
Execution Count:173
173
8159 }
executed: }
Execution Count:211
211
8160 }
executed: }
Execution Count:304
304
8161 }
executed: }
Execution Count:174
174
8162#if defined(Q_WS_WIN) -
8163 setDisabledStyle(this, (event->type() == QEvent::WindowBlocked)); -
8164#endif -
8165 break;
executed: break;
Execution Count:683
683
8166#ifndef QT_NO_TOOLTIP -
8167 case QEvent::ToolTip: -
8168 if (!d->toolTip.isEmpty())
evaluated: !d->toolTip.isEmpty()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1
1-2
8169 QToolTip::showText(static_cast<QHelpEvent*>(event)->globalPos(), d->toolTip, this);
executed: QToolTip::showText(static_cast<QHelpEvent*>(event)->globalPos(), d->toolTip, this);
Execution Count:2
2
8170 else -
8171 event->ignore();
executed: event->ignore();
Execution Count:1
1
8172 break;
executed: break;
Execution Count:3
3
8173#endif -
8174#ifndef QT_NO_WHATSTHIS -
8175 case QEvent::WhatsThis: -
8176 if (d->whatsThis.size())
never evaluated: d->whatsThis.size()
0
8177 QWhatsThis::showText(static_cast<QHelpEvent *>(event)->globalPos(), d->whatsThis, this);
never executed: QWhatsThis::showText(static_cast<QHelpEvent *>(event)->globalPos(), d->whatsThis, this);
0
8178 else -
8179 event->ignore();
never executed: event->ignore();
0
8180 break;
never executed: break;
0
8181 case QEvent::QueryWhatsThis: -
8182 if (d->whatsThis.isEmpty())
never evaluated: d->whatsThis.isEmpty()
0
8183 event->ignore();
never executed: event->ignore();
0
8184 break;
never executed: break;
0
8185#endif -
8186 case QEvent::EmbeddingControl: -
8187 d->topData()->frameStrut.setCoords(0 ,0, 0, 0);
never executed (the execution status of this line is deduced): d->topData()->frameStrut.setCoords(0 ,0, 0, 0);
-
8188 data->fstrut_dirty = false;
never executed (the execution status of this line is deduced): data->fstrut_dirty = false;
-
8189#if defined(Q_WS_WIN) || defined(Q_WS_X11) -
8190 d->topData()->embedded = 1; -
8191#endif -
8192 break;
never executed: break;
0
8193#ifndef QT_NO_ACTION -
8194 case QEvent::ActionAdded: -
8195 case QEvent::ActionRemoved: -
8196 case QEvent::ActionChanged: -
8197 actionEvent((QActionEvent*)event);
executed (the execution status of this line is deduced): actionEvent((QActionEvent*)event);
-
8198 break;
executed: break;
Execution Count:13511
13511
8199#endif -
8200 -
8201 case QEvent::KeyboardLayoutChange: -
8202 { -
8203 changeEvent(event);
never executed (the execution status of this line is deduced): changeEvent(event);
-
8204 -
8205 // inform children of the change -
8206 QList<QObject*> childList = d->children;
never executed (the execution status of this line is deduced): QList<QObject*> childList = d->children;
-
8207 for (int i = 0; i < childList.size(); ++i) {
never evaluated: i < childList.size()
0
8208 QWidget *w = qobject_cast<QWidget *>(childList.at(i));
never executed (the execution status of this line is deduced): QWidget *w = qobject_cast<QWidget *>(childList.at(i));
-
8209 if (w && w->isVisible() && !w->isWindow())
never evaluated: w
never evaluated: w->isVisible()
never evaluated: !w->isWindow()
0
8210 QApplication::sendEvent(w, event);
never executed: QApplication::sendEvent(w, event);
0
8211 }
never executed: }
0
8212 break;
never executed: break;
0
8213 } -
8214#ifdef Q_WS_MAC -
8215 case QEvent::MacGLWindowChange: -
8216 d->needWindowChange = false; -
8217 break; -
8218#endif -
8219 case QEvent::TouchBegin: -
8220 case QEvent::TouchUpdate: -
8221 case QEvent::TouchEnd: -
8222 case QEvent::TouchCancel: -
8223 { -
8224 event->ignore();
executed (the execution status of this line is deduced): event->ignore();
-
8225 break;
executed: break;
Execution Count:1
1
8226 } -
8227#ifndef QT_NO_GESTURES -
8228 case QEvent::Gesture: -
8229 event->ignore();
never executed (the execution status of this line is deduced): event->ignore();
-
8230 break;
never executed: break;
0
8231#endif -
8232#ifndef QT_NO_PROPERTIES -
8233 case QEvent::DynamicPropertyChange: { -
8234 const QByteArray &propName = static_cast<QDynamicPropertyChangeEvent *>(event)->propertyName();
executed (the execution status of this line is deduced): const QByteArray &propName = static_cast<QDynamicPropertyChangeEvent *>(event)->propertyName();
-
8235 if (!qstrncmp(propName, "_q_customDpi", 12) && propName.length() == 13) {
evaluated: !qstrncmp(propName, "_q_customDpi", 12)
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:1960
partially evaluated: propName.length() == 13
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
0-1960
8236 uint value = property(propName.constData()).toUInt();
executed (the execution status of this line is deduced): uint value = property(propName.constData()).toUInt();
-
8237 if (!d->extra)
evaluated: !d->extra
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:3
1-3
8238 d->createExtra();
executed: d->createExtra();
Execution Count:1
1
8239 const char axis = propName.at(12);
executed (the execution status of this line is deduced): const char axis = propName.at(12);
-
8240 if (axis == 'X')
evaluated: axis == 'X'
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2
2
8241 d->extra->customDpiX = value;
executed: d->extra->customDpiX = value;
Execution Count:2
2
8242 else if (axis == 'Y')
partially evaluated: axis == 'Y'
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
8243 d->extra->customDpiY = value;
executed: d->extra->customDpiY = value;
Execution Count:2
2
8244 d->updateFont(d->data.fnt);
executed (the execution status of this line is deduced): d->updateFont(d->data.fnt);
-
8245 }
executed: }
Execution Count:4
4
8246 // fall through -
8247 } -
8248#endif -
8249 default: -
8250 return QObject::event(event);
executed: return QObject::event(event);
Execution Count:279696
279696
8251 } -
8252 return true;
executed: return true;
Execution Count:309077
309077
8253} -
8254 -
8255/*! -
8256 This event handler can be reimplemented to handle state changes. -
8257 -
8258 The state being changed in this event can be retrieved through the \a event -
8259 supplied. -
8260 -
8261 Change events include: QEvent::ToolBarChange, -
8262 QEvent::ActivationChange, QEvent::EnabledChange, QEvent::FontChange, -
8263 QEvent::StyleChange, QEvent::PaletteChange, -
8264 QEvent::WindowTitleChange, QEvent::IconTextChange, -
8265 QEvent::ModifiedChange, QEvent::MouseTrackingChange, -
8266 QEvent::ParentChange, QEvent::WindowStateChange, -
8267 QEvent::LanguageChange, QEvent::LocaleChange, -
8268 QEvent::LayoutDirectionChange. -
8269 -
8270*/ -
8271void QWidget::changeEvent(QEvent * event) -
8272{ -
8273 switch(event->type()) { -
8274 case QEvent::EnabledChange: { -
8275 update();
executed (the execution status of this line is deduced): update();
-
8276#ifndef QT_NO_ACCESSIBILITY -
8277 QAccessible::State s;
executed (the execution status of this line is deduced): QAccessible::State s;
-
8278 s.disabled = true;
executed (the execution status of this line is deduced): s.disabled = true;
-
8279 QAccessibleStateChangeEvent event(this, s);
executed (the execution status of this line is deduced): QAccessibleStateChangeEvent event(this, s);
-
8280 QAccessible::updateAccessibility(&event);
executed (the execution status of this line is deduced): QAccessible::updateAccessibility(&event);
-
8281#endif -
8282 break;
executed: break;
Execution Count:3015
3015
8283 } -
8284 -
8285 case QEvent::FontChange: -
8286 case QEvent::StyleChange: { -
8287 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
8288 update();
executed (the execution status of this line is deduced): update();
-
8289 updateGeometry();
executed (the execution status of this line is deduced): updateGeometry();
-
8290 if (d->layout)
evaluated: d->layout
TRUEFALSE
yes
Evaluation Count:1479
yes
Evaluation Count:4890
1479-4890
8291 d->layout->invalidate();
executed: d->layout->invalidate();
Execution Count:1479
1479
8292 break;
executed: break;
Execution Count:6369
6369
8293 } -
8294 -
8295 case QEvent::PaletteChange: -
8296 update();
executed (the execution status of this line is deduced): update();
-
8297 break;
executed: break;
Execution Count:21716
21716
8298 -
8299 case QEvent::ThemeChange: -
8300 if (QApplication::desktopSettingsAware() && windowType() != Qt::Desktop
never evaluated: QApplication::desktopSettingsAware()
never evaluated: windowType() != Qt::Desktop
0
8301 && qApp && !QApplication::closingDown()) {
never evaluated: (static_cast<QApplication *>(QCoreApplication::instance()))
never evaluated: !QApplication::closingDown()
0
8302 if (testAttribute(Qt::WA_WState_Polished))
never evaluated: testAttribute(Qt::WA_WState_Polished)
0
8303 QApplication::style()->unpolish(this);
never executed: QApplication::style()->unpolish(this);
0
8304 if (testAttribute(Qt::WA_WState_Polished))
never evaluated: testAttribute(Qt::WA_WState_Polished)
0
8305 QApplication::style()->polish(this);
never executed: QApplication::style()->polish(this);
0
8306 QEvent styleChangedEvent(QEvent::StyleChange);
never executed (the execution status of this line is deduced): QEvent styleChangedEvent(QEvent::StyleChange);
-
8307 QCoreApplication::sendEvent(this, &styleChangedEvent);
never executed (the execution status of this line is deduced): QCoreApplication::sendEvent(this, &styleChangedEvent);
-
8308 if (isVisible())
never evaluated: isVisible()
0
8309 update();
never executed: update();
0
8310 }
never executed: }
0
8311 break;
never executed: break;
0
8312 -
8313#ifdef Q_OS_MAC -
8314 case QEvent::MacSizeChange: -
8315 updateGeometry(); -
8316 break; -
8317#elif defined Q_WS_MAC -
8318 case QEvent::ToolTipChange: -
8319 case QEvent::MouseTrackingChange: -
8320 qt_mac_update_mouseTracking(this); -
8321 break; -
8322#endif -
8323 -
8324 default: -
8325 break;
executed: break;
Execution Count:60035
60035
8326 } -
8327}
executed: }
Execution Count:91135
91135
8328 -
8329/*! -
8330 This event handler, for event \a event, can be reimplemented in a -
8331 subclass to receive mouse move events for the widget. -
8332 -
8333 If mouse tracking is switched off, mouse move events only occur if -
8334 a mouse button is pressed while the mouse is being moved. If mouse -
8335 tracking is switched on, mouse move events occur even if no mouse -
8336 button is pressed. -
8337 -
8338 QMouseEvent::pos() reports the position of the mouse cursor, -
8339 relative to this widget. For press and release events, the -
8340 position is usually the same as the position of the last mouse -
8341 move event, but it might be different if the user's hand shakes. -
8342 This is a feature of the underlying window system, not Qt. -
8343 -
8344 If you want to show a tooltip immediately, while the mouse is -
8345 moving (e.g., to get the mouse coordinates with QMouseEvent::pos() -
8346 and show them as a tooltip), you must first enable mouse tracking -
8347 as described above. Then, to ensure that the tooltip is updated -
8348 immediately, you must call QToolTip::showText() instead of -
8349 setToolTip() in your implementation of mouseMoveEvent(). -
8350 -
8351 \sa setMouseTracking(), mousePressEvent(), mouseReleaseEvent(), -
8352 mouseDoubleClickEvent(), event(), QMouseEvent, {Scribble Example} -
8353*/ -
8354 -
8355void QWidget::mouseMoveEvent(QMouseEvent *event) -
8356{ -
8357 event->ignore();
executed (the execution status of this line is deduced): event->ignore();
-
8358}
executed: }
Execution Count:1
1
8359 -
8360/*! -
8361 This event handler, for event \a event, can be reimplemented in a -
8362 subclass to receive mouse press events for the widget. -
8363 -
8364 If you create new widgets in the mousePressEvent() the -
8365 mouseReleaseEvent() may not end up where you expect, depending on -
8366 the underlying window system (or X11 window manager), the widgets' -
8367 location and maybe more. -
8368 -
8369 The default implementation implements the closing of popup widgets -
8370 when you click outside the window. For other widget types it does -
8371 nothing. -
8372 -
8373 \sa mouseReleaseEvent(), mouseDoubleClickEvent(), -
8374 mouseMoveEvent(), event(), QMouseEvent, {Scribble Example} -
8375*/ -
8376 -
8377void QWidget::mousePressEvent(QMouseEvent *event) -
8378{ -
8379 event->ignore();
executed (the execution status of this line is deduced): event->ignore();
-
8380 if ((windowType() == Qt::Popup)) {
partially evaluated: (windowType() == Qt::Popup)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:15
0-15
8381 event->accept();
never executed (the execution status of this line is deduced): event->accept();
-
8382 QWidget* w;
never executed (the execution status of this line is deduced): QWidget* w;
-
8383 while ((w = QApplication::activePopupWidget()) && w != this){
never evaluated: (w = QApplication::activePopupWidget())
never evaluated: w != this
0
8384 w->close();
never executed (the execution status of this line is deduced): w->close();
-
8385 if (QApplication::activePopupWidget() == w) // widget does not want to disappear
never evaluated: QApplication::activePopupWidget() == w
0
8386 w->hide(); // hide at least
never executed: w->hide();
0
8387 }
never executed: }
0
8388 if (!rect().contains(event->pos())){
never evaluated: !rect().contains(event->pos())
0
8389 close();
never executed (the execution status of this line is deduced): close();
-
8390 }
never executed: }
0
8391 }
never executed: }
0
8392}
executed: }
Execution Count:15
15
8393 -
8394/*! -
8395 This event handler, for event \a event, can be reimplemented in a -
8396 subclass to receive mouse release events for the widget. -
8397 -
8398 \sa mousePressEvent(), mouseDoubleClickEvent(), -
8399 mouseMoveEvent(), event(), QMouseEvent, {Scribble Example} -
8400*/ -
8401 -
8402void QWidget::mouseReleaseEvent(QMouseEvent *event) -
8403{ -
8404 event->ignore();
executed (the execution status of this line is deduced): event->ignore();
-
8405}
executed: }
Execution Count:8
8
8406 -
8407/*! -
8408 This event handler, for event \a event, can be reimplemented in a -
8409 subclass to receive mouse double click events for the widget. -
8410 -
8411 The default implementation generates a normal mouse press event. -
8412 -
8413 \note The widget will also receive mouse press and mouse release -
8414 events in addition to the double click event. It is up to the -
8415 developer to ensure that the application interprets these events -
8416 correctly. -
8417 -
8418 \sa mousePressEvent(), mouseReleaseEvent(), mouseMoveEvent(), -
8419 event(), QMouseEvent -
8420*/ -
8421 -
8422void QWidget::mouseDoubleClickEvent(QMouseEvent *event) -
8423{ -
8424 event->ignore();
executed (the execution status of this line is deduced): event->ignore();
-
8425}
executed: }
Execution Count:12
12
8426 -
8427#ifndef QT_NO_WHEELEVENT -
8428/*! -
8429 This event handler, for event \a event, can be reimplemented in a -
8430 subclass to receive wheel events for the widget. -
8431 -
8432 If you reimplement this handler, it is very important that you -
8433 \l{QWheelEvent}{ignore()} the event if you do not handle -
8434 it, so that the widget's parent can interpret it. -
8435 -
8436 The default implementation ignores the event. -
8437 -
8438 \sa QWheelEvent::ignore(), QWheelEvent::accept(), event(), -
8439 QWheelEvent -
8440*/ -
8441 -
8442void QWidget::wheelEvent(QWheelEvent *event) -
8443{ -
8444 event->ignore();
executed (the execution status of this line is deduced): event->ignore();
-
8445}
executed: }
Execution Count:2
2
8446#endif // QT_NO_WHEELEVENT -
8447 -
8448#ifndef QT_NO_TABLETEVENT -
8449/*! -
8450 This event handler, for event \a event, can be reimplemented in a -
8451 subclass to receive tablet events for the widget. -
8452 -
8453 If you reimplement this handler, it is very important that you -
8454 \l{QTabletEvent}{ignore()} the event if you do not handle -
8455 it, so that the widget's parent can interpret it. -
8456 -
8457 The default implementation ignores the event. -
8458 -
8459 \sa QTabletEvent::ignore(), QTabletEvent::accept(), event(), -
8460 QTabletEvent -
8461*/ -
8462 -
8463void QWidget::tabletEvent(QTabletEvent *event) -
8464{ -
8465 event->ignore();
never executed (the execution status of this line is deduced): event->ignore();
-
8466}
never executed: }
0
8467#endif // QT_NO_TABLETEVENT -
8468 -
8469/*! -
8470 This event handler, for event \a event, can be reimplemented in a -
8471 subclass to receive key press events for the widget. -
8472 -
8473 A widget must call setFocusPolicy() to accept focus initially and -
8474 have focus in order to receive a key press event. -
8475 -
8476 If you reimplement this handler, it is very important that you -
8477 call the base class implementation if you do not act upon the key. -
8478 -
8479 The default implementation closes popup widgets if the user -
8480 presses Esc. Otherwise the event is ignored, so that the widget's -
8481 parent can interpret it. -
8482 -
8483 Note that QKeyEvent starts with isAccepted() == true, so you do not -
8484 need to call QKeyEvent::accept() - just do not call the base class -
8485 implementation if you act upon the key. -
8486 -
8487 \sa keyReleaseEvent(), setFocusPolicy(), -
8488 focusInEvent(), focusOutEvent(), event(), QKeyEvent, {Tetrix Example} -
8489*/ -
8490 -
8491void QWidget::keyPressEvent(QKeyEvent *event) -
8492{ -
8493 if ((windowType() == Qt::Popup) && event->key() == Qt::Key_Escape) {
partially evaluated: (windowType() == Qt::Popup)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:543
never evaluated: event->key() == Qt::Key_Escape
0-543
8494 event->accept();
never executed (the execution status of this line is deduced): event->accept();
-
8495 close();
never executed (the execution status of this line is deduced): close();
-
8496 } else {
never executed: }
0
8497 event->ignore();
executed (the execution status of this line is deduced): event->ignore();
-
8498 }
executed: }
Execution Count:543
543
8499} -
8500 -
8501/*! -
8502 This event handler, for event \a event, can be reimplemented in a -
8503 subclass to receive key release events for the widget. -
8504 -
8505 A widget must \l{setFocusPolicy()}{accept focus} -
8506 initially and \l{hasFocus()}{have focus} in order to -
8507 receive a key release event. -
8508 -
8509 If you reimplement this handler, it is very important that you -
8510 call the base class implementation if you do not act upon the key. -
8511 -
8512 The default implementation ignores the event, so that the widget's -
8513 parent can interpret it. -
8514 -
8515 Note that QKeyEvent starts with isAccepted() == true, so you do not -
8516 need to call QKeyEvent::accept() - just do not call the base class -
8517 implementation if you act upon the key. -
8518 -
8519 \sa keyPressEvent(), QKeyEvent::ignore(), setFocusPolicy(), -
8520 focusInEvent(), focusOutEvent(), event(), QKeyEvent -
8521*/ -
8522 -
8523void QWidget::keyReleaseEvent(QKeyEvent *event) -
8524{ -
8525 event->ignore();
executed (the execution status of this line is deduced): event->ignore();
-
8526}
executed: }
Execution Count:6312
6312
8527 -
8528/*! -
8529 \fn void QWidget::focusInEvent(QFocusEvent *event) -
8530 -
8531 This event handler can be reimplemented in a subclass to receive -
8532 keyboard focus events (focus received) for the widget. The event -
8533 is passed in the \a event parameter -
8534 -
8535 A widget normally must setFocusPolicy() to something other than -
8536 Qt::NoFocus in order to receive focus events. (Note that the -
8537 application programmer can call setFocus() on any widget, even -
8538 those that do not normally accept focus.) -
8539 -
8540 The default implementation updates the widget (except for windows -
8541 that do not specify a focusPolicy()). -
8542 -
8543 \sa focusOutEvent(), setFocusPolicy(), keyPressEvent(), -
8544 keyReleaseEvent(), event(), QFocusEvent -
8545*/ -
8546 -
8547void QWidget::focusInEvent(QFocusEvent *) -
8548{ -
8549 if (focusPolicy() != Qt::NoFocus || !isWindow()) {
evaluated: focusPolicy() != Qt::NoFocus
TRUEFALSE
yes
Evaluation Count:1345
yes
Evaluation Count:96
evaluated: !isWindow()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:91
5-1345
8550 update();
executed (the execution status of this line is deduced): update();
-
8551 }
executed: }
Execution Count:1350
1350
8552}
executed: }
Execution Count:1441
1441
8553 -
8554/*! -
8555 \fn void QWidget::focusOutEvent(QFocusEvent *event) -
8556 -
8557 This event handler can be reimplemented in a subclass to receive -
8558 keyboard focus events (focus lost) for the widget. The events is -
8559 passed in the \a event parameter. -
8560 -
8561 A widget normally must setFocusPolicy() to something other than -
8562 Qt::NoFocus in order to receive focus events. (Note that the -
8563 application programmer can call setFocus() on any widget, even -
8564 those that do not normally accept focus.) -
8565 -
8566 The default implementation updates the widget (except for windows -
8567 that do not specify a focusPolicy()). -
8568 -
8569 \sa focusInEvent(), setFocusPolicy(), keyPressEvent(), -
8570 keyReleaseEvent(), event(), QFocusEvent -
8571*/ -
8572 -
8573void QWidget::focusOutEvent(QFocusEvent *) -
8574{ -
8575 if (focusPolicy() != Qt::NoFocus || !isWindow())
evaluated: focusPolicy() != Qt::NoFocus
TRUEFALSE
yes
Evaluation Count:1257
yes
Evaluation Count:24
evaluated: !isWindow()
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:17
7-1257
8576 update();
executed: update();
Execution Count:1264
1264
8577}
executed: }
Execution Count:1281
1281
8578 -
8579/*! -
8580 \fn void QWidget::enterEvent(QEvent *event) -
8581 -
8582 This event handler can be reimplemented in a subclass to receive -
8583 widget enter events which are passed in the \a event parameter. -
8584 -
8585 An event is sent to the widget when the mouse cursor enters the -
8586 widget. -
8587 -
8588 \sa leaveEvent(), mouseMoveEvent(), event() -
8589*/ -
8590 -
8591void QWidget::enterEvent(QEvent *) -
8592{ -
8593} -
8594 -
8595// ### Qt 6: void QWidget::enterEvent(QEnterEvent *). -
8596 -
8597/*! -
8598 \fn void QWidget::leaveEvent(QEvent *event) -
8599 -
8600 This event handler can be reimplemented in a subclass to receive -
8601 widget leave events which are passed in the \a event parameter. -
8602 -
8603 A leave event is sent to the widget when the mouse cursor leaves -
8604 the widget. -
8605 -
8606 \sa enterEvent(), mouseMoveEvent(), event() -
8607*/ -
8608 -
8609void QWidget::leaveEvent(QEvent *) -
8610{ -
8611} -
8612 -
8613/*! -
8614 \fn void QWidget::paintEvent(QPaintEvent *event) -
8615 -
8616 This event handler can be reimplemented in a subclass to receive paint -
8617 events passed in \a event. -
8618 -
8619 A paint event is a request to repaint all or part of a widget. It can -
8620 happen for one of the following reasons: -
8621 -
8622 \list -
8623 \li repaint() or update() was invoked, -
8624 \li the widget was obscured and has now been uncovered, or -
8625 \li many other reasons. -
8626 \endlist -
8627 -
8628 Many widgets can simply repaint their entire surface when asked to, but -
8629 some slow widgets need to optimize by painting only the requested region: -
8630 QPaintEvent::region(). This speed optimization does not change the result, -
8631 as painting is clipped to that region during event processing. QListView -
8632 and QTableView do this, for example. -
8633 -
8634 Qt also tries to speed up painting by merging multiple paint events into -
8635 one. When update() is called several times or the window system sends -
8636 several paint events, Qt merges these events into one event with a larger -
8637 region (see QRegion::united()). The repaint() function does not permit this -
8638 optimization, so we suggest using update() whenever possible. -
8639 -
8640 When the paint event occurs, the update region has normally been erased, so -
8641 you are painting on the widget's background. -
8642 -
8643 The background can be set using setBackgroundRole() and setPalette(). -
8644 -
8645 Since Qt 4.0, QWidget automatically double-buffers its painting, so there -
8646 is no need to write double-buffering code in paintEvent() to avoid flicker. -
8647 -
8648 \b{Note for the X11 platform}: It is possible to toggle global double -
8649 buffering by calling \c qt_x11_set_global_double_buffer(). For example, -
8650 -
8651 \snippet code/src_gui_kernel_qwidget.cpp 14 -
8652 -
8653 \note Generally, you should refrain from calling update() or repaint() -
8654 \b{inside} a paintEvent(). For example, calling update() or repaint() on -
8655 children inside a paintevent() results in undefined behavior; the child may -
8656 or may not get a paint event. -
8657 -
8658 \warning If you are using a custom paint engine without Qt's backingstore, -
8659 Qt::WA_PaintOnScreen must be set. Otherwise, QWidget::paintEngine() will -
8660 never be called; the backingstore will be used instead. -
8661 -
8662 \sa event(), repaint(), update(), QPainter, QPixmap, QPaintEvent, -
8663 {Analog Clock Example} -
8664*/ -
8665 -
8666void QWidget::paintEvent(QPaintEvent *) -
8667{ -
8668} -
8669 -
8670 -
8671/*! -
8672 \fn void QWidget::moveEvent(QMoveEvent *event) -
8673 -
8674 This event handler can be reimplemented in a subclass to receive -
8675 widget move events which are passed in the \a event parameter. -
8676 When the widget receives this event, it is already at the new -
8677 position. -
8678 -
8679 The old position is accessible through QMoveEvent::oldPos(). -
8680 -
8681 \sa resizeEvent(), event(), move(), QMoveEvent -
8682*/ -
8683 -
8684void QWidget::moveEvent(QMoveEvent *) -
8685{ -
8686} -
8687 -
8688 -
8689/*! -
8690 This event handler can be reimplemented in a subclass to receive -
8691 widget resize events which are passed in the \a event parameter. -
8692 When resizeEvent() is called, the widget already has its new -
8693 geometry. The old size is accessible through -
8694 QResizeEvent::oldSize(). -
8695 -
8696 The widget will be erased and receive a paint event immediately -
8697 after processing the resize event. No drawing need be (or should -
8698 be) done inside this handler. -
8699 -
8700 -
8701 \sa moveEvent(), event(), resize(), QResizeEvent, paintEvent(), -
8702 {Scribble Example} -
8703*/ -
8704 -
8705void QWidget::resizeEvent(QResizeEvent * /* event */) -
8706{ -
8707} -
8708 -
8709#ifndef QT_NO_ACTION -
8710/*! -
8711 \fn void QWidget::actionEvent(QActionEvent *event) -
8712 -
8713 This event handler is called with the given \a event whenever the -
8714 widget's actions are changed. -
8715 -
8716 \sa addAction(), insertAction(), removeAction(), actions(), QActionEvent -
8717*/ -
8718void QWidget::actionEvent(QActionEvent *) -
8719{ -
8720 -
8721} -
8722#endif -
8723 -
8724/*! -
8725 This event handler is called with the given \a event when Qt receives a window -
8726 close request for a top-level widget from the window system. -
8727 -
8728 By default, the event is accepted and the widget is closed. You can reimplement -
8729 this function to change the way the widget responds to window close requests. -
8730 For example, you can prevent the window from closing by calling \l{QEvent::}{ignore()} -
8731 on all events. -
8732 -
8733 Main window applications typically use reimplementations of this function to check -
8734 whether the user's work has been saved and ask for permission before closing. -
8735 For example, the \l{Application Example} uses a helper function to determine whether -
8736 or not to close the window: -
8737 -
8738 \snippet mainwindows/application/mainwindow.cpp 3 -
8739 \snippet mainwindows/application/mainwindow.cpp 4 -
8740 -
8741 \sa event(), hide(), close(), QCloseEvent, {Application Example} -
8742*/ -
8743 -
8744void QWidget::closeEvent(QCloseEvent *event) -
8745{ -
8746 event->accept();
executed (the execution status of this line is deduced): event->accept();
-
8747}
executed: }
Execution Count:61
61
8748 -
8749#ifndef QT_NO_CONTEXTMENU -
8750/*! -
8751 This event handler, for event \a event, can be reimplemented in a -
8752 subclass to receive widget context menu events. -
8753 -
8754 The handler is called when the widget's \l contextMenuPolicy is -
8755 Qt::DefaultContextMenu. -
8756 -
8757 The default implementation ignores the context event. -
8758 See the \l QContextMenuEvent documentation for more details. -
8759 -
8760 \sa event(), QContextMenuEvent, customContextMenuRequested() -
8761*/ -
8762 -
8763void QWidget::contextMenuEvent(QContextMenuEvent *event) -
8764{ -
8765 event->ignore();
never executed (the execution status of this line is deduced): event->ignore();
-
8766}
never executed: }
0
8767#endif // QT_NO_CONTEXTMENU -
8768 -
8769 -
8770/*! -
8771 This event handler, for event \a event, can be reimplemented in a -
8772 subclass to receive Input Method composition events. This handler -
8773 is called when the state of the input method changes. -
8774 -
8775 Note that when creating custom text editing widgets, the -
8776 Qt::WA_InputMethodEnabled window attribute must be set explicitly -
8777 (using the setAttribute() function) in order to receive input -
8778 method events. -
8779 -
8780 The default implementation calls event->ignore(), which rejects the -
8781 Input Method event. See the \l QInputMethodEvent documentation for more -
8782 details. -
8783 -
8784 \sa event(), QInputMethodEvent -
8785*/ -
8786void QWidget::inputMethodEvent(QInputMethodEvent *event) -
8787{ -
8788 event->ignore();
executed (the execution status of this line is deduced): event->ignore();
-
8789}
executed: }
Execution Count:6
6
8790 -
8791/*! -
8792 This method is only relevant for input widgets. It is used by the -
8793 input method to query a set of properties of the widget to be -
8794 able to support complex input method operations as support for -
8795 surrounding text and reconversions. -
8796 -
8797 \a query specifies which property is queried. -
8798 -
8799 \sa inputMethodEvent(), QInputMethodEven, inputMethodHints -
8800*/ -
8801QVariant QWidget::inputMethodQuery(Qt::InputMethodQuery query) const -
8802{ -
8803 switch(query) { -
8804 case Qt::ImCursorRectangle: -
8805 return QRect(width()/2, 0, 1, height());
executed: return QRect(width()/2, 0, 1, height());
Execution Count:1
1
8806 case Qt::ImFont: -
8807 return font();
never executed: return font();
0
8808 case Qt::ImAnchorPosition: -
8809 // Fallback. -
8810 return inputMethodQuery(Qt::ImCursorPosition);
never executed: return inputMethodQuery(Qt::ImCursorPosition);
0
8811 case Qt::ImHints: -
8812 return (int)inputMethodHints();
executed: return (int)inputMethodHints();
Execution Count:6
6
8813 default: -
8814 return QVariant();
executed: return QVariant();
Execution Count:3473
3473
8815 } -
8816}
never executed: }
0
8817 -
8818/*! -
8819 \property QWidget::inputMethodHints -
8820 \brief What input method specific hints the widget has. -
8821 -
8822 This is only relevant for input widgets. It is used by -
8823 the input method to retrieve hints as to how the input method -
8824 should operate. For example, if the Qt::ImhFormattedNumbersOnly flag -
8825 is set, the input method may change its visual components to reflect -
8826 that only numbers can be entered. -
8827 -
8828 \note The flags are only hints, so the particular input method -
8829 implementation is free to ignore them. If you want to be -
8830 sure that a certain type of characters are entered, -
8831 you should also set a QValidator on the widget. -
8832 -
8833 The default value is Qt::ImhNone. -
8834 -
8835 \since 4.6 -
8836 -
8837 \sa inputMethodQuery() -
8838*/ -
8839Qt::InputMethodHints QWidget::inputMethodHints() const -
8840{ -
8841#ifndef QT_NO_IM -
8842 const QWidgetPrivate *priv = d_func();
executed (the execution status of this line is deduced): const QWidgetPrivate *priv = d_func();
-
8843 while (priv->inheritsInputMethodHints) {
evaluated: priv->inheritsInputMethodHints
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:77
4-77
8844 priv = priv->q_func()->parentWidget()->d_func();
executed (the execution status of this line is deduced): priv = priv->q_func()->parentWidget()->d_func();
-
8845 Q_ASSERT(priv);
executed (the execution status of this line is deduced): qt_noop();
-
8846 }
executed: }
Execution Count:4
4
8847 return priv->imHints;
executed: return priv->imHints;
Execution Count:77
77
8848#else //QT_NO_IM -
8849 return 0; -
8850#endif //QT_NO_IM -
8851} -
8852 -
8853void QWidget::setInputMethodHints(Qt::InputMethodHints hints) -
8854{ -
8855#ifndef QT_NO_IM -
8856 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
8857 if (d->imHints == hints)
evaluated: d->imHints == hints
TRUEFALSE
yes
Evaluation Count:2782
yes
Evaluation Count:461
461-2782
8858 return;
executed: return;
Execution Count:2782
2782
8859 d->imHints = hints;
executed (the execution status of this line is deduced): d->imHints = hints;
-
8860 qApp->inputMethod()->update(Qt::ImHints);
executed (the execution status of this line is deduced): (static_cast<QApplication *>(QCoreApplication::instance()))->inputMethod()->update(Qt::ImHints);
-
8861#endif //QT_NO_IM -
8862}
executed: }
Execution Count:461
461
8863 -
8864 -
8865#ifndef QT_NO_DRAGANDDROP -
8866 -
8867/*! -
8868 \fn void QWidget::dragEnterEvent(QDragEnterEvent *event) -
8869 -
8870 This event handler is called when a drag is in progress and the -
8871 mouse enters this widget. The event is passed in the \a event parameter. -
8872 -
8873 If the event is ignored, the widget won't receive any \l{dragMoveEvent()}{drag -
8874 move events}. -
8875 -
8876 See the \l{dnd.html}{Drag-and-drop documentation} for an -
8877 overview of how to provide drag-and-drop in your application. -
8878 -
8879 \sa QDrag, QDragEnterEvent -
8880*/ -
8881void QWidget::dragEnterEvent(QDragEnterEvent *) -
8882{ -
8883} -
8884 -
8885/*! -
8886 \fn void QWidget::dragMoveEvent(QDragMoveEvent *event) -
8887 -
8888 This event handler is called if a drag is in progress, and when -
8889 any of the following conditions occur: the cursor enters this widget, -
8890 the cursor moves within this widget, or a modifier key is pressed on -
8891 the keyboard while this widget has the focus. The event is passed -
8892 in the \a event parameter. -
8893 -
8894 See the \l{dnd.html}{Drag-and-drop documentation} for an -
8895 overview of how to provide drag-and-drop in your application. -
8896 -
8897 \sa QDrag, QDragMoveEvent -
8898*/ -
8899void QWidget::dragMoveEvent(QDragMoveEvent *) -
8900{ -
8901} -
8902 -
8903/*! -
8904 \fn void QWidget::dragLeaveEvent(QDragLeaveEvent *event) -
8905 -
8906 This event handler is called when a drag is in progress and the -
8907 mouse leaves this widget. The event is passed in the \a event -
8908 parameter. -
8909 -
8910 See the \l{dnd.html}{Drag-and-drop documentation} for an -
8911 overview of how to provide drag-and-drop in your application. -
8912 -
8913 \sa QDrag, QDragLeaveEvent -
8914*/ -
8915void QWidget::dragLeaveEvent(QDragLeaveEvent *) -
8916{ -
8917} -
8918 -
8919/*! -
8920 \fn void QWidget::dropEvent(QDropEvent *event) -
8921 -
8922 This event handler is called when the drag is dropped on this -
8923 widget. The event is passed in the \a event parameter. -
8924 -
8925 See the \l{dnd.html}{Drag-and-drop documentation} for an -
8926 overview of how to provide drag-and-drop in your application. -
8927 -
8928 \sa QDrag, QDropEvent -
8929*/ -
8930void QWidget::dropEvent(QDropEvent *) -
8931{ -
8932} -
8933 -
8934#endif // QT_NO_DRAGANDDROP -
8935 -
8936/*! -
8937 \fn void QWidget::showEvent(QShowEvent *event) -
8938 -
8939 This event handler can be reimplemented in a subclass to receive -
8940 widget show events which are passed in the \a event parameter. -
8941 -
8942 Non-spontaneous show events are sent to widgets immediately -
8943 before they are shown. The spontaneous show events of windows are -
8944 delivered afterwards. -
8945 -
8946 Note: A widget receives spontaneous show and hide events when its -
8947 mapping status is changed by the window system, e.g. a spontaneous -
8948 hide event when the user minimizes the window, and a spontaneous -
8949 show event when the window is restored again. After receiving a -
8950 spontaneous hide event, a widget is still considered visible in -
8951 the sense of isVisible(). -
8952 -
8953 \sa visible, event(), QShowEvent -
8954*/ -
8955void QWidget::showEvent(QShowEvent *) -
8956{ -
8957} -
8958 -
8959/*! -
8960 \fn void QWidget::hideEvent(QHideEvent *event) -
8961 -
8962 This event handler can be reimplemented in a subclass to receive -
8963 widget hide events. The event is passed in the \a event parameter. -
8964 -
8965 Hide events are sent to widgets immediately after they have been -
8966 hidden. -
8967 -
8968 Note: A widget receives spontaneous show and hide events when its -
8969 mapping status is changed by the window system, e.g. a spontaneous -
8970 hide event when the user minimizes the window, and a spontaneous -
8971 show event when the window is restored again. After receiving a -
8972 spontaneous hide event, a widget is still considered visible in -
8973 the sense of isVisible(). -
8974 -
8975 \sa visible, event(), QHideEvent -
8976*/ -
8977void QWidget::hideEvent(QHideEvent *) -
8978{ -
8979} -
8980 -
8981/*! -
8982 This special event handler can be reimplemented in a subclass to -
8983 receive native platform events identified by \a eventType -
8984 which are passed in the \a message parameter. -
8985 -
8986 In your reimplementation of this function, if you want to stop the -
8987 event being handled by Qt, return true and set \a result. -
8988 If you return false, this native event is passed back to Qt, -
8989 which translates the event into a Qt event and sends it to the widget. -
8990 -
8991 \note Events are only delivered to this event handler if the widget is -
8992 has a native Window handle. -
8993 -
8994 \note This function superseedes the event filter functions -
8995 x11Event(), winEvent() and macEvent() of Qt 4. -
8996 -
8997 \table -
8998 \header \li Platform \li Event Type Identifier \li Message Type \li Result Type -
8999 \row \li Windows \li "windows_generic_MSG" \li MSG * \li LRESULT -
9000 \endtable -
9001*/ -
9002 -
9003bool QWidget::nativeEvent(const QByteArray &eventType, void *message, long *result) -
9004{ -
9005 Q_UNUSED(eventType);
executed (the execution status of this line is deduced): (void)eventType;;
-
9006 Q_UNUSED(message);
executed (the execution status of this line is deduced): (void)message;;
-
9007 Q_UNUSED(result);
executed (the execution status of this line is deduced): (void)result;;
-
9008 return false;
executed: return false;
Execution Count:67454
67454
9009} -
9010 -
9011/*! -
9012 Ensures that the widget has been polished by QStyle (i.e., has a -
9013 proper font and palette). -
9014 -
9015 QWidget calls this function after it has been fully constructed -
9016 but before it is shown the very first time. You can call this -
9017 function if you want to ensure that the widget is polished before -
9018 doing an operation, e.g., the correct font size might be needed in -
9019 the widget's sizeHint() reimplementation. Note that this function -
9020 \e is called from the default implementation of sizeHint(). -
9021 -
9022 Polishing is useful for final initialization that must happen after -
9023 all constructors (from base classes as well as from subclasses) -
9024 have been called. -
9025 -
9026 If you need to change some settings when a widget is polished, -
9027 reimplement event() and handle the QEvent::Polish event type. -
9028 -
9029 \b{Note:} The function is declared const so that it can be called from -
9030 other const functions (e.g., sizeHint()). -
9031 -
9032 \sa event() -
9033*/ -
9034void QWidget::ensurePolished() const -
9035{ -
9036 Q_D(const QWidget);
executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
9037 -
9038 const QMetaObject *m = metaObject();
executed (the execution status of this line is deduced): const QMetaObject *m = metaObject();
-
9039 if (m == d->polished)
evaluated: m == d->polished
TRUEFALSE
yes
Evaluation Count:185046
yes
Evaluation Count:37234
37234-185046
9040 return;
executed: return;
Execution Count:185046
185046
9041 d->polished = m;
executed (the execution status of this line is deduced): d->polished = m;
-
9042 -
9043 QEvent e(QEvent::Polish);
executed (the execution status of this line is deduced): QEvent e(QEvent::Polish);
-
9044 QCoreApplication::sendEvent(const_cast<QWidget *>(this), &e);
executed (the execution status of this line is deduced): QCoreApplication::sendEvent(const_cast<QWidget *>(this), &e);
-
9045 -
9046 // polish children after 'this' -
9047 QList<QObject*> children = d->children;
executed (the execution status of this line is deduced): QList<QObject*> children = d->children;
-
9048 for (int i = 0; i < children.size(); ++i) {
evaluated: i < children.size()
TRUEFALSE
yes
Evaluation Count:49032
yes
Evaluation Count:37234
37234-49032
9049 QObject *o = children.at(i);
executed (the execution status of this line is deduced): QObject *o = children.at(i);
-
9050 if(!o->isWidgetType())
evaluated: !o->isWidgetType()
TRUEFALSE
yes
Evaluation Count:19578
yes
Evaluation Count:29454
19578-29454
9051 continue;
executed: continue;
Execution Count:19578
19578
9052 if (QWidget *w = qobject_cast<QWidget *>(o))
partially evaluated: QWidget *w = qobject_cast<QWidget *>(o)
TRUEFALSE
yes
Evaluation Count:29454
no
Evaluation Count:0
0-29454
9053 w->ensurePolished();
executed: w->ensurePolished();
Execution Count:29454
29454
9054 }
executed: }
Execution Count:29454
29454
9055 -
9056 if (d->parent && d->sendChildEvents) {
evaluated: d->parent
TRUEFALSE
yes
Evaluation Count:33946
yes
Evaluation Count:3288
evaluated: d->sendChildEvents
TRUEFALSE
yes
Evaluation Count:33945
yes
Evaluation Count:1
1-33946
9057 QChildEvent e(QEvent::ChildPolished, const_cast<QWidget *>(this));
executed (the execution status of this line is deduced): QChildEvent e(QEvent::ChildPolished, const_cast<QWidget *>(this));
-
9058 QCoreApplication::sendEvent(d->parent, &e);
executed (the execution status of this line is deduced): QCoreApplication::sendEvent(d->parent, &e);
-
9059 }
executed: }
Execution Count:33945
33945
9060}
executed: }
Execution Count:37234
37234
9061 -
9062/*! -
9063 Returns the mask currently set on a widget. If no mask is set the -
9064 return value will be an empty region. -
9065 -
9066 \sa setMask(), clearMask(), QRegion::isEmpty(), {Shaped Clock Example} -
9067*/ -
9068QRegion QWidget::mask() const -
9069{ -
9070 Q_D(const QWidget);
executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
9071 return d->extra ? d->extra->mask : QRegion();
executed: return d->extra ? d->extra->mask : QRegion();
Execution Count:783
783
9072} -
9073 -
9074/*! -
9075 Returns the layout manager that is installed on this widget, or 0 -
9076 if no layout manager is installed. -
9077 -
9078 The layout manager sets the geometry of the widget's children -
9079 that have been added to the layout. -
9080 -
9081 \sa setLayout(), sizePolicy(), {Layout Management} -
9082*/ -
9083QLayout *QWidget::layout() const -
9084{ -
9085 return d_func()->layout;
executed: return d_func()->layout;
Execution Count:57774
57774
9086} -
9087 -
9088 -
9089/*! -
9090 \fn void QWidget::setLayout(QLayout *layout) -
9091 -
9092 Sets the layout manager for this widget to \a layout. -
9093 -
9094 If there already is a layout manager installed on this widget, -
9095 QWidget won't let you install another. You must first delete the -
9096 existing layout manager (returned by layout()) before you can -
9097 call setLayout() with the new layout. -
9098 -
9099 If \a layout is the layout manger on a different widget, setLayout() -
9100 will reparent the layout and make it the layout manager for this widget. -
9101 -
9102 Example: -
9103 -
9104 \snippet layouts/layouts.cpp 24 -
9105 -
9106 An alternative to calling this function is to pass this widget to -
9107 the layout's constructor. -
9108 -
9109 The QWidget will take ownership of \a layout. -
9110 -
9111 \sa layout(), {Layout Management} -
9112*/ -
9113 -
9114void QWidget::setLayout(QLayout *l) -
9115{ -
9116 if (!l) {
evaluated: !l
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:10623
1-10623
9117 qWarning("QWidget::setLayout: Cannot set layout to 0");
executed (the execution status of this line is deduced): QMessageLogger("kernel/qwidget.cpp", 9117, __PRETTY_FUNCTION__).warning("QWidget::setLayout: Cannot set layout to 0");
-
9118 return;
executed: return;
Execution Count:1
1
9119 } -
9120 if (layout()) {
evaluated: layout()
TRUEFALSE
yes
Evaluation Count:24
yes
Evaluation Count:10599
24-10599
9121 if (layout() != l)
partially evaluated: layout() != l
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:24
0-24
9122 qWarning("QWidget::setLayout: Attempting to set QLayout \"%s\" on %s \"%s\", which already has a"
never executed: QMessageLogger("kernel/qwidget.cpp", 9122, __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
9123 " layout", l->objectName().toLocal8Bit().data(), metaObject()->className(),
never executed: QMessageLogger("kernel/qwidget.cpp", 9122, __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
9124 objectName().toLocal8Bit().data());
never executed: QMessageLogger("kernel/qwidget.cpp", 9122, __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
9125 return;
executed: return;
Execution Count:24
24
9126 } -
9127 -
9128 QObject *oldParent = l->parent();
executed (the execution status of this line is deduced): QObject *oldParent = l->parent();
-
9129 if (oldParent && oldParent != this) {
evaluated: oldParent
TRUEFALSE
yes
Evaluation Count:88
yes
Evaluation Count:10511
evaluated: oldParent != this
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:87
1-10511
9130 if (oldParent->isWidgetType()) {
partially evaluated: oldParent->isWidgetType()
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
9131 // Steal the layout off a widget parent. Takes effect when -
9132 // morphing laid-out container widgets in Designer. -
9133 QWidget *oldParentWidget = static_cast<QWidget *>(oldParent);
executed (the execution status of this line is deduced): QWidget *oldParentWidget = static_cast<QWidget *>(oldParent);
-
9134 oldParentWidget->takeLayout();
executed (the execution status of this line is deduced): oldParentWidget->takeLayout();
-
9135 } else {
executed: }
Execution Count:1
1
9136 qWarning("QWidget::setLayout: Attempting to set QLayout \"%s\" on %s \"%s\", when the QLayout already has a parent",
never executed (the execution status of this line is deduced): QMessageLogger("kernel/qwidget.cpp", 9136, __PRETTY_FUNCTION__).warning("QWidget::setLayout: Attempting to set QLayout \"%s\" on %s \"%s\", when the QLayout already has a parent",
-
9137 l->objectName().toLocal8Bit().data(), metaObject()->className(),
never executed (the execution status of this line is deduced): l->objectName().toLocal8Bit().data(), metaObject()->className(),
-
9138 objectName().toLocal8Bit().data());
never executed (the execution status of this line is deduced): objectName().toLocal8Bit().data());
-
9139 return;
never executed: return;
0
9140 } -
9141 } -
9142 -
9143 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
9144 l->d_func()->topLevel = true;
executed (the execution status of this line is deduced): l->d_func()->topLevel = true;
-
9145 d->layout = l;
executed (the execution status of this line is deduced): d->layout = l;
-
9146 if (oldParent != this) {
evaluated: oldParent != this
TRUEFALSE
yes
Evaluation Count:10512
yes
Evaluation Count:87
87-10512
9147 l->setParent(this);
executed (the execution status of this line is deduced): l->setParent(this);
-
9148 l->d_func()->reparentChildWidgets(this);
executed (the execution status of this line is deduced): l->d_func()->reparentChildWidgets(this);
-
9149 l->invalidate();
executed (the execution status of this line is deduced): l->invalidate();
-
9150 }
executed: }
Execution Count:10512
10512
9151 -
9152 if (isWindow() && d->maybeTopData())
evaluated: isWindow()
TRUEFALSE
yes
Evaluation Count:262
yes
Evaluation Count:10337
evaluated: d->maybeTopData()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:257
5-10337
9153 d->topData()->sizeAdjusted = false;
executed: d->topData()->sizeAdjusted = false;
Execution Count:5
5
9154}
executed: }
Execution Count:10599
10599
9155 -
9156/*! -
9157 \fn QLayout *QWidget::takeLayout() -
9158 -
9159 Remove the layout from the widget. -
9160 \since 4.5 -
9161*/ -
9162 -
9163QLayout *QWidget::takeLayout() -
9164{ -
9165 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
9166 QLayout *l = layout();
executed (the execution status of this line is deduced): QLayout *l = layout();
-
9167 if (!l)
partially evaluated: !l
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
9168 return 0;
never executed: return 0;
0
9169 d->layout = 0;
executed (the execution status of this line is deduced): d->layout = 0;
-
9170 l->setParent(0);
executed (the execution status of this line is deduced): l->setParent(0);
-
9171 return l;
executed: return l;
Execution Count:1
1
9172} -
9173 -
9174/*! -
9175 \property QWidget::sizePolicy -
9176 \brief the default layout behavior of the widget -
9177 -
9178 If there is a QLayout that manages this widget's children, the -
9179 size policy specified by that layout is used. If there is no such -
9180 QLayout, the result of this function is used. -
9181 -
9182 The default policy is Preferred/Preferred, which means that the -
9183 widget can be freely resized, but prefers to be the size -
9184 sizeHint() returns. Button-like widgets set the size policy to -
9185 specify that they may stretch horizontally, but are fixed -
9186 vertically. The same applies to lineedit controls (such as -
9187 QLineEdit, QSpinBox or an editable QComboBox) and other -
9188 horizontally orientated widgets (such as QProgressBar). -
9189 QToolButton's are normally square, so they allow growth in both -
9190 directions. Widgets that support different directions (such as -
9191 QSlider, QScrollBar or QHeader) specify stretching in the -
9192 respective direction only. Widgets that can provide scroll bars -
9193 (usually subclasses of QScrollArea) tend to specify that they can -
9194 use additional space, and that they can make do with less than -
9195 sizeHint(). -
9196 -
9197 \sa sizeHint(), QLayout, QSizePolicy, updateGeometry() -
9198*/ -
9199QSizePolicy QWidget::sizePolicy() const -
9200{ -
9201 Q_D(const QWidget);
executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
9202 return d->size_policy;
executed: return d->size_policy;
Execution Count:109807
109807
9203} -
9204 -
9205void QWidget::setSizePolicy(QSizePolicy policy) -
9206{ -
9207 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
9208 setAttribute(Qt::WA_WState_OwnSizePolicy);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_WState_OwnSizePolicy);
-
9209 if (policy == d->size_policy)
evaluated: policy == d->size_policy
TRUEFALSE
yes
Evaluation Count:577
yes
Evaluation Count:33145
577-33145
9210 return;
executed: return;
Execution Count:577
577
9211 d->size_policy = policy;
executed (the execution status of this line is deduced): d->size_policy = policy;
-
9212 -
9213#ifndef QT_NO_GRAPHICSVIEW -
9214 if (QWExtra *extra = d->extra) {
evaluated: QWExtra *extra = d->extra
TRUEFALSE
yes
Evaluation Count:1589
yes
Evaluation Count:31556
1589-31556
9215 if (extra->proxyWidget)
partially evaluated: extra->proxyWidget
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1589
0-1589
9216 extra->proxyWidget->setSizePolicy(policy);
never executed: extra->proxyWidget->setSizePolicy(policy);
0
9217 }
executed: }
Execution Count:1589
1589
9218#endif -
9219 -
9220 updateGeometry();
executed (the execution status of this line is deduced): updateGeometry();
-
9221 -
9222 if (isWindow() && d->maybeTopData())
evaluated: isWindow()
TRUEFALSE
yes
Evaluation Count:7213
yes
Evaluation Count:25932
evaluated: d->maybeTopData()
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:7200
13-25932
9223 d->topData()->sizeAdjusted = false;
executed: d->topData()->sizeAdjusted = false;
Execution Count:13
13
9224}
executed: }
Execution Count:33145
33145
9225 -
9226/*! -
9227 \fn void QWidget::setSizePolicy(QSizePolicy::Policy horizontal, QSizePolicy::Policy vertical) -
9228 \overload -
9229 -
9230 Sets the size policy of the widget to \a horizontal and \a -
9231 vertical, with standard stretch and no height-for-width. -
9232 -
9233 \sa QSizePolicy::QSizePolicy() -
9234*/ -
9235 -
9236/*! -
9237 Returns the preferred height for this widget, given the width \a w. -
9238 -
9239 If this widget has a layout, the default implementation returns -
9240 the layout's preferred height. if there is no layout, the default -
9241 implementation returns -1 indicating that the preferred height -
9242 does not depend on the width. -
9243*/ -
9244 -
9245int QWidget::heightForWidth(int w) const -
9246{ -
9247 if (layout() && layout()->hasHeightForWidth())
evaluated: layout()
TRUEFALSE
yes
Evaluation Count:68
yes
Evaluation Count:5
partially evaluated: layout()->hasHeightForWidth()
TRUEFALSE
yes
Evaluation Count:68
no
Evaluation Count:0
0-68
9248 return layout()->totalHeightForWidth(w);
executed: return layout()->totalHeightForWidth(w);
Execution Count:68
68
9249 return -1;
executed: return -1;
Execution Count:5
5
9250} -
9251 -
9252 -
9253/*! -
9254 \since 5.0 -
9255 -
9256 Returns true if the widget's preferred height depends on its width; otherwise returns false. -
9257*/ -
9258bool QWidget::hasHeightForWidth() const -
9259{ -
9260 Q_D(const QWidget);
executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
9261 return d->layout ? d->layout->hasHeightForWidth() : d->size_policy.hasHeightForWidth();
executed: return d->layout ? d->layout->hasHeightForWidth() : d->size_policy.hasHeightForWidth();
Execution Count:18198
18198
9262} -
9263 -
9264/*! -
9265 \fn QWidget *QWidget::childAt(int x, int y) const -
9266 -
9267 Returns the visible child widget at the position (\a{x}, \a{y}) -
9268 in the widget's coordinate system. If there is no visible child -
9269 widget at the specified position, the function returns 0. -
9270*/ -
9271 -
9272/*! -
9273 \overload -
9274 -
9275 Returns the visible child widget at point \a p in the widget's own -
9276 coordinate system. -
9277*/ -
9278 -
9279QWidget *QWidget::childAt(const QPoint &p) const -
9280{ -
9281 return d_func()->childAt_helper(p, false);
executed: return d_func()->childAt_helper(p, false);
Execution Count:2087
2087
9282} -
9283 -
9284QWidget *QWidgetPrivate::childAt_helper(const QPoint &p, bool ignoreChildrenInDestructor) const -
9285{ -
9286 if (children.isEmpty())
evaluated: children.isEmpty()
TRUEFALSE
yes
Evaluation Count:552
yes
Evaluation Count:2013
552-2013
9287 return 0;
executed: return 0;
Execution Count:552
552
9288 -
9289#ifdef Q_WS_MAC -
9290 Q_Q(const QWidget); -
9291 // Unified tool bars on the Mac require special handling since they live outside -
9292 // QMainWindow's geometry(). See commit: 35667fd45ada49269a5987c235fdedfc43e92bb8 -
9293 bool includeFrame = q->isWindow() && qobject_cast<const QMainWindow *>(q) -
9294 && static_cast<const QMainWindow *>(q)->unifiedTitleAndToolBarOnMac(); -
9295 if (includeFrame) -
9296 return childAtRecursiveHelper(p, ignoreChildrenInDestructor, includeFrame); -
9297#endif -
9298 -
9299 if (!pointInsideRectAndMask(p))
evaluated: !pointInsideRectAndMask(p)
TRUEFALSE
yes
Evaluation Count:15
yes
Evaluation Count:1998
15-1998
9300 return 0;
executed: return 0;
Execution Count:15
15
9301 return childAtRecursiveHelper(p, ignoreChildrenInDestructor);
executed: return childAtRecursiveHelper(p, ignoreChildrenInDestructor);
Execution Count:1998
1998
9302} -
9303 -
9304QWidget *QWidgetPrivate::childAtRecursiveHelper(const QPoint &p, bool ignoreChildrenInDestructor, bool includeFrame) const -
9305{ -
9306#ifndef Q_WS_MAC -
9307 Q_UNUSED(includeFrame);
executed (the execution status of this line is deduced): (void)includeFrame;;
-
9308#endif -
9309 for (int i = children.size() - 1; i >= 0; --i) {
evaluated: i >= 0
TRUEFALSE
yes
Evaluation Count:10599
yes
Evaluation Count:1998
1998-10599
9310 QWidget *child = qobject_cast<QWidget *>(children.at(i));
executed (the execution status of this line is deduced): QWidget *child = qobject_cast<QWidget *>(children.at(i));
-
9311 if (!child || child->isWindow() || child->isHidden() || child->testAttribute(Qt::WA_TransparentForMouseEvents)
evaluated: !child
TRUEFALSE
yes
Evaluation Count:2982
yes
Evaluation Count:7617
evaluated: child->isWindow()
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:7603
evaluated: child->isHidden()
TRUEFALSE
yes
Evaluation Count:1370
yes
Evaluation Count:6233
evaluated: child->testAttribute(Qt::WA_TransparentForMouseEvents)
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:6229
4-7617
9312 || (ignoreChildrenInDestructor && child->data->in_destructor)) {
evaluated: ignoreChildrenInDestructor
TRUEFALSE
yes
Evaluation Count:72
yes
Evaluation Count:6157
evaluated: child->data->in_destructor
TRUEFALSE
yes
Evaluation Count:65
yes
Evaluation Count:7
7-6157
9313 continue;
executed: continue;
Execution Count:4435
4435
9314 } -
9315 -
9316 // Map the point 'p' from parent coordinates to child coordinates. -
9317 QPoint childPoint = p;
executed (the execution status of this line is deduced): QPoint childPoint = p;
-
9318#ifdef Q_WS_MAC -
9319 // 'includeFrame' is true if the child's parent is a top-level QMainWindow with an unified tool bar. -
9320 // An unified tool bar on the Mac lives outside QMainWindow's geometry(), so a normal -
9321 // QWidget::mapFromParent won't do the trick. -
9322 if (includeFrame && qobject_cast<QToolBar *>(child)) -
9323 childPoint = qt_mac_nativeMapFromParent(child, p); -
9324 else -
9325#endif -
9326 childPoint -= child->data->crect.topLeft();
executed (the execution status of this line is deduced): childPoint -= child->data->crect.topLeft();
-
9327 -
9328 // Check if the point hits the child. -
9329 if (!child->d_func()->pointInsideRectAndMask(childPoint))
evaluated: !child->d_func()->pointInsideRectAndMask(childPoint)
TRUEFALSE
yes
Evaluation Count:3500
yes
Evaluation Count:2664
2664-3500
9330 continue;
executed: continue;
Execution Count:3500
3500
9331 -
9332 // Do the same for the child's descendants. -
9333 if (QWidget *w = child->d_func()->childAtRecursiveHelper(childPoint, ignoreChildrenInDestructor))
evaluated: QWidget *w = child->d_func()->childAtRecursiveHelper(childPoint, ignoreChildrenInDestructor)
TRUEFALSE
yes
Evaluation Count:899
yes
Evaluation Count:1765
899-1765
9334 return w;
executed: return w;
Execution Count:899
899
9335 -
9336 // We have found our target; namely the child at position 'p'. -
9337 return child;
executed: return child;
Execution Count:1765
1765
9338 } -
9339 return 0;
executed: return 0;
Execution Count:1998
1998
9340} -
9341 -
9342void QWidgetPrivate::updateGeometry_helper(bool forceUpdate) -
9343{ -
9344 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
9345 if (widgetItem)
evaluated: widgetItem
TRUEFALSE
yes
Evaluation Count:14295
yes
Evaluation Count:59822
14295-59822
9346 widgetItem->invalidateSizeCache();
executed: widgetItem->invalidateSizeCache();
Execution Count:14295
14295
9347 QWidget *parent;
executed (the execution status of this line is deduced): QWidget *parent;
-
9348 if (forceUpdate || !extra || extra->minw != extra->maxw || extra->minh != extra->maxh) {
evaluated: forceUpdate
TRUEFALSE
yes
Evaluation Count:5280
yes
Evaluation Count:68837
evaluated: !extra
TRUEFALSE
yes
Evaluation Count:52751
yes
Evaluation Count:16086
evaluated: extra->minw != extra->maxw
TRUEFALSE
yes
Evaluation Count:15900
yes
Evaluation Count:186
evaluated: extra->minh != extra->maxh
TRUEFALSE
yes
Evaluation Count:18
yes
Evaluation Count:168
18-68837
9349 if (!q->isWindow() && !q->isHidden() && (parent = q->parentWidget())) {
evaluated: !q->isWindow()
TRUEFALSE
yes
Evaluation Count:57253
yes
Evaluation Count:16696
evaluated: !q->isHidden()
TRUEFALSE
yes
Evaluation Count:55267
yes
Evaluation Count:1986
partially evaluated: (parent = q->parentWidget())
TRUEFALSE
yes
Evaluation Count:55267
no
Evaluation Count:0
0-57253
9350 if (parent->d_func()->layout)
evaluated: parent->d_func()->layout
TRUEFALSE
yes
Evaluation Count:24578
yes
Evaluation Count:30689
24578-30689
9351 parent->d_func()->layout->invalidate();
executed: parent->d_func()->layout->invalidate();
Execution Count:24578
24578
9352 else if (parent->isVisible())
evaluated: parent->isVisible()
TRUEFALSE
yes
Evaluation Count:3308
yes
Evaluation Count:27381
3308-27381
9353 QApplication::postEvent(parent, new QEvent(QEvent::LayoutRequest));
executed: QApplication::postEvent(parent, new QEvent(QEvent::LayoutRequest));
Execution Count:3308
3308
9354 } -
9355 }
executed: }
Execution Count:73949
73949
9356}
executed: }
Execution Count:74117
74117
9357 -
9358/*! -
9359 Notifies the layout system that this widget has changed and may -
9360 need to change geometry. -
9361 -
9362 Call this function if the sizeHint() or sizePolicy() have changed. -
9363 -
9364 For explicitly hidden widgets, updateGeometry() is a no-op. The -
9365 layout system will be notified as soon as the widget is shown. -
9366*/ -
9367 -
9368void QWidget::updateGeometry() -
9369{ -
9370 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
9371 d->updateGeometry_helper(false);
executed (the execution status of this line is deduced): d->updateGeometry_helper(false);
-
9372}
executed: }
Execution Count:64381
64381
9373 -
9374/*! \property QWidget::windowFlags -
9375 -
9376 Window flags are a combination of a type (e.g. Qt::Dialog) and -
9377 zero or more hints to the window system (e.g. -
9378 Qt::FramelessWindowHint). -
9379 -
9380 If the widget had type Qt::Widget or Qt::SubWindow and becomes a -
9381 window (Qt::Window, Qt::Dialog, etc.), it is put at position (0, -
9382 0) on the desktop. If the widget is a window and becomes a -
9383 Qt::Widget or Qt::SubWindow, it is put at position (0, 0) -
9384 relative to its parent widget. -
9385 -
9386 \note This function calls setParent() when changing the flags for -
9387 a window, causing the widget to be hidden. You must call show() to make -
9388 the widget visible again.. -
9389 -
9390 \sa windowType(), {Window Flags Example} -
9391*/ -
9392void QWidget::setWindowFlags(Qt::WindowFlags flags) -
9393{ -
9394 if (data->window_flags == flags)
evaluated: data->window_flags == flags
TRUEFALSE
yes
Evaluation Count:25
yes
Evaluation Count:575
25-575
9395 return;
executed: return;
Execution Count:25
25
9396 -
9397 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
9398 -
9399 if ((data->window_flags | flags) & Qt::Window) {
evaluated: (data->window_flags | flags) & Qt::Window
TRUEFALSE
yes
Evaluation Count:469
yes
Evaluation Count:106
106-469
9400 // the old type was a window and/or the new type is a window -
9401 QPoint oldPos = pos();
executed (the execution status of this line is deduced): QPoint oldPos = pos();
-
9402 bool visible = isVisible();
executed (the execution status of this line is deduced): bool visible = isVisible();
-
9403 setParent(parentWidget(), flags);
executed (the execution status of this line is deduced): setParent(parentWidget(), flags);
-
9404 -
9405 // if both types are windows or neither of them are, we restore -
9406 // the old position -
9407 if (!((data->window_flags ^ flags) & Qt::Window)
evaluated: !((data->window_flags ^ flags) & Qt::Window)
TRUEFALSE
yes
Evaluation Count:409
yes
Evaluation Count:60
60-409
9408 && (visible || testAttribute(Qt::WA_Moved))) {
evaluated: visible
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:399
evaluated: testAttribute(Qt::WA_Moved)
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:394
5-399
9409 move(oldPos);
executed (the execution status of this line is deduced): move(oldPos);
-
9410 }
executed: }
Execution Count:15
15
9411 // for backward-compatibility we change Qt::WA_QuitOnClose attribute value only when the window was recreated. -
9412 d->adjustQuitOnCloseAttribute();
executed (the execution status of this line is deduced): d->adjustQuitOnCloseAttribute();
-
9413 } else {
executed: }
Execution Count:469
469
9414 data->window_flags = flags;
executed (the execution status of this line is deduced): data->window_flags = flags;
-
9415 }
executed: }
Execution Count:106
106
9416} -
9417 -
9418/*! -
9419 Sets the window flags for the widget to \a flags, -
9420 \e without telling the window system. -
9421 -
9422 \warning Do not call this function unless you really know what -
9423 you're doing. -
9424 -
9425 \sa setWindowFlags() -
9426*/ -
9427void QWidget::overrideWindowFlags(Qt::WindowFlags flags) -
9428{ -
9429 data->window_flags = flags;
never executed (the execution status of this line is deduced): data->window_flags = flags;
-
9430}
never executed: }
0
9431 -
9432/*! -
9433 \fn Qt::WindowType QWidget::windowType() const -
9434 -
9435 Returns the window type of this widget. This is identical to -
9436 windowFlags() & Qt::WindowType_Mask. -
9437 -
9438 \sa windowFlags -
9439*/ -
9440 -
9441/*! -
9442 Sets the parent of the widget to \a parent, and resets the window -
9443 flags. The widget is moved to position (0, 0) in its new parent. -
9444 -
9445 If the new parent widget is in a different window, the -
9446 reparented widget and its children are appended to the end of the -
9447 \l{setFocusPolicy()}{tab chain} of the new parent -
9448 widget, in the same internal order as before. If one of the moved -
9449 widgets had keyboard focus, setParent() calls clearFocus() for that -
9450 widget. -
9451 -
9452 If the new parent widget is in the same window as the -
9453 old parent, setting the parent doesn't change the tab order or -
9454 keyboard focus. -
9455 -
9456 If the "new" parent widget is the old parent widget, this function -
9457 does nothing. -
9458 -
9459 \note The widget becomes invisible as part of changing its parent, -
9460 even if it was previously visible. You must call show() to make the -
9461 widget visible again. -
9462 -
9463 \warning It is very unlikely that you will ever need this -
9464 function. If you have a widget that changes its content -
9465 dynamically, it is far easier to use \l QStackedWidget. -
9466 -
9467 \sa setWindowFlags() -
9468*/ -
9469void QWidget::setParent(QWidget *parent) -
9470{ -
9471 if (parent == parentWidget())
evaluated: parent == parentWidget()
TRUEFALSE
yes
Evaluation Count:1974
yes
Evaluation Count:3442
1974-3442
9472 return;
executed: return;
Execution Count:1974
1974
9473 setParent((QWidget*)parent, windowFlags() & ~Qt::WindowType_Mask);
executed (the execution status of this line is deduced): setParent((QWidget*)parent, windowFlags() & ~Qt::WindowType_Mask);
-
9474}
executed: }
Execution Count:3442
3442
9475 -
9476/*! -
9477 \overload -
9478 -
9479 This function also takes widget flags, \a f as an argument. -
9480*/ -
9481 -
9482void QWidget::setParent(QWidget *parent, Qt::WindowFlags f) -
9483{ -
9484 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
9485 bool resized = testAttribute(Qt::WA_Resized);
executed (the execution status of this line is deduced): bool resized = testAttribute(Qt::WA_Resized);
-
9486 bool wasCreated = testAttribute(Qt::WA_WState_Created);
executed (the execution status of this line is deduced): bool wasCreated = testAttribute(Qt::WA_WState_Created);
-
9487 QWidget *oldtlw = window();
executed (the execution status of this line is deduced): QWidget *oldtlw = window();
-
9488 -
9489 QWidget *desktopWidget = 0;
executed (the execution status of this line is deduced): QWidget *desktopWidget = 0;
-
9490 if (parent && parent->windowType() == Qt::Desktop)
evaluated: parent
TRUEFALSE
yes
Evaluation Count:40989
yes
Evaluation Count:574
partially evaluated: parent->windowType() == Qt::Desktop
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:40989
0-40989
9491 desktopWidget = parent;
never executed: desktopWidget = parent;
0
9492 bool newParent = (parent != parentWidget()) || !wasCreated || desktopWidget;
evaluated: (parent != parentWidget())
TRUEFALSE
yes
Evaluation Count:41065
yes
Evaluation Count:498
evaluated: !wasCreated
TRUEFALSE
yes
Evaluation Count:475
yes
Evaluation Count:23
partially evaluated: desktopWidget
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:23
0-41065
9493 -
9494 if (newParent && parent && !desktopWidget) {
evaluated: newParent
TRUEFALSE
yes
Evaluation Count:41540
yes
Evaluation Count:23
evaluated: parent
TRUEFALSE
yes
Evaluation Count:40970
yes
Evaluation Count:570
partially evaluated: !desktopWidget
TRUEFALSE
yes
Evaluation Count:40970
no
Evaluation Count:0
0-41540
9495 if (testAttribute(Qt::WA_NativeWindow) && !qApp->testAttribute(Qt::AA_DontCreateNativeWidgetSiblings)
evaluated: testAttribute(Qt::WA_NativeWindow)
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:40962
evaluated: !(static_cast<QApplication *>(QCoreApplication::instance()))->testAttribute(Qt::AA_DontCreateNativeWidgetSiblings)
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:1
1-40962
9496#ifdef Q_WS_MAC -
9497 // On Mac, toolbars inside the unified title bar will never overlap with -
9498 // siblings in the content view. So we skip enforce native siblings in that case -
9499 && !d->isInUnifiedToolbar && parentWidget() && parentWidget()->isWindow() -
9500#endif // Q_WS_MAC -
9501 ) -
9502 parent->d_func()->enforceNativeChildren();
executed: parent->d_func()->enforceNativeChildren();
Execution Count:7
7
9503 else if (parent->d_func()->nativeChildrenForced() || parent->testAttribute(Qt::WA_PaintOnScreen))
evaluated: parent->d_func()->nativeChildrenForced()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:40962
evaluated: parent->testAttribute(Qt::WA_PaintOnScreen)
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:40960
1-40962
9504 setAttribute(Qt::WA_NativeWindow);
executed: setAttribute(Qt::WA_NativeWindow);
Execution Count:3
3
9505 } -
9506 -
9507 if (wasCreated) {
evaluated: wasCreated
TRUEFALSE
yes
Evaluation Count:131
yes
Evaluation Count:41432
131-41432
9508 if (!testAttribute(Qt::WA_WState_Hidden)) {
evaluated: !testAttribute(Qt::WA_WState_Hidden)
TRUEFALSE
yes
Evaluation Count:49
yes
Evaluation Count:82
49-82
9509 hide();
executed (the execution status of this line is deduced): hide();
-
9510 setAttribute(Qt::WA_WState_ExplicitShowHide, false);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_WState_ExplicitShowHide, false);
-
9511 }
executed: }
Execution Count:49
49
9512 if (newParent) {
evaluated: newParent
TRUEFALSE
yes
Evaluation Count:108
yes
Evaluation Count:23
23-108
9513 QEvent e(QEvent::ParentAboutToChange);
executed (the execution status of this line is deduced): QEvent e(QEvent::ParentAboutToChange);
-
9514 QApplication::sendEvent(this, &e);
executed (the execution status of this line is deduced): QApplication::sendEvent(this, &e);
-
9515 }
executed: }
Execution Count:108
108
9516 }
executed: }
Execution Count:131
131
9517 if (newParent && isAncestorOf(focusWidget()))
evaluated: newParent
TRUEFALSE
yes
Evaluation Count:41540
yes
Evaluation Count:23
evaluated: isAncestorOf(focusWidget())
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:41534
6-41540
9518 focusWidget()->clearFocus();
executed: focusWidget()->clearFocus();
Execution Count:6
6
9519 -
9520 QTLWExtra *oldTopExtra = window()->d_func()->maybeTopData();
executed (the execution status of this line is deduced): QTLWExtra *oldTopExtra = window()->d_func()->maybeTopData();
-
9521 QWidgetBackingStoreTracker *oldBsTracker = oldTopExtra ? &oldTopExtra->backingStoreTracker : 0;
evaluated: oldTopExtra
TRUEFALSE
yes
Evaluation Count:257
yes
Evaluation Count:41306
257-41306
9522 -
9523 d->setParent_sys(parent, f);
executed (the execution status of this line is deduced): d->setParent_sys(parent, f);
-
9524 -
9525 QTLWExtra *topExtra = window()->d_func()->maybeTopData();
executed (the execution status of this line is deduced): QTLWExtra *topExtra = window()->d_func()->maybeTopData();
-
9526 QWidgetBackingStoreTracker *bsTracker = topExtra ? &topExtra->backingStoreTracker : 0;
evaluated: topExtra
TRUEFALSE
yes
Evaluation Count:2856
yes
Evaluation Count:38707
2856-38707
9527 if (oldBsTracker && oldBsTracker != bsTracker)
evaluated: oldBsTracker
TRUEFALSE
yes
Evaluation Count:257
yes
Evaluation Count:41306
evaluated: oldBsTracker != bsTracker
TRUEFALSE
yes
Evaluation Count:185
yes
Evaluation Count:72
72-41306
9528 oldBsTracker->unregisterWidgetSubtree(this);
executed: oldBsTracker->unregisterWidgetSubtree(this);
Execution Count:185
185
9529 -
9530 if (desktopWidget)
partially evaluated: desktopWidget
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:41563
0-41563
9531 parent = 0;
never executed: parent = 0;
0
9532 -
9533 if (QWidgetBackingStore *oldBs = oldtlw->d_func()->maybeBackingStore()) {
evaluated: QWidgetBackingStore *oldBs = oldtlw->d_func()->maybeBackingStore()
TRUEFALSE
yes
Evaluation Count:825
yes
Evaluation Count:40738
825-40738
9534 if (newParent)
evaluated: newParent
TRUEFALSE
yes
Evaluation Count:802
yes
Evaluation Count:23
23-802
9535 oldBs->removeDirtyWidget(this);
executed: oldBs->removeDirtyWidget(this);
Execution Count:802
802
9536 // Move the widget and all its static children from -
9537 // the old backing store to the new one. -
9538 oldBs->moveStaticWidgets(this);
executed (the execution status of this line is deduced): oldBs->moveStaticWidgets(this);
-
9539 }
executed: }
Execution Count:825
825
9540 -
9541 if (QApplicationPrivate::testAttribute(Qt::AA_ImmediateWidgetCreation) && !testAttribute(Qt::WA_WState_Created))
evaluated: QApplicationPrivate::testAttribute(Qt::AA_ImmediateWidgetCreation)
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:41561
partially evaluated: !testAttribute(Qt::WA_WState_Created)
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-41561
9542 create();
executed: create();
Execution Count:2
2
9543 -
9544 d->reparentFocusWidgets(oldtlw);
executed (the execution status of this line is deduced): d->reparentFocusWidgets(oldtlw);
-
9545 setAttribute(Qt::WA_Resized, resized);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_Resized, resized);
-
9546 if (!testAttribute(Qt::WA_StyleSheet)
partially evaluated: !testAttribute(Qt::WA_StyleSheet)
TRUEFALSE
yes
Evaluation Count:41563
no
Evaluation Count:0
0-41563
9547 && (!parent || !parent->testAttribute(Qt::WA_StyleSheet))) {
evaluated: !parent
TRUEFALSE
yes
Evaluation Count:574
yes
Evaluation Count:40989
evaluated: !parent->testAttribute(Qt::WA_StyleSheet)
TRUEFALSE
yes
Evaluation Count:40979
yes
Evaluation Count:10
10-40989
9548 d->resolveFont();
executed (the execution status of this line is deduced): d->resolveFont();
-
9549 d->resolvePalette();
executed (the execution status of this line is deduced): d->resolvePalette();
-
9550 }
executed: }
Execution Count:41553
41553
9551 d->resolveLayoutDirection();
executed (the execution status of this line is deduced): d->resolveLayoutDirection();
-
9552 d->resolveLocale();
executed (the execution status of this line is deduced): d->resolveLocale();
-
9553 -
9554 // Note: GL widgets under WGL or EGL will always need a ParentChange -
9555 // event to handle recreation/rebinding of the GL context, hence the -
9556 // (f & Qt::MSWindowsOwnDC) clause (which is set on QGLWidgets on all -
9557 // platforms). -
9558 if (newParent
evaluated: newParent
TRUEFALSE
yes
Evaluation Count:41540
yes
Evaluation Count:23
23-41540
9559#if defined(Q_WS_WIN) || defined(QT_OPENGL_ES) -
9560 || (f & Qt::MSWindowsOwnDC) -
9561#endif -
9562 ) { -
9563 // propagate enabled updates enabled state to non-windows -
9564 if (!isWindow()) {
evaluated: !isWindow()
TRUEFALSE
yes
Evaluation Count:40322
yes
Evaluation Count:1218
1218-40322
9565 if (!testAttribute(Qt::WA_ForceDisabled))
partially evaluated: !testAttribute(Qt::WA_ForceDisabled)
TRUEFALSE
yes
Evaluation Count:40322
no
Evaluation Count:0
0-40322
9566 d->setEnabled_helper(parent ? parent->isEnabled() : true);
executed: d->setEnabled_helper(parent ? parent->isEnabled() : true);
Execution Count:40322
40322
9567 if (!testAttribute(Qt::WA_ForceUpdatesDisabled))
partially evaluated: !testAttribute(Qt::WA_ForceUpdatesDisabled)
TRUEFALSE
yes
Evaluation Count:40322
no
Evaluation Count:0
0-40322
9568 d->setUpdatesEnabled_helper(parent ? parent->updatesEnabled() : true);
executed: d->setUpdatesEnabled_helper(parent ? parent->updatesEnabled() : true);
Execution Count:40322
40322
9569 }
executed: }
Execution Count:40322
40322
9570 d->inheritStyle();
executed (the execution status of this line is deduced): d->inheritStyle();
-
9571 -
9572 // send and post remaining QObject events -
9573 if (parent && d->sendChildEvents) {
evaluated: parent
TRUEFALSE
yes
Evaluation Count:40970
yes
Evaluation Count:570
evaluated: d->sendChildEvents
TRUEFALSE
yes
Evaluation Count:40969
yes
Evaluation Count:1
1-40970
9574 QChildEvent e(QEvent::ChildAdded, this);
executed (the execution status of this line is deduced): QChildEvent e(QEvent::ChildAdded, this);
-
9575 QApplication::sendEvent(parent, &e);
executed (the execution status of this line is deduced): QApplication::sendEvent(parent, &e);
-
9576 }
executed: }
Execution Count:40969
40969
9577 -
9578//### already hidden above ---> must probably do something smart on the mac -
9579// #ifdef Q_WS_MAC -
9580// extern bool qt_mac_is_macdrawer(const QWidget *); //qwidget_mac.cpp -
9581// if(!qt_mac_is_macdrawer(q)) //special case -
9582// q->setAttribute(Qt::WA_WState_Hidden); -
9583// #else -
9584// q->setAttribute(Qt::WA_WState_Hidden); -
9585//#endif -
9586 -
9587 if (parent && d->sendChildEvents && d->polished) {
evaluated: parent
TRUEFALSE
yes
Evaluation Count:40970
yes
Evaluation Count:570
evaluated: d->sendChildEvents
TRUEFALSE
yes
Evaluation Count:40969
yes
Evaluation Count:1
evaluated: d->polished
TRUEFALSE
yes
Evaluation Count:126
yes
Evaluation Count:40843
1-40970
9588 QChildEvent e(QEvent::ChildPolished, this);
executed (the execution status of this line is deduced): QChildEvent e(QEvent::ChildPolished, this);
-
9589 QCoreApplication::sendEvent(parent, &e);
executed (the execution status of this line is deduced): QCoreApplication::sendEvent(parent, &e);
-
9590 }
executed: }
Execution Count:126
126
9591 -
9592 QEvent e(QEvent::ParentChange);
executed (the execution status of this line is deduced): QEvent e(QEvent::ParentChange);
-
9593 QApplication::sendEvent(this, &e);
executed (the execution status of this line is deduced): QApplication::sendEvent(this, &e);
-
9594 }
executed: }
Execution Count:41540
41540
9595 -
9596 if (!wasCreated) {
evaluated: !wasCreated
TRUEFALSE
yes
Evaluation Count:41432
yes
Evaluation Count:131
131-41432
9597 if (isWindow() || parentWidget()->isVisible())
evaluated: isWindow()
TRUEFALSE
yes
Evaluation Count:1110
yes
Evaluation Count:40322
evaluated: parentWidget()->isVisible()
TRUEFALSE
yes
Evaluation Count:471
yes
Evaluation Count:39851
471-40322
9598 setAttribute(Qt::WA_WState_Hidden, true);
executed: setAttribute(Qt::WA_WState_Hidden, true);
Execution Count:1581
1581
9599 else if (!testAttribute(Qt::WA_WState_ExplicitShowHide))
evaluated: !testAttribute(Qt::WA_WState_ExplicitShowHide)
TRUEFALSE
yes
Evaluation Count:39837
yes
Evaluation Count:14
14-39837
9600 setAttribute(Qt::WA_WState_Hidden, false);
executed: setAttribute(Qt::WA_WState_Hidden, false);
Execution Count:39837
39837
9601 } -
9602 -
9603 d->updateIsOpaque();
executed (the execution status of this line is deduced): d->updateIsOpaque();
-
9604 -
9605#ifndef QT_NO_GRAPHICSVIEW -
9606 // Embed the widget into a proxy if the parent is embedded. -
9607 // ### Doesn't handle reparenting out of an embedded widget. -
9608 if (oldtlw->graphicsProxyWidget()) {
partially evaluated: oldtlw->graphicsProxyWidget()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:41563
0-41563
9609 if (QGraphicsProxyWidget *ancestorProxy = d->nearestGraphicsProxyWidget(oldtlw))
never evaluated: QGraphicsProxyWidget *ancestorProxy = d->nearestGraphicsProxyWidget(oldtlw)
0
9610 ancestorProxy->d_func()->unembedSubWindow(this);
never executed: ancestorProxy->d_func()->unembedSubWindow(this);
0
9611 }
never executed: }
0
9612 if (isWindow() && parent && !graphicsProxyWidget() && !bypassGraphicsProxyWidget(this)) {
evaluated: isWindow()
TRUEFALSE
yes
Evaluation Count:1218
yes
Evaluation Count:40345
evaluated: parent
TRUEFALSE
yes
Evaluation Count:644
yes
Evaluation Count:574
partially evaluated: !graphicsProxyWidget()
TRUEFALSE
yes
Evaluation Count:644
no
Evaluation Count:0
evaluated: !bypassGraphicsProxyWidget(this)
TRUEFALSE
yes
Evaluation Count:637
yes
Evaluation Count:7
0-40345
9613 if (QGraphicsProxyWidget *ancestorProxy = d->nearestGraphicsProxyWidget(parent))
partially evaluated: QGraphicsProxyWidget *ancestorProxy = d->nearestGraphicsProxyWidget(parent)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:637
0-637
9614 ancestorProxy->d_func()->embedSubWindow(this);
never executed: ancestorProxy->d_func()->embedSubWindow(this);
0
9615 }
executed: }
Execution Count:637
637
9616#endif -
9617}
executed: }
Execution Count:41563
41563
9618 -
9619/*! -
9620 Scrolls the widget including its children \a dx pixels to the -
9621 right and \a dy downward. Both \a dx and \a dy may be negative. -
9622 -
9623 After scrolling, the widgets will receive paint events for -
9624 the areas that need to be repainted. For widgets that Qt knows to -
9625 be opaque, this is only the newly exposed parts. -
9626 For example, if an opaque widget is scrolled 8 pixels to the left, -
9627 only an 8-pixel wide stripe at the right edge needs updating. -
9628 -
9629 Since widgets propagate the contents of their parents by default, -
9630 you need to set the \l autoFillBackground property, or use -
9631 setAttribute() to set the Qt::WA_OpaquePaintEvent attribute, to make -
9632 a widget opaque. -
9633 -
9634 For widgets that use contents propagation, a scroll will cause an -
9635 update of the entire scroll area. -
9636 -
9637 \sa {Transparency and Double Buffering} -
9638*/ -
9639 -
9640void QWidget::scroll(int dx, int dy) -
9641{ -
9642 if ((!updatesEnabled() && children().size() == 0) || !isVisible())
evaluated: !updatesEnabled()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:14703
partially evaluated: children().size() == 0
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
evaluated: !isVisible()
TRUEFALSE
yes
Evaluation Count:52
yes
Evaluation Count:14651
0-14703
9643 return;
executed: return;
Execution Count:54
54
9644 if (dx == 0 && dy == 0)
evaluated: dx == 0
TRUEFALSE
yes
Evaluation Count:2141
yes
Evaluation Count:12510
evaluated: dy == 0
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2139
2-12510
9645 return;
executed: return;
Execution Count:2
2
9646 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
9647#ifndef QT_NO_GRAPHICSVIEW -
9648 if (QGraphicsProxyWidget *proxy = QWidgetPrivate::nearestGraphicsProxyWidget(this)) {
partially evaluated: QGraphicsProxyWidget *proxy = QWidgetPrivate::nearestGraphicsProxyWidget(this)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:14649
0-14649
9649 // Graphics View maintains its own dirty region as a list of rects; -
9650 // until we can connect item updates directly to the view, we must -
9651 // separately add a translated dirty region. -
9652 if (!d->dirty.isEmpty()) {
never evaluated: !d->dirty.isEmpty()
0
9653 foreach (const QRect &rect, (d->dirty.translated(dx, dy)).rects())
never executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__((d->dirty.translated(dx, dy)).rects())> _container_((d->dirty.translated(dx, dy)).rects()); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (const QRect &rect = *_container_.i;; __extension__ ({--_container_.brk; break;}))
-
9654 proxy->update(rect);
never executed: proxy->update(rect);
0
9655 }
never executed: }
0
9656 proxy->scroll(dx, dy, proxy->subWidgetRect(this));
never executed (the execution status of this line is deduced): proxy->scroll(dx, dy, proxy->subWidgetRect(this));
-
9657 return;
never executed: return;
0
9658 } -
9659#endif -
9660 d->setDirtyOpaqueRegion();
executed (the execution status of this line is deduced): d->setDirtyOpaqueRegion();
-
9661 d->scroll_sys(dx, dy);
executed (the execution status of this line is deduced): d->scroll_sys(dx, dy);
-
9662}
executed: }
Execution Count:14649
14649
9663 -
9664/*! -
9665 \overload -
9666 -
9667 This version only scrolls \a r and does not move the children of -
9668 the widget. -
9669 -
9670 If \a r is empty or invalid, the result is undefined. -
9671 -
9672 \sa QScrollArea -
9673*/ -
9674void QWidget::scroll(int dx, int dy, const QRect &r) -
9675{ -
9676 -
9677 if ((!updatesEnabled() && children().size() == 0) || !isVisible())
never evaluated: !updatesEnabled()
never evaluated: children().size() == 0
never evaluated: !isVisible()
0
9678 return;
never executed: return;
0
9679 if (dx == 0 && dy == 0)
never evaluated: dx == 0
never evaluated: dy == 0
0
9680 return;
never executed: return;
0
9681 Q_D(QWidget);
never executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
9682#ifndef QT_NO_GRAPHICSVIEW -
9683 if (QGraphicsProxyWidget *proxy = QWidgetPrivate::nearestGraphicsProxyWidget(this)) {
never evaluated: QGraphicsProxyWidget *proxy = QWidgetPrivate::nearestGraphicsProxyWidget(this)
0
9684 // Graphics View maintains its own dirty region as a list of rects; -
9685 // until we can connect item updates directly to the view, we must -
9686 // separately add a translated dirty region. -
9687 if (!d->dirty.isEmpty()) {
never evaluated: !d->dirty.isEmpty()
0
9688 foreach (const QRect &rect, (d->dirty.translated(dx, dy) & r).rects())
never executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__((d->dirty.translated(dx, dy) & r).rects())> _container_((d->dirty.translated(dx, dy) & r).rects()); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (const QRect &rect = *_container_.i;; __extension__ ({--_container_.brk; break;}))
-
9689 proxy->update(rect);
never executed: proxy->update(rect);
0
9690 }
never executed: }
0
9691 proxy->scroll(dx, dy, r.translated(proxy->subWidgetRect(this).topLeft().toPoint()));
never executed (the execution status of this line is deduced): proxy->scroll(dx, dy, r.translated(proxy->subWidgetRect(this).topLeft().toPoint()));
-
9692 return;
never executed: return;
0
9693 } -
9694#endif -
9695 d->scroll_sys(dx, dy, r);
never executed (the execution status of this line is deduced): d->scroll_sys(dx, dy, r);
-
9696}
never executed: }
0
9697 -
9698/*! -
9699 Repaints the widget directly by calling paintEvent() immediately, -
9700 unless updates are disabled or the widget is hidden. -
9701 -
9702 We suggest only using repaint() if you need an immediate repaint, -
9703 for example during animation. In almost all circumstances update() -
9704 is better, as it permits Qt to optimize for speed and minimize -
9705 flicker. -
9706 -
9707 \warning If you call repaint() in a function which may itself be -
9708 called from paintEvent(), you may get infinite recursion. The -
9709 update() function never causes recursion. -
9710 -
9711 \sa update(), paintEvent(), setUpdatesEnabled() -
9712*/ -
9713 -
9714void QWidget::repaint() -
9715{ -
9716 repaint(rect());
executed (the execution status of this line is deduced): repaint(rect());
-
9717}
executed: }
Execution Count:382
382
9718 -
9719/*! \overload -
9720 -
9721 This version repaints a rectangle (\a x, \a y, \a w, \a h) inside -
9722 the widget. -
9723 -
9724 If \a w is negative, it is replaced with \c{width() - x}, and if -
9725 \a h is negative, it is replaced width \c{height() - y}. -
9726*/ -
9727void QWidget::repaint(int x, int y, int w, int h) -
9728{ -
9729 if (x > data->crect.width() || y > data->crect.height())
partially evaluated: x > data->crect.width()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
partially evaluated: y > data->crect.height()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
9730 return;
never executed: return;
0
9731 -
9732 if (w < 0)
partially evaluated: w < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
9733 w = data->crect.width() - x;
never executed: w = data->crect.width() - x;
0
9734 if (h < 0)
partially evaluated: h < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
9735 h = data->crect.height() - y;
never executed: h = data->crect.height() - y;
0
9736 -
9737 repaint(QRect(x, y, w, h));
executed (the execution status of this line is deduced): repaint(QRect(x, y, w, h));
-
9738}
executed: }
Execution Count:1
1
9739 -
9740/*! \overload -
9741 -
9742 This version repaints a rectangle \a rect inside the widget. -
9743*/ -
9744void QWidget::repaint(const QRect &rect) -
9745{ -
9746 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
9747 -
9748 if (testAttribute(Qt::WA_WState_ConfigPending)) {
partially evaluated: testAttribute(Qt::WA_WState_ConfigPending)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:412
0-412
9749 update(rect);
never executed (the execution status of this line is deduced): update(rect);
-
9750 return;
never executed: return;
0
9751 } -
9752 -
9753 if (!isVisible() || !updatesEnabled() || rect.isEmpty())
evaluated: !isVisible()
TRUEFALSE
yes
Evaluation Count:143
yes
Evaluation Count:269
partially evaluated: !updatesEnabled()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:269
evaluated: rect.isEmpty()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:266
0-269
9754 return;
executed: return;
Execution Count:146
146
9755 -
9756 if (hasBackingStoreSupport()) {
partially evaluated: hasBackingStoreSupport()
TRUEFALSE
yes
Evaluation Count:266
no
Evaluation Count:0
0-266
9757#ifdef Q_WS_MAC -
9758 if (qt_widget_private(this)->isInUnifiedToolbar) { -
9759 qt_widget_private(this)->unifiedSurface->renderToolbar(this, true); -
9760 return; -
9761 } -
9762#endif // Q_WS_MAC -
9763 QTLWExtra *tlwExtra = window()->d_func()->maybeTopData();
executed (the execution status of this line is deduced): QTLWExtra *tlwExtra = window()->d_func()->maybeTopData();
-
9764 if (tlwExtra && !tlwExtra->inTopLevelResize && tlwExtra->backingStore) {
partially evaluated: tlwExtra
TRUEFALSE
yes
Evaluation Count:266
no
Evaluation Count:0
partially evaluated: !tlwExtra->inTopLevelResize
TRUEFALSE
yes
Evaluation Count:266
no
Evaluation Count:0
partially evaluated: tlwExtra->backingStore
TRUEFALSE
yes
Evaluation Count:266
no
Evaluation Count:0
0-266
9765 tlwExtra->inRepaint = true;
executed (the execution status of this line is deduced): tlwExtra->inRepaint = true;
-
9766 tlwExtra->backingStoreTracker->markDirty(rect, this, true);
executed (the execution status of this line is deduced): tlwExtra->backingStoreTracker->markDirty(rect, this, true);
-
9767 tlwExtra->inRepaint = false;
executed (the execution status of this line is deduced): tlwExtra->inRepaint = false;
-
9768 }
executed: }
Execution Count:266
266
9769 } else {
executed: }
Execution Count:266
266
9770 d->repaint_sys(rect);
never executed (the execution status of this line is deduced): d->repaint_sys(rect);
-
9771 }
never executed: }
0
9772} -
9773 -
9774/*! -
9775 \overload -
9776 -
9777 This version repaints a region \a rgn inside the widget. -
9778*/ -
9779void QWidget::repaint(const QRegion &rgn) -
9780{ -
9781 Q_D(QWidget);
never executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
9782 -
9783 if (testAttribute(Qt::WA_WState_ConfigPending)) {
never evaluated: testAttribute(Qt::WA_WState_ConfigPending)
0
9784 update(rgn);
never executed (the execution status of this line is deduced): update(rgn);
-
9785 return;
never executed: return;
0
9786 } -
9787 -
9788 if (!isVisible() || !updatesEnabled() || rgn.isEmpty())
never evaluated: !isVisible()
never evaluated: !updatesEnabled()
never evaluated: rgn.isEmpty()
0
9789 return;
never executed: return;
0
9790 -
9791 if (hasBackingStoreSupport()) {
never evaluated: hasBackingStoreSupport()
0
9792#ifdef Q_WS_MAC -
9793 if (qt_widget_private(this)->isInUnifiedToolbar) { -
9794 qt_widget_private(this)->unifiedSurface->renderToolbar(this, true); -
9795 return; -
9796 } -
9797#endif // Q_WS_MAC -
9798 QTLWExtra *tlwExtra = window()->d_func()->maybeTopData();
never executed (the execution status of this line is deduced): QTLWExtra *tlwExtra = window()->d_func()->maybeTopData();
-
9799 if (tlwExtra && !tlwExtra->inTopLevelResize && tlwExtra->backingStore) {
never evaluated: tlwExtra
never evaluated: !tlwExtra->inTopLevelResize
never evaluated: tlwExtra->backingStore
0
9800 tlwExtra->inRepaint = true;
never executed (the execution status of this line is deduced): tlwExtra->inRepaint = true;
-
9801 tlwExtra->backingStoreTracker->markDirty(rgn, this, true);
never executed (the execution status of this line is deduced): tlwExtra->backingStoreTracker->markDirty(rgn, this, true);
-
9802 tlwExtra->inRepaint = false;
never executed (the execution status of this line is deduced): tlwExtra->inRepaint = false;
-
9803 }
never executed: }
0
9804 } else {
never executed: }
0
9805 d->repaint_sys(rgn);
never executed (the execution status of this line is deduced): d->repaint_sys(rgn);
-
9806 }
never executed: }
0
9807} -
9808 -
9809/*! -
9810 Updates the widget unless updates are disabled or the widget is -
9811 hidden. -
9812 -
9813 This function does not cause an immediate repaint; instead it -
9814 schedules a paint event for processing when Qt returns to the main -
9815 event loop. This permits Qt to optimize for more speed and less -
9816 flicker than a call to repaint() does. -
9817 -
9818 Calling update() several times normally results in just one -
9819 paintEvent() call. -
9820 -
9821 Qt normally erases the widget's area before the paintEvent() call. -
9822 If the Qt::WA_OpaquePaintEvent widget attribute is set, the widget is -
9823 responsible for painting all its pixels with an opaque color. -
9824 -
9825 \sa repaint(), paintEvent(), setUpdatesEnabled(), {Analog Clock Example} -
9826*/ -
9827void QWidget::update() -
9828{ -
9829 update(rect());
executed (the execution status of this line is deduced): update(rect());
-
9830}
executed: }
Execution Count:191807
191807
9831 -
9832/*! \fn void QWidget::update(int x, int y, int w, int h) -
9833 \overload -
9834 -
9835 This version updates a rectangle (\a x, \a y, \a w, \a h) inside -
9836 the widget. -
9837*/ -
9838 -
9839/*! -
9840 \overload -
9841 -
9842 This version updates a rectangle \a rect inside the widget. -
9843*/ -
9844void QWidget::update(const QRect &rect) -
9845{ -
9846 if (!isVisible() || !updatesEnabled() || rect.isEmpty())
evaluated: !isVisible()
TRUEFALSE
yes
Evaluation Count:146754
yes
Evaluation Count:88256
evaluated: !updatesEnabled()
TRUEFALSE
yes
Evaluation Count:361
yes
Evaluation Count:87895
evaluated: rect.isEmpty()
TRUEFALSE
yes
Evaluation Count:1234
yes
Evaluation Count:86661
361-146754
9847 return;
executed: return;
Execution Count:148349
148349
9848 -
9849 if (testAttribute(Qt::WA_WState_InPaintEvent)) {
evaluated: testAttribute(Qt::WA_WState_InPaintEvent)
TRUEFALSE
yes
Evaluation Count:186
yes
Evaluation Count:86475
186-86475
9850 QApplication::postEvent(this, new QUpdateLaterEvent(rect));
executed (the execution status of this line is deduced): QApplication::postEvent(this, new QUpdateLaterEvent(rect));
-
9851 return;
executed: return;
Execution Count:186
186
9852 } -
9853 -
9854 if (hasBackingStoreSupport()) {
partially evaluated: hasBackingStoreSupport()
TRUEFALSE
yes
Evaluation Count:86475
no
Evaluation Count:0
0-86475
9855#ifdef Q_WS_MAC -
9856 if (qt_widget_private(this)->isInUnifiedToolbar) { -
9857 qt_widget_private(this)->unifiedSurface->renderToolbar(this, true); -
9858 return; -
9859 } -
9860#endif // Q_WS_MAC -
9861 QTLWExtra *tlwExtra = window()->d_func()->maybeTopData();
executed (the execution status of this line is deduced): QTLWExtra *tlwExtra = window()->d_func()->maybeTopData();
-
9862 if (tlwExtra && !tlwExtra->inTopLevelResize && tlwExtra->backingStore)
partially evaluated: tlwExtra
TRUEFALSE
yes
Evaluation Count:86475
no
Evaluation Count:0
partially evaluated: !tlwExtra->inTopLevelResize
TRUEFALSE
yes
Evaluation Count:86475
no
Evaluation Count:0
partially evaluated: tlwExtra->backingStore
TRUEFALSE
yes
Evaluation Count:86475
no
Evaluation Count:0
0-86475
9863 tlwExtra->backingStoreTracker->markDirty(rect, this);
executed: tlwExtra->backingStoreTracker->markDirty(rect, this);
Execution Count:86475
86475
9864 } else {
executed: }
Execution Count:86475
86475
9865 d_func()->repaint_sys(rect);
never executed (the execution status of this line is deduced): d_func()->repaint_sys(rect);
-
9866 }
never executed: }
0
9867} -
9868 -
9869/*! -
9870 \overload -
9871 -
9872 This version repaints a region \a rgn inside the widget. -
9873*/ -
9874void QWidget::update(const QRegion &rgn) -
9875{ -
9876 if (!isVisible() || !updatesEnabled() || rgn.isEmpty())
evaluated: !isVisible()
TRUEFALSE
yes
Evaluation Count:534
yes
Evaluation Count:20558
evaluated: !updatesEnabled()
TRUEFALSE
yes
Evaluation Count:190
yes
Evaluation Count:20368
evaluated: rgn.isEmpty()
TRUEFALSE
yes
Evaluation Count:6906
yes
Evaluation Count:13462
190-20558
9877 return;
executed: return;
Execution Count:7630
7630
9878 -
9879 if (testAttribute(Qt::WA_WState_InPaintEvent)) {
partially evaluated: testAttribute(Qt::WA_WState_InPaintEvent)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13462
0-13462
9880 QApplication::postEvent(this, new QUpdateLaterEvent(rgn));
never executed (the execution status of this line is deduced): QApplication::postEvent(this, new QUpdateLaterEvent(rgn));
-
9881 return;
never executed: return;
0
9882 } -
9883 -
9884 if (hasBackingStoreSupport()) {
partially evaluated: hasBackingStoreSupport()
TRUEFALSE
yes
Evaluation Count:13462
no
Evaluation Count:0
0-13462
9885#ifdef Q_WS_MAC -
9886 if (qt_widget_private(this)->isInUnifiedToolbar) { -
9887 qt_widget_private(this)->unifiedSurface->renderToolbar(this, true); -
9888 return; -
9889 } -
9890#endif // Q_WS_MAC -
9891 QTLWExtra *tlwExtra = window()->d_func()->maybeTopData();
executed (the execution status of this line is deduced): QTLWExtra *tlwExtra = window()->d_func()->maybeTopData();
-
9892 if (tlwExtra && !tlwExtra->inTopLevelResize && tlwExtra->backingStore)
partially evaluated: tlwExtra
TRUEFALSE
yes
Evaluation Count:13462
no
Evaluation Count:0
partially evaluated: !tlwExtra->inTopLevelResize
TRUEFALSE
yes
Evaluation Count:13462
no
Evaluation Count:0
partially evaluated: tlwExtra->backingStore
TRUEFALSE
yes
Evaluation Count:13462
no
Evaluation Count:0
0-13462
9893 tlwExtra->backingStoreTracker->markDirty(rgn, this);
executed: tlwExtra->backingStoreTracker->markDirty(rgn, this);
Execution Count:13462
13462
9894 } else {
executed: }
Execution Count:13462
13462
9895 d_func()->repaint_sys(rgn);
never executed (the execution status of this line is deduced): d_func()->repaint_sys(rgn);
-
9896 }
never executed: }
0
9897} -
9898 -
9899 -
9900 /*! -
9901 \internal -
9902 -
9903 This just sets the corresponding attribute bit to 1 or 0 -
9904 */ -
9905static void setAttribute_internal(Qt::WidgetAttribute attribute, bool on, QWidgetData *data, -
9906 QWidgetPrivate *d) -
9907{ -
9908 if (attribute < int(8*sizeof(uint))) {
evaluated: attribute < int(8*sizeof(uint))
TRUEFALSE
yes
Evaluation Count:223533
yes
Evaluation Count:416710
223533-416710
9909 if (on)
evaluated: on
TRUEFALSE
yes
Evaluation Count:141099
yes
Evaluation Count:82434
82434-141099
9910 data->widget_attributes |= (1<<attribute);
executed: data->widget_attributes |= (1<<attribute);
Execution Count:141099
141099
9911 else -
9912 data->widget_attributes &= ~(1<<attribute);
executed: data->widget_attributes &= ~(1<<attribute);
Execution Count:82434
82434
9913 } else { -
9914 const int x = attribute - 8*sizeof(uint);
executed (the execution status of this line is deduced): const int x = attribute - 8*sizeof(uint);
-
9915 const int int_off = x / (8*sizeof(uint));
executed (the execution status of this line is deduced): const int int_off = x / (8*sizeof(uint));
-
9916 if (on)
evaluated: on
TRUEFALSE
yes
Evaluation Count:335471
yes
Evaluation Count:81239
81239-335471
9917 d->high_attributes[int_off] |= (1<<(x-(int_off*8*sizeof(uint))));
executed: d->high_attributes[int_off] |= (1<<(x-(int_off*8*sizeof(uint))));
Execution Count:335471
335471
9918 else -
9919 d->high_attributes[int_off] &= ~(1<<(x-(int_off*8*sizeof(uint))));
executed: d->high_attributes[int_off] &= ~(1<<(x-(int_off*8*sizeof(uint))));
Execution Count:81239
81239
9920 } -
9921} -
9922 -
9923#ifdef Q_OS_MAC -
9924void QWidgetPrivate::macUpdateSizeAttribute() -
9925{ -
9926 Q_Q(QWidget); -
9927 QEvent event(QEvent::MacSizeChange); -
9928 QApplication::sendEvent(q, &event); -
9929 for (int i = 0; i < children.size(); ++i) { -
9930 QWidget *w = qobject_cast<QWidget *>(children.at(i)); -
9931 if (w && (!w->isWindow() || w->testAttribute(Qt::WA_WindowPropagation)) -
9932 && !q->testAttribute(Qt::WA_MacMiniSize) // no attribute set? inherit from parent -
9933 && !w->testAttribute(Qt::WA_MacSmallSize) -
9934 && !w->testAttribute(Qt::WA_MacNormalSize)) -
9935 w->d_func()->macUpdateSizeAttribute(); -
9936 } -
9937 resolveFont(); -
9938} -
9939#endif -
9940 -
9941/*! -
9942 Sets the attribute \a attribute on this widget if \a on is true; -
9943 otherwise clears the attribute. -
9944 -
9945 \sa testAttribute() -
9946*/ -
9947void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on) -
9948{ -
9949 if (testAttribute(attribute) == on)
evaluated: testAttribute(attribute) == on
TRUEFALSE
yes
Evaluation Count:514746
yes
Evaluation Count:640243
514746-640243
9950 return;
executed: return;
Execution Count:514746
514746
9951 -
9952 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
9953 Q_ASSERT_X(sizeof(d->high_attributes)*8 >= (Qt::WA_AttributeCount - sizeof(uint)*8),
executed (the execution status of this line is deduced): qt_noop();
-
9954 "QWidget::setAttribute(WidgetAttribute, bool)", -
9955 "QWidgetPrivate::high_attributes[] too small to contain all attributes in WidgetAttribute"); -
9956#ifdef Q_OS_WIN -
9957 // ### Don't use PaintOnScreen+paintEngine() to do native painting in some future release -
9958 if (attribute == Qt::WA_PaintOnScreen && on && windowType() != Qt::Desktop && !inherits("QGLWidget")) { -
9959 // see qwidget_qpa.cpp, ::paintEngine for details -
9960 paintEngine(); -
9961 if (d->noPaintOnScreen) -
9962 return; -
9963 } -
9964#endif -
9965 -
9966 setAttribute_internal(attribute, on, data, d);
executed (the execution status of this line is deduced): setAttribute_internal(attribute, on, data, d);
-
9967 -
9968 switch (attribute) { -
9969 -
9970#ifndef QT_NO_DRAGANDDROP -
9971 case Qt::WA_AcceptDrops: { -
9972 if (on && !testAttribute(Qt::WA_DropSiteRegistered))
evaluated: on
TRUEFALSE
yes
Evaluation Count:4235
yes
Evaluation Count:416
evaluated: !testAttribute(Qt::WA_DropSiteRegistered)
TRUEFALSE
yes
Evaluation Count:2663
yes
Evaluation Count:1572
416-4235
9973 setAttribute(Qt::WA_DropSiteRegistered, true);
executed: setAttribute(Qt::WA_DropSiteRegistered, true);
Execution Count:2663
2663
9974 else if (!on && (isWindow() || !parentWidget() || !parentWidget()->testAttribute(Qt::WA_DropSiteRegistered)))
evaluated: !on
TRUEFALSE
yes
Evaluation Count:416
yes
Evaluation Count:1572
evaluated: isWindow()
TRUEFALSE
yes
Evaluation Count:11
yes
Evaluation Count:405
partially evaluated: !parentWidget()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:405
evaluated: !parentWidget()->testAttribute(Qt::WA_DropSiteRegistered)
TRUEFALSE
yes
Evaluation Count:404
yes
Evaluation Count:1
0-1572
9975 setAttribute(Qt::WA_DropSiteRegistered, false);
executed: setAttribute(Qt::WA_DropSiteRegistered, false);
Execution Count:415
415
9976 QEvent e(QEvent::AcceptDropsChange);
executed (the execution status of this line is deduced): QEvent e(QEvent::AcceptDropsChange);
-
9977 QApplication::sendEvent(this, &e);
executed (the execution status of this line is deduced): QApplication::sendEvent(this, &e);
-
9978 break;
executed: break;
Execution Count:4651
4651
9979 } -
9980 case Qt::WA_DropSiteRegistered: { -
9981 d->registerDropSite(on);
executed (the execution status of this line is deduced): d->registerDropSite(on);
-
9982 for (int i = 0; i < d->children.size(); ++i) {
evaluated: i < d->children.size()
TRUEFALSE
yes
Evaluation Count:15658
yes
Evaluation Count:12325
12325-15658
9983 QWidget *w = qobject_cast<QWidget *>(d->children.at(i));
executed (the execution status of this line is deduced): QWidget *w = qobject_cast<QWidget *>(d->children.at(i));
-
9984 if (w && !w->isWindow() && !w->testAttribute(Qt::WA_AcceptDrops) && w->testAttribute(Qt::WA_DropSiteRegistered) != on)
evaluated: w
TRUEFALSE
yes
Evaluation Count:9252
yes
Evaluation Count:6406
partially evaluated: !w->isWindow()
TRUEFALSE
yes
Evaluation Count:9252
no
Evaluation Count:0
evaluated: !w->testAttribute(Qt::WA_AcceptDrops)
TRUEFALSE
yes
Evaluation Count:9241
yes
Evaluation Count:11
partially evaluated: w->testAttribute(Qt::WA_DropSiteRegistered) != on
TRUEFALSE
yes
Evaluation Count:9241
no
Evaluation Count:0
0-9252
9985 w->setAttribute(Qt::WA_DropSiteRegistered, on);
executed: w->setAttribute(Qt::WA_DropSiteRegistered, on);
Execution Count:9241
9241
9986 }
executed: }
Execution Count:15658
15658
9987 break;
executed: break;
Execution Count:12325
12325
9988 } -
9989#endif -
9990 -
9991 case Qt::WA_NoChildEventsForParent: -
9992 d->sendChildEvents = !on;
executed (the execution status of this line is deduced): d->sendChildEvents = !on;
-
9993 break;
executed: break;
Execution Count:1
1
9994 case Qt::WA_NoChildEventsFromChildren: -
9995 d->receiveChildEvents = !on;
never executed (the execution status of this line is deduced): d->receiveChildEvents = !on;
-
9996 break;
never executed: break;
0
9997 case Qt::WA_MacBrushedMetal: -
9998#ifdef Q_WS_MAC -
9999 d->setStyle_helper(style(), false, true); // Make sure things get unpolished/polished correctly. -
10000 // fall through since changing the metal attribute affects the opaque size grip. -
10001 case Qt::WA_MacOpaqueSizeGrip: -
10002 d->macUpdateOpaqueSizeGrip(); -
10003 break; -
10004 case Qt::WA_MacShowFocusRect: -
10005 if (hasFocus()) { -
10006 clearFocus(); -
10007 setFocus(); -
10008 } -
10009 break; -
10010 case Qt::WA_Hover: -
10011 qt_mac_update_mouseTracking(this); -
10012 break; -
10013#endif -
10014 case Qt::WA_MacAlwaysShowToolWindow: -
10015#ifdef Q_WS_MAC -
10016 d->macUpdateHideOnSuspend(); -
10017#endif -
10018 break;
never executed: break;
0
10019 case Qt::WA_MacNormalSize: -
10020 case Qt::WA_MacSmallSize: -
10021 case Qt::WA_MacMiniSize: -
10022#ifdef Q_OS_MAC -
10023 { -
10024 // We can only have one of these set at a time -
10025 const Qt::WidgetAttribute MacSizes[] = { Qt::WA_MacNormalSize, Qt::WA_MacSmallSize, -
10026 Qt::WA_MacMiniSize }; -
10027 for (int i = 0; i < 3; ++i) { -
10028 if (MacSizes[i] != attribute) -
10029 setAttribute_internal(MacSizes[i], false, data, d); -
10030 } -
10031 d->macUpdateSizeAttribute(); -
10032 } -
10033#endif -
10034 break;
never executed: break;
0
10035 case Qt::WA_ShowModal: -
10036 if (!on) {
evaluated: !on
TRUEFALSE
yes
Evaluation Count:47
yes
Evaluation Count:92
47-92
10037 // reset modality type to NonModal when clearing WA_ShowModal -
10038 data->window_modality = Qt::NonModal;
executed (the execution status of this line is deduced): data->window_modality = Qt::NonModal;
-
10039 } else if (data->window_modality == Qt::NonModal) {
executed: }
Execution Count:47
evaluated: data->window_modality == Qt::NonModal
TRUEFALSE
yes
Evaluation Count:90
yes
Evaluation Count:2
2-90
10040 // determine the modality type if it hasn't been set prior -
10041 // to setting WA_ShowModal. set the default to WindowModal -
10042 // if we are the child of a group leader; otherwise use -
10043 // ApplicationModal. -
10044 QWidget *w = parentWidget();
executed (the execution status of this line is deduced): QWidget *w = parentWidget();
-
10045 if (w)
evaluated: w
TRUEFALSE
yes
Evaluation Count:35
yes
Evaluation Count:55
35-55
10046 w = w->window();
executed: w = w->window();
Execution Count:35
35
10047 while (w && !w->testAttribute(Qt::WA_GroupLeader)) {
evaluated: w
TRUEFALSE
yes
Evaluation Count:35
yes
Evaluation Count:90
partially evaluated: !w->testAttribute(Qt::WA_GroupLeader)
TRUEFALSE
yes
Evaluation Count:35
no
Evaluation Count:0
0-90
10048 w = w->parentWidget();
executed (the execution status of this line is deduced): w = w->parentWidget();
-
10049 if (w)
partially evaluated: w
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:35
0-35
10050 w = w->window();
never executed: w = w->window();
0
10051 }
executed: }
Execution Count:35
35
10052 data->window_modality = (w && w->testAttribute(Qt::WA_GroupLeader))
partially evaluated: w
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:90
never evaluated: w->testAttribute(Qt::WA_GroupLeader)
0-90
10053 ? Qt::WindowModal
executed (the execution status of this line is deduced): ? Qt::WindowModal
-
10054 : Qt::ApplicationModal;
executed (the execution status of this line is deduced): : Qt::ApplicationModal;
-
10055 // Some window managers do not allow us to enter modality after the -
10056 // window is visible.The window must be hidden before changing the -
10057 // windowModality property and then reshown. -
10058 }
executed: }
Execution Count:90
90
10059 if (testAttribute(Qt::WA_WState_Created)) {
evaluated: testAttribute(Qt::WA_WState_Created)
TRUEFALSE
yes
Evaluation Count:47
yes
Evaluation Count:92
47-92
10060 // don't call setModal_sys() before create_sys() -
10061 d->setModal_sys();
executed (the execution status of this line is deduced): d->setModal_sys();
-
10062 }
executed: }
Execution Count:47
47
10063 break;
executed: break;
Execution Count:139
139
10064 case Qt::WA_MouseTracking: { -
10065 QEvent e(QEvent::MouseTrackingChange);
executed (the execution status of this line is deduced): QEvent e(QEvent::MouseTrackingChange);
-
10066 QApplication::sendEvent(this, &e);
executed (the execution status of this line is deduced): QApplication::sendEvent(this, &e);
-
10067 break; }
executed: break;
Execution Count:4488
4488
10068 case Qt::WA_NativeWindow: { -
10069 d->createTLExtra();
executed (the execution status of this line is deduced): d->createTLExtra();
-
10070#ifndef QT_NO_IM -
10071 QWidget *focusWidget = d->effectiveFocusWidget();
executed (the execution status of this line is deduced): QWidget *focusWidget = d->effectiveFocusWidget();
-
10072 if (on && !internalWinId() && hasFocus()
partially evaluated: on
TRUEFALSE
yes
Evaluation Count:52
no
Evaluation Count:0
evaluated: !internalWinId()
TRUEFALSE
yes
Evaluation Count:46
yes
Evaluation Count:6
partially evaluated: hasFocus()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:46
0-52
10073 && focusWidget->testAttribute(Qt::WA_InputMethodEnabled)) {
never evaluated: focusWidget->testAttribute(Qt::WA_InputMethodEnabled)
0
10074 qApp->inputMethod()->commit();
never executed (the execution status of this line is deduced): (static_cast<QApplication *>(QCoreApplication::instance()))->inputMethod()->commit();
-
10075 qApp->inputMethod()->update(Qt::ImEnabled);
never executed (the execution status of this line is deduced): (static_cast<QApplication *>(QCoreApplication::instance()))->inputMethod()->update(Qt::ImEnabled);
-
10076 }
never executed: }
0
10077 if (!qApp->testAttribute(Qt::AA_DontCreateNativeWidgetSiblings) && parentWidget()
evaluated: !(static_cast<QApplication *>(QCoreApplication::instance()))->testAttribute(Qt::AA_DontCreateNativeWidgetSiblings)
TRUEFALSE
yes
Evaluation Count:41
yes
Evaluation Count:11
evaluated: parentWidget()
TRUEFALSE
yes
Evaluation Count:24
yes
Evaluation Count:17
11-41
10078#ifdef Q_WS_MAC -
10079 // On Mac, toolbars inside the unified title bar will never overlap with -
10080 // siblings in the content view. So we skip enforce native siblings in that case -
10081 && !d->isInUnifiedToolbar && parentWidget()->isWindow() -
10082#endif // Q_WS_MAC -
10083 ) -
10084 parentWidget()->d_func()->enforceNativeChildren();
executed: parentWidget()->d_func()->enforceNativeChildren();
Execution Count:24
24
10085 if (on && !internalWinId() && testAttribute(Qt::WA_WState_Created))
partially evaluated: on
TRUEFALSE
yes
Evaluation Count:52
no
Evaluation Count:0
evaluated: !internalWinId()
TRUEFALSE
yes
Evaluation Count:43
yes
Evaluation Count:9
evaluated: testAttribute(Qt::WA_WState_Created)
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:34
0-52
10086 d->createWinId();
executed: d->createWinId();
Execution Count:9
9
10087 if (isEnabled() && focusWidget->isEnabled()
partially evaluated: isEnabled()
TRUEFALSE
yes
Evaluation Count:52
no
Evaluation Count:0
partially evaluated: focusWidget->isEnabled()
TRUEFALSE
yes
Evaluation Count:52
no
Evaluation Count:0
0-52
10088 && focusWidget->testAttribute(Qt::WA_InputMethodEnabled)) {
evaluated: focusWidget->testAttribute(Qt::WA_InputMethodEnabled)
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:50
2-50
10089 qApp->inputMethod()->update(Qt::ImEnabled);
executed (the execution status of this line is deduced): (static_cast<QApplication *>(QCoreApplication::instance()))->inputMethod()->update(Qt::ImEnabled);
-
10090 }
executed: }
Execution Count:2
2
10091#endif //QT_NO_IM -
10092 break;
executed: break;
Execution Count:52
52
10093 } -
10094 case Qt::WA_PaintOnScreen: -
10095 d->updateIsOpaque();
executed (the execution status of this line is deduced): d->updateIsOpaque();
-
10096#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined(Q_WS_MAC) -
10097 // Recreate the widget if it's already created as an alien widget and -
10098 // WA_PaintOnScreen is enabled. Paint on screen widgets must have win id. -
10099 // So must their children. -
10100 if (on) { -
10101 setAttribute(Qt::WA_NativeWindow); -
10102 d->enforceNativeChildren(); -
10103 } -
10104#endif -
10105 // fall through -
10106 case Qt::WA_OpaquePaintEvent:
code before this statement executed: case Qt::WA_OpaquePaintEvent:
Execution Count:139
139
10107 d->updateIsOpaque();
executed (the execution status of this line is deduced): d->updateIsOpaque();
-
10108 break;
executed: break;
Execution Count:10535
10535
10109 case Qt::WA_NoSystemBackground: -
10110 d->updateIsOpaque();
executed (the execution status of this line is deduced): d->updateIsOpaque();
-
10111 // fall through... -
10112 case Qt::WA_UpdatesDisabled:
code before this statement executed: case Qt::WA_UpdatesDisabled:
Execution Count:59
59
10113 d->updateSystemBackground();
executed (the execution status of this line is deduced): d->updateSystemBackground();
-
10114 break;
executed: break;
Execution Count:30103
30103
10115 case Qt::WA_TransparentForMouseEvents: -
10116#ifdef Q_WS_MAC -
10117 d->macUpdateIgnoreMouseEvents(); -
10118#endif -
10119 break;
executed: break;
Execution Count:52
52
10120 case Qt::WA_InputMethodEnabled: { -
10121#ifndef QT_NO_IM -
10122 if (qApp->focusObject() == this) {
evaluated: (static_cast<QApplication *>(QCoreApplication::instance()))->focusObject() == this
TRUEFALSE
yes
Evaluation Count:700
yes
Evaluation Count:8516
700-8516
10123 if (!on)
evaluated: !on
TRUEFALSE
yes
Evaluation Count:686
yes
Evaluation Count:14
14-686
10124 qApp->inputMethod()->commit();
executed: (static_cast<QApplication *>(QCoreApplication::instance()))->inputMethod()->commit();
Execution Count:686
686
10125 qApp->inputMethod()->update(Qt::ImEnabled);
executed (the execution status of this line is deduced): (static_cast<QApplication *>(QCoreApplication::instance()))->inputMethod()->update(Qt::ImEnabled);
-
10126 }
executed: }
Execution Count:700
700
10127#endif //QT_NO_IM -
10128 break;
executed: break;
Execution Count:9216
9216
10129 } -
10130 case Qt::WA_WindowPropagation: -
10131 d->resolvePalette();
executed (the execution status of this line is deduced): d->resolvePalette();
-
10132 d->resolveFont();
executed (the execution status of this line is deduced): d->resolveFont();
-
10133 d->resolveLocale();
executed (the execution status of this line is deduced): d->resolveLocale();
-
10134 break;
executed: break;
Execution Count:343
343
10135#ifdef Q_WS_X11 -
10136 case Qt::WA_NoX11EventCompression: -
10137 if (!d->extra) -
10138 d->createExtra(); -
10139 d->extra->compress_events = on; -
10140 break; -
10141 case Qt::WA_X11OpenGLOverlay: -
10142 d->updateIsOpaque(); -
10143 break; -
10144 case Qt::WA_X11DoNotAcceptFocus: -
10145 if (testAttribute(Qt::WA_WState_Created)) -
10146 d->updateX11AcceptFocus(); -
10147 break; -
10148#endif -
10149 case Qt::WA_DontShowOnScreen: { -
10150 if (on && isVisible()) {
partially evaluated: on
TRUEFALSE
yes
Evaluation Count:11
no
Evaluation Count:0
partially evaluated: isVisible()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:11
0-11
10151 // Make sure we keep the current state and only hide the widget -
10152 // from the desktop. show_sys will only update platform specific -
10153 // attributes at this point. -
10154 d->hide_sys();
never executed (the execution status of this line is deduced): d->hide_sys();
-
10155 d->show_sys();
never executed (the execution status of this line is deduced): d->show_sys();
-
10156 }
never executed: }
0
10157 break;
executed: break;
Execution Count:11
11
10158 } -
10159 -
10160#ifdef Q_WS_X11 -
10161 case Qt::WA_X11NetWmWindowTypeDesktop: -
10162 case Qt::WA_X11NetWmWindowTypeDock: -
10163 case Qt::WA_X11NetWmWindowTypeToolBar: -
10164 case Qt::WA_X11NetWmWindowTypeMenu: -
10165 case Qt::WA_X11NetWmWindowTypeUtility: -
10166 case Qt::WA_X11NetWmWindowTypeSplash: -
10167 case Qt::WA_X11NetWmWindowTypeDialog: -
10168 case Qt::WA_X11NetWmWindowTypeDropDownMenu: -
10169 case Qt::WA_X11NetWmWindowTypePopupMenu: -
10170 case Qt::WA_X11NetWmWindowTypeToolTip: -
10171 case Qt::WA_X11NetWmWindowTypeNotification: -
10172 case Qt::WA_X11NetWmWindowTypeCombo: -
10173 case Qt::WA_X11NetWmWindowTypeDND: -
10174 if (testAttribute(Qt::WA_WState_Created)) -
10175 d->setNetWmWindowTypes(); -
10176 break; -
10177#endif -
10178 -
10179 case Qt::WA_StaticContents: -
10180 if (QWidgetBackingStore *bs = d->maybeBackingStore()) {
evaluated: QWidgetBackingStore *bs = d->maybeBackingStore()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:4
4-5
10181 if (on)
evaluated: on
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:3
2-3
10182 bs->addStaticWidget(this);
executed: bs->addStaticWidget(this);
Execution Count:2
2
10183 else -
10184 bs->removeStaticWidget(this);
executed: bs->removeStaticWidget(this);
Execution Count:3
3
10185 } -
10186 break;
executed: break;
Execution Count:9
9
10187 case Qt::WA_TranslucentBackground: -
10188 if (on) {
partially evaluated: on
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
0-4
10189 setAttribute(Qt::WA_NoSystemBackground);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_NoSystemBackground);
-
10190 d->updateIsTranslucent();
executed (the execution status of this line is deduced): d->updateIsTranslucent();
-
10191 }
executed: }
Execution Count:4
4
10192 -
10193 break;
executed: break;
Execution Count:4
4
10194 case Qt::WA_AcceptTouchEvents: -
10195#if defined(Q_WS_WIN) || defined(Q_WS_MAC) -
10196 if (on) -
10197 d->registerTouchWindow(); -
10198#endif -
10199 break;
executed: break;
Execution Count:5125
5125
10200 default: -
10201 break;
executed: break;
Execution Count:563189
563189
10202 } -
10203}
executed: }
Execution Count:640243
640243
10204 -
10205/*! \fn bool QWidget::testAttribute(Qt::WidgetAttribute attribute) const -
10206 -
10207 Returns true if attribute \a attribute is set on this widget; -
10208 otherwise returns false. -
10209 -
10210 \sa setAttribute() -
10211 */ -
10212bool QWidget::testAttribute_helper(Qt::WidgetAttribute attribute) const -
10213{ -
10214 Q_D(const QWidget);
executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
10215 const int x = attribute - 8*sizeof(uint);
executed (the execution status of this line is deduced): const int x = attribute - 8*sizeof(uint);
-
10216 const int int_off = x / (8*sizeof(uint));
executed (the execution status of this line is deduced): const int int_off = x / (8*sizeof(uint));
-
10217 return (d->high_attributes[int_off] & (1<<(x-(int_off*8*sizeof(uint)))));
executed: return (d->high_attributes[int_off] & (1<<(x-(int_off*8*sizeof(uint)))));
Execution Count:3395215
3395215
10218} -
10219 -
10220/*! -
10221 \property QWidget::windowOpacity -
10222 -
10223 \brief The level of opacity for the window. -
10224 -
10225 The valid range of opacity is from 1.0 (completely opaque) to -
10226 0.0 (completely transparent). -
10227 -
10228 By default the value of this property is 1.0. -
10229 -
10230 This feature is available on Embedded Linux, Mac OS X, Windows, -
10231 and X11 platforms that support the Composite extension. -
10232 -
10233 This feature is not available on Windows CE. -
10234 -
10235 Note that under X11 you need to have a composite manager running, -
10236 and the X11 specific _NET_WM_WINDOW_OPACITY atom needs to be -
10237 supported by the window manager you are using. -
10238 -
10239 \warning Changing this property from opaque to transparent might issue a -
10240 paint event that needs to be processed before the window is displayed -
10241 correctly. This affects mainly the use of QPixmap::grabWindow(). Also note -
10242 that semi-transparent windows update and resize significantly slower than -
10243 opaque windows. -
10244 -
10245 \sa setMask() -
10246*/ -
10247qreal QWidget::windowOpacity() const -
10248{ -
10249 Q_D(const QWidget);
executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
10250 return (isWindow() && d->maybeTopData()) ? d->maybeTopData()->opacity / 255. : 1.0;
executed: return (isWindow() && d->maybeTopData()) ? d->maybeTopData()->opacity / 255. : 1.0;
Execution Count:20
20
10251} -
10252 -
10253void QWidget::setWindowOpacity(qreal opacity) -
10254{ -
10255 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
10256 if (!isWindow())
evaluated: !isWindow()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:355
4-355
10257 return;
executed: return;
Execution Count:4
4
10258 -
10259 opacity = qBound(qreal(0.0), opacity, qreal(1.0));
executed (the execution status of this line is deduced): opacity = qBound(qreal(0.0), opacity, qreal(1.0));
-
10260 QTLWExtra *extra = d->topData();
executed (the execution status of this line is deduced): QTLWExtra *extra = d->topData();
-
10261 extra->opacity = uint(opacity * 255);
executed (the execution status of this line is deduced): extra->opacity = uint(opacity * 255);
-
10262 setAttribute(Qt::WA_WState_WindowOpacitySet);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_WState_WindowOpacitySet);
-
10263 d->setWindowOpacity_sys(opacity);
executed (the execution status of this line is deduced): d->setWindowOpacity_sys(opacity);
-
10264 -
10265 if (!testAttribute(Qt::WA_WState_Created))
evaluated: !testAttribute(Qt::WA_WState_Created)
TRUEFALSE
yes
Evaluation Count:353
yes
Evaluation Count:2
2-353
10266 return;
executed: return;
Execution Count:353
353
10267 -
10268#ifndef QT_NO_GRAPHICSVIEW -
10269 if (QGraphicsProxyWidget *proxy = graphicsProxyWidget()) {
partially evaluated: QGraphicsProxyWidget *proxy = graphicsProxyWidget()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
10270 // Avoid invalidating the cache if set. -
10271 if (proxy->cacheMode() == QGraphicsItem::NoCache)
never evaluated: proxy->cacheMode() == QGraphicsItem::NoCache
0
10272 proxy->update();
never executed: proxy->update();
0
10273 else if (QGraphicsScene *scene = proxy->scene())
never evaluated: QGraphicsScene *scene = proxy->scene()
0
10274 scene->update(proxy->sceneBoundingRect());
never executed: scene->update(proxy->sceneBoundingRect());
0
10275 return;
never executed: return;
0
10276 } -
10277#endif -
10278}
executed: }
Execution Count:2
2
10279 -
10280/*! -
10281 \property QWidget::windowModified -
10282 \brief whether the document shown in the window has unsaved changes -
10283 -
10284 A modified window is a window whose content has changed but has -
10285 not been saved to disk. This flag will have different effects -
10286 varied by the platform. On Mac OS X the close button will have a -
10287 modified look; on other platforms, the window title will have an -
10288 '*' (asterisk). -
10289 -
10290 The window title must contain a "[*]" placeholder, which -
10291 indicates where the '*' should appear. Normally, it should appear -
10292 right after the file name (e.g., "document1.txt[*] - Text -
10293 Editor"). If the window isn't modified, the placeholder is simply -
10294 removed. -
10295 -
10296 Note that if a widget is set as modified, all its ancestors will -
10297 also be set as modified. However, if you call \c -
10298 {setWindowModified(false)} on a widget, this will not propagate to -
10299 its parent because other children of the parent might have been -
10300 modified. -
10301 -
10302 \sa windowTitle, {Application Example}, {SDI Example}, {MDI Example} -
10303*/ -
10304bool QWidget::isWindowModified() const -
10305{ -
10306 return testAttribute(Qt::WA_WindowModified);
executed: return testAttribute(Qt::WA_WindowModified);
Execution Count:378
378
10307} -
10308 -
10309void QWidget::setWindowModified(bool mod) -
10310{ -
10311 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
10312 setAttribute(Qt::WA_WindowModified, mod);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_WindowModified, mod);
-
10313 -
10314 d->setWindowModified_helper();
executed (the execution status of this line is deduced): d->setWindowModified_helper();
-
10315 -
10316 QEvent e(QEvent::ModifiedChange);
executed (the execution status of this line is deduced): QEvent e(QEvent::ModifiedChange);
-
10317 QApplication::sendEvent(this, &e);
executed (the execution status of this line is deduced): QApplication::sendEvent(this, &e);
-
10318}
executed: }
Execution Count:148
148
10319 -
10320void QWidgetPrivate::setWindowModified_helper() -
10321{ -
10322 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
10323 QWindow *window = q->windowHandle();
executed (the execution status of this line is deduced): QWindow *window = q->windowHandle();
-
10324 if (!window)
evaluated: !window
TRUEFALSE
yes
Evaluation Count:11
yes
Evaluation Count:2811
11-2811
10325 return;
executed: return;
Execution Count:11
11
10326 QPlatformWindow *platformWindow = window->handle();
executed (the execution status of this line is deduced): QPlatformWindow *platformWindow = window->handle();
-
10327 if (!platformWindow)
evaluated: !platformWindow
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:2810
1-2810
10328 return;
executed: return;
Execution Count:1
1
10329 bool on = q->testAttribute(Qt::WA_WindowModified);
executed (the execution status of this line is deduced): bool on = q->testAttribute(Qt::WA_WindowModified);
-
10330 if (!platformWindow->setWindowModified(on)) {
partially evaluated: !platformWindow->setWindowModified(on)
TRUEFALSE
yes
Evaluation Count:2810
no
Evaluation Count:0
0-2810
10331 if (!q->windowTitle().contains(QLatin1String("[*]")) && on)
partially evaluated: !q->windowTitle().contains(QLatin1String("[*]"))
TRUEFALSE
yes
Evaluation Count:2810
no
Evaluation Count:0
partially evaluated: on
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2810
0-2810
10332 qWarning("QWidget::setWindowModified: The window title does not contain a '[*]' placeholder");
never executed: QMessageLogger("kernel/qwidget.cpp", 10332, __PRETTY_FUNCTION__).warning("QWidget::setWindowModified: The window title does not contain a '[*]' placeholder");
0
10333 setWindowTitle_helper(q->windowTitle());
executed (the execution status of this line is deduced): setWindowTitle_helper(q->windowTitle());
-
10334 setWindowIconText_helper(q->windowIconText());
executed (the execution status of this line is deduced): setWindowIconText_helper(q->windowIconText());
-
10335 }
executed: }
Execution Count:2810
2810
10336}
executed: }
Execution Count:2810
2810
10337 -
10338#ifndef QT_NO_TOOLTIP -
10339/*! -
10340 \property QWidget::toolTip -
10341 -
10342 \brief the widget's tooltip -
10343 -
10344 Note that by default tooltips are only shown for widgets that are -
10345 children of the active window. You can change this behavior by -
10346 setting the attribute Qt::WA_AlwaysShowToolTips on the \e window, -
10347 not on the widget with the tooltip. -
10348 -
10349 If you want to control a tooltip's behavior, you can intercept the -
10350 event() function and catch the QEvent::ToolTip event (e.g., if you -
10351 want to customize the area for which the tooltip should be shown). -
10352 -
10353 By default, this property contains an empty string. -
10354 -
10355 \sa QToolTip, statusTip, whatsThis -
10356*/ -
10357void QWidget::setToolTip(const QString &s) -
10358{ -
10359 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
10360 d->toolTip = s;
executed (the execution status of this line is deduced): d->toolTip = s;
-
10361 -
10362 QEvent event(QEvent::ToolTipChange);
executed (the execution status of this line is deduced): QEvent event(QEvent::ToolTipChange);
-
10363 QApplication::sendEvent(this, &event);
executed (the execution status of this line is deduced): QApplication::sendEvent(this, &event);
-
10364}
executed: }
Execution Count:2298
2298
10365 -
10366QString QWidget::toolTip() const -
10367{ -
10368 Q_D(const QWidget);
executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
10369 return d->toolTip;
executed: return d->toolTip;
Execution Count:5
5
10370} -
10371#endif // QT_NO_TOOLTIP -
10372 -
10373 -
10374#ifndef QT_NO_STATUSTIP -
10375/*! -
10376 \property QWidget::statusTip -
10377 \brief the widget's status tip -
10378 -
10379 By default, this property contains an empty string. -
10380 -
10381 \sa toolTip, whatsThis -
10382*/ -
10383void QWidget::setStatusTip(const QString &s) -
10384{ -
10385 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
10386 d->statusTip = s;
executed (the execution status of this line is deduced): d->statusTip = s;
-
10387}
executed: }
Execution Count:18
18
10388 -
10389QString QWidget::statusTip() const -
10390{ -
10391 Q_D(const QWidget);
never executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
10392 return d->statusTip;
never executed: return d->statusTip;
0
10393} -
10394#endif // QT_NO_STATUSTIP -
10395 -
10396#ifndef QT_NO_WHATSTHIS -
10397/*! -
10398 \property QWidget::whatsThis -
10399 -
10400 \brief the widget's What's This help text. -
10401 -
10402 By default, this property contains an empty string. -
10403 -
10404 \sa QWhatsThis, QWidget::toolTip, QWidget::statusTip -
10405*/ -
10406void QWidget::setWhatsThis(const QString &s) -
10407{ -
10408 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
10409 d->whatsThis = s;
executed (the execution status of this line is deduced): d->whatsThis = s;
-
10410}
executed: }
Execution Count:18
18
10411 -
10412QString QWidget::whatsThis() const -
10413{ -
10414 Q_D(const QWidget);
never executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
10415 return d->whatsThis;
never executed: return d->whatsThis;
0
10416} -
10417#endif // QT_NO_WHATSTHIS -
10418 -
10419#ifndef QT_NO_ACCESSIBILITY -
10420/*! -
10421 \property QWidget::accessibleName -
10422 -
10423 \brief the widget's name as seen by assistive technologies -
10424 -
10425 This property is used by accessible clients to identify, find, or announce -
10426 the widget for accessible clients. -
10427 -
10428 By default, this property contains an empty string. -
10429 -
10430 \sa QAccessibleInterface::text() -
10431*/ -
10432void QWidget::setAccessibleName(const QString &name) -
10433{ -
10434 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
10435 d->accessibleName = name;
executed (the execution status of this line is deduced): d->accessibleName = name;
-
10436 QAccessibleEvent event(this, QAccessible::NameChanged);
executed (the execution status of this line is deduced): QAccessibleEvent event(this, QAccessible::NameChanged);
-
10437 QAccessible::updateAccessibility(&event);
executed (the execution status of this line is deduced): QAccessible::updateAccessibility(&event);
-
10438}
executed: }
Execution Count:3663
3663
10439 -
10440QString QWidget::accessibleName() const -
10441{ -
10442 Q_D(const QWidget);
executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
10443 return d->accessibleName;
executed: return d->accessibleName;
Execution Count:1072
1072
10444} -
10445 -
10446/*! -
10447 \property QWidget::accessibleDescription -
10448 -
10449 \brief the widget's description as seen by assistive technologies -
10450 -
10451 By default, this property contains an empty string. -
10452 -
10453 \sa QAccessibleInterface::text() -
10454*/ -
10455void QWidget::setAccessibleDescription(const QString &description) -
10456{ -
10457 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
10458 d->accessibleDescription = description;
executed (the execution status of this line is deduced): d->accessibleDescription = description;
-
10459 QAccessibleEvent event(this, QAccessible::DescriptionChanged);
executed (the execution status of this line is deduced): QAccessibleEvent event(this, QAccessible::DescriptionChanged);
-
10460 QAccessible::updateAccessibility(&event);
executed (the execution status of this line is deduced): QAccessible::updateAccessibility(&event);
-
10461}
executed: }
Execution Count:2677
2677
10462 -
10463QString QWidget::accessibleDescription() const -
10464{ -
10465 Q_D(const QWidget);
executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
10466 return d->accessibleDescription;
executed: return d->accessibleDescription;
Execution Count:55
55
10467} -
10468#endif // QT_NO_ACCESSIBILITY -
10469 -
10470#ifndef QT_NO_SHORTCUT -
10471/*! -
10472 Adds a shortcut to Qt's shortcut system that watches for the given -
10473 \a key sequence in the given \a context. If the \a context is -
10474 Qt::ApplicationShortcut, the shortcut applies to the application as a -
10475 whole. Otherwise, it is either local to this widget, Qt::WidgetShortcut, -
10476 or to the window itself, Qt::WindowShortcut. -
10477 -
10478 If the same \a key sequence has been grabbed by several widgets, -
10479 when the \a key sequence occurs a QEvent::Shortcut event is sent -
10480 to all the widgets to which it applies in a non-deterministic -
10481 order, but with the ``ambiguous'' flag set to true. -
10482 -
10483 \warning You should not normally need to use this function; -
10484 instead create \l{QAction}s with the shortcut key sequences you -
10485 require (if you also want equivalent menu options and toolbar -
10486 buttons), or create \l{QShortcut}s if you just need key sequences. -
10487 Both QAction and QShortcut handle all the event filtering for you, -
10488 and provide signals which are triggered when the user triggers the -
10489 key sequence, so are much easier to use than this low-level -
10490 function. -
10491 -
10492 \sa releaseShortcut(), setShortcutEnabled() -
10493*/ -
10494int QWidget::grabShortcut(const QKeySequence &key, Qt::ShortcutContext context) -
10495{ -
10496 Q_ASSERT(qApp);
executed (the execution status of this line is deduced): qt_noop();
-
10497 if (key.isEmpty())
evaluated: key.isEmpty()
TRUEFALSE
yes
Evaluation Count:2011
yes
Evaluation Count:1589
1589-2011
10498 return 0;
executed: return 0;
Execution Count:2011
2011
10499 setAttribute(Qt::WA_GrabbedShortcut);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_GrabbedShortcut);
-
10500 return qApp->d_func()->shortcutMap.addShortcut(this, key, context, qWidgetShortcutContextMatcher);
executed: return (static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->shortcutMap.addShortcut(this, key, context, qWidgetShortcutContextMatcher);
Execution Count:1589
1589
10501} -
10502 -
10503/*! -
10504 Removes the shortcut with the given \a id from Qt's shortcut -
10505 system. The widget will no longer receive QEvent::Shortcut events -
10506 for the shortcut's key sequence (unless it has other shortcuts -
10507 with the same key sequence). -
10508 -
10509 \warning You should not normally need to use this function since -
10510 Qt's shortcut system removes shortcuts automatically when their -
10511 parent widget is destroyed. It is best to use QAction or -
10512 QShortcut to handle shortcuts, since they are easier to use than -
10513 this low-level function. Note also that this is an expensive -
10514 operation. -
10515 -
10516 \sa grabShortcut(), setShortcutEnabled() -
10517*/ -
10518void QWidget::releaseShortcut(int id) -
10519{ -
10520 Q_ASSERT(qApp);
executed (the execution status of this line is deduced): qt_noop();
-
10521 if (id)
evaluated: id
TRUEFALSE
yes
Evaluation Count:363
yes
Evaluation Count:374
363-374
10522 qApp->d_func()->shortcutMap.removeShortcut(id, this, 0);
executed: (static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->shortcutMap.removeShortcut(id, this, 0);
Execution Count:363
363
10523}
executed: }
Execution Count:737
737
10524 -
10525/*! -
10526 If \a enable is true, the shortcut with the given \a id is -
10527 enabled; otherwise the shortcut is disabled. -
10528 -
10529 \warning You should not normally need to use this function since -
10530 Qt's shortcut system enables/disables shortcuts automatically as -
10531 widgets become hidden/visible and gain or lose focus. It is best -
10532 to use QAction or QShortcut to handle shortcuts, since they are -
10533 easier to use than this low-level function. -
10534 -
10535 \sa grabShortcut(), releaseShortcut() -
10536*/ -
10537void QWidget::setShortcutEnabled(int id, bool enable) -
10538{ -
10539 Q_ASSERT(qApp);
executed (the execution status of this line is deduced): qt_noop();
-
10540 if (id)
partially evaluated: id
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:16
0-16
10541 qApp->d_func()->shortcutMap.setShortcutEnabled(enable, id, this, 0);
never executed: (static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->shortcutMap.setShortcutEnabled(enable, id, this, 0);
0
10542}
executed: }
Execution Count:16
16
10543 -
10544/*! -
10545 \since 4.2 -
10546 -
10547 If \a enable is true, auto repeat of the shortcut with the -
10548 given \a id is enabled; otherwise it is disabled. -
10549 -
10550 \sa grabShortcut(), releaseShortcut() -
10551*/ -
10552void QWidget::setShortcutAutoRepeat(int id, bool enable) -
10553{ -
10554 Q_ASSERT(qApp);
never executed (the execution status of this line is deduced): qt_noop();
-
10555 if (id)
never evaluated: id
0
10556 qApp->d_func()->shortcutMap.setShortcutAutoRepeat(enable, id, this, 0);
never executed: (static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->shortcutMap.setShortcutAutoRepeat(enable, id, this, 0);
0
10557}
never executed: }
0
10558#endif // QT_NO_SHORTCUT -
10559 -
10560/*! -
10561 Updates the widget's micro focus. -
10562*/ -
10563void QWidget::updateMicroFocus() -
10564{ -
10565 // updating everything since this is currently called for any kind of state change -
10566 qApp->inputMethod()->update(Qt::ImQueryAll);
executed (the execution status of this line is deduced): (static_cast<QApplication *>(QCoreApplication::instance()))->inputMethod()->update(Qt::ImQueryAll);
-
10567}
executed: }
Execution Count:19250
19250
10568 -
10569/*! -
10570 Raises this widget to the top of the parent widget's stack. -
10571 -
10572 After this call the widget will be visually in front of any -
10573 overlapping sibling widgets. -
10574 -
10575 \note When using activateWindow(), you can call this function to -
10576 ensure that the window is stacked on top. -
10577 -
10578 \sa lower(), stackUnder() -
10579*/ -
10580 -
10581void QWidget::raise() -
10582{ -
10583 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
10584 if (!isWindow()) {
evaluated: !isWindow()
TRUEFALSE
yes
Evaluation Count:6756
yes
Evaluation Count:132
132-6756
10585 QWidget *p = parentWidget();
executed (the execution status of this line is deduced): QWidget *p = parentWidget();
-
10586 const int parentChildCount = p->d_func()->children.size();
executed (the execution status of this line is deduced): const int parentChildCount = p->d_func()->children.size();
-
10587 if (parentChildCount < 2)
evaluated: parentChildCount < 2
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:6749
7-6749
10588 return;
executed: return;
Execution Count:7
7
10589 const int from = p->d_func()->children.indexOf(this);
executed (the execution status of this line is deduced): const int from = p->d_func()->children.indexOf(this);
-
10590 Q_ASSERT(from >= 0);
executed (the execution status of this line is deduced): qt_noop();
-
10591 // Do nothing if the widget is already in correct stacking order _and_ created. -
10592 if (from != parentChildCount -1)
evaluated: from != parentChildCount -1
TRUEFALSE
yes
Evaluation Count:4108
yes
Evaluation Count:2641
2641-4108
10593 p->d_func()->children.move(from, parentChildCount - 1);
executed: p->d_func()->children.move(from, parentChildCount - 1);
Execution Count:4108
4108
10594 if (!testAttribute(Qt::WA_WState_Created) && p->testAttribute(Qt::WA_WState_Created))
evaluated: !testAttribute(Qt::WA_WState_Created)
TRUEFALSE
yes
Evaluation Count:2525
yes
Evaluation Count:4224
evaluated: p->testAttribute(Qt::WA_WState_Created)
TRUEFALSE
yes
Evaluation Count:1065
yes
Evaluation Count:1460
1065-4224
10595 create();
executed: create();
Execution Count:1065
1065
10596 else if (from == parentChildCount - 1)
evaluated: from == parentChildCount - 1
TRUEFALSE
yes
Evaluation Count:2600
yes
Evaluation Count:3084
2600-3084
10597 return;
executed: return;
Execution Count:2600
2600
10598 -
10599 QRegion region(rect());
executed (the execution status of this line is deduced): QRegion region(rect());
-
10600 d->subtractOpaqueSiblings(region);
executed (the execution status of this line is deduced): d->subtractOpaqueSiblings(region);
-
10601 d->invalidateBuffer(region);
executed (the execution status of this line is deduced): d->invalidateBuffer(region);
-
10602 }
executed: }
Execution Count:4149
4149
10603 if (testAttribute(Qt::WA_WState_Created))
evaluated: testAttribute(Qt::WA_WState_Created)
TRUEFALSE
yes
Evaluation Count:3719
yes
Evaluation Count:562
562-3719
10604 d->raise_sys();
executed: d->raise_sys();
Execution Count:3719
3719
10605 -
10606 QEvent e(QEvent::ZOrderChange);
executed (the execution status of this line is deduced): QEvent e(QEvent::ZOrderChange);
-
10607 QApplication::sendEvent(this, &e);
executed (the execution status of this line is deduced): QApplication::sendEvent(this, &e);
-
10608}
executed: }
Execution Count:4281
4281
10609 -
10610/*! -
10611 Lowers the widget to the bottom of the parent widget's stack. -
10612 -
10613 After this call the widget will be visually behind (and therefore -
10614 obscured by) any overlapping sibling widgets. -
10615 -
10616 \sa raise(), stackUnder() -
10617*/ -
10618 -
10619void QWidget::lower() -
10620{ -
10621 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
10622 if (!isWindow()) {
evaluated: !isWindow()
TRUEFALSE
yes
Evaluation Count:1107
yes
Evaluation Count:1
1-1107
10623 QWidget *p = parentWidget();
executed (the execution status of this line is deduced): QWidget *p = parentWidget();
-
10624 const int parentChildCount = p->d_func()->children.size();
executed (the execution status of this line is deduced): const int parentChildCount = p->d_func()->children.size();
-
10625 if (parentChildCount < 2)
partially evaluated: parentChildCount < 2
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1107
0-1107
10626 return;
never executed: return;
0
10627 const int from = p->d_func()->children.indexOf(this);
executed (the execution status of this line is deduced): const int from = p->d_func()->children.indexOf(this);
-
10628 Q_ASSERT(from >= 0);
executed (the execution status of this line is deduced): qt_noop();
-
10629 // Do nothing if the widget is already in correct stacking order _and_ created. -
10630 if (from != 0)
evaluated: from != 0
TRUEFALSE
yes
Evaluation Count:863
yes
Evaluation Count:244
244-863
10631 p->d_func()->children.move(from, 0);
executed: p->d_func()->children.move(from, 0);
Execution Count:863
863
10632 if (!testAttribute(Qt::WA_WState_Created) && p->testAttribute(Qt::WA_WState_Created))
evaluated: !testAttribute(Qt::WA_WState_Created)
TRUEFALSE
yes
Evaluation Count:1084
yes
Evaluation Count:23
evaluated: p->testAttribute(Qt::WA_WState_Created)
TRUEFALSE
yes
Evaluation Count:25
yes
Evaluation Count:1059
23-1084
10633 create();
executed: create();
Execution Count:25
25
10634 else if (from == 0)
evaluated: from == 0
TRUEFALSE
yes
Evaluation Count:234
yes
Evaluation Count:848
234-848
10635 return;
executed: return;
Execution Count:234
234
10636 } -
10637 if (testAttribute(Qt::WA_WState_Created))
evaluated: testAttribute(Qt::WA_WState_Created)
TRUEFALSE
yes
Evaluation Count:36
yes
Evaluation Count:838
36-838
10638 d->lower_sys();
executed: d->lower_sys();
Execution Count:36
36
10639 -
10640 QEvent e(QEvent::ZOrderChange);
executed (the execution status of this line is deduced): QEvent e(QEvent::ZOrderChange);
-
10641 QApplication::sendEvent(this, &e);
executed (the execution status of this line is deduced): QApplication::sendEvent(this, &e);
-
10642}
executed: }
Execution Count:874
874
10643 -
10644 -
10645/*! -
10646 Places the widget under \a w in the parent widget's stack. -
10647 -
10648 To make this work, the widget itself and \a w must be siblings. -
10649 -
10650 \sa raise(), lower() -
10651*/ -
10652void QWidget::stackUnder(QWidget* w) -
10653{ -
10654 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
10655 QWidget *p = parentWidget();
executed (the execution status of this line is deduced): QWidget *p = parentWidget();
-
10656 if (!w || isWindow() || p != w->parentWidget() || this == w)
partially evaluated: !w
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:11
partially evaluated: isWindow()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:11
partially evaluated: p != w->parentWidget()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:11
partially evaluated: this == w
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:11
0-11
10657 return;
never executed: return;
0
10658 if (p) {
partially evaluated: p
TRUEFALSE
yes
Evaluation Count:11
no
Evaluation Count:0
0-11
10659 int from = p->d_func()->children.indexOf(this);
executed (the execution status of this line is deduced): int from = p->d_func()->children.indexOf(this);
-
10660 int to = p->d_func()->children.indexOf(w);
executed (the execution status of this line is deduced): int to = p->d_func()->children.indexOf(w);
-
10661 Q_ASSERT(from >= 0);
executed (the execution status of this line is deduced): qt_noop();
-
10662 Q_ASSERT(to >= 0);
executed (the execution status of this line is deduced): qt_noop();
-
10663 if (from < to)
evaluated: from < to
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:2
2-9
10664 --to;
executed: --to;
Execution Count:9
9
10665 // Do nothing if the widget is already in correct stacking order _and_ created. -
10666 if (from != to)
evaluated: from != to
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:8
3-8
10667 p->d_func()->children.move(from, to);
executed: p->d_func()->children.move(from, to);
Execution Count:3
3
10668 if (!testAttribute(Qt::WA_WState_Created) && p->testAttribute(Qt::WA_WState_Created))
evaluated: !testAttribute(Qt::WA_WState_Created)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:10
partially evaluated: p->testAttribute(Qt::WA_WState_Created)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-10
10669 create();
never executed: create();
0
10670 else if (from == to)
evaluated: from == to
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:3
3-8
10671 return;
executed: return;
Execution Count:8
8
10672 } -
10673 if (testAttribute(Qt::WA_WState_Created))
evaluated: testAttribute(Qt::WA_WState_Created)
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1
1-2
10674 d->stackUnder_sys(w);
executed: d->stackUnder_sys(w);
Execution Count:2
2
10675 -
10676 QEvent e(QEvent::ZOrderChange);
executed (the execution status of this line is deduced): QEvent e(QEvent::ZOrderChange);
-
10677 QApplication::sendEvent(this, &e);
executed (the execution status of this line is deduced): QApplication::sendEvent(this, &e);
-
10678}
executed: }
Execution Count:3
3
10679 -
10680 -
10681/*! -
10682 \fn bool QWidget::isTopLevel() const -
10683 \obsolete -
10684 -
10685 Use isWindow() instead. -
10686*/ -
10687 -
10688/*! -
10689 \fn bool QWidget::isRightToLeft() const -
10690 \internal -
10691*/ -
10692 -
10693/*! -
10694 \fn bool QWidget::isLeftToRight() const -
10695 \internal -
10696*/ -
10697 -
10698/*! -
10699 \macro QWIDGETSIZE_MAX -
10700 \relates QWidget -
10701 -
10702 Defines the maximum size for a QWidget object. -
10703 -
10704 The largest allowed size for a widget is QSize(QWIDGETSIZE_MAX, -
10705 QWIDGETSIZE_MAX), i.e. QSize (16777215,16777215). -
10706 -
10707 \sa QWidget::setMaximumSize() -
10708*/ -
10709 -
10710/*! -
10711 \fn QWidget::setupUi(QWidget *widget) -
10712 -
10713 Sets up the user interface for the specified \a widget. -
10714 -
10715 \note This function is available with widgets that derive from user -
10716 interface descriptions created using \l{uic}. -
10717 -
10718 \sa {Using a Designer UI File in Your Application} -
10719*/ -
10720 -
10721QRect QWidgetPrivate::frameStrut() const -
10722{ -
10723 Q_Q(const QWidget);
executed (the execution status of this line is deduced): const QWidget * const q = q_func();
-
10724 if (!q->isWindow() || (q->windowType() == Qt::Desktop) || q->testAttribute(Qt::WA_DontShowOnScreen)) {
partially evaluated: !q->isWindow()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6371
evaluated: (q->windowType() == Qt::Desktop)
TRUEFALSE
yes
Evaluation Count:133
yes
Evaluation Count:6238
evaluated: q->testAttribute(Qt::WA_DontShowOnScreen)
TRUEFALSE
yes
Evaluation Count:28
yes
Evaluation Count:6210
0-6371
10725 // x2 = x1 + w - 1, so w/h = 1 -
10726 return QRect(0, 0, 1, 1);
executed: return QRect(0, 0, 1, 1);
Execution Count:161
161
10727 } -
10728 -
10729 if (data.fstrut_dirty
evaluated: data.fstrut_dirty
TRUEFALSE
yes
Evaluation Count:5721
yes
Evaluation Count:489
489-5721
10730#ifndef Q_WS_WIN
executed (the execution status of this line is deduced):
-
10731 // ### Fix properly for 4.3
executed (the execution status of this line is deduced):
-
10732 && q->isVisible()
evaluated: q->isVisible()
TRUEFALSE
yes
Evaluation Count:2037
yes
Evaluation Count:3684
2037-3684
10733#endif
executed (the execution status of this line is deduced):
-
10734 && q->testAttribute(Qt::WA_WState_Created))
partially evaluated: q->testAttribute(Qt::WA_WState_Created)
TRUEFALSE
yes
Evaluation Count:2037
no
Evaluation Count:0
0-2037
10735 const_cast<QWidgetPrivate *>(this)->updateFrameStrut();
executed: const_cast<QWidgetPrivate *>(this)->updateFrameStrut();
Execution Count:2037
2037
10736 -
10737 return maybeTopData() ? maybeTopData()->frameStrut : QRect();
executed: return maybeTopData() ? maybeTopData()->frameStrut : QRect();
Execution Count:6210
6210
10738} -
10739 -
10740#ifdef QT_KEYPAD_NAVIGATION -
10741/*! -
10742 \internal -
10743 -
10744 Changes the focus from the current focusWidget to a widget in -
10745 the \a direction. -
10746 -
10747 Returns true, if there was a widget in that direction -
10748*/ -
10749bool QWidgetPrivate::navigateToDirection(Direction direction) -
10750{ -
10751 QWidget *targetWidget = widgetInNavigationDirection(direction); -
10752 if (targetWidget) -
10753 targetWidget->setFocus(); -
10754 return (targetWidget != 0); -
10755} -
10756 -
10757/*! -
10758 \internal -
10759 -
10760 Searches for a widget that is positioned in the \a direction, starting -
10761 from the current focusWidget. -
10762 -
10763 Returns the pointer to a found widget or 0, if there was no widget in -
10764 that direction. -
10765*/ -
10766QWidget *QWidgetPrivate::widgetInNavigationDirection(Direction direction) -
10767{ -
10768 const QWidget *sourceWidget = QApplication::focusWidget(); -
10769 if (!sourceWidget) -
10770 return 0; -
10771 const QRect sourceRect = sourceWidget->rect().translated(sourceWidget->mapToGlobal(QPoint())); -
10772 const int sourceX = -
10773 (direction == DirectionNorth || direction == DirectionSouth) ? -
10774 (sourceRect.left() + (sourceRect.right() - sourceRect.left()) / 2) -
10775 :(direction == DirectionEast ? sourceRect.right() : sourceRect.left()); -
10776 const int sourceY = -
10777 (direction == DirectionEast || direction == DirectionWest) ? -
10778 (sourceRect.top() + (sourceRect.bottom() - sourceRect.top()) / 2) -
10779 :(direction == DirectionSouth ? sourceRect.bottom() : sourceRect.top()); -
10780 const QPoint sourcePoint(sourceX, sourceY); -
10781 const QPoint sourceCenter = sourceRect.center(); -
10782 const QWidget *sourceWindow = sourceWidget->window(); -
10783 -
10784 QWidget *targetWidget = 0; -
10785 int shortestDistance = INT_MAX; -
10786 foreach(QWidget *targetCandidate, QApplication::allWidgets()) { -
10787 -
10788 const QRect targetCandidateRect = targetCandidate->rect().translated(targetCandidate->mapToGlobal(QPoint())); -
10789 -
10790 // For focus proxies, the child widget handling the focus can have keypad navigation focus, -
10791 // but the owner of the proxy cannot. -
10792 // Additionally, empty widgets should be ignored. -
10793 if (targetCandidate->focusProxy() || targetCandidateRect.isEmpty()) -
10794 continue; -
10795 -
10796 // Only navigate to a target widget that... -
10797 if ( targetCandidate != sourceWidget -
10798 // ...takes the focus, -
10799 && targetCandidate->focusPolicy() & Qt::TabFocus -
10800 // ...is above if DirectionNorth, -
10801 && !(direction == DirectionNorth && targetCandidateRect.bottom() > sourceRect.top()) -
10802 // ...is on the right if DirectionEast, -
10803 && !(direction == DirectionEast && targetCandidateRect.left() < sourceRect.right()) -
10804 // ...is below if DirectionSouth, -
10805 && !(direction == DirectionSouth && targetCandidateRect.top() < sourceRect.bottom()) -
10806 // ...is on the left if DirectionWest, -
10807 && !(direction == DirectionWest && targetCandidateRect.right() > sourceRect.left()) -
10808 // ...is enabled, -
10809 && targetCandidate->isEnabled() -
10810 // ...is visible, -
10811 && targetCandidate->isVisible() -
10812 // ...is in the same window, -
10813 && targetCandidate->window() == sourceWindow) { -
10814 const int targetCandidateDistance = pointToRect(sourcePoint, targetCandidateRect); -
10815 if (targetCandidateDistance < shortestDistance) { -
10816 shortestDistance = targetCandidateDistance; -
10817 targetWidget = targetCandidate; -
10818 } -
10819 } -
10820 } -
10821 return targetWidget; -
10822} -
10823 -
10824/*! -
10825 \internal -
10826 -
10827 Tells us if it there is currently a reachable widget by keypad navigation in -
10828 a certain \a orientation. -
10829 If no navigation is possible, occurring key events in that \a orientation may -
10830 be used to interact with the value in the focused widget, even though it -
10831 currently has not the editFocus. -
10832 -
10833 \sa QWidgetPrivate::widgetInNavigationDirection(), QWidget::hasEditFocus() -
10834*/ -
10835bool QWidgetPrivate::canKeypadNavigate(Qt::Orientation orientation) -
10836{ -
10837 return orientation == Qt::Horizontal? -
10838 (QWidgetPrivate::widgetInNavigationDirection(QWidgetPrivate::DirectionEast) -
10839 || QWidgetPrivate::widgetInNavigationDirection(QWidgetPrivate::DirectionWest)) -
10840 :(QWidgetPrivate::widgetInNavigationDirection(QWidgetPrivate::DirectionNorth) -
10841 || QWidgetPrivate::widgetInNavigationDirection(QWidgetPrivate::DirectionSouth)); -
10842} -
10843/*! -
10844 \internal -
10845 -
10846 Checks, if the \a widget is inside a QTabWidget. If is is inside -
10847 one, left/right key events will be used to switch between tabs in keypad -
10848 navigation. If there is no QTabWidget, the horizontal key events can be used -
10849to -
10850 interact with the value in the focused widget, even though it currently has -
10851 not the editFocus. -
10852 -
10853 \sa QWidget::hasEditFocus() -
10854*/ -
10855bool QWidgetPrivate::inTabWidget(QWidget *widget) -
10856{ -
10857 for (QWidget *tabWidget = widget; tabWidget; tabWidget = tabWidget->parentWidget()) -
10858 if (qobject_cast<const QTabWidget*>(tabWidget)) -
10859 return true; -
10860 return false; -
10861} -
10862#endif -
10863 -
10864/*! -
10865 \since 5.0 -
10866 \internal -
10867 -
10868 Sets the backing store to be the \a store specified. -
10869 The QWidget will take ownership of the \a store. -
10870*/ -
10871void QWidget::setBackingStore(QBackingStore *store) -
10872{ -
10873 // ### createWinId() ?? -
10874 -
10875 if (!isTopLevel())
partially evaluated: !isTopLevel()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2499
0-2499
10876 return;
never executed: return;
0
10877 -
10878 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
10879 -
10880 QTLWExtra *topData = d->topData();
executed (the execution status of this line is deduced): QTLWExtra *topData = d->topData();
-
10881 if (topData->backingStore == store)
partially evaluated: topData->backingStore == store
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2499
0-2499
10882 return;
never executed: return;
0
10883 -
10884 QBackingStore *oldStore = topData->backingStore;
executed (the execution status of this line is deduced): QBackingStore *oldStore = topData->backingStore;
-
10885 delete topData->backingStore;
executed (the execution status of this line is deduced): delete topData->backingStore;
-
10886 topData->backingStore = store;
executed (the execution status of this line is deduced): topData->backingStore = store;
-
10887 -
10888 QWidgetBackingStore *bs = d->maybeBackingStore();
executed (the execution status of this line is deduced): QWidgetBackingStore *bs = d->maybeBackingStore();
-
10889 if (!bs)
partially evaluated: !bs
TRUEFALSE
yes
Evaluation Count:2499
no
Evaluation Count:0
0-2499
10890 return;
executed: return;
Execution Count:2499
2499
10891 -
10892 if (isTopLevel()) {
never evaluated: isTopLevel()
0
10893 if (bs->store != oldStore && bs->store != store)
never evaluated: bs->store != oldStore
never evaluated: bs->store != store
0
10894 delete bs->store;
never executed: delete bs->store;
0
10895 bs->store = store;
never executed (the execution status of this line is deduced): bs->store = store;
-
10896 }
never executed: }
0
10897}
never executed: }
0
10898 -
10899/*! -
10900 \since 5.0 -
10901 -
10902 Returns the QBackingStore this widget will be drawn into. -
10903*/ -
10904QBackingStore *QWidget::backingStore() const -
10905{ -
10906 Q_D(const QWidget);
executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
10907 QTLWExtra *extra = d->maybeTopData();
executed (the execution status of this line is deduced): QTLWExtra *extra = d->maybeTopData();
-
10908 if (extra && extra->backingStore)
partially evaluated: extra
TRUEFALSE
yes
Evaluation Count:7745
no
Evaluation Count:0
evaluated: extra->backingStore
TRUEFALSE
yes
Evaluation Count:5068
yes
Evaluation Count:2677
0-7745
10909 return extra->backingStore;
executed: return extra->backingStore;
Execution Count:5068
5068
10910 -
10911 QWidgetBackingStore *bs = d->maybeBackingStore();
executed (the execution status of this line is deduced): QWidgetBackingStore *bs = d->maybeBackingStore();
-
10912 -
10913 return bs ? bs->store : 0;
executed: return bs ? bs->store : 0;
Execution Count:2677
2677
10914} -
10915 -
10916void QWidgetPrivate::getLayoutItemMargins(int *left, int *top, int *right, int *bottom) const -
10917{ -
10918 if (left)
partially evaluated: left
TRUEFALSE
yes
Evaluation Count:587
no
Evaluation Count:0
0-587
10919 *left = (int)leftLayoutItemMargin;
executed: *left = (int)leftLayoutItemMargin;
Execution Count:587
587
10920 if (top)
partially evaluated: top
TRUEFALSE
yes
Evaluation Count:587
no
Evaluation Count:0
0-587
10921 *top = (int)topLayoutItemMargin;
executed: *top = (int)topLayoutItemMargin;
Execution Count:587
587
10922 if (right)
partially evaluated: right
TRUEFALSE
yes
Evaluation Count:587
no
Evaluation Count:0
0-587
10923 *right = (int)rightLayoutItemMargin;
executed: *right = (int)rightLayoutItemMargin;
Execution Count:587
587
10924 if (bottom)
partially evaluated: bottom
TRUEFALSE
yes
Evaluation Count:587
no
Evaluation Count:0
0-587
10925 *bottom = (int)bottomLayoutItemMargin;
executed: *bottom = (int)bottomLayoutItemMargin;
Execution Count:587
587
10926}
executed: }
Execution Count:587
587
10927 -
10928void QWidgetPrivate::setLayoutItemMargins(int left, int top, int right, int bottom) -
10929{ -
10930 if (leftLayoutItemMargin == left
never evaluated: leftLayoutItemMargin == left
0
10931 && topLayoutItemMargin == top
never evaluated: topLayoutItemMargin == top
0
10932 && rightLayoutItemMargin == right
never evaluated: rightLayoutItemMargin == right
0
10933 && bottomLayoutItemMargin == bottom)
never evaluated: bottomLayoutItemMargin == bottom
0
10934 return;
never executed: return;
0
10935 -
10936 Q_Q(QWidget);
never executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
10937 leftLayoutItemMargin = (signed char)left;
never executed (the execution status of this line is deduced): leftLayoutItemMargin = (signed char)left;
-
10938 topLayoutItemMargin = (signed char)top;
never executed (the execution status of this line is deduced): topLayoutItemMargin = (signed char)top;
-
10939 rightLayoutItemMargin = (signed char)right;
never executed (the execution status of this line is deduced): rightLayoutItemMargin = (signed char)right;
-
10940 bottomLayoutItemMargin = (signed char)bottom;
never executed (the execution status of this line is deduced): bottomLayoutItemMargin = (signed char)bottom;
-
10941 q->updateGeometry();
never executed (the execution status of this line is deduced): q->updateGeometry();
-
10942}
never executed: }
0
10943 -
10944void QWidgetPrivate::setLayoutItemMargins(QStyle::SubElement element, const QStyleOption *opt) -
10945{ -
10946 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
10947 QStyleOption myOpt;
executed (the execution status of this line is deduced): QStyleOption myOpt;
-
10948 if (!opt) {
evaluated: !opt
TRUEFALSE
yes
Evaluation Count:27986
yes
Evaluation Count:4313
4313-27986
10949 myOpt.initFrom(q);
executed (the execution status of this line is deduced): myOpt.initFrom(q);
-
10950 myOpt.rect.setRect(0, 0, 32768, 32768); // arbitrary
executed (the execution status of this line is deduced): myOpt.rect.setRect(0, 0, 32768, 32768);
-
10951 opt = &myOpt;
executed (the execution status of this line is deduced): opt = &myOpt;
-
10952 }
executed: }
Execution Count:27986
27986
10953 -
10954 QRect liRect = q->style()->subElementRect(element, opt, q);
executed (the execution status of this line is deduced): QRect liRect = q->style()->subElementRect(element, opt, q);
-
10955 if (liRect.isValid()) {
evaluated: liRect.isValid()
TRUEFALSE
yes
Evaluation Count:30
yes
Evaluation Count:32269
30-32269
10956 leftLayoutItemMargin = (signed char)(opt->rect.left() - liRect.left());
executed (the execution status of this line is deduced): leftLayoutItemMargin = (signed char)(opt->rect.left() - liRect.left());
-
10957 topLayoutItemMargin = (signed char)(opt->rect.top() - liRect.top());
executed (the execution status of this line is deduced): topLayoutItemMargin = (signed char)(opt->rect.top() - liRect.top());
-
10958 rightLayoutItemMargin = (signed char)(liRect.right() - opt->rect.right());
executed (the execution status of this line is deduced): rightLayoutItemMargin = (signed char)(liRect.right() - opt->rect.right());
-
10959 bottomLayoutItemMargin = (signed char)(liRect.bottom() - opt->rect.bottom());
executed (the execution status of this line is deduced): bottomLayoutItemMargin = (signed char)(liRect.bottom() - opt->rect.bottom());
-
10960 } else {
executed: }
Execution Count:30
30
10961 leftLayoutItemMargin = 0;
executed (the execution status of this line is deduced): leftLayoutItemMargin = 0;
-
10962 topLayoutItemMargin = 0;
executed (the execution status of this line is deduced): topLayoutItemMargin = 0;
-
10963 rightLayoutItemMargin = 0;
executed (the execution status of this line is deduced): rightLayoutItemMargin = 0;
-
10964 bottomLayoutItemMargin = 0;
executed (the execution status of this line is deduced): bottomLayoutItemMargin = 0;
-
10965 }
executed: }
Execution Count:32269
32269
10966} -
10967// resets the Qt::WA_QuitOnClose attribute to the default value for transient widgets. -
10968void QWidgetPrivate::adjustQuitOnCloseAttribute() -
10969{ -
10970 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
10971 -
10972 if (!q->parentWidget()) {
evaluated: !q->parentWidget()
TRUEFALSE
yes
Evaluation Count:45989
yes
Evaluation Count:42
42-45989
10973 Qt::WindowType type = q->windowType();
executed (the execution status of this line is deduced): Qt::WindowType type = q->windowType();
-
10974 if (type == Qt::Widget || type == Qt::SubWindow)
evaluated: type == Qt::Widget
TRUEFALSE
yes
Evaluation Count:44364
yes
Evaluation Count:1625
evaluated: type == Qt::SubWindow
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1624
1-44364
10975 type = Qt::Window;
executed: type = Qt::Window;
Execution Count:44365
44365
10976 if (type != Qt::Widget && type != Qt::Window && type != Qt::Dialog)
partially evaluated: type != Qt::Widget
TRUEFALSE
yes
Evaluation Count:45989
no
Evaluation Count:0
evaluated: type != Qt::Window
TRUEFALSE
yes
Evaluation Count:1291
yes
Evaluation Count:44698
evaluated: type != Qt::Dialog
TRUEFALSE
yes
Evaluation Count:906
yes
Evaluation Count:385
0-45989
10977 q->setAttribute(Qt::WA_QuitOnClose, false);
executed: q->setAttribute(Qt::WA_QuitOnClose, false);
Execution Count:906
906
10978 }
executed: }
Execution Count:45989
45989
10979}
executed: }
Execution Count:46031
46031
10980 -
10981 -
10982 -
10983Q_WIDGETS_EXPORT QWidgetData *qt_qwidget_data(QWidget *widget) -
10984{ -
10985 return widget->data;
never executed: return widget->data;
0
10986} -
10987 -
10988Q_WIDGETS_EXPORT QWidgetPrivate *qt_widget_private(QWidget *widget) -
10989{ -
10990 return widget->d_func();
executed: return widget->d_func();
Execution Count:1616
1616
10991} -
10992 -
10993 -
10994#ifndef QT_NO_GRAPHICSVIEW -
10995/*! -
10996 \since 4.5 -
10997 -
10998 Returns the proxy widget for the corresponding embedded widget in a graphics -
10999 view; otherwise returns 0. -
11000 -
11001 \sa QGraphicsProxyWidget::createProxyForChildWidget(), -
11002 QGraphicsScene::addWidget() -
11003 */ -
11004QGraphicsProxyWidget *QWidget::graphicsProxyWidget() const -
11005{ -
11006 Q_D(const QWidget);
executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
11007 if (d->extra) {
evaluated: d->extra
TRUEFALSE
yes
Evaluation Count:7417
yes
Evaluation Count:41756
7417-41756
11008 return d->extra->proxyWidget;
executed: return d->extra->proxyWidget;
Execution Count:7417
7417
11009 } -
11010 return 0;
executed: return 0;
Execution Count:41756
41756
11011} -
11012#endif -
11013 -
11014#ifndef QT_NO_GESTURES -
11015/*! -
11016 Subscribes the widget to a given \a gesture with specific \a flags. -
11017 -
11018 \sa ungrabGesture(), QGestureEvent -
11019 \since 4.6 -
11020*/ -
11021void QWidget::grabGesture(Qt::GestureType gesture, Qt::GestureFlags flags) -
11022{ -
11023 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
11024 d->gestureContext.insert(gesture, flags);
executed (the execution status of this line is deduced): d->gestureContext.insert(gesture, flags);
-
11025 (void)QGestureManager::instance(); // create a gesture manager
executed (the execution status of this line is deduced): (void)QGestureManager::instance();
-
11026}
executed: }
Execution Count:6064
6064
11027 -
11028/*! -
11029 Unsubscribes the widget from a given \a gesture type -
11030 -
11031 \sa grabGesture(), QGestureEvent -
11032 \since 4.6 -
11033*/ -
11034void QWidget::ungrabGesture(Qt::GestureType gesture) -
11035{ -
11036 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
11037 if (d->gestureContext.remove(gesture)) {
partially evaluated: d->gestureContext.remove(gesture)
TRUEFALSE
yes
Evaluation Count:5416
no
Evaluation Count:0
0-5416
11038 if (QGestureManager *manager = QGestureManager::instance())
partially evaluated: QGestureManager *manager = QGestureManager::instance()
TRUEFALSE
yes
Evaluation Count:5416
no
Evaluation Count:0
0-5416
11039 manager->cleanupCachedGestures(this, gesture);
executed: manager->cleanupCachedGestures(this, gesture);
Execution Count:5416
5416
11040 }
executed: }
Execution Count:5416
5416
11041}
executed: }
Execution Count:5416
5416
11042#endif // QT_NO_GESTURES -
11043 -
11044/*! -
11045 \fn void QWidget::destroy(bool destroyWindow, bool destroySubWindows) -
11046 -
11047 Frees up window system resources. Destroys the widget window if \a -
11048 destroyWindow is true. -
11049 -
11050 destroy() calls itself recursively for all the child widgets, -
11051 passing \a destroySubWindows for the \a destroyWindow parameter. -
11052 To have more control over destruction of subwidgets, destroy -
11053 subwidgets selectively first. -
11054 -
11055 This function is usually called from the QWidget destructor. -
11056*/ -
11057 -
11058/*! -
11059 \fn QPaintEngine *QWidget::paintEngine() const -
11060 -
11061 Returns the widget's paint engine. -
11062 -
11063 Note that this function should not be called explicitly by the -
11064 user, since it's meant for reimplementation purposes only. The -
11065 function is called by Qt internally, and the default -
11066 implementation may not always return a valid pointer. -
11067*/ -
11068 -
11069/*! -
11070 \fn QPoint QWidget::mapToGlobal(const QPoint &pos) const -
11071 -
11072 Translates the widget coordinate \a pos to global screen -
11073 coordinates. For example, \c{mapToGlobal(QPoint(0,0))} would give -
11074 the global coordinates of the top-left pixel of the widget. -
11075 -
11076 \sa mapFromGlobal(), mapTo(), mapToParent() -
11077*/ -
11078 -
11079/*! -
11080 \fn QPoint QWidget::mapFromGlobal(const QPoint &pos) const -
11081 -
11082 Translates the global screen coordinate \a pos to widget -
11083 coordinates. -
11084 -
11085 \sa mapToGlobal(), mapFrom(), mapFromParent() -
11086*/ -
11087 -
11088/*! -
11089 \fn void QWidget::grabMouse() -
11090 -
11091 Grabs the mouse input. -
11092 -
11093 This widget receives all mouse events until releaseMouse() is -
11094 called; other widgets get no mouse events at all. Keyboard -
11095 events are not affected. Use grabKeyboard() if you want to grab -
11096 that. -
11097 -
11098 \warning Bugs in mouse-grabbing applications very often lock the -
11099 terminal. Use this function with extreme caution, and consider -
11100 using the \c -nograb command line option while debugging. -
11101 -
11102 It is almost never necessary to grab the mouse when using Qt, as -
11103 Qt grabs and releases it sensibly. In particular, Qt grabs the -
11104 mouse when a mouse button is pressed and keeps it until the last -
11105 button is released. -
11106 -
11107 \note Only visible widgets can grab mouse input. If isVisible() -
11108 returns false for a widget, that widget cannot call grabMouse(). -
11109 -
11110 \note \b{(Mac OS X developers)} For \e Cocoa, calling -
11111 grabMouse() on a widget only works when the mouse is inside the -
11112 frame of that widget. For \e Carbon, it works outside the widget's -
11113 frame as well, like for Windows and X11. -
11114 -
11115 \sa releaseMouse(), grabKeyboard(), releaseKeyboard() -
11116*/ -
11117 -
11118/*! -
11119 \fn void QWidget::grabMouse(const QCursor &cursor) -
11120 \overload grabMouse() -
11121 -
11122 Grabs the mouse input and changes the cursor shape. -
11123 -
11124 The cursor will assume shape \a cursor (for as long as the mouse -
11125 focus is grabbed) and this widget will be the only one to receive -
11126 mouse events until releaseMouse() is called(). -
11127 -
11128 \warning Grabbing the mouse might lock the terminal. -
11129 -
11130 \note \b{(Mac OS X developers)} See the note in QWidget::grabMouse(). -
11131 -
11132 \sa releaseMouse(), grabKeyboard(), releaseKeyboard(), setCursor() -
11133*/ -
11134 -
11135/*! -
11136 \fn void QWidget::releaseMouse() -
11137 -
11138 Releases the mouse grab. -
11139 -
11140 \sa grabMouse(), grabKeyboard(), releaseKeyboard() -
11141*/ -
11142 -
11143/*! -
11144 \fn void QWidget::grabKeyboard() -
11145 -
11146 Grabs the keyboard input. -
11147 -
11148 This widget receives all keyboard events until releaseKeyboard() -
11149 is called; other widgets get no keyboard events at all. Mouse -
11150 events are not affected. Use grabMouse() if you want to grab that. -
11151 -
11152 The focus widget is not affected, except that it doesn't receive -
11153 any keyboard events. setFocus() moves the focus as usual, but the -
11154 new focus widget receives keyboard events only after -
11155 releaseKeyboard() is called. -
11156 -
11157 If a different widget is currently grabbing keyboard input, that -
11158 widget's grab is released first. -
11159 -
11160 \sa releaseKeyboard(), grabMouse(), releaseMouse(), focusWidget() -
11161*/ -
11162 -
11163/*! -
11164 \fn void QWidget::releaseKeyboard() -
11165 -
11166 Releases the keyboard grab. -
11167 -
11168 \sa grabKeyboard(), grabMouse(), releaseMouse() -
11169*/ -
11170 -
11171/*! -
11172 \fn QWidget *QWidget::mouseGrabber() -
11173 -
11174 Returns the widget that is currently grabbing the mouse input. -
11175 -
11176 If no widget in this application is currently grabbing the mouse, -
11177 0 is returned. -
11178 -
11179 \sa grabMouse(), keyboardGrabber() -
11180*/ -
11181 -
11182/*! -
11183 \fn QWidget *QWidget::keyboardGrabber() -
11184 -
11185 Returns the widget that is currently grabbing the keyboard input. -
11186 -
11187 If no widget in this application is currently grabbing the -
11188 keyboard, 0 is returned. -
11189 -
11190 \sa grabMouse(), mouseGrabber() -
11191*/ -
11192 -
11193/*! -
11194 \fn void QWidget::activateWindow() -
11195 -
11196 Sets the top-level widget containing this widget to be the active -
11197 window. -
11198 -
11199 An active window is a visible top-level window that has the -
11200 keyboard input focus. -
11201 -
11202 This function performs the same operation as clicking the mouse on -
11203 the title bar of a top-level window. On X11, the result depends on -
11204 the Window Manager. If you want to ensure that the window is -
11205 stacked on top as well you should also call raise(). Note that the -
11206 window must be visible, otherwise activateWindow() has no effect. -
11207 -
11208 On Windows, if you are calling this when the application is not -
11209 currently the active one then it will not make it the active -
11210 window. It will change the color of the taskbar entry to indicate -
11211 that the window has changed in some way. This is because Microsoft -
11212 does not allow an application to interrupt what the user is currently -
11213 doing in another application. -
11214 -
11215 \sa isActiveWindow(), window(), show() -
11216*/ -
11217 -
11218/*! -
11219 \fn int QWidget::metric(PaintDeviceMetric m) const -
11220 -
11221 Internal implementation of the virtual QPaintDevice::metric() -
11222 function. -
11223 -
11224 \a m is the metric to get. -
11225*/ -
11226 -
11227/*! -
11228 Initializes the \a painter pen, background and font to the same as -
11229 the given widget's. This function is called automatically when the -
11230 painter is opened on a QWidget. -
11231*/ -
11232void QWidget::initPainter(QPainter *painter) const -
11233{ -
11234 const QPalette &pal = palette();
executed (the execution status of this line is deduced): const QPalette &pal = palette();
-
11235 painter->d_func()->state->pen = QPen(pal.brush(foregroundRole()), 1);
executed (the execution status of this line is deduced): painter->d_func()->state->pen = QPen(pal.brush(foregroundRole()), 1);
-
11236 painter->d_func()->state->bgBrush = pal.brush(backgroundRole());
executed (the execution status of this line is deduced): painter->d_func()->state->bgBrush = pal.brush(backgroundRole());
-
11237 QFont f(font(), const_cast<QWidget *>(this));
executed (the execution status of this line is deduced): QFont f(font(), const_cast<QWidget *>(this));
-
11238 painter->d_func()->state->deviceFont = f;
executed (the execution status of this line is deduced): painter->d_func()->state->deviceFont = f;
-
11239 painter->d_func()->state->font = f;
executed (the execution status of this line is deduced): painter->d_func()->state->font = f;
-
11240}
executed: }
Execution Count:23461
23461
11241 -
11242QPaintDevice *QWidget::redirected(QPoint *offset) const -
11243{ -
11244 return d_func()->redirected(offset);
executed: return d_func()->redirected(offset);
Execution Count:23460
23460
11245} -
11246 -
11247QPainter *QWidget::sharedPainter() const -
11248{ -
11249 // Someone sent a paint event directly to the widget -
11250 if (!d_func()->redirectDev)
partially evaluated: !d_func()->redirectDev
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:44943
0-44943
11251 return 0;
never executed: return 0;
0
11252 -
11253 QPainter *sp = d_func()->sharedPainter();
executed (the execution status of this line is deduced): QPainter *sp = d_func()->sharedPainter();
-
11254 if (!sp || !sp->isActive())
evaluated: !sp
TRUEFALSE
yes
Evaluation Count:44903
yes
Evaluation Count:40
partially evaluated: !sp->isActive()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:40
0-44903
11255 return 0;
executed: return 0;
Execution Count:44903
44903
11256 -
11257 if (sp->paintEngine()->paintDevice() != d_func()->redirectDev)
partially evaluated: sp->paintEngine()->paintDevice() != d_func()->redirectDev
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:40
0-40
11258 return 0;
never executed: return 0;
0
11259 -
11260 return sp;
executed: return sp;
Execution Count:40
40
11261} -
11262 -
11263/*! -
11264 \fn void QWidget::setMask(const QRegion &region) -
11265 \overload -
11266 -
11267 Causes only the parts of the widget which overlap \a region to be -
11268 visible. If the region includes pixels outside the rect() of the -
11269 widget, window system controls in that area may or may not be -
11270 visible, depending on the platform. -
11271 -
11272 Note that this effect can be slow if the region is particularly -
11273 complex. -
11274 -
11275 \sa windowOpacity -
11276*/ -
11277void QWidget::setMask(const QRegion &newMask) -
11278{ -
11279 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
11280 -
11281 d->createExtra();
executed (the execution status of this line is deduced): d->createExtra();
-
11282 if (newMask == d->extra->mask)
evaluated: newMask == d->extra->mask
TRUEFALSE
yes
Evaluation Count:24
yes
Evaluation Count:48
24-48
11283 return;
executed: return;
Execution Count:24
24
11284 -
11285#ifndef QT_NO_BACKINGSTORE -
11286 const QRegion oldMask(d->extra->mask);
executed (the execution status of this line is deduced): const QRegion oldMask(d->extra->mask);
-
11287#endif -
11288 -
11289 d->extra->mask = newMask;
executed (the execution status of this line is deduced): d->extra->mask = newMask;
-
11290 d->extra->hasMask = !newMask.isEmpty();
executed (the execution status of this line is deduced): d->extra->hasMask = !newMask.isEmpty();
-
11291 -
11292#ifndef Q_WS_MAC -
11293 if (!testAttribute(Qt::WA_WState_Created))
evaluated: !testAttribute(Qt::WA_WState_Created)
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:35
13-35
11294 return;
executed: return;
Execution Count:13
13
11295#endif -
11296 -
11297 d->setMask_sys(newMask);
executed (the execution status of this line is deduced): d->setMask_sys(newMask);
-
11298 -
11299#ifndef QT_NO_BACKINGSTORE -
11300 if (!isVisible())
evaluated: !isVisible()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:34
1-34
11301 return;
executed: return;
Execution Count:1
1
11302 -
11303 if (!d->extra->hasMask) {
evaluated: !d->extra->hasMask
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:28
6-28
11304 // Mask was cleared; update newly exposed area. -
11305 QRegion expose(rect());
executed (the execution status of this line is deduced): QRegion expose(rect());
-
11306 expose -= oldMask;
executed (the execution status of this line is deduced): expose -= oldMask;
-
11307 if (!expose.isEmpty()) {
evaluated: !expose.isEmpty()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:1
1-5
11308 d->setDirtyOpaqueRegion();
executed (the execution status of this line is deduced): d->setDirtyOpaqueRegion();
-
11309 update(expose);
executed (the execution status of this line is deduced): update(expose);
-
11310 }
executed: }
Execution Count:5
5
11311 return;
executed: return;
Execution Count:6
6
11312 } -
11313 -
11314 if (!isWindow()) {
evaluated: !isWindow()
TRUEFALSE
yes
Evaluation Count:27
yes
Evaluation Count:1
1-27
11315 // Update newly exposed area on the parent widget. -
11316 QRegion parentExpose(rect());
executed (the execution status of this line is deduced): QRegion parentExpose(rect());
-
11317 parentExpose -= newMask;
executed (the execution status of this line is deduced): parentExpose -= newMask;
-
11318 if (!parentExpose.isEmpty()) {
evaluated: !parentExpose.isEmpty()
TRUEFALSE
yes
Evaluation Count:26
yes
Evaluation Count:1
1-26
11319 d->setDirtyOpaqueRegion();
executed (the execution status of this line is deduced): d->setDirtyOpaqueRegion();
-
11320 parentExpose.translate(data->crect.topLeft());
executed (the execution status of this line is deduced): parentExpose.translate(data->crect.topLeft());
-
11321 parentWidget()->update(parentExpose);
executed (the execution status of this line is deduced): parentWidget()->update(parentExpose);
-
11322 }
executed: }
Execution Count:26
26
11323 -
11324 // Update newly exposed area on this widget -
11325 if (!oldMask.isEmpty())
evaluated: !oldMask.isEmpty()
TRUEFALSE
yes
Evaluation Count:24
yes
Evaluation Count:3
3-24
11326 update(newMask - oldMask);
executed: update(newMask - oldMask);
Execution Count:24
24
11327 }
executed: }
Execution Count:27
27
11328#endif -
11329}
executed: }
Execution Count:28
28
11330 -
11331/*! -
11332 \fn void QWidget::setMask(const QBitmap &bitmap) -
11333 -
11334 Causes only the pixels of the widget for which \a bitmap has a -
11335 corresponding 1 bit to be visible. If the region includes pixels -
11336 outside the rect() of the widget, window system controls in that -
11337 area may or may not be visible, depending on the platform. -
11338 -
11339 Note that this effect can be slow if the region is particularly -
11340 complex. -
11341 -
11342 The following code shows how an image with an alpha channel can be -
11343 used to generate a mask for a widget: -
11344 -
11345 \snippet widget-mask/main.cpp 0 -
11346 -
11347 The label shown by this code is masked using the image it contains, -
11348 giving the appearance that an irregularly-shaped image is being drawn -
11349 directly onto the screen. -
11350 -
11351 Masked widgets receive mouse events only on their visible -
11352 portions. -
11353 -
11354 \sa clearMask(), windowOpacity(), {Shaped Clock Example} -
11355*/ -
11356void QWidget::setMask(const QBitmap &bitmap) -
11357{ -
11358 setMask(QRegion(bitmap));
executed (the execution status of this line is deduced): setMask(QRegion(bitmap));
-
11359}
executed: }
Execution Count:4
4
11360 -
11361/*! -
11362 \fn void QWidget::clearMask() -
11363 -
11364 Removes any mask set by setMask(). -
11365 -
11366 \sa setMask() -
11367*/ -
11368void QWidget::clearMask() -
11369{ -
11370 setMask(QRegion());
executed (the execution status of this line is deduced): setMask(QRegion());
-
11371}
executed: }
Execution Count:7
7
11372 -
11373#ifdef Q_WS_MAC -
11374void QWidgetPrivate::syncUnifiedMode() { -
11375 // The whole purpose of this method is to keep the unifiedToolbar in sync. -
11376 // That means making sure we either exchange the drawing methods or we let -
11377 // the toolbar know that it does not require to draw the baseline. -
11378 Q_Q(QWidget); -
11379 // This function makes sense only if this is a top level -
11380 if(!q->isWindow()) -
11381 return; -
11382 OSWindowRef window = qt_mac_window_for(q); -
11383 if(changeMethods) { -
11384 // Ok, we are in documentMode. -
11385 if(originalDrawMethod) -
11386 qt_mac_replaceDrawRect(window, this); -
11387 } else { -
11388 if(!originalDrawMethod) -
11389 qt_mac_replaceDrawRectOriginal(window, this); -
11390 } -
11391} -
11392 -
11393#endif // Q_WS_MAC -
11394 -
11395QT_END_NAMESPACE -
11396 -
11397#include "moc_qwidget.cpp" -
11398 -
11399 -
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial