kernel/qwidget.cpp

Source codeSwitch to Preprocessed file
LineSource CodeCoverage
1/**************************************************************************** -
2** -
3** Copyright (C) 2012 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:18300
18300
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:18300
18300
131} -
132 -
133static inline bool hasBackingStoreSupport() -
134{ -
135 return true;
executed: return true;
Execution Count:56397
56397
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:2248
2248
160 -
161QWidgetBackingStoreTracker::~QWidgetBackingStoreTracker() -
162{ -
163 delete m_ptr;
executed (the execution status of this line is deduced): delete m_ptr;
-
164}
executed: }
Execution Count:2157
2157
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:1485
1485
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:7170
7170
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:248
never evaluated: m_widgets.isEmpty()
0-248
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:248
248
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:99
yes
Evaluation Count:294
99-294
227 unregisterWidgetSubtree(childWidget);
executed: unregisterWidgetSubtree(childWidget);
Execution Count:99
99
228}
executed: }
Execution Count:248
248
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:33631
0-33631
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:33631
0-33631
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:33631
33631
309 -
310 -
311QWidgetPrivate::~QWidgetPrivate() -
312{ -
313 if (widgetItem)
evaluated: widgetItem
TRUEFALSE
yes
Evaluation Count:65
yes
Evaluation Count:29261
65-29261
314 widgetItem->wid = 0;
executed: widgetItem->wid = 0;
Execution Count:65
65
315 -
316 if (extra)
evaluated: extra
TRUEFALSE
yes
Evaluation Count:10038
yes
Evaluation Count:19288
10038-19288
317 deleteExtra();
executed: deleteExtra();
Execution Count:10038
10038
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:29326
29326
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:3
yes
Evaluation Count:1108
3-1108
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:3
yes
Evaluation Count:3
3
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:3
no
Evaluation Count:0
partially evaluated: !w->isWindow()
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
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:3
no
Evaluation Count:0
0-3
340 w->d_func()->setWSGeometry();
executed: w->d_func()->setWSGeometry();
Execution Count:3
3
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:3
3
345 }
executed: }
Execution Count:3
3
346 }
executed: }
Execution Count:3
3
347}
executed: }
Execution Count:1111
1111
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:1335
yes
Evaluation Count:19160
1335-19160
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:1335
1335
358}
executed: }
Execution Count:20495
20495
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:73078
73078
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:3990
yes
Evaluation Count:346
346-3990
455 d->createExtra();
executed: d->createExtra();
Execution Count:3990
3990
456 if (d->extra->autoFillBackground == enabled)
evaluated: d->extra->autoFillBackground == enabled
TRUEFALSE
yes
Evaluation Count:73
yes
Evaluation Count:4263
73-4263
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:4263
4263
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:13539
no
Evaluation Count:0
0-13539
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:13539
13539
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:20092
no
Evaluation Count:0
0-20092
1015 d->init(parent, f);
executed (the execution status of this line is deduced): d->init(parent, f);
-
1016 } QT_CATCH(...) {
executed: }
Execution Count:20092
20092
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:29680
29680
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:35072
yes
Evaluation Count:1385
evaluated: type == Qt::SubWindow
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:1372
partially evaluated: w
TRUEFALSE
yes
Evaluation Count:35085
no
Evaluation Count:0
evaluated: !w->parent()
TRUEFALSE
yes
Evaluation Count:5275
yes
Evaluation Count:29810
0-35085
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:5275
5275
1049 -
1050 if (flags & Qt::CustomizeWindowHint) {
partially evaluated: flags & Qt::CustomizeWindowHint
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:36457
0-36457
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:2807
yes
Evaluation Count:33650
evaluated: !(flags & Qt::FramelessWindowHint)
TRUEFALSE
yes
Evaluation Count:2599
yes
Evaluation Count:208
0-33650
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:2599
2599
1072 if (customize)
evaluated: customize
TRUEFALSE
yes
Evaluation Count:2807
yes
Evaluation Count:33650
2807-33650
1073 ; // don't modify window flags if the user explicitly set them.
executed: ;
Execution Count:2807
2807
1074 else if (type == Qt::Dialog || type == Qt::Sheet)
evaluated: type == Qt::Dialog
TRUEFALSE
yes
Evaluation Count:261
yes
Evaluation Count:33389
evaluated: type == Qt::Sheet
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:33388
1-33389
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:262
262
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:3
yes
Evaluation Count:33385
3-33385
1081 flags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint;
executed: flags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint;
Execution Count:3
3
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:33385
33385
1084 Qt::WindowMaximizeButtonHint | Qt::WindowCloseButtonHint | Qt::WindowFullscreenButtonHint;
executed: flags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinimizeButtonHint | Qt::WindowMaximizeButtonHint | Qt::WindowCloseButtonHint | Qt::WindowFullscreenButtonHint;
Execution Count:33385
33385
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:33631
0-33631
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:33631
no
Evaluation Count:0
0-33631
1096 allWidgets->insert(q);
executed: allWidgets->insert(q);
Execution Count:33631
33631
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:27895
yes
Evaluation Count:5736
partially evaluated: parentWidget->windowType() == Qt::Desktop
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:27895
0-27895
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:33631
no
Evaluation Count:0
0-33631
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:33631
33631
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:33631
0-33631
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)
partially evaluated: f & Qt::MSWindowsOwnDC
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:33631
0-33631
1144 q->setAttribute(Qt::WA_NativeWindow);
never executed: q->setAttribute(Qt::WA_NativeWindow);
0
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:27895
yes
Evaluation Count:5736
5736-27895
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:104
yes
Evaluation Count:33527
104-33527
1160 q->create();
executed: q->create();
Execution Count:104
104
1161 else if (parentWidget)
evaluated: parentWidget
TRUEFALSE
yes
Evaluation Count:27895
yes
Evaluation Count:5632
5632-27895
1162 q->setParent(parentWidget, data.window_flags);
executed: q->setParent(parentWidget, data.window_flags);
Execution Count:27895
27895
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:5632
5632
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:6067
yes
Evaluation Count:27564
6067-27564
1179 QWidgetPrivate::maxInstances = QWidgetPrivate::instanceCounter;
executed: QWidgetPrivate::maxInstances = QWidgetPrivate::instanceCounter;
Execution Count:6067
6067
1180 -
1181 if (QApplicationPrivate::testAttribute(Qt::AA_ImmediateWidgetCreation))
partially evaluated: QApplicationPrivate::testAttribute(Qt::AA_ImmediateWidgetCreation)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:33631
0-33631
1182 q->create();
never executed: q->create();
0
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:33631
33631
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:999
yes
Evaluation Count:997
997-999
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:678
yes
Evaluation Count:321
evaluated: !child->isHidden()
TRUEFALSE
yes
Evaluation Count:426
yes
Evaluation Count:252
partially evaluated: !child->isWindow()
TRUEFALSE
yes
Evaluation Count:426
no
Evaluation Count:0
partially evaluated: !child->testAttribute(Qt::WA_WState_Created)
TRUEFALSE
yes
Evaluation Count:426
no
Evaluation Count:0
0-678
1210 child->d_func()->createRecursively();
executed: child->d_func()->createRecursively();
Execution Count:426
426
1211 }
executed: }
Execution Count:999
999
1212}
executed: }
Execution Count:997
997
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())
partially evaluated: testAttribute(Qt::WA_WState_Created)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7553
never evaluated: window == 0
never evaluated: internalWinId()
0-7553
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:7553
0-7553
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:5840
yes
Evaluation Count:1713
evaluated: type == Qt::SubWindow
TRUEFALSE
yes
Evaluation Count:119
yes
Evaluation Count:1594
partially evaluated: !parentWidget()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5959
0-5959
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:6045
yes
Evaluation Count:1508
1508-6045
1252 if (type & Qt::Window) {
evaluated: type & Qt::Window
TRUEFALSE
yes
Evaluation Count:86
yes
Evaluation Count:5959
86-5959
1253 if (!parent->testAttribute(Qt::WA_WState_Created))
evaluated: !parent->testAttribute(Qt::WA_WState_Created)
TRUEFALSE
yes
Evaluation Count:37
yes
Evaluation Count:49
37-49
1254 parent->createWinId();
executed: parent->createWinId();
Execution Count:37
37
1255 } else if (testAttribute(Qt::WA_NativeWindow) && !parent->internalWinId()
executed: }
Execution Count:86
evaluated: testAttribute(Qt::WA_NativeWindow)
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:5955
partially evaluated: !parent->internalWinId()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-5955
1256 && !testAttribute(Qt::WA_DontCreateNativeAncestors)) {
never evaluated: !testAttribute(Qt::WA_DontCreateNativeAncestors)
0
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);
never 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));
never executed (the execution status of this line is deduced): qt_noop();
-
1263 Q_ASSERT(internalWinId());
never executed (the execution status of this line is deduced): qt_noop();
-
1264 return;
never executed: return;
0
1265 } -
1266 } -
1267 -
1268 -
1269 static int paintOnScreenEnv = -1; -
1270 if (paintOnScreenEnv == -1)
evaluated: paintOnScreenEnv == -1
TRUEFALSE
yes
Evaluation Count:93
yes
Evaluation Count:7460
93-7460
1271 paintOnScreenEnv = qgetenv("QT_ONSCREEN_PAINT").toInt() > 0 ? 1 : 0;
executed: paintOnScreenEnv = qgetenv("QT_ONSCREEN_PAINT").toInt() > 0 ? 1 : 0;
Execution Count:93
partially evaluated: qgetenv("QT_ONSCREEN_PAINT").toInt() > 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:93
0-93
1272 if (paintOnScreenEnv == 1)
partially evaluated: paintOnScreenEnv == 1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7553
0-7553
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:7553
0-7553
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:1590
yes
Evaluation Count:5959
evaluated: windowType() != Qt::Desktop
TRUEFALSE
yes
Evaluation Count:1485
yes
Evaluation Count:105
105-5959
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:1485
no
Evaluation Count:0
0-1485
1301 d->topData()->backingStoreTracker.create(this);
executed: d->topData()->backingStoreTracker.create(this);
Execution Count:1485
1485
1302 }
executed: }
Execution Count:1485
1485
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:5959
yes
Evaluation Count:1590
partially evaluated: parentWidget()
TRUEFALSE
yes
Evaluation Count:5959
no
Evaluation Count:0
evaluated: parentWidget()->testAttribute(Qt::WA_DropSiteRegistered)
TRUEFALSE
yes
Evaluation Count:419
yes
Evaluation Count:5540
0-5959
1307 setAttribute(Qt::WA_DropSiteRegistered, true);
executed: setAttribute(Qt::WA_DropSiteRegistered, true);
Execution Count:419
419
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:7549
0-7549
1316 d->setWindowIcon_sys();
never executed: d->setWindowIcon_sys();
0
1317 -
1318 if (isWindow() && !d->topData()->iconText.isEmpty())
evaluated: isWindow()
TRUEFALSE
yes
Evaluation Count:1590
yes
Evaluation Count:5959
partially evaluated: !d->topData()->iconText.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1590
0-5959
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:1590
yes
Evaluation Count:5959
evaluated: !d->topData()->caption.isEmpty()
TRUEFALSE
yes
Evaluation Count:60
yes
Evaluation Count:1530
60-5959
1321 d->setWindowTitle_helper(d->topData()->caption);
executed: d->setWindowTitle_helper(d->topData()->caption);
Execution Count:60
60
1322 if (windowType() != Qt::Desktop) {
evaluated: windowType() != Qt::Desktop
TRUEFALSE
yes
Evaluation Count:7444
yes
Evaluation Count:105
105-7444
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:1485
yes
Evaluation Count:5959
partially evaluated: !testAttribute(Qt::WA_SetWindowIcon)
TRUEFALSE
yes
Evaluation Count:1485
no
Evaluation Count:0
0-5959
1326 d->setWindowIcon_sys();
executed: d->setWindowIcon_sys();
Execution Count:1485
1485
1327 }
executed: }
Execution Count:7444
7444
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:7549
7549
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:3420
3420
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:3102
yes
Evaluation Count:29326
3102-29326
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:3102
3102
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:29153
yes
Evaluation Count:173
evaluated: testAttribute(Qt::WA_GrabbedShortcut)
TRUEFALSE
yes
Evaluation Count:1096
yes
Evaluation Count:28057
173-29153
1375 qApp->d_func()->shortcutMap.removeShortcut(0, this, QKeySequence());
executed: (static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->shortcutMap.removeShortcut(0, this, QKeySequence());
Execution Count:1096
1096
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:25605
yes
Evaluation Count:3721
3721-25605
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:25605
25605
1391 -
1392 -
1393 QT_TRY {
partially evaluated: true
TRUEFALSE
yes
Evaluation Count:29326
no
Evaluation Count:0
0-29326
1394 clearFocus();
executed (the execution status of this line is deduced): clearFocus();
-
1395 } QT_CATCH(...) {
executed: }
Execution Count:29326
29326
1396 // swallow this problem because we are in a destructor -
1397 }
never executed: }
0
1398 -
1399 d->setDirtyOpaqueRegion();
executed (the execution status of this line is deduced): d->setDirtyOpaqueRegion();
-
1400 -
1401 if (isWindow() && isVisible() && internalWinId()) {
evaluated: isWindow()
TRUEFALSE
yes
Evaluation Count:3721
yes
Evaluation Count:25605
evaluated: isVisible()
TRUEFALSE
yes
Evaluation Count:1137
yes
Evaluation Count:2584
partially evaluated: internalWinId()
TRUEFALSE
yes
Evaluation Count:1137
no
Evaluation Count:0
0-25605
1402 QT_TRY {
partially evaluated: true
TRUEFALSE
yes
Evaluation Count:1137
no
Evaluation Count:0
0-1137
1403 d->close_helper(QWidgetPrivate::CloseNoEvent);
executed (the execution status of this line is deduced): d->close_helper(QWidgetPrivate::CloseNoEvent);
-
1404 } QT_CATCH(...) {
executed: }
Execution Count:1137
1137
1405 // if we're out of memory, at least hide the window. -
1406 QT_TRY {
never evaluated: true
0
1407 hide();
never executed (the execution status of this line is deduced): hide();
-
1408 } QT_CATCH(...) {
never executed: }
0
1409 // and if that also doesn't work, then give up -
1410 }
never executed: }
0
1411 } -
1412 } -
1413 -
1414#if defined(Q_WS_WIN) || defined(Q_WS_X11)|| defined(Q_WS_MAC) -
1415 else if (!internalWinId() && isVisible()) { -
1416 qApp->d_func()->sendSyntheticEnterLeave(this); -
1417 } -
1418#endif -
1419 else if (isVisible()) {
evaluated: isVisible()
TRUEFALSE
yes
Evaluation Count:383
yes
Evaluation Count:27806
383-27806
1420 qApp->d_func()->sendSyntheticEnterLeave(this);
executed (the execution status of this line is deduced): (static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->sendSyntheticEnterLeave(this);
-
1421 }
executed: }
Execution Count:383
383
1422 -
1423 if (QWidgetBackingStore *bs = d->maybeBackingStore()) {
evaluated: QWidgetBackingStore *bs = d->maybeBackingStore()
TRUEFALSE
yes
Evaluation Count:12069
yes
Evaluation Count:17257
12069-17257
1424 bs->removeDirtyWidget(this);
executed (the execution status of this line is deduced): bs->removeDirtyWidget(this);
-
1425 if (testAttribute(Qt::WA_StaticContents))
partially evaluated: testAttribute(Qt::WA_StaticContents)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:12069
0-12069
1426 bs->removeStaticWidget(this);
never executed: bs->removeStaticWidget(this);
0
1427 }
executed: }
Execution Count:12069
12069
1428 -
1429 delete d->needsFlush;
executed (the execution status of this line is deduced): delete d->needsFlush;
-
1430 d->needsFlush = 0;
executed (the execution status of this line is deduced): d->needsFlush = 0;
-
1431 -
1432 // The next 20 lines are duplicated from QObject, but required here -
1433 // since QWidget deletes is children itself -
1434 bool blocked = d->blockSig;
executed (the execution status of this line is deduced): bool blocked = d->blockSig;
-
1435 d->blockSig = 0; // unblock signals so we always emit destroyed()
executed (the execution status of this line is deduced): d->blockSig = 0;
-
1436 -
1437 if (d->isSignalConnected(0)) {
evaluated: d->isSignalConnected(0)
TRUEFALSE
yes
Evaluation Count:1276
yes
Evaluation Count:28050
1276-28050
1438 QT_TRY {
partially evaluated: true
TRUEFALSE
yes
Evaluation Count:1276
no
Evaluation Count:0
0-1276
1439 emit destroyed(this);
executed (the execution status of this line is deduced): destroyed(this);
-
1440 } QT_CATCH(...) {
executed: }
Execution Count:1276
1276
1441 // all the signal/slots connections are still in place - if we don't -
1442 // quit now, we will crash pretty soon. -
1443 qWarning("Detected an unexpected exception in ~QWidget while emitting destroyed().");
never executed (the execution status of this line is deduced): QMessageLogger("kernel/qwidget.cpp", 1443, __PRETTY_FUNCTION__).warning("Detected an unexpected exception in ~QWidget while emitting destroyed().");
-
1444 QT_RETHROW;
never executed (the execution status of this line is deduced): qt_noop();
-
1445 }
never executed: }
0
1446 } -
1447 -
1448 if (d->declarativeData) {
partially evaluated: d->declarativeData
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:29326
0-29326
1449 QAbstractDeclarativeData::destroyed(d->declarativeData, this);
never executed (the execution status of this line is deduced): QAbstractDeclarativeData::destroyed(d->declarativeData, this);
-
1450 d->declarativeData = 0; // don't activate again in ~QObject
never executed (the execution status of this line is deduced): d->declarativeData = 0;
-
1451 }
never executed: }
0
1452 -
1453 d->blockSig = blocked;
executed (the execution status of this line is deduced): d->blockSig = blocked;
-
1454 -
1455#ifdef Q_WS_MAC -
1456 // QCocoaView holds a pointer back to this widget. Clear it now -
1457 // to make sure it's not followed later on. The lifetime of the -
1458 // QCocoaView might exceed the lifetime of this widget in cases -
1459 // where Cocoa itself holds references to it. -
1460 extern void qt_mac_clearCocoaViewQWidgetPointers(QWidget *); -
1461 qt_mac_clearCocoaViewQWidgetPointers(this); -
1462#endif -
1463 -
1464 if (!d->children.isEmpty())
evaluated: !d->children.isEmpty()
TRUEFALSE
yes
Evaluation Count:13392
yes
Evaluation Count:15934
13392-15934
1465 d->deleteChildren();
executed: d->deleteChildren();
Execution Count:13392
13392
1466 -
1467 QApplication::removePostedEvents(this);
executed (the execution status of this line is deduced): QApplication::removePostedEvents(this);
-
1468 -
1469 QT_TRY {
partially evaluated: true
TRUEFALSE
yes
Evaluation Count:29326
no
Evaluation Count:0
0-29326
1470 destroy(); // platform-dependent cleanup
executed (the execution status of this line is deduced): destroy();
-
1471 } QT_CATCH(...) {
executed: }
Execution Count:29326
29326
1472 // if this fails we can't do anything about it but at least we are not allowed to throw. -
1473 }
never executed: }
0
1474 --QWidgetPrivate::instanceCounter;
executed (the execution status of this line is deduced): --QWidgetPrivate::instanceCounter;
-
1475 -
1476 if (QWidgetPrivate::allWidgets) // might have been deleted by ~QApplication
evaluated: QWidgetPrivate::allWidgets
TRUEFALSE
yes
Evaluation Count:29153
yes
Evaluation Count:173
173-29153
1477 QWidgetPrivate::allWidgets->remove(this);
executed: QWidgetPrivate::allWidgets->remove(this);
Execution Count:29153
29153
1478 -
1479 QT_TRY {
partially evaluated: true
TRUEFALSE
yes
Evaluation Count:29326
no
Evaluation Count:0
0-29326
1480 QEvent e(QEvent::Destroy);
executed (the execution status of this line is deduced): QEvent e(QEvent::Destroy);
-
1481 QCoreApplication::sendEvent(this, &e);
executed (the execution status of this line is deduced): QCoreApplication::sendEvent(this, &e);
-
1482 } QT_CATCH(const std::exception&) {
executed: }
Execution Count:29326
29326
1483 // if this fails we can't do anything about it but at least we are not allowed to throw. -
1484 }
never executed: }
0
1485} -
1486 -
1487int QWidgetPrivate::instanceCounter = 0; // Current number of widget instances -
1488int QWidgetPrivate::maxInstances = 0; // Maximum number of widget instances -
1489 -
1490void QWidgetPrivate::setWinId(WId id) // set widget identifier -
1491{ -
1492 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
1493 // the user might create a widget with Qt::Desktop window -
1494 // attribute (or create another QDesktopWidget instance), which -
1495 // will have the same windowid (the root window id) as the -
1496 // qt_desktopWidget. We should not add the second desktop widget -
1497 // to the mapper. -
1498 bool userDesktopWidget = qt_desktopWidget != 0 && qt_desktopWidget != q && q->windowType() == Qt::Desktop;
evaluated: qt_desktopWidget != 0
TRUEFALSE
yes
Evaluation Count:57206
yes
Evaluation Count:11166
evaluated: qt_desktopWidget != q
TRUEFALSE
yes
Evaluation Count:57121
yes
Evaluation Count:85
evaluated: q->windowType() == Qt::Desktop
TRUEFALSE
yes
Evaluation Count:92
yes
Evaluation Count:57029
85-57206
1499 if (mapper && data.winid && !userDesktopWidget) {
evaluated: mapper
TRUEFALSE
yes
Evaluation Count:67839
yes
Evaluation Count:533
evaluated: data.winid
TRUEFALSE
yes
Evaluation Count:1445
yes
Evaluation Count:66394
evaluated: !userDesktopWidget
TRUEFALSE
yes
Evaluation Count:1442
yes
Evaluation Count:3
3-67839
1500 mapper->remove(data.winid);
executed (the execution status of this line is deduced): mapper->remove(data.winid);
-
1501 }
executed: }
Execution Count:1442
1442
1502 -
1503 const WId oldWinId = data.winid;
executed (the execution status of this line is deduced): const WId oldWinId = data.winid;
-
1504 -
1505 data.winid = id;
executed (the execution status of this line is deduced): data.winid = id;
-
1506#if defined(Q_WS_X11) -
1507 hd = id; // X11: hd == ident -
1508#endif -
1509 if (mapper && id && !userDesktopWidget) {
evaluated: mapper
TRUEFALSE
yes
Evaluation Count:67839
yes
Evaluation Count:533
evaluated: id
TRUEFALSE
yes
Evaluation Count:1594
yes
Evaluation Count:66245
evaluated: !userDesktopWidget
TRUEFALSE
yes
Evaluation Count:1592
yes
Evaluation Count:2
2-67839
1510 mapper->insert(data.winid, q);
executed (the execution status of this line is deduced): mapper->insert(data.winid, q);
-
1511 }
executed: }
Execution Count:1592
1592
1512 -
1513 if(oldWinId != id) {
evaluated: oldWinId != id
TRUEFALSE
yes
Evaluation Count:3140
yes
Evaluation Count:65232
3140-65232
1514 QEvent e(QEvent::WinIdChange);
executed (the execution status of this line is deduced): QEvent e(QEvent::WinIdChange);
-
1515 QCoreApplication::sendEvent(q, &e);
executed (the execution status of this line is deduced): QCoreApplication::sendEvent(q, &e);
-
1516 }
executed: }
Execution Count:3140
3140
1517}
executed: }
Execution Count:68372
68372
1518 -
1519void QWidgetPrivate::createTLExtra() -
1520{ -
1521 if (!extra)
evaluated: !extra
TRUEFALSE
yes
Evaluation Count:1976
yes
Evaluation Count:16998
1976-16998
1522 createExtra();
executed: createExtra();
Execution Count:1976
1976
1523 if (!extra->topextra) {
evaluated: !extra->topextra
TRUEFALSE
yes
Evaluation Count:2248
yes
Evaluation Count:16726
2248-16726
1524 QTLWExtra* x = extra->topextra = new QTLWExtra;
executed (the execution status of this line is deduced): QTLWExtra* x = extra->topextra = new QTLWExtra;
-
1525 x->icon = 0;
executed (the execution status of this line is deduced): x->icon = 0;
-
1526 x->backingStore = 0;
executed (the execution status of this line is deduced): x->backingStore = 0;
-
1527 x->sharedPainter = 0;
executed (the execution status of this line is deduced): x->sharedPainter = 0;
-
1528 x->incw = x->inch = 0;
executed (the execution status of this line is deduced): x->incw = x->inch = 0;
-
1529 x->basew = x->baseh = 0;
executed (the execution status of this line is deduced): x->basew = x->baseh = 0;
-
1530 x->frameStrut.setCoords(0, 0, 0, 0);
executed (the execution status of this line is deduced): x->frameStrut.setCoords(0, 0, 0, 0);
-
1531 x->normalGeometry = QRect(0,0,-1,-1);
executed (the execution status of this line is deduced): x->normalGeometry = QRect(0,0,-1,-1);
-
1532 x->savedFlags = 0;
executed (the execution status of this line is deduced): x->savedFlags = 0;
-
1533 x->opacity = 255;
executed (the execution status of this line is deduced): x->opacity = 255;
-
1534 x->posIncludesFrame = 0;
executed (the execution status of this line is deduced): x->posIncludesFrame = 0;
-
1535 x->sizeAdjusted = false;
executed (the execution status of this line is deduced): x->sizeAdjusted = false;
-
1536 x->inTopLevelResize = false;
executed (the execution status of this line is deduced): x->inTopLevelResize = false;
-
1537 x->inRepaint = false;
executed (the execution status of this line is deduced): x->inRepaint = false;
-
1538 x->embedded = 0;
executed (the execution status of this line is deduced): x->embedded = 0;
-
1539#ifdef Q_WS_MAC -
1540 x->wasMaximized = false; -
1541#endif // Q_WS_MAC -
1542 createTLSysExtra();
executed (the execution status of this line is deduced): createTLSysExtra();
-
1543#ifdef QWIDGET_EXTRA_DEBUG -
1544 static int count = 0; -
1545 qDebug() << "tlextra" << ++count; -
1546#endif -
1547 }
executed: }
Execution Count:2248
2248
1548}
executed: }
Execution Count:18974
18974
1549 -
1550/*! -
1551 \internal -
1552 Creates the widget extra data. -
1553*/ -
1554 -
1555void QWidgetPrivate::createExtra() -
1556{ -
1557 if (!extra) { // if not exists
evaluated: !extra
TRUEFALSE
yes
Evaluation Count:10895
yes
Evaluation Count:16780
10895-16780
1558 extra = new QWExtra;
executed (the execution status of this line is deduced): extra = new QWExtra;
-
1559 extra->glContext = 0;
executed (the execution status of this line is deduced): extra->glContext = 0;
-
1560 extra->topextra = 0;
executed (the execution status of this line is deduced): extra->topextra = 0;
-
1561#ifndef QT_NO_GRAPHICSVIEW -
1562 extra->proxyWidget = 0;
executed (the execution status of this line is deduced): extra->proxyWidget = 0;
-
1563#endif -
1564#ifndef QT_NO_CURSOR -
1565 extra->curs = 0;
executed (the execution status of this line is deduced): extra->curs = 0;
-
1566#endif -
1567 extra->minw = 0;
executed (the execution status of this line is deduced): extra->minw = 0;
-
1568 extra->minh = 0;
executed (the execution status of this line is deduced): extra->minh = 0;
-
1569 extra->maxw = QWIDGETSIZE_MAX;
executed (the execution status of this line is deduced): extra->maxw = ((1<<24)-1);
-
1570 extra->maxh = QWIDGETSIZE_MAX;
executed (the execution status of this line is deduced): extra->maxh = ((1<<24)-1);
-
1571 extra->customDpiX = 0;
executed (the execution status of this line is deduced): extra->customDpiX = 0;
-
1572 extra->customDpiY = 0;
executed (the execution status of this line is deduced): extra->customDpiY = 0;
-
1573 extra->explicitMinSize = 0;
executed (the execution status of this line is deduced): extra->explicitMinSize = 0;
-
1574 extra->explicitMaxSize = 0;
executed (the execution status of this line is deduced): extra->explicitMaxSize = 0;
-
1575 extra->autoFillBackground = 0;
executed (the execution status of this line is deduced): extra->autoFillBackground = 0;
-
1576 extra->nativeChildrenForced = 0;
executed (the execution status of this line is deduced): extra->nativeChildrenForced = 0;
-
1577 extra->inRenderWithPainter = 0;
executed (the execution status of this line is deduced): extra->inRenderWithPainter = 0;
-
1578 extra->hasMask = 0;
executed (the execution status of this line is deduced): extra->hasMask = 0;
-
1579 createSysExtra();
executed (the execution status of this line is deduced): createSysExtra();
-
1580#ifdef QWIDGET_EXTRA_DEBUG -
1581 static int count = 0; -
1582 qDebug() << "extra" << ++count; -
1583#endif -
1584 }
executed: }
Execution Count:10895
10895
1585}
executed: }
Execution Count:27675
27675
1586 -
1587 -
1588/*! -
1589 \internal -
1590 Deletes the widget extra data. -
1591*/ -
1592 -
1593void QWidgetPrivate::deleteExtra() -
1594{ -
1595 if (extra) { // if exists
partially evaluated: extra
TRUEFALSE
yes
Evaluation Count:10038
no
Evaluation Count:0
0-10038
1596#ifndef QT_NO_CURSOR -
1597 delete extra->curs;
executed (the execution status of this line is deduced): delete extra->curs;
-
1598#endif -
1599 deleteSysExtra();
executed (the execution status of this line is deduced): deleteSysExtra();
-
1600#ifndef QT_NO_STYLE_STYLESHEET -
1601 // dereference the stylesheet style -
1602 if (QStyleSheetStyle *proxy = qobject_cast<QStyleSheetStyle *>(extra->style))
evaluated: QStyleSheetStyle *proxy = qobject_cast<QStyleSheetStyle *>(extra->style)
TRUEFALSE
yes
Evaluation Count:35
yes
Evaluation Count:10003
35-10003
1603 proxy->deref();
executed: proxy->deref();
Execution Count:35
35
1604#endif -
1605 if (extra->topextra) {
evaluated: extra->topextra
TRUEFALSE
yes
Evaluation Count:2157
yes
Evaluation Count:7881
2157-7881
1606 deleteTLSysExtra();
executed (the execution status of this line is deduced): deleteTLSysExtra();
-
1607 // extra->topextra->backingStore destroyed in QWidgetPrivate::deleteTLSysExtra() -
1608 delete extra->topextra->icon;
executed (the execution status of this line is deduced): delete extra->topextra->icon;
-
1609 delete extra->topextra;
executed (the execution status of this line is deduced): delete extra->topextra;
-
1610 }
executed: }
Execution Count:2157
2157
1611 delete extra;
executed (the execution status of this line is deduced): delete extra;
-
1612 // extra->xic destroyed in QWidget::destroy() -
1613 extra = 0;
executed (the execution status of this line is deduced): extra = 0;
-
1614 }
executed: }
Execution Count:10038
10038
1615}
executed: }
Execution Count:10038
10038
1616 -
1617/* -
1618 Returns true if there are widgets above this which overlap with -
1619 \a rect, which is in parent's coordinate system (same as crect). -
1620*/ -
1621 -
1622bool QWidgetPrivate::isOverlapped(const QRect &rect) const -
1623{ -
1624 Q_Q(const QWidget);
executed (the execution status of this line is deduced): const QWidget * const q = q_func();
-
1625 -
1626 const QWidget *w = q;
executed (the execution status of this line is deduced): const QWidget *w = q;
-
1627 QRect r = rect;
executed (the execution status of this line is deduced): QRect r = rect;
-
1628 while (w) {
partially evaluated: w
TRUEFALSE
yes
Evaluation Count:3072
no
Evaluation Count:0
0-3072
1629 if (w->isWindow())
evaluated: w->isWindow()
TRUEFALSE
yes
Evaluation Count:1231
yes
Evaluation Count:1841
1231-1841
1630 return false;
executed: return false;
Execution Count:1231
1231
1631 QWidgetPrivate *pd = w->parentWidget()->d_func();
executed (the execution status of this line is deduced): QWidgetPrivate *pd = w->parentWidget()->d_func();
-
1632 bool above = false;
executed (the execution status of this line is deduced): bool above = false;
-
1633 for (int i = 0; i < pd->children.size(); ++i) {
evaluated: i < pd->children.size()
TRUEFALSE
yes
Evaluation Count:10148
yes
Evaluation Count:1833
1833-10148
1634 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));
-
1635 if (!sibling || !sibling->isVisible() || sibling->isWindow())
evaluated: !sibling
TRUEFALSE
yes
Evaluation Count:2760
yes
Evaluation Count:7388
evaluated: !sibling->isVisible()
TRUEFALSE
yes
Evaluation Count:1544
yes
Evaluation Count:5844
partially evaluated: sibling->isWindow()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5844
0-7388
1636 continue;
executed: continue;
Execution Count:4304
4304
1637 if (!above) {
evaluated: !above
TRUEFALSE
yes
Evaluation Count:2588
yes
Evaluation Count:3256
2588-3256
1638 above = (sibling == w);
executed (the execution status of this line is deduced): above = (sibling == w);
-
1639 continue;
executed: continue;
Execution Count:2588
2588
1640 } -
1641 -
1642 if (qRectIntersects(sibling->d_func()->effectiveRectFor(sibling->data->crect), r)) {
evaluated: qRectIntersects(sibling->d_func()->effectiveRectFor(sibling->data->crect), r)
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:3248
8-3248
1643 const QWExtra *siblingExtra = sibling->d_func()->extra;
executed (the execution status of this line is deduced): const QWExtra *siblingExtra = sibling->d_func()->extra;
-
1644 if (siblingExtra && siblingExtra->hasMask && !sibling->d_func()->graphicsEffect
partially evaluated: siblingExtra
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
evaluated: siblingExtra->hasMask
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:7
partially evaluated: !sibling->d_func()->graphicsEffect
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-8
1645 && !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
1646 continue;
never executed: continue;
0
1647 } -
1648 return true;
executed: return true;
Execution Count:8
8
1649 } -
1650 }
executed: }
Execution Count:3248
3248
1651 w = w->parentWidget();
executed (the execution status of this line is deduced): w = w->parentWidget();
-
1652 r.translate(pd->data.crect.topLeft());
executed (the execution status of this line is deduced): r.translate(pd->data.crect.topLeft());
-
1653 }
executed: }
Execution Count:1833
1833
1654 return false;
never executed: return false;
0
1655} -
1656 -
1657void QWidgetPrivate::syncBackingStore() -
1658{ -
1659 if (paintOnScreen()) {
partially evaluated: paintOnScreen()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4008
0-4008
1660 repaint_sys(dirty);
never executed (the execution status of this line is deduced): repaint_sys(dirty);
-
1661 dirty = QRegion();
never executed (the execution status of this line is deduced): dirty = QRegion();
-
1662 } else if (QWidgetBackingStore *bs = maybeBackingStore()) {
never executed: }
partially evaluated: QWidgetBackingStore *bs = maybeBackingStore()
TRUEFALSE
yes
Evaluation Count:4008
no
Evaluation Count:0
0-4008
1663 bs->sync();
executed (the execution status of this line is deduced): bs->sync();
-
1664 }
executed: }
Execution Count:4008
4008
1665} -
1666 -
1667void QWidgetPrivate::syncBackingStore(const QRegion &region) -
1668{ -
1669 if (paintOnScreen())
partially evaluated: paintOnScreen()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1659
0-1659
1670 repaint_sys(region);
never executed: repaint_sys(region);
0
1671 else if (QWidgetBackingStore *bs = maybeBackingStore()) {
partially evaluated: QWidgetBackingStore *bs = maybeBackingStore()
TRUEFALSE
yes
Evaluation Count:1659
no
Evaluation Count:0
0-1659
1672 bs->sync(q_func(), region);
executed (the execution status of this line is deduced): bs->sync(q_func(), region);
-
1673 }
executed: }
Execution Count:1659
1659
1674} -
1675 -
1676void QWidgetPrivate::setUpdatesEnabled_helper(bool enable) -
1677{ -
1678 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
1679 -
1680 if (enable && !q->isWindow() && q->parentWidget() && !q->parentWidget()->updatesEnabled())
evaluated: enable
TRUEFALSE
yes
Evaluation Count:42370
yes
Evaluation Count:13089
evaluated: !q->isWindow()
TRUEFALSE
yes
Evaluation Count:41393
yes
Evaluation Count:977
partially evaluated: q->parentWidget()
TRUEFALSE
yes
Evaluation Count:41393
no
Evaluation Count:0
partially evaluated: !q->parentWidget()->updatesEnabled()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:41393
0-42370
1681 return; // nothing we can do
never executed: return;
0
1682 -
1683 if (enable != q->testAttribute(Qt::WA_UpdatesDisabled))
evaluated: enable != q->testAttribute(Qt::WA_UpdatesDisabled)
TRUEFALSE
yes
Evaluation Count:29910
yes
Evaluation Count:25549
25549-29910
1684 return; // nothing to do
executed: return;
Execution Count:29910
29910
1685 -
1686 q->setAttribute(Qt::WA_UpdatesDisabled, !enable);
executed (the execution status of this line is deduced): q->setAttribute(Qt::WA_UpdatesDisabled, !enable);
-
1687 if (enable)
evaluated: enable
TRUEFALSE
yes
Evaluation Count:12540
yes
Evaluation Count:13009
12540-13009
1688 q->update();
executed: q->update();
Execution Count:12540
12540
1689 -
1690 Qt::WidgetAttribute attribute = enable ? Qt::WA_ForceUpdatesDisabled : Qt::WA_UpdatesDisabled;
evaluated: enable
TRUEFALSE
yes
Evaluation Count:12540
yes
Evaluation Count:13009
12540-13009
1691 for (int i = 0; i < children.size(); ++i) {
evaluated: i < children.size()
TRUEFALSE
yes
Evaluation Count:33367
yes
Evaluation Count:25549
25549-33367
1692 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));
-
1693 if (w && !w->isWindow() && !w->testAttribute(attribute))
evaluated: w
TRUEFALSE
yes
Evaluation Count:23550
yes
Evaluation Count:9817
evaluated: !w->isWindow()
TRUEFALSE
yes
Evaluation Count:23344
yes
Evaluation Count:206
evaluated: !w->testAttribute(attribute)
TRUEFALSE
yes
Evaluation Count:23292
yes
Evaluation Count:52
52-23550
1694 w->d_func()->setUpdatesEnabled_helper(enable);
executed: w->d_func()->setUpdatesEnabled_helper(enable);
Execution Count:23292
23292
1695 }
executed: }
Execution Count:33367
33367
1696}
executed: }
Execution Count:25549
25549
1697 -
1698/*! -
1699 \internal -
1700 -
1701 Propagate this widget's palette to all children, except style sheet -
1702 widgets, and windows that don't enable window propagation (palettes don't -
1703 normally propagate to windows). -
1704*/ -
1705void QWidgetPrivate::propagatePaletteChange() -
1706{ -
1707 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
1708 // Propagate a new inherited mask to all children. -
1709#ifndef QT_NO_GRAPHICSVIEW -
1710 if (!q->parentWidget() && extra && extra->proxyWidget) {
evaluated: !q->parentWidget()
TRUEFALSE
yes
Evaluation Count:674
yes
Evaluation Count:15942
evaluated: extra
TRUEFALSE
yes
Evaluation Count:125
yes
Evaluation Count:549
partially evaluated: extra->proxyWidget
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:125
0-15942
1711 QGraphicsProxyWidget *p = extra->proxyWidget;
never executed (the execution status of this line is deduced): QGraphicsProxyWidget *p = extra->proxyWidget;
-
1712 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();
-
1713 } else
never executed: }
0
1714#endif //QT_NO_GRAPHICSVIEW -
1715 if (q->isWindow() && !q->testAttribute(Qt::WA_WindowPropagation)) {
evaluated: q->isWindow()
TRUEFALSE
yes
Evaluation Count:684
yes
Evaluation Count:15932
partially evaluated: !q->testAttribute(Qt::WA_WindowPropagation)
TRUEFALSE
yes
Evaluation Count:684
no
Evaluation Count:0
0-15932
1716 inheritedPaletteResolveMask = 0;
executed (the execution status of this line is deduced): inheritedPaletteResolveMask = 0;
-
1717 }
executed: }
Execution Count:684
684
1718 int mask = data.pal.resolve() | inheritedPaletteResolveMask;
executed (the execution status of this line is deduced): int mask = data.pal.resolve() | inheritedPaletteResolveMask;
-
1719 -
1720 QEvent pc(QEvent::PaletteChange);
executed (the execution status of this line is deduced): QEvent pc(QEvent::PaletteChange);
-
1721 QApplication::sendEvent(q, &pc);
executed (the execution status of this line is deduced): QApplication::sendEvent(q, &pc);
-
1722 for (int i = 0; i < children.size(); ++i) {
evaluated: i < children.size()
TRUEFALSE
yes
Evaluation Count:2036
yes
Evaluation Count:16616
2036-16616
1723 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));
-
1724 if (w && !w->testAttribute(Qt::WA_StyleSheet)
evaluated: w
TRUEFALSE
yes
Evaluation Count:986
yes
Evaluation Count:1050
partially evaluated: !w->testAttribute(Qt::WA_StyleSheet)
TRUEFALSE
yes
Evaluation Count:986
no
Evaluation Count:0
0-1050
1725 && (!w->isWindow() || w->testAttribute(Qt::WA_WindowPropagation))) {
evaluated: !w->isWindow()
TRUEFALSE
yes
Evaluation Count:848
yes
Evaluation Count:138
partially evaluated: w->testAttribute(Qt::WA_WindowPropagation)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:138
0-848
1726 QWidgetPrivate *wd = w->d_func();
executed (the execution status of this line is deduced): QWidgetPrivate *wd = w->d_func();
-
1727 wd->inheritedPaletteResolveMask = mask;
executed (the execution status of this line is deduced): wd->inheritedPaletteResolveMask = mask;
-
1728 wd->resolvePalette();
executed (the execution status of this line is deduced): wd->resolvePalette();
-
1729 }
executed: }
Execution Count:848
848
1730 }
executed: }
Execution Count:2036
2036
1731}
executed: }
Execution Count:16616
16616
1732 -
1733/* -
1734 Returns the widget's clipping rectangle. -
1735*/ -
1736QRect QWidgetPrivate::clipRect() const -
1737{ -
1738 Q_Q(const QWidget);
executed (the execution status of this line is deduced): const QWidget * const q = q_func();
-
1739 const QWidget * w = q;
executed (the execution status of this line is deduced): const QWidget * w = q;
-
1740 if (!w->isVisible())
evaluated: !w->isVisible()
TRUEFALSE
yes
Evaluation Count:548
yes
Evaluation Count:19435
548-19435
1741 return QRect();
executed: return QRect();
Execution Count:548
548
1742 QRect r = effectiveRectFor(q->rect());
executed (the execution status of this line is deduced): QRect r = effectiveRectFor(q->rect());
-
1743 int ox = 0;
executed (the execution status of this line is deduced): int ox = 0;
-
1744 int oy = 0;
executed (the execution status of this line is deduced): int oy = 0;
-
1745 while (w
partially evaluated: w
TRUEFALSE
yes
Evaluation Count:41113
no
Evaluation Count:0
0-41113
1746 && w->isVisible()
evaluated: w->isVisible()
TRUEFALSE
yes
Evaluation Count:41107
yes
Evaluation Count:6
6-41107
1747 && !w->isWindow()
evaluated: !w->isWindow()
TRUEFALSE
yes
Evaluation Count:21678
yes
Evaluation Count:19429
19429-21678
1748 && w->parentWidget()) {
partially evaluated: w->parentWidget()
TRUEFALSE
yes
Evaluation Count:21678
no
Evaluation Count:0
0-21678
1749 ox -= w->x();
executed (the execution status of this line is deduced): ox -= w->x();
-
1750 oy -= w->y();
executed (the execution status of this line is deduced): oy -= w->y();
-
1751 w = w->parentWidget();
executed (the execution status of this line is deduced): w = w->parentWidget();
-
1752 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());
-
1753 }
executed: }
Execution Count:21678
21678
1754 return r;
executed: return r;
Execution Count:19435
19435
1755} -
1756 -
1757/* -
1758 Returns the widget's clipping region (without siblings). -
1759*/ -
1760QRegion QWidgetPrivate::clipRegion() const -
1761{ -
1762 Q_Q(const QWidget);
never executed (the execution status of this line is deduced): const QWidget * const q = q_func();
-
1763 if (!q->isVisible())
never evaluated: !q->isVisible()
0
1764 return QRegion();
never executed: return QRegion();
0
1765 QRegion r(q->rect());
never executed (the execution status of this line is deduced): QRegion r(q->rect());
-
1766 const QWidget * w = q;
never executed (the execution status of this line is deduced): const QWidget * w = q;
-
1767 const QWidget *ignoreUpTo;
never executed (the execution status of this line is deduced): const QWidget *ignoreUpTo;
-
1768 int ox = 0;
never executed (the execution status of this line is deduced): int ox = 0;
-
1769 int oy = 0;
never executed (the execution status of this line is deduced): int oy = 0;
-
1770 while (w
never evaluated: w
0
1771 && w->isVisible()
never evaluated: w->isVisible()
0
1772 && !w->isWindow()
never evaluated: !w->isWindow()
0
1773 && w->parentWidget()) {
never evaluated: w->parentWidget()
0
1774 ox -= w->x();
never executed (the execution status of this line is deduced): ox -= w->x();
-
1775 oy -= w->y();
never executed (the execution status of this line is deduced): oy -= w->y();
-
1776 ignoreUpTo = w;
never executed (the execution status of this line is deduced): ignoreUpTo = w;
-
1777 w = w->parentWidget();
never executed (the execution status of this line is deduced): w = w->parentWidget();
-
1778 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());
-
1779 -
1780 int i = 0;
never executed (the execution status of this line is deduced): int i = 0;
-
1781 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
1782 ;
never executed: ;
0
1783 for ( ; i < w->d_func()->children.size(); ++i) {
never evaluated: i < w->d_func()->children.size()
0
1784 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
1785 if(sibling->isVisible() && !sibling->isWindow()) {
never evaluated: sibling->isVisible()
never evaluated: !sibling->isWindow()
0
1786 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(),
-
1787 sibling->width(), sibling->height());
never executed (the execution status of this line is deduced): sibling->width(), sibling->height());
-
1788 if (qRectIntersects(siblingRect, q->rect()))
never evaluated: qRectIntersects(siblingRect, q->rect())
0
1789 r -= QRegion(siblingRect);
never executed: r -= QRegion(siblingRect);
0
1790 }
never executed: }
0
1791 }
never executed: }
0
1792 }
never executed: }
0
1793 }
never executed: }
0
1794 return r;
never executed: return r;
0
1795} -
1796 -
1797void QWidgetPrivate::setSystemClip(QPaintDevice *paintDevice, const QRegion &region) -
1798{ -
1799// Transform the system clip region from device-independent pixels to device pixels -
1800// Qt 5.0.0: This is a Mac-only code path for now, can be made cross-platform once -
1801// it has been tested. -
1802 QPaintEngine *paintEngine = paintDevice->paintEngine();
executed (the execution status of this line is deduced): QPaintEngine *paintEngine = paintDevice->paintEngine();
-
1803#ifdef Q_OS_MAC -
1804 const qreal devicePixelRatio = (paintDevice->physicalDpiX() == 0 || paintDevice->logicalDpiX() == 0) ? -
1805 1.0 : (paintDevice->physicalDpiX() / paintDevice->logicalDpiX()); -
1806 QTransform scaleTransform; -
1807 scaleTransform.scale(devicePixelRatio, devicePixelRatio); -
1808 paintEngine->d_func()->systemClip = scaleTransform.map(region); -
1809#else -
1810 paintEngine->d_func()->systemClip = region;
executed (the execution status of this line is deduced): paintEngine->d_func()->systemClip = region;
-
1811#endif -
1812}
executed: }
Execution Count:17440
17440
1813 -
1814#ifndef QT_NO_GRAPHICSEFFECT -
1815void QWidgetPrivate::invalidateGraphicsEffectsRecursively() -
1816{ -
1817 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
1818 QWidget *w = q;
executed (the execution status of this line is deduced): QWidget *w = q;
-
1819 do { -
1820 if (w->graphicsEffect()) {
partially evaluated: w->graphicsEffect()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:535252
0-535252
1821 QWidgetEffectSourcePrivate *sourced =
never executed (the execution status of this line is deduced): QWidgetEffectSourcePrivate *sourced =
-
1822 static_cast<QWidgetEffectSourcePrivate *>(w->graphicsEffect()->source()->d_func());
never executed (the execution status of this line is deduced): static_cast<QWidgetEffectSourcePrivate *>(w->graphicsEffect()->source()->d_func());
-
1823 if (!sourced->updateDueToGraphicsEffect)
never evaluated: !sourced->updateDueToGraphicsEffect
0
1824 w->graphicsEffect()->source()->d_func()->invalidateCache();
never executed: w->graphicsEffect()->source()->d_func()->invalidateCache();
0
1825 }
never executed: }
0
1826 w = w->parentWidget();
executed (the execution status of this line is deduced): w = w->parentWidget();
-
1827 } while (w);
executed: }
Execution Count:535252
evaluated: w
TRUEFALSE
yes
Evaluation Count:324677
yes
Evaluation Count:210575
210575-535252
1828}
executed: }
Execution Count:210575
210575
1829#endif //QT_NO_GRAPHICSEFFECT -
1830 -
1831void QWidgetPrivate::setDirtyOpaqueRegion() -
1832{ -
1833 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
1834 -
1835 dirtyOpaqueChildren = true;
executed (the execution status of this line is deduced): dirtyOpaqueChildren = true;
-
1836 -
1837#ifndef QT_NO_GRAPHICSEFFECT -
1838 invalidateGraphicsEffectsRecursively();
executed (the execution status of this line is deduced): invalidateGraphicsEffectsRecursively();
-
1839#endif //QT_NO_GRAPHICSEFFECT -
1840 -
1841 if (q->isWindow())
evaluated: q->isWindow()
TRUEFALSE
yes
Evaluation Count:20459
yes
Evaluation Count:123846
20459-123846
1842 return;
executed: return;
Execution Count:20459
20459
1843 -
1844 QWidget *parent = q->parentWidget();
executed (the execution status of this line is deduced): QWidget *parent = q->parentWidget();
-
1845 if (!parent)
partially evaluated: !parent
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:123846
0-123846
1846 return;
never executed: return;
0
1847 -
1848 // TODO: instead of setting dirtyflag, manipulate the dirtyregion directly? -
1849 QWidgetPrivate *pd = parent->d_func();
executed (the execution status of this line is deduced): QWidgetPrivate *pd = parent->d_func();
-
1850 if (!pd->dirtyOpaqueChildren)
evaluated: !pd->dirtyOpaqueChildren
TRUEFALSE
yes
Evaluation Count:1532
yes
Evaluation Count:122314
1532-122314
1851 pd->setDirtyOpaqueRegion();
executed: pd->setDirtyOpaqueRegion();
Execution Count:1532
1532
1852}
executed: }
Execution Count:123846
123846
1853 -
1854const QRegion &QWidgetPrivate::getOpaqueChildren() const -
1855{ -
1856 if (!dirtyOpaqueChildren)
evaluated: !dirtyOpaqueChildren
TRUEFALSE
yes
Evaluation Count:4790
yes
Evaluation Count:5380
4790-5380
1857 return opaqueChildren;
executed: return opaqueChildren;
Execution Count:4790
4790
1858 -
1859 QWidgetPrivate *that = const_cast<QWidgetPrivate*>(this);
executed (the execution status of this line is deduced): QWidgetPrivate *that = const_cast<QWidgetPrivate*>(this);
-
1860 that->opaqueChildren = QRegion();
executed (the execution status of this line is deduced): that->opaqueChildren = QRegion();
-
1861 -
1862 for (int i = 0; i < children.size(); ++i) {
evaluated: i < children.size()
TRUEFALSE
yes
Evaluation Count:13990
yes
Evaluation Count:5380
5380-13990
1863 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));
-
1864 if (!child || !child->isVisible() || child->isWindow())
evaluated: !child
TRUEFALSE
yes
Evaluation Count:4827
yes
Evaluation Count:9163
evaluated: !child->isVisible()
TRUEFALSE
yes
Evaluation Count:3170
yes
Evaluation Count:5993
evaluated: child->isWindow()
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:5981
12-9163
1865 continue;
executed: continue;
Execution Count:8009
8009
1866 -
1867 const QPoint offset = child->geometry().topLeft();
executed (the execution status of this line is deduced): const QPoint offset = child->geometry().topLeft();
-
1868 QWidgetPrivate *childd = child->d_func();
executed (the execution status of this line is deduced): QWidgetPrivate *childd = child->d_func();
-
1869 QRegion r = childd->isOpaque ? child->rect() : childd->getOpaqueChildren();
evaluated: childd->isOpaque
TRUEFALSE
yes
Evaluation Count:1954
yes
Evaluation Count:4027
1954-4027
1870 if (childd->extra && childd->extra->hasMask)
evaluated: childd->extra
TRUEFALSE
yes
Evaluation Count:3127
yes
Evaluation Count:2854
partially evaluated: childd->extra->hasMask
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3127
0-3127
1871 r &= childd->extra->mask;
never executed: r &= childd->extra->mask;
0
1872 if (r.isEmpty())
evaluated: r.isEmpty()
TRUEFALSE
yes
Evaluation Count:2741
yes
Evaluation Count:3240
2741-3240
1873 continue;
executed: continue;
Execution Count:2741
2741
1874 r.translate(offset);
executed (the execution status of this line is deduced): r.translate(offset);
-
1875 that->opaqueChildren += r;
executed (the execution status of this line is deduced): that->opaqueChildren += r;
-
1876 }
executed: }
Execution Count:3240
3240
1877 -
1878 that->opaqueChildren &= q_func()->rect();
executed (the execution status of this line is deduced): that->opaqueChildren &= q_func()->rect();
-
1879 that->dirtyOpaqueChildren = false;
executed (the execution status of this line is deduced): that->dirtyOpaqueChildren = false;
-
1880 -
1881 return that->opaqueChildren;
executed: return that->opaqueChildren;
Execution Count:5380
5380
1882} -
1883 -
1884void QWidgetPrivate::subtractOpaqueChildren(QRegion &source, const QRect &clipRect) const -
1885{ -
1886 if (children.isEmpty() || clipRect.isEmpty())
evaluated: children.isEmpty()
TRUEFALSE
yes
Evaluation Count:7812
yes
Evaluation Count:6072
evaluated: clipRect.isEmpty()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:6067
5-7812
1887 return;
executed: return;
Execution Count:7817
7817
1888 -
1889 const QRegion &r = getOpaqueChildren();
executed (the execution status of this line is deduced): const QRegion &r = getOpaqueChildren();
-
1890 if (!r.isEmpty())
evaluated: !r.isEmpty()
TRUEFALSE
yes
Evaluation Count:2995
yes
Evaluation Count:3072
2995-3072
1891 source -= (r & clipRect);
executed: source -= (r & clipRect);
Execution Count:2995
2995
1892}
executed: }
Execution Count:6067
6067
1893 -
1894//subtract any relatives that are higher up than me --- this is too expensive !!! -
1895void QWidgetPrivate::subtractOpaqueSiblings(QRegion &sourceRegion, bool *hasDirtySiblingsAbove, -
1896 bool alsoNonOpaque) const -
1897{ -
1898 Q_Q(const QWidget);
executed (the execution status of this line is deduced): const QWidget * const q = q_func();
-
1899 static int disableSubtractOpaqueSiblings = qgetenv("QT_NO_SUBTRACTOPAQUESIBLINGS").toInt(); -
1900 if (disableSubtractOpaqueSiblings || q->isWindow())
partially evaluated: disableSubtractOpaqueSiblings
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6758
evaluated: q->isWindow()
TRUEFALSE
yes
Evaluation Count:780
yes
Evaluation Count:5978
0-6758
1901 return;
executed: return;
Execution Count:780
780
1902 -
1903#ifdef Q_WS_MAC -
1904 if (q->d_func()->isInUnifiedToolbar) -
1905 return; -
1906#endif // Q_WS_MAC -
1907 -
1908 QRect clipBoundingRect;
executed (the execution status of this line is deduced): QRect clipBoundingRect;
-
1909 bool dirtyClipBoundingRect = true;
executed (the execution status of this line is deduced): bool dirtyClipBoundingRect = true;
-
1910 -
1911 QRegion parentClip;
executed (the execution status of this line is deduced): QRegion parentClip;
-
1912 bool dirtyParentClip = true;
executed (the execution status of this line is deduced): bool dirtyParentClip = true;
-
1913 -
1914 QPoint parentOffset = data.crect.topLeft();
executed (the execution status of this line is deduced): QPoint parentOffset = data.crect.topLeft();
-
1915 -
1916 const QWidget *w = q;
executed (the execution status of this line is deduced): const QWidget *w = q;
-
1917 -
1918 while (w) {
partially evaluated: w
TRUEFALSE
yes
Evaluation Count:15615
no
Evaluation Count:0
0-15615
1919 if (w->isWindow())
evaluated: w->isWindow()
TRUEFALSE
yes
Evaluation Count:5695
yes
Evaluation Count:9920
5695-9920
1920 break;
executed: break;
Execution Count:5695
5695
1921 QWidgetPrivate *pd = w->parentWidget()->d_func();
executed (the execution status of this line is deduced): QWidgetPrivate *pd = w->parentWidget()->d_func();
-
1922 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));
-
1923 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);
-
1924 for (int i = myIndex + 1; i < pd->children.size(); ++i) {
evaluated: i < pd->children.size()
TRUEFALSE
yes
Evaluation Count:16831
yes
Evaluation Count:9637
9637-16831
1925 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));
-
1926 if (!sibling || !sibling->isVisible() || sibling->isWindow())
evaluated: !sibling
TRUEFALSE
yes
Evaluation Count:7626
yes
Evaluation Count:9205
evaluated: !sibling->isVisible()
TRUEFALSE
yes
Evaluation Count:3251
yes
Evaluation Count:5954
evaluated: sibling->isWindow()
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:5941
13-9205
1927 continue;
executed: continue;
Execution Count:10890
10890
1928 -
1929 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);
-
1930 if (!qRectIntersects(siblingGeometry, widgetGeometry))
evaluated: !qRectIntersects(siblingGeometry, widgetGeometry)
TRUEFALSE
yes
Evaluation Count:5384
yes
Evaluation Count:557
557-5384
1931 continue;
executed: continue;
Execution Count:5384
5384
1932 -
1933 if (dirtyClipBoundingRect) {
evaluated: dirtyClipBoundingRect
TRUEFALSE
yes
Evaluation Count:531
yes
Evaluation Count:26
26-531
1934 clipBoundingRect = sourceRegion.boundingRect();
executed (the execution status of this line is deduced): clipBoundingRect = sourceRegion.boundingRect();
-
1935 dirtyClipBoundingRect = false;
executed (the execution status of this line is deduced): dirtyClipBoundingRect = false;
-
1936 }
executed: }
Execution Count:531
531
1937 -
1938 if (!qRectIntersects(siblingGeometry, clipBoundingRect.translated(parentOffset)))
evaluated: !qRectIntersects(siblingGeometry, clipBoundingRect.translated(parentOffset))
TRUEFALSE
yes
Evaluation Count:62
yes
Evaluation Count:495
62-495
1939 continue;
executed: continue;
Execution Count:62
62
1940 -
1941 if (dirtyParentClip) {
evaluated: dirtyParentClip
TRUEFALSE
yes
Evaluation Count:494
yes
Evaluation Count:1
1-494
1942 parentClip = sourceRegion.translated(parentOffset);
executed (the execution status of this line is deduced): parentClip = sourceRegion.translated(parentOffset);
-
1943 dirtyParentClip = false;
executed (the execution status of this line is deduced): dirtyParentClip = false;
-
1944 }
executed: }
Execution Count:494
494
1945 -
1946 const QPoint siblingPos(sibling->data->crect.topLeft());
executed (the execution status of this line is deduced): const QPoint siblingPos(sibling->data->crect.topLeft());
-
1947 const QRect siblingClipRect(sibling->d_func()->clipRect());
executed (the execution status of this line is deduced): const QRect siblingClipRect(sibling->d_func()->clipRect());
-
1948 QRegion siblingDirty(parentClip);
executed (the execution status of this line is deduced): QRegion siblingDirty(parentClip);
-
1949 siblingDirty &= (siblingClipRect.translated(siblingPos));
executed (the execution status of this line is deduced): siblingDirty &= (siblingClipRect.translated(siblingPos));
-
1950 const bool hasMask = sibling->d_func()->extra && sibling->d_func()->extra->hasMask
evaluated: sibling->d_func()->extra
TRUEFALSE
yes
Evaluation Count:479
yes
Evaluation Count:16
partially evaluated: sibling->d_func()->extra->hasMask
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:479
0-479
1951 && !sibling->d_func()->graphicsEffect;
never evaluated: !sibling->d_func()->graphicsEffect
0
1952 if (hasMask)
partially evaluated: hasMask
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:495
0-495
1953 siblingDirty &= sibling->d_func()->extra->mask.translated(siblingPos);
never executed: siblingDirty &= sibling->d_func()->extra->mask.translated(siblingPos);
0
1954 if (siblingDirty.isEmpty())
partially evaluated: siblingDirty.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:495
0-495
1955 continue;
never executed: continue;
0
1956 -
1957 if (sibling->d_func()->isOpaque || alsoNonOpaque) {
evaluated: sibling->d_func()->isOpaque
TRUEFALSE
yes
Evaluation Count:412
yes
Evaluation Count:83
partially evaluated: alsoNonOpaque
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:83
0-412
1958 if (hasMask) {
partially evaluated: hasMask
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:412
0-412
1959 siblingDirty.translate(-parentOffset);
never executed (the execution status of this line is deduced): siblingDirty.translate(-parentOffset);
-
1960 sourceRegion -= siblingDirty;
never executed (the execution status of this line is deduced): sourceRegion -= siblingDirty;
-
1961 } else {
never executed: }
0
1962 sourceRegion -= siblingGeometry.translated(-parentOffset);
executed (the execution status of this line is deduced): sourceRegion -= siblingGeometry.translated(-parentOffset);
-
1963 }
executed: }
Execution Count:412
412
1964 } else { -
1965 if (hasDirtySiblingsAbove)
evaluated: hasDirtySiblingsAbove
TRUEFALSE
yes
Evaluation Count:16
yes
Evaluation Count:67
16-67
1966 *hasDirtySiblingsAbove = true;
executed: *hasDirtySiblingsAbove = true;
Execution Count:16
16
1967 if (sibling->d_func()->children.isEmpty())
evaluated: sibling->d_func()->children.isEmpty()
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:76
7-76
1968 continue;
executed: continue;
Execution Count:7
7
1969 QRegion opaqueSiblingChildren(sibling->d_func()->getOpaqueChildren());
executed (the execution status of this line is deduced): QRegion opaqueSiblingChildren(sibling->d_func()->getOpaqueChildren());
-
1970 opaqueSiblingChildren.translate(-parentOffset + siblingPos);
executed (the execution status of this line is deduced): opaqueSiblingChildren.translate(-parentOffset + siblingPos);
-
1971 sourceRegion -= opaqueSiblingChildren;
executed (the execution status of this line is deduced): sourceRegion -= opaqueSiblingChildren;
-
1972 }
executed: }
Execution Count:76
76
1973 if (sourceRegion.isEmpty())
evaluated: sourceRegion.isEmpty()
TRUEFALSE
yes
Evaluation Count:283
yes
Evaluation Count:205
205-283
1974 return;
executed: return;
Execution Count:283
283
1975 -
1976 dirtyClipBoundingRect = true;
executed (the execution status of this line is deduced): dirtyClipBoundingRect = true;
-
1977 dirtyParentClip = true;
executed (the execution status of this line is deduced): dirtyParentClip = true;
-
1978 }
executed: }
Execution Count:205
205
1979 -
1980 w = w->parentWidget();
executed (the execution status of this line is deduced): w = w->parentWidget();
-
1981 parentOffset += pd->data.crect.topLeft();
executed (the execution status of this line is deduced): parentOffset += pd->data.crect.topLeft();
-
1982 dirtyParentClip = true;
executed (the execution status of this line is deduced): dirtyParentClip = true;
-
1983 }
executed: }
Execution Count:9637
9637
1984}
executed: }
Execution Count:5695
5695
1985 -
1986void QWidgetPrivate::clipToEffectiveMask(QRegion &region) const -
1987{ -
1988 Q_Q(const QWidget);
executed (the execution status of this line is deduced): const QWidget * const q = q_func();
-
1989 -
1990 const QWidget *w = q;
executed (the execution status of this line is deduced): const QWidget *w = q;
-
1991 QPoint offset;
executed (the execution status of this line is deduced): QPoint offset;
-
1992 -
1993#ifndef QT_NO_GRAPHICSEFFECT -
1994 if (graphicsEffect) {
partially evaluated: graphicsEffect
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4474
0-4474
1995 w = q->parentWidget();
never executed (the execution status of this line is deduced): w = q->parentWidget();
-
1996 offset -= data.crect.topLeft();
never executed (the execution status of this line is deduced): offset -= data.crect.topLeft();
-
1997 }
never executed: }
0
1998#endif //QT_NO_GRAPHICSEFFECT -
1999 -
2000 while (w) {
partially evaluated: w
TRUEFALSE
yes
Evaluation Count:11491
no
Evaluation Count:0
0-11491
2001 const QWidgetPrivate *wd = w->d_func();
executed (the execution status of this line is deduced): const QWidgetPrivate *wd = w->d_func();
-
2002 if (wd->extra && wd->extra->hasMask)
evaluated: wd->extra
TRUEFALSE
yes
Evaluation Count:9030
yes
Evaluation Count:2461
partially evaluated: wd->extra->hasMask
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:9030
0-9030
2003 region &= (w != q) ? wd->extra->mask.translated(offset) : wd->extra->mask;
never executed: region &= (w != q) ? wd->extra->mask.translated(offset) : wd->extra->mask;
never evaluated: (w != q)
0
2004 if (w->isWindow())
evaluated: w->isWindow()
TRUEFALSE
yes
Evaluation Count:4474
yes
Evaluation Count:7017
4474-7017
2005 return;
executed: return;
Execution Count:4474
4474
2006 offset -= wd->data.crect.topLeft();
executed (the execution status of this line is deduced): offset -= wd->data.crect.topLeft();
-
2007 w = w->parentWidget();
executed (the execution status of this line is deduced): w = w->parentWidget();
-
2008 }
executed: }
Execution Count:7017
7017
2009}
never executed: }
0
2010 -
2011bool QWidgetPrivate::paintOnScreen() const -
2012{ -
2013#if defined(QT_NO_BACKINGSTORE) -
2014 return true; -
2015#else -
2016 Q_Q(const QWidget);
executed (the execution status of this line is deduced): const QWidget * const q = q_func();
-
2017 if (q->testAttribute(Qt::WA_PaintOnScreen)
partially evaluated: q->testAttribute(Qt::WA_PaintOnScreen)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:83569
0-83569
2018 || (!q->isWindow() && q->window()->testAttribute(Qt::WA_PaintOnScreen))) {
evaluated: !q->isWindow()
TRUEFALSE
yes
Evaluation Count:63154
yes
Evaluation Count:20415
partially evaluated: q->window()->testAttribute(Qt::WA_PaintOnScreen)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:63154
0-63154
2019 return true;
never executed: return true;
0
2020 } -
2021 -
2022 return !qt_enable_backingstore;
executed: return !qt_enable_backingstore;
Execution Count:83569
83569
2023#endif -
2024} -
2025 -
2026void QWidgetPrivate::updateIsOpaque() -
2027{ -
2028 // hw: todo: only needed if opacity actually changed -
2029 setDirtyOpaqueRegion();
executed (the execution status of this line is deduced): setDirtyOpaqueRegion();
-
2030 -
2031#ifndef QT_NO_GRAPHICSEFFECT -
2032 if (graphicsEffect) {
partially evaluated: graphicsEffect
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:68329
0-68329
2033 // ### We should probably add QGraphicsEffect::isOpaque at some point. -
2034 setOpaque(false);
never executed (the execution status of this line is deduced): setOpaque(false);
-
2035 return;
never executed: return;
0
2036 } -
2037#endif //QT_NO_GRAPHICSEFFECT -
2038 -
2039 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
2040#ifdef Q_WS_X11 -
2041 if (q->testAttribute(Qt::WA_X11OpenGLOverlay)) { -
2042 setOpaque(false); -
2043 return; -
2044 } -
2045#endif -
2046 -
2047 if (q->testAttribute(Qt::WA_OpaquePaintEvent) || q->testAttribute(Qt::WA_PaintOnScreen)) {
evaluated: q->testAttribute(Qt::WA_OpaquePaintEvent)
TRUEFALSE
yes
Evaluation Count:8199
yes
Evaluation Count:60130
evaluated: q->testAttribute(Qt::WA_PaintOnScreen)
TRUEFALSE
yes
Evaluation Count:213
yes
Evaluation Count:59917
213-60130
2048 setOpaque(true);
executed (the execution status of this line is deduced): setOpaque(true);
-
2049 return;
executed: return;
Execution Count:8412
8412
2050 } -
2051 -
2052 const QPalette &pal = q->palette();
executed (the execution status of this line is deduced): const QPalette &pal = q->palette();
-
2053 -
2054 if (q->autoFillBackground()) {
evaluated: q->autoFillBackground()
TRUEFALSE
yes
Evaluation Count:15078
yes
Evaluation Count:44839
15078-44839
2055 const QBrush &autoFillBrush = pal.brush(q->backgroundRole());
executed (the execution status of this line is deduced): const QBrush &autoFillBrush = pal.brush(q->backgroundRole());
-
2056 if (autoFillBrush.style() != Qt::NoBrush && autoFillBrush.isOpaque()) {
partially evaluated: autoFillBrush.style() != Qt::NoBrush
TRUEFALSE
yes
Evaluation Count:15078
no
Evaluation Count:0
evaluated: autoFillBrush.isOpaque()
TRUEFALSE
yes
Evaluation Count:15065
yes
Evaluation Count:13
0-15078
2057 setOpaque(true);
executed (the execution status of this line is deduced): setOpaque(true);
-
2058 return;
executed: return;
Execution Count:15065
15065
2059 } -
2060 }
executed: }
Execution Count:13
13
2061 -
2062 if (q->isWindow() && !q->testAttribute(Qt::WA_NoSystemBackground)) {
evaluated: q->isWindow()
TRUEFALSE
yes
Evaluation Count:3069
yes
Evaluation Count:41783
evaluated: !q->testAttribute(Qt::WA_NoSystemBackground)
TRUEFALSE
yes
Evaluation Count:3058
yes
Evaluation Count:11
11-41783
2063 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);
-
2064 if (windowBrush.style() != Qt::NoBrush && windowBrush.isOpaque()) {
partially evaluated: windowBrush.style() != Qt::NoBrush
TRUEFALSE
yes
Evaluation Count:3058
no
Evaluation Count:0
partially evaluated: windowBrush.isOpaque()
TRUEFALSE
yes
Evaluation Count:3058
no
Evaluation Count:0
0-3058
2065 setOpaque(true);
executed (the execution status of this line is deduced): setOpaque(true);
-
2066 return;
executed: return;
Execution Count:3058
3058
2067 } -
2068 }
never executed: }
0
2069 setOpaque(false);
executed (the execution status of this line is deduced): setOpaque(false);
-
2070}
executed: }
Execution Count:41794
41794
2071 -
2072void QWidgetPrivate::setOpaque(bool opaque) -
2073{ -
2074 if (isOpaque != opaque) {
evaluated: isOpaque != opaque
TRUEFALSE
yes
Evaluation Count:20386
yes
Evaluation Count:53575
20386-53575
2075 isOpaque = opaque;
executed (the execution status of this line is deduced): isOpaque = opaque;
-
2076 updateIsTranslucent();
executed (the execution status of this line is deduced): updateIsTranslucent();
-
2077 }
executed: }
Execution Count:20386
20386
2078}
executed: }
Execution Count:73961
73961
2079 -
2080void QWidgetPrivate::updateIsTranslucent() -
2081{ -
2082 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
2083 if (QWindow *window = q->windowHandle())
partially evaluated: QWindow *window = q->windowHandle()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:20389
0-20389
2084 window->setOpacity(isOpaque ? qreal(1.0) : qreal(0.0));
never executed: window->setOpacity(isOpaque ? qreal(1.0) : qreal(0.0));
0
2085}
executed: }
Execution Count:20389
20389
2086 -
2087static inline void fillRegion(QPainter *painter, const QRegion &rgn, const QBrush &brush) -
2088{ -
2089 Q_ASSERT(painter);
executed (the execution status of this line is deduced): qt_noop();
-
2090 -
2091 if (brush.style() == Qt::TexturePattern) {
partially evaluated: brush.style() == Qt::TexturePattern
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4440
0-4440
2092#ifdef Q_WS_MAC -
2093 // Optimize pattern filling on mac by using HITheme directly -
2094 // when filling with the standard widget background. -
2095 // Defined in qmacstyle_mac.cpp -
2096 extern void qt_mac_fill_background(QPainter *painter, const QRegion &rgn, const QBrush &brush); -
2097 qt_mac_fill_background(painter, rgn, brush); -
2098#else -
2099 { -
2100 const QRect rect(rgn.boundingRect());
never executed (the execution status of this line is deduced): const QRect rect(rgn.boundingRect());
-
2101 painter->setClipRegion(rgn);
never executed (the execution status of this line is deduced): painter->setClipRegion(rgn);
-
2102 painter->drawTiledPixmap(rect, brush.texture(), rect.topLeft());
never executed (the execution status of this line is deduced): painter->drawTiledPixmap(rect, brush.texture(), rect.topLeft());
-
2103 } -
2104#endif // Q_WS_MAC -
2105 -
2106 } else if (brush.gradient()
never executed: }
evaluated: brush.gradient()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:4436
0-4436
2107 && brush.gradient()->coordinateMode() == QGradient::ObjectBoundingMode) {
partially evaluated: brush.gradient()->coordinateMode() == QGradient::ObjectBoundingMode
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
2108 painter->save();
never executed (the execution status of this line is deduced): painter->save();
-
2109 painter->setClipRegion(rgn);
never executed (the execution status of this line is deduced): painter->setClipRegion(rgn);
-
2110 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);
-
2111 painter->restore();
never executed (the execution status of this line is deduced): painter->restore();
-
2112 } else {
never executed: }
0
2113 const QVector<QRect> &rects = rgn.rects();
executed (the execution status of this line is deduced): const QVector<QRect> &rects = rgn.rects();
-
2114 for (int i = 0; i < rects.size(); ++i)
evaluated: i < rects.size()
TRUEFALSE
yes
Evaluation Count:7664
yes
Evaluation Count:4440
4440-7664
2115 painter->fillRect(rects.at(i), brush);
executed: painter->fillRect(rects.at(i), brush);
Execution Count:7664
7664
2116 }
executed: }
Execution Count:4440
4440
2117} -
2118 -
2119void QWidgetPrivate::paintBackground(QPainter *painter, const QRegion &rgn, int flags) const -
2120{ -
2121 Q_Q(const QWidget);
executed (the execution status of this line is deduced): const QWidget * const q = q_func();
-
2122 -
2123#ifndef QT_NO_SCROLLAREA -
2124 bool resetBrushOrigin = false;
executed (the execution status of this line is deduced): bool resetBrushOrigin = false;
-
2125 QPointF oldBrushOrigin;
executed (the execution status of this line is deduced): QPointF oldBrushOrigin;
-
2126 //If we are painting the viewport of a scrollarea, we must apply an offset to the brush in case we are drawing a texture -
2127 QAbstractScrollArea *scrollArea = qobject_cast<QAbstractScrollArea *>(parent);
executed (the execution status of this line is deduced): QAbstractScrollArea *scrollArea = qobject_cast<QAbstractScrollArea *>(parent);
-
2128 if (scrollArea && scrollArea->viewport() == q) {
evaluated: scrollArea
TRUEFALSE
yes
Evaluation Count:1999
yes
Evaluation Count:2441
partially evaluated: scrollArea->viewport() == q
TRUEFALSE
yes
Evaluation Count:1999
no
Evaluation Count:0
0-2441
2129 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();
-
2130 QAbstractScrollAreaPrivate *priv = static_cast<QAbstractScrollAreaPrivate *>(scrollPrivate);
executed (the execution status of this line is deduced): QAbstractScrollAreaPrivate *priv = static_cast<QAbstractScrollAreaPrivate *>(scrollPrivate);
-
2131 oldBrushOrigin = painter->brushOrigin();
executed (the execution status of this line is deduced): oldBrushOrigin = painter->brushOrigin();
-
2132 resetBrushOrigin = true;
executed (the execution status of this line is deduced): resetBrushOrigin = true;
-
2133 painter->setBrushOrigin(-priv->contentsOffset());
executed (the execution status of this line is deduced): painter->setBrushOrigin(-priv->contentsOffset());
-
2134 -
2135 }
executed: }
Execution Count:1999
1999
2136#endif // QT_NO_SCROLLAREA -
2137 -
2138 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());
-
2139 -
2140 if ((flags & DrawAsRoot) && !(q->autoFillBackground() && autoFillBrush.isOpaque())) {
evaluated: (flags & DrawAsRoot)
TRUEFALSE
yes
Evaluation Count:2050
yes
Evaluation Count:2390
evaluated: q->autoFillBackground()
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:2043
partially evaluated: autoFillBrush.isOpaque()
TRUEFALSE
yes
Evaluation Count:7
no
Evaluation Count:0
0-2390
2141 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);
-
2142 if (!(flags & DontSetCompositionMode)) {
evaluated: !(flags & DontSetCompositionMode)
TRUEFALSE
yes
Evaluation Count:1999
yes
Evaluation Count:44
44-1999
2143 //copy alpha straight in -
2144 QPainter::CompositionMode oldMode = painter->compositionMode();
executed (the execution status of this line is deduced): QPainter::CompositionMode oldMode = painter->compositionMode();
-
2145 painter->setCompositionMode(QPainter::CompositionMode_Source);
executed (the execution status of this line is deduced): painter->setCompositionMode(QPainter::CompositionMode_Source);
-
2146 fillRegion(painter, rgn, bg);
executed (the execution status of this line is deduced): fillRegion(painter, rgn, bg);
-
2147 painter->setCompositionMode(oldMode);
executed (the execution status of this line is deduced): painter->setCompositionMode(oldMode);
-
2148 } else {
executed: }
Execution Count:1999
1999
2149 fillRegion(painter, rgn, bg);
executed (the execution status of this line is deduced): fillRegion(painter, rgn, bg);
-
2150 }
executed: }
Execution Count:44
44
2151 } -
2152 -
2153 if (q->autoFillBackground())
evaluated: q->autoFillBackground()
TRUEFALSE
yes
Evaluation Count:2397
yes
Evaluation Count:2043
2043-2397
2154 fillRegion(painter, rgn, autoFillBrush);
executed: fillRegion(painter, rgn, autoFillBrush);
Execution Count:2397
2397
2155 -
2156 if (q->testAttribute(Qt::WA_StyledBackground)) {
partially evaluated: q->testAttribute(Qt::WA_StyledBackground)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4440
0-4440
2157 painter->setClipRegion(rgn);
never executed (the execution status of this line is deduced): painter->setClipRegion(rgn);
-
2158 QStyleOption opt;
never executed (the execution status of this line is deduced): QStyleOption opt;
-
2159 opt.initFrom(q);
never executed (the execution status of this line is deduced): opt.initFrom(q);
-
2160 q->style()->drawPrimitive(QStyle::PE_Widget, &opt, painter, q);
never executed (the execution status of this line is deduced): q->style()->drawPrimitive(QStyle::PE_Widget, &opt, painter, q);
-
2161 }
never executed: }
0
2162 -
2163#ifndef QT_NO_SCROLLAREA -
2164 if (resetBrushOrigin)
evaluated: resetBrushOrigin
TRUEFALSE
yes
Evaluation Count:1999
yes
Evaluation Count:2441
1999-2441
2165 painter->setBrushOrigin(oldBrushOrigin);
executed: painter->setBrushOrigin(oldBrushOrigin);
Execution Count:1999
1999
2166#endif // QT_NO_SCROLLAREA -
2167}
executed: }
Execution Count:4440
4440
2168 -
2169/* -
2170 \internal -
2171 This function is called when a widget is hidden or destroyed. -
2172 It resets some application global pointers that should only refer active, -
2173 visible widgets. -
2174*/ -
2175 -
2176#ifdef Q_WS_MAC -
2177 extern QPointer<QWidget> qt_button_down; -
2178#else -
2179 extern QWidget *qt_button_down; -
2180#endif -
2181 -
2182void QWidgetPrivate::deactivateWidgetCleanup() -
2183{ -
2184 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
2185 // If this was the active application window, reset it -
2186 if (QApplication::activeWindow() == q)
evaluated: QApplication::activeWindow() == q
TRUEFALSE
yes
Evaluation Count:624
yes
Evaluation Count:34211
624-34211
2187 QApplication::setActiveWindow(0);
executed: QApplication::setActiveWindow(0);
Execution Count:624
624
2188 // If the is the active mouse press widget, reset it -
2189 if (q == qt_button_down)
partially evaluated: q == qt_button_down
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:34835
0-34835
2190 qt_button_down = 0;
never executed: qt_button_down = 0;
0
2191}
executed: }
Execution Count:34835
34835
2192 -
2193 -
2194/*! -
2195 Returns a pointer to the widget with window identifer/handle \a -
2196 id. -
2197 -
2198 The window identifier type depends on the underlying window -
2199 system, see \c qwindowdefs.h for the actual definition. If there -
2200 is no widget with this identifier, 0 is returned. -
2201*/ -
2202 -
2203QWidget *QWidget::find(WId id) -
2204{ -
2205 return QWidgetPrivate::mapper ? QWidgetPrivate::mapper->value(id, 0) : 0;
never executed: return QWidgetPrivate::mapper ? QWidgetPrivate::mapper->value(id, 0) : 0;
0
2206} -
2207 -
2208 -
2209 -
2210/*! -
2211 \fn WId QWidget::internalWinId() const -
2212 \internal -
2213 Returns the window system identifier of the widget, or 0 if the widget is not created yet. -
2214 -
2215*/ -
2216 -
2217/*! -
2218 \fn WId QWidget::winId() const -
2219 -
2220 Returns the window system identifier of the widget. -
2221 -
2222 Portable in principle, but if you use it you are probably about to -
2223 do something non-portable. Be careful. -
2224 -
2225 If a widget is non-native (alien) and winId() is invoked on it, that widget -
2226 will be provided a native handle. -
2227 -
2228 On Mac OS X, the type returned depends on which framework Qt was linked -
2229 against. If Qt is using Carbon, the {WId} is actually an HIViewRef. If Qt -
2230 is using Cocoa, {WId} is a pointer to an NSView. -
2231 -
2232 This value may change at run-time. An event with type QEvent::WinIdChange -
2233 will be sent to the widget following a change in window system identifier. -
2234 -
2235 \sa find() -
2236*/ -
2237WId QWidget::winId() const -
2238{ -
2239 if (!testAttribute(Qt::WA_WState_Created) || !internalWinId()) {
evaluated: !testAttribute(Qt::WA_WState_Created)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:11
partially evaluated: !internalWinId()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:11
0-11
2240#ifdef ALIEN_DEBUG -
2241 qDebug() << "QWidget::winId: creating native window for" << this; -
2242#endif -
2243 QWidget *that = const_cast<QWidget*>(this);
executed (the execution status of this line is deduced): QWidget *that = const_cast<QWidget*>(this);
-
2244 that->setAttribute(Qt::WA_NativeWindow);
executed (the execution status of this line is deduced): that->setAttribute(Qt::WA_NativeWindow);
-
2245 that->d_func()->createWinId();
executed (the execution status of this line is deduced): that->d_func()->createWinId();
-
2246 return that->data->winid;
executed: return that->data->winid;
Execution Count:1
1
2247 } -
2248 return data->winid;
executed: return data->winid;
Execution Count:11
11
2249} -
2250 -
2251 -
2252void QWidgetPrivate::createWinId(WId winid) -
2253{ -
2254 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
2255 -
2256#ifdef ALIEN_DEBUG -
2257 qDebug() << "QWidgetPrivate::createWinId for" << q << winid; -
2258#endif -
2259 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);
-
2260 if (!q->testAttribute(Qt::WA_WState_Created) || (forceNativeWindow && !q->internalWinId())) {
partially evaluated: !q->testAttribute(Qt::WA_WState_Created)
TRUEFALSE
yes
Evaluation Count:62
no
Evaluation Count:0
never evaluated: forceNativeWindow
never evaluated: !q->internalWinId()
0-62
2261 if (!q->isWindow()) {
evaluated: !q->isWindow()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:59
3-59
2262 QWidget *parent = q->parentWidget();
executed (the execution status of this line is deduced): QWidget *parent = q->parentWidget();
-
2263 QWidgetPrivate *pd = parent->d_func();
executed (the execution status of this line is deduced): QWidgetPrivate *pd = parent->d_func();
-
2264 if (forceNativeWindow && !q->testAttribute(Qt::WA_DontCreateNativeAncestors))
evaluated: forceNativeWindow
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1
partially evaluated: !q->testAttribute(Qt::WA_DontCreateNativeAncestors)
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
2265 parent->setAttribute(Qt::WA_NativeWindow);
executed: parent->setAttribute(Qt::WA_NativeWindow);
Execution Count:2
2
2266 if (!parent->internalWinId()) {
partially evaluated: !parent->internalWinId()
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
2267 pd->createWinId();
executed (the execution status of this line is deduced): pd->createWinId();
-
2268 }
executed: }
Execution Count:3
3
2269 -
2270 for (int i = 0; i < pd->children.size(); ++i) {
evaluated: i < pd->children.size()
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:3
3-6
2271 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));
-
2272 if (w && !w->isWindow() && (!w->testAttribute(Qt::WA_WState_Created)
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
partially evaluated: !w->testAttribute(Qt::WA_WState_Created)
TRUEFALSE
yes
Evaluation Count:6
no
Evaluation Count:0
0-6
2273 || (!w->internalWinId() && w->testAttribute(Qt::WA_NativeWindow)))) {
never evaluated: !w->internalWinId()
never evaluated: w->testAttribute(Qt::WA_NativeWindow)
0
2274 if (w!=q) {
evaluated: w!=q
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:3
3
2275 w->create();
executed (the execution status of this line is deduced): w->create();
-
2276 } else {
executed: }
Execution Count:3
3
2277 w->create(winid);
executed (the execution status of this line is deduced): w->create(winid);
-
2278 // if the window has already been created, we -
2279 // need to raise it to its proper stacking position -
2280 if (winid)
partially evaluated: winid
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
2281 w->raise();
never executed: w->raise();
0
2282 }
executed: }
Execution Count:3
3
2283 } -
2284 }
executed: }
Execution Count:6
6
2285 } else {
executed: }
Execution Count:3
3
2286 q->create();
executed (the execution status of this line is deduced): q->create();
-
2287 }
executed: }
Execution Count:59
59
2288 } -
2289}
executed: }
Execution Count:62
62
2290 -
2291 -
2292/*! -
2293\internal -
2294Ensures that the widget has a window system identifier, i.e. that it is known to the windowing system. -
2295 -
2296*/ -
2297 -
2298void QWidget::createWinId() -
2299{ -
2300 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
2301#ifdef ALIEN_DEBUG -
2302 qDebug() << "QWidget::createWinId" << this; -
2303#endif -
2304// qWarning("QWidget::createWinId is obsolete, please fix your code."); -
2305 d->createWinId();
executed (the execution status of this line is deduced): d->createWinId();
-
2306}
executed: }
Execution Count:58
58
2307 -
2308/*! -
2309 \since 4.4 -
2310 -
2311 Returns the effective window system identifier of the widget, i.e. the -
2312 native parent's window system identifier. -
2313 -
2314 If the widget is native, this function returns the native widget ID. -
2315 Otherwise, the window ID of the first native parent widget, i.e., the -
2316 top-level widget that contains this widget, is returned. -
2317 -
2318 \note We recommend that you do not store this value as it is likely to -
2319 change at run-time. -
2320 -
2321 \sa nativeParentWidget() -
2322*/ -
2323WId QWidget::effectiveWinId() const -
2324{ -
2325 const WId id = internalWinId();
executed (the execution status of this line is deduced): const WId id = internalWinId();
-
2326 if (id || !testAttribute(Qt::WA_WState_Created))
evaluated: id
TRUEFALSE
yes
Evaluation Count:54
yes
Evaluation Count:62
partially evaluated: !testAttribute(Qt::WA_WState_Created)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:62
0-62
2327 return id;
executed: return id;
Execution Count:54
54
2328 if (const QWidget *realParent = nativeParentWidget())
partially evaluated: const QWidget *realParent = nativeParentWidget()
TRUEFALSE
yes
Evaluation Count:62
no
Evaluation Count:0
0-62
2329 return realParent->internalWinId();
executed: return realParent->internalWinId();
Execution Count:62
62
2330 return 0;
never executed: return 0;
0
2331} -
2332 -
2333#ifndef QT_NO_STYLE_STYLESHEET -
2334 -
2335/*! -
2336 \property QWidget::styleSheet -
2337 \brief the widget's style sheet -
2338 \since 4.2 -
2339 -
2340 The style sheet contains a textual description of customizations to the -
2341 widget's style, as described in the \l{Qt Style Sheets} document. -
2342 -
2343 Since Qt 4.5, Qt style sheets fully supports Mac OS X. -
2344 -
2345 \warning Qt style sheets are currently not supported for custom QStyle -
2346 subclasses. We plan to address this in some future release. -
2347 -
2348 \sa setStyle(), QApplication::styleSheet, {Qt Style Sheets} -
2349*/ -
2350QString QWidget::styleSheet() const -
2351{ -
2352 Q_D(const QWidget);
executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
2353 if (!d->extra)
evaluated: !d->extra
TRUEFALSE
yes
Evaluation Count:30601
yes
Evaluation Count:336
336-30601
2354 return QString();
executed: return QString();
Execution Count:30601
30601
2355 return d->extra->styleSheet;
executed: return d->extra->styleSheet;
Execution Count:336
336
2356} -
2357 -
2358void QWidget::setStyleSheet(const QString& styleSheet) -
2359{ -
2360 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
2361 d->createExtra();
executed (the execution status of this line is deduced): d->createExtra();
-
2362 -
2363 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);
-
2364 d->extra->styleSheet = styleSheet;
executed (the execution status of this line is deduced): d->extra->styleSheet = styleSheet;
-
2365 if (styleSheet.isEmpty()) { // stylesheet removed
partially evaluated: styleSheet.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13
0-13
2366 if (!proxy)
never evaluated: !proxy
0
2367 return;
never executed: return;
0
2368 -
2369 d->inheritStyle();
never executed (the execution status of this line is deduced): d->inheritStyle();
-
2370 return;
never executed: return;
0
2371 } -
2372 -
2373 if (proxy) { // style sheet update
partially evaluated: proxy
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13
0-13
2374 proxy->repolish(this);
never executed (the execution status of this line is deduced): proxy->repolish(this);
-
2375 return;
never executed: return;
0
2376 } -
2377 -
2378 if (testAttribute(Qt::WA_SetStyle)) {
partially evaluated: testAttribute(Qt::WA_SetStyle)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13
0-13
2379 d->setStyle_helper(new QStyleSheetStyle(d->extra->style), true);
never executed (the execution status of this line is deduced): d->setStyle_helper(new QStyleSheetStyle(d->extra->style), true);
-
2380 } else {
never executed: }
0
2381 d->setStyle_helper(new QStyleSheetStyle(0), true);
executed (the execution status of this line is deduced): d->setStyle_helper(new QStyleSheetStyle(0), true);
-
2382 }
executed: }
Execution Count:13
13
2383} -
2384 -
2385#endif // QT_NO_STYLE_STYLESHEET -
2386 -
2387/*! -
2388 \sa QWidget::setStyle(), QApplication::setStyle(), QApplication::style() -
2389*/ -
2390 -
2391QStyle *QWidget::style() const -
2392{ -
2393 Q_D(const QWidget);
executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
2394 -
2395 if (d->extra && d->extra->style)
evaluated: d->extra
TRUEFALSE
yes
Evaluation Count:431801
yes
Evaluation Count:683210
evaluated: d->extra->style
TRUEFALSE
yes
Evaluation Count:822
yes
Evaluation Count:430979
822-683210
2396 return d->extra->style;
executed: return d->extra->style;
Execution Count:822
822
2397 return QApplication::style();
executed: return QApplication::style();
Execution Count:1114189
1114189
2398} -
2399 -
2400/*! -
2401 Sets the widget's GUI style to \a style. The ownership of the style -
2402 object is not transferred. -
2403 -
2404 If no style is set, the widget uses the application's style, -
2405 QApplication::style() instead. -
2406 -
2407 Setting a widget's style has no effect on existing or future child -
2408 widgets. -
2409 -
2410 \warning This function is particularly useful for demonstration -
2411 purposes, where you want to show Qt's styling capabilities. Real -
2412 applications should avoid it and use one consistent GUI style -
2413 instead. -
2414 -
2415 \warning Qt style sheets are currently not supported for custom QStyle -
2416 subclasses. We plan to address this in some future release. -
2417 -
2418 \sa style(), QStyle, QApplication::style(), QApplication::setStyle() -
2419*/ -
2420 -
2421void QWidget::setStyle(QStyle *style) -
2422{ -
2423 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
2424 setAttribute(Qt::WA_SetStyle, style != 0);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_SetStyle, style != 0);
-
2425 d->createExtra();
executed (the execution status of this line is deduced): d->createExtra();
-
2426#ifndef QT_NO_STYLE_STYLESHEET -
2427 if (QStyleSheetStyle *proxy = qobject_cast<QStyleSheetStyle *>(style)) {
partially evaluated: QStyleSheetStyle *proxy = qobject_cast<QStyleSheetStyle *>(style)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:55
0-55
2428 //if for some reason someone try to set a QStyleSheetStyle, ref it -
2429 //(this may happen for exemple in QButtonDialogBox which propagates its style) -
2430 proxy->ref();
never executed (the execution status of this line is deduced): proxy->ref();
-
2431 d->setStyle_helper(style, false);
never executed (the execution status of this line is deduced): d->setStyle_helper(style, false);
-
2432 } 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:55
partially evaluated: !(static_cast<QApplication *>(QCoreApplication::instance()))->styleSheet().isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:55
0-55
2433 // if we have an application stylesheet or have a proxy already, propagate -
2434 d->setStyle_helper(new QStyleSheetStyle(style), true);
never executed (the execution status of this line is deduced): d->setStyle_helper(new QStyleSheetStyle(style), true);
-
2435 } else
never executed: }
0
2436#endif -
2437 d->setStyle_helper(style, false);
executed: d->setStyle_helper(style, false);
Execution Count:55
55
2438} -
2439 -
2440void QWidgetPrivate::setStyle_helper(QStyle *newStyle, bool propagate, bool -
2441#ifdef Q_WS_MAC -
2442 metalHack -
2443#endif -
2444 ) -
2445{ -
2446 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
2447 QStyle *oldStyle = q->style();
executed (the execution status of this line is deduced): QStyle *oldStyle = q->style();
-
2448#ifndef QT_NO_STYLE_STYLESHEET -
2449 QPointer<QStyle> origStyle;
executed (the execution status of this line is deduced): QPointer<QStyle> origStyle;
-
2450#endif -
2451 -
2452#ifdef Q_WS_MAC -
2453 // the metalhack boolean allows Qt/Mac to do a proper re-polish depending -
2454 // on how the Qt::WA_MacBrushedMetal attribute is set. It is only ever -
2455 // set when changing that attribute and passes the widget's CURRENT style. -
2456 // therefore no need to do a reassignment. -
2457 if (!metalHack) -
2458#endif -
2459 { -
2460 createExtra();
executed (the execution status of this line is deduced): createExtra();
-
2461 -
2462#ifndef QT_NO_STYLE_STYLESHEET -
2463 origStyle = extra->style.data();
executed (the execution status of this line is deduced): origStyle = extra->style.data();
-
2464#endif -
2465 extra->style = newStyle;
executed (the execution status of this line is deduced): extra->style = newStyle;
-
2466 } -
2467 -
2468 // repolish -
2469 if (q->windowType() != Qt::Desktop) {
partially evaluated: q->windowType() != Qt::Desktop
TRUEFALSE
yes
Evaluation Count:93
no
Evaluation Count:0
0-93
2470 if (polished) {
evaluated: polished
TRUEFALSE
yes
Evaluation Count:28
yes
Evaluation Count:65
28-65
2471 oldStyle->unpolish(q);
executed (the execution status of this line is deduced): oldStyle->unpolish(q);
-
2472#ifdef Q_WS_MAC -
2473 if (metalHack) -
2474 macUpdateMetalAttribute(); -
2475#endif -
2476 q->style()->polish(q);
executed (the execution status of this line is deduced): q->style()->polish(q);
-
2477#ifdef Q_WS_MAC -
2478 } else if (metalHack) { -
2479 macUpdateMetalAttribute(); -
2480#endif -
2481 }
executed: }
Execution Count:28
28
2482 }
executed: }
Execution Count:93
93
2483 -
2484 if (propagate) {
evaluated: propagate
TRUEFALSE
yes
Evaluation Count:38
yes
Evaluation Count:55
38-55
2485 // We copy the list because the order may be modified -
2486 const QObjectList childrenList = children;
executed (the execution status of this line is deduced): const QObjectList childrenList = children;
-
2487 for (int i = 0; i < childrenList.size(); ++i) {
evaluated: i < childrenList.size()
TRUEFALSE
yes
Evaluation Count:24
yes
Evaluation Count:38
24-38
2488 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));
-
2489 if (c)
evaluated: c
TRUEFALSE
yes
Evaluation Count:21
yes
Evaluation Count:3
3-21
2490 c->d_func()->inheritStyle();
executed: c->d_func()->inheritStyle();
Execution Count:21
21
2491 }
executed: }
Execution Count:24
24
2492 }
executed: }
Execution Count:38
38
2493 -
2494#ifndef QT_NO_STYLE_STYLESHEET -
2495 if (!qobject_cast<QStyleSheetStyle*>(newStyle)) {
evaluated: !qobject_cast<QStyleSheetStyle*>(newStyle)
TRUEFALSE
yes
Evaluation Count:56
yes
Evaluation Count:37
37-56
2496 if (const QStyleSheetStyle* cssStyle = qobject_cast<QStyleSheetStyle*>(origStyle.data())) {
partially evaluated: const QStyleSheetStyle* cssStyle = qobject_cast<QStyleSheetStyle*>(origStyle.data())
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:56
0-56
2497 cssStyle->clearWidgetFont(q);
never executed (the execution status of this line is deduced): cssStyle->clearWidgetFont(q);
-
2498 }
never executed: }
0
2499 }
executed: }
Execution Count:56
56
2500#endif -
2501 -
2502 QEvent e(QEvent::StyleChange);
executed (the execution status of this line is deduced): QEvent e(QEvent::StyleChange);
-
2503 QApplication::sendEvent(q, &e);
executed (the execution status of this line is deduced): QApplication::sendEvent(q, &e);
-
2504 -
2505#ifndef QT_NO_STYLE_STYLESHEET -
2506 // dereference the old stylesheet style -
2507 if (QStyleSheetStyle *proxy = qobject_cast<QStyleSheetStyle *>(origStyle.data()))
partially evaluated: QStyleSheetStyle *proxy = qobject_cast<QStyleSheetStyle *>(origStyle.data())
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:93
0-93
2508 proxy->deref();
never executed: proxy->deref();
0
2509#endif -
2510}
executed: }
Execution Count:93
93
2511 -
2512// Inherits style from the current parent and propagates it as necessary -
2513void QWidgetPrivate::inheritStyle() -
2514{ -
2515#ifndef QT_NO_STYLE_STYLESHEET -
2516 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
2517 -
2518 QStyleSheetStyle *proxy = extra ? qobject_cast<QStyleSheetStyle *>(extra->style) : 0;
evaluated: extra
TRUEFALSE
yes
Evaluation Count:233
yes
Evaluation Count:30595
233-30595
2519 -
2520 if (!q->styleSheet().isEmpty()) {
partially evaluated: !q->styleSheet().isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:30828
0-30828
2521 Q_ASSERT(proxy);
never executed (the execution status of this line is deduced): qt_noop();
-
2522 proxy->repolish(q);
never executed (the execution status of this line is deduced): proxy->repolish(q);
-
2523 return;
never executed: return;
0
2524 } -
2525 -
2526 QStyle *origStyle = proxy ? proxy->base : (extra ? (QStyle*)extra->style : 0);
partially evaluated: proxy
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:30828
0-30828
2527 QWidget *parent = q->parentWidget();
executed (the execution status of this line is deduced): QWidget *parent = q->parentWidget();
-
2528 QStyle *parentStyle = (parent && parent->d_func()->extra) ? (QStyle*)parent->d_func()->extra->style : 0;
evaluated: parent
TRUEFALSE
yes
Evaluation Count:30401
yes
Evaluation Count:427
evaluated: parent->d_func()->extra
TRUEFALSE
yes
Evaluation Count:2502
yes
Evaluation Count:27899
427-30401
2529 // If we have stylesheet on app or parent has stylesheet style, we need -
2530 // to be running a proxy -
2531 if (!qApp->styleSheet().isEmpty() || qobject_cast<QStyleSheetStyle *>(parentStyle)) {
evaluated: !(static_cast<QApplication *>(QCoreApplication::instance()))->styleSheet().isEmpty()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:30827
evaluated: qobject_cast<QStyleSheetStyle *>(parentStyle)
TRUEFALSE
yes
Evaluation Count:24
yes
Evaluation Count:30803
1-30827
2532 QStyle *newStyle = parentStyle;
executed (the execution status of this line is deduced): QStyle *newStyle = parentStyle;
-
2533 if (q->testAttribute(Qt::WA_SetStyle))
partially evaluated: q->testAttribute(Qt::WA_SetStyle)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:25
0-25
2534 newStyle = new QStyleSheetStyle(origStyle);
never executed: newStyle = new QStyleSheetStyle(origStyle);
0
2535 else if (QStyleSheetStyle *newProxy = qobject_cast<QStyleSheetStyle *>(parentStyle))
evaluated: QStyleSheetStyle *newProxy = qobject_cast<QStyleSheetStyle *>(parentStyle)
TRUEFALSE
yes
Evaluation Count:24
yes
Evaluation Count:1
1-24
2536 newProxy->ref();
executed: newProxy->ref();
Execution Count:24
24
2537 -
2538 setStyle_helper(newStyle, true);
executed (the execution status of this line is deduced): setStyle_helper(newStyle, true);
-
2539 return;
executed: return;
Execution Count:25
25
2540 } -
2541 -
2542 // So, we have no stylesheet on parent/app and we have an empty stylesheet -
2543 // we just need our original style back -
2544 if (origStyle == (extra ? (QStyle*)extra->style : 0)) // is it any different?
partially evaluated: origStyle == (extra ? (QStyle*)extra->style : 0)
TRUEFALSE
yes
Evaluation Count:30803
no
Evaluation Count:0
evaluated: extra
TRUEFALSE
yes
Evaluation Count:233
yes
Evaluation Count:30570
0-30803
2545 return;
executed: return;
Execution Count:30803
30803
2546 -
2547 // We could have inherited the proxy from our parent (which has a custom style) -
2548 // In such a case we need to start following the application style (i.e revert -
2549 // the propagation behavior of QStyleSheetStyle) -
2550 if (!q->testAttribute(Qt::WA_SetStyle))
never evaluated: !q->testAttribute(Qt::WA_SetStyle)
0
2551 origStyle = 0;
never executed: origStyle = 0;
0
2552 -
2553 setStyle_helper(origStyle, true);
never executed (the execution status of this line is deduced): setStyle_helper(origStyle, true);
-
2554#endif // QT_NO_STYLE_STYLESHEET -
2555}
never executed: }
0
2556 -
2557 -
2558/*! -
2559 \fn bool QWidget::isWindow() const -
2560 -
2561 Returns true if the widget is an independent window, otherwise -
2562 returns false. -
2563 -
2564 A window is a widget that isn't visually the child of any other -
2565 widget and that usually has a frame and a -
2566 \l{QWidget::setWindowTitle()}{window title}. -
2567 -
2568 A window can have a \l{QWidget::parentWidget()}{parent widget}. -
2569 It will then be grouped with its parent and deleted when the -
2570 parent is deleted, minimized when the parent is minimized etc. If -
2571 supported by the window manager, it will also have a common -
2572 taskbar entry with its parent. -
2573 -
2574 QDialog and QMainWindow widgets are by default windows, even if a -
2575 parent widget is specified in the constructor. This behavior is -
2576 specified by the Qt::Window flag. -
2577 -
2578 \sa window(), isModal(), parentWidget() -
2579*/ -
2580 -
2581/*! -
2582 \property QWidget::modal -
2583 \brief whether the widget is a modal widget -
2584 -
2585 This property only makes sense for windows. A modal widget -
2586 prevents widgets in all other windows from getting any input. -
2587 -
2588 By default, this property is false. -
2589 -
2590 \sa isWindow(), windowModality, QDialog -
2591*/ -
2592 -
2593/*! -
2594 \property QWidget::windowModality -
2595 \brief which windows are blocked by the modal widget -
2596 \since 4.1 -
2597 -
2598 This property only makes sense for windows. A modal widget -
2599 prevents widgets in other windows from getting input. The value of -
2600 this property controls which windows are blocked when the widget -
2601 is visible. Changing this property while the window is visible has -
2602 no effect; you must hide() the widget first, then show() it again. -
2603 -
2604 By default, this property is Qt::NonModal. -
2605 -
2606 \sa isWindow(), QWidget::modal, QDialog -
2607*/ -
2608 -
2609Qt::WindowModality QWidget::windowModality() const -
2610{ -
2611 return static_cast<Qt::WindowModality>(data->window_modality);
executed: return static_cast<Qt::WindowModality>(data->window_modality);
Execution Count:1643
1643
2612} -
2613 -
2614void QWidget::setWindowModality(Qt::WindowModality windowModality) -
2615{ -
2616 data->window_modality = windowModality;
executed (the execution status of this line is deduced): data->window_modality = windowModality;
-
2617 // setModal_sys() will be called by setAttribute() -
2618 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));
-
2619 setAttribute(Qt::WA_SetWindowModality, true);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_SetWindowModality, true);
-
2620}
executed: }
Execution Count:1
1
2621 -
2622/*! -
2623 \fn bool QWidget::underMouse() const -
2624 -
2625 Returns true if the widget is under the mouse cursor; otherwise -
2626 returns false. -
2627 -
2628 This value is not updated properly during drag and drop -
2629 operations. -
2630 -
2631 \sa enterEvent(), leaveEvent() -
2632*/ -
2633 -
2634/*! -
2635 \property QWidget::minimized -
2636 \brief whether this widget is minimized (iconified) -
2637 -
2638 This property is only relevant for windows. -
2639 -
2640 By default, this property is false. -
2641 -
2642 \sa showMinimized(), visible, show(), hide(), showNormal(), maximized -
2643*/ -
2644bool QWidget::isMinimized() const -
2645{ return data->window_state & Qt::WindowMinimized; }
executed: return data->window_state & Qt::WindowMinimized;
Execution Count:46943
46943
2646 -
2647/*! -
2648 Shows the widget minimized, as an icon. -
2649 -
2650 Calling this function only affects \l{isWindow()}{windows}. -
2651 -
2652 \sa showNormal(), showMaximized(), show(), hide(), isVisible(), -
2653 isMinimized() -
2654*/ -
2655void QWidget::showMinimized() -
2656{ -
2657 bool isMin = isMinimized();
executed (the execution status of this line is deduced): bool isMin = isMinimized();
-
2658 if (isMin && isVisible())
evaluated: isMin
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:29
evaluated: isVisible()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
1-29
2659 return;
executed: return;
Execution Count:1
1
2660 -
2661 ensurePolished();
executed (the execution status of this line is deduced): ensurePolished();
-
2662 -
2663 if (!isMin)
evaluated: !isMin
TRUEFALSE
yes
Evaluation Count:29
yes
Evaluation Count:1
1-29
2664 setWindowState((windowState() & ~Qt::WindowActive) | Qt::WindowMinimized);
executed: setWindowState((windowState() & ~Qt::WindowActive) | Qt::WindowMinimized);
Execution Count:29
29
2665 setVisible(true);
executed (the execution status of this line is deduced): setVisible(true);
-
2666}
executed: }
Execution Count:30
30
2667 -
2668/*! -
2669 \property QWidget::maximized -
2670 \brief whether this widget is maximized -
2671 -
2672 This property is only relevant for windows. -
2673 -
2674 \note Due to limitations on some window systems, this does not always -
2675 report the expected results (e.g., if the user on X11 maximizes the -
2676 window via the window manager, Qt has no way of distinguishing this -
2677 from any other resize). This is expected to improve as window manager -
2678 protocols evolve. -
2679 -
2680 By default, this property is false. -
2681 -
2682 \sa windowState(), showMaximized(), visible, show(), hide(), showNormal(), minimized -
2683*/ -
2684bool QWidget::isMaximized() const -
2685{ return data->window_state & Qt::WindowMaximized; }
executed: return data->window_state & Qt::WindowMaximized;
Execution Count:32813
32813
2686 -
2687 -
2688 -
2689/*! -
2690 Returns the current window state. The window state is a OR'ed -
2691 combination of Qt::WindowState: Qt::WindowMinimized, -
2692 Qt::WindowMaximized, Qt::WindowFullScreen, and Qt::WindowActive. -
2693 -
2694 \sa Qt::WindowState, setWindowState() -
2695 */ -
2696Qt::WindowStates QWidget::windowState() const -
2697{ -
2698 return Qt::WindowStates(data->window_state);
executed: return Qt::WindowStates(data->window_state);
Execution Count:32670
32670
2699} -
2700 -
2701/*!\internal -
2702 -
2703 The function sets the window state on child widgets similar to -
2704 setWindowState(). The difference is that the window state changed -
2705 event has the isOverride() flag set. It exists mainly to keep -
2706 QWorkspace working. -
2707 */ -
2708void QWidget::overrideWindowState(Qt::WindowStates newstate) -
2709{ -
2710 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);
-
2711 data->window_state = newstate;
executed (the execution status of this line is deduced): data->window_state = newstate;
-
2712 QApplication::sendEvent(this, &e);
executed (the execution status of this line is deduced): QApplication::sendEvent(this, &e);
-
2713}
executed: }
Execution Count:2054
2054
2714 -
2715/*! -
2716 \fn void QWidget::setWindowState(Qt::WindowStates windowState) -
2717 -
2718 Sets the window state to \a windowState. The window state is a OR'ed -
2719 combination of Qt::WindowState: Qt::WindowMinimized, -
2720 Qt::WindowMaximized, Qt::WindowFullScreen, and Qt::WindowActive. -
2721 -
2722 If the window is not visible (i.e. isVisible() returns false), the -
2723 window state will take effect when show() is called. For visible -
2724 windows, the change is immediate. For example, to toggle between -
2725 full-screen and normal mode, use the following code: -
2726 -
2727 \snippet code/src_gui_kernel_qwidget.cpp 0 -
2728 -
2729 In order to restore and activate a minimized window (while -
2730 preserving its maximized and/or full-screen state), use the following: -
2731 -
2732 \snippet code/src_gui_kernel_qwidget.cpp 1 -
2733 -
2734 Calling this function will hide the widget. You must call show() to make -
2735 the widget visible again. -
2736 -
2737 \note On some window systems Qt::WindowActive is not immediate, and may be -
2738 ignored in certain cases. -
2739 -
2740 When the window state changes, the widget receives a changeEvent() -
2741 of type QEvent::WindowStateChange. -
2742 -
2743 \sa Qt::WindowState, windowState() -
2744*/ -
2745 -
2746/*! -
2747 \property QWidget::fullScreen -
2748 \brief whether the widget is shown in full screen mode -
2749 -
2750 A widget in full screen mode occupies the whole screen area and does not -
2751 display window decorations, such as a title bar. -
2752 -
2753 By default, this property is false. -
2754 -
2755 \sa windowState(), minimized, maximized -
2756*/ -
2757bool QWidget::isFullScreen() const -
2758{ return data->window_state & Qt::WindowFullScreen; }
executed: return data->window_state & Qt::WindowFullScreen;
Execution Count:8
8
2759 -
2760/*! -
2761 Shows the widget in full-screen mode. -
2762 -
2763 Calling this function only affects \l{isWindow()}{windows}. -
2764 -
2765 To return from full-screen mode, call showNormal(). -
2766 -
2767 Full-screen mode works fine under Windows, but has certain -
2768 problems under X. These problems are due to limitations of the -
2769 ICCCM protocol that specifies the communication between X11 -
2770 clients and the window manager. ICCCM simply does not understand -
2771 the concept of non-decorated full-screen windows. Therefore, the -
2772 best we can do is to request a borderless window and place and -
2773 resize it to fill the entire screen. Depending on the window -
2774 manager, this may or may not work. The borderless window is -
2775 requested using MOTIF hints, which are at least partially -
2776 supported by virtually all modern window managers. -
2777 -
2778 An alternative would be to bypass the window manager entirely and -
2779 create a window with the Qt::X11BypassWindowManagerHint flag. This -
2780 has other severe problems though, like totally broken keyboard focus -
2781 and very strange effects on desktop changes or when the user raises -
2782 other windows. -
2783 -
2784 X11 window managers that follow modern post-ICCCM specifications -
2785 support full-screen mode properly. -
2786 -
2787 \sa showNormal(), showMaximized(), show(), hide(), isVisible() -
2788*/ -
2789void QWidget::showFullScreen() -
2790{ -
2791#ifdef Q_WS_MAC -
2792 // If the unified toolbar is enabled, we have to disable it before going fullscreen. -
2793 QMainWindow *mainWindow = qobject_cast<QMainWindow*>(this); -
2794 if (mainWindow && mainWindow->unifiedTitleAndToolBarOnMac()) { -
2795 mainWindow->setUnifiedTitleAndToolBarOnMac(false); -
2796 QMainWindowLayout *mainLayout = qobject_cast<QMainWindowLayout*>(mainWindow->layout()); -
2797 mainLayout->activateUnifiedToolbarAfterFullScreen = true; -
2798 } -
2799#endif // Q_WS_MAC -
2800 ensurePolished();
executed (the execution status of this line is deduced): ensurePolished();
-
2801 -
2802 setWindowState((windowState() & ~(Qt::WindowMinimized | Qt::WindowMaximized))
executed (the execution status of this line is deduced): setWindowState((windowState() & ~(Qt::WindowMinimized | Qt::WindowMaximized))
-
2803 | Qt::WindowFullScreen);
executed (the execution status of this line is deduced): | Qt::WindowFullScreen);
-
2804 setVisible(true);
executed (the execution status of this line is deduced): setVisible(true);
-
2805 activateWindow();
executed (the execution status of this line is deduced): activateWindow();
-
2806}
executed: }
Execution Count:5
5
2807 -
2808/*! -
2809 Shows the widget maximized. -
2810 -
2811 Calling this function only affects \l{isWindow()}{windows}. -
2812 -
2813 On X11, this function may not work properly with certain window -
2814 managers. See the \l{Window Geometry} documentation for an explanation. -
2815 -
2816 \sa setWindowState(), showNormal(), showMinimized(), show(), hide(), isVisible() -
2817*/ -
2818void QWidget::showMaximized() -
2819{ -
2820 ensurePolished();
executed (the execution status of this line is deduced): ensurePolished();
-
2821 -
2822 setWindowState((windowState() & ~(Qt::WindowMinimized | Qt::WindowFullScreen))
executed (the execution status of this line is deduced): setWindowState((windowState() & ~(Qt::WindowMinimized | Qt::WindowFullScreen))
-
2823 | Qt::WindowMaximized);
executed (the execution status of this line is deduced): | Qt::WindowMaximized);
-
2824#ifdef Q_WS_MAC -
2825 // If the unified toolbar was enabled before going fullscreen, we have to enable it back. -
2826 QMainWindow *mainWindow = qobject_cast<QMainWindow*>(this); -
2827 if (mainWindow) -
2828 { -
2829 QMainWindowLayout *mainLayout = qobject_cast<QMainWindowLayout*>(mainWindow->layout()); -
2830 if (mainLayout->activateUnifiedToolbarAfterFullScreen) { -
2831 mainWindow->setUnifiedTitleAndToolBarOnMac(true); -
2832 mainLayout->activateUnifiedToolbarAfterFullScreen = false; -
2833 } -
2834 } -
2835#endif // Q_WS_MAC -
2836 setVisible(true);
executed (the execution status of this line is deduced): setVisible(true);
-
2837}
executed: }
Execution Count:67
67
2838 -
2839/*! -
2840 Restores the widget after it has been maximized or minimized. -
2841 -
2842 Calling this function only affects \l{isWindow()}{windows}. -
2843 -
2844 \sa setWindowState(), showMinimized(), showMaximized(), show(), hide(), isVisible() -
2845*/ -
2846void QWidget::showNormal() -
2847{ -
2848 ensurePolished();
executed (the execution status of this line is deduced): ensurePolished();
-
2849 -
2850 setWindowState(windowState() & ~(Qt::WindowMinimized
executed (the execution status of this line is deduced): setWindowState(windowState() & ~(Qt::WindowMinimized
-
2851 | Qt::WindowMaximized
executed (the execution status of this line is deduced): | Qt::WindowMaximized
-
2852 | Qt::WindowFullScreen));
executed (the execution status of this line is deduced): | Qt::WindowFullScreen));
-
2853#ifdef Q_WS_MAC -
2854 // If the unified toolbar was enabled before going fullscreen, we have to enable it back. -
2855 QMainWindow *mainWindow = qobject_cast<QMainWindow*>(this); -
2856 if (mainWindow) -
2857 { -
2858 QMainWindowLayout *mainLayout = qobject_cast<QMainWindowLayout*>(mainWindow->layout()); -
2859 if (mainLayout->activateUnifiedToolbarAfterFullScreen) { -
2860 mainWindow->setUnifiedTitleAndToolBarOnMac(true); -
2861 mainLayout->activateUnifiedToolbarAfterFullScreen = false; -
2862 } -
2863 } -
2864#endif // Q_WS_MAC -
2865 setVisible(true);
executed (the execution status of this line is deduced): setVisible(true);
-
2866}
executed: }
Execution Count:67
67
2867 -
2868/*! -
2869 Returns true if this widget would become enabled if \a ancestor is -
2870 enabled; otherwise returns false. -
2871 -
2872 -
2873 -
2874 This is the case if neither the widget itself nor every parent up -
2875 to but excluding \a ancestor has been explicitly disabled. -
2876 -
2877 isEnabledTo(0) is equivalent to isEnabled(). -
2878 -
2879 \sa setEnabled(), enabled -
2880*/ -
2881 -
2882bool QWidget::isEnabledTo(const QWidget *ancestor) const -
2883{ -
2884 const QWidget * w = this;
never executed (the execution status of this line is deduced): const QWidget * w = this;
-
2885 while (!w->testAttribute(Qt::WA_ForceDisabled)
never evaluated: !w->testAttribute(Qt::WA_ForceDisabled)
0
2886 && !w->isWindow()
never evaluated: !w->isWindow()
0
2887 && w->parentWidget()
never evaluated: w->parentWidget()
0
2888 && w->parentWidget() != ancestor)
never evaluated: w->parentWidget() != ancestor
0
2889 w = w->parentWidget();
never executed: w = w->parentWidget();
0
2890 return !w->testAttribute(Qt::WA_ForceDisabled);
never executed: return !w->testAttribute(Qt::WA_ForceDisabled);
0
2891} -
2892 -
2893#ifndef QT_NO_ACTION -
2894/*! -
2895 Appends the action \a action to this widget's list of actions. -
2896 -
2897 All QWidgets have a list of \l{QAction}s, however they can be -
2898 represented graphically in many different ways. The default use of -
2899 the QAction list (as returned by actions()) is to create a context -
2900 QMenu. -
2901 -
2902 A QWidget should only have one of each action and adding an action -
2903 it already has will not cause the same action to be in the widget twice. -
2904 -
2905 The ownership of \a action is not transferred to this QWidget. -
2906 -
2907 \sa removeAction(), insertAction(), actions(), QMenu -
2908*/ -
2909void QWidget::addAction(QAction *action) -
2910{ -
2911 insertAction(0, action);
executed (the execution status of this line is deduced): insertAction(0, action);
-
2912}
executed: }
Execution Count:2402
2402
2913 -
2914/*! -
2915 Appends the actions \a actions to this widget's list of actions. -
2916 -
2917 \sa removeAction(), QMenu, addAction() -
2918*/ -
2919void QWidget::addActions(QList<QAction*> actions) -
2920{ -
2921 for(int i = 0; i < actions.count(); i++)
evaluated: i < actions.count()
TRUEFALSE
yes
Evaluation Count:1172
yes
Evaluation Count:184
184-1172
2922 insertAction(0, actions.at(i));
executed: insertAction(0, actions.at(i));
Execution Count:1172
1172
2923}
executed: }
Execution Count:184
184
2924 -
2925/*! -
2926 Inserts the action \a action to this widget's list of actions, -
2927 before the action \a before. It appends the action if \a before is 0 or -
2928 \a before is not a valid action for this widget. -
2929 -
2930 A QWidget should only have one of each action. -
2931 -
2932 \sa removeAction(), addAction(), QMenu, contextMenuPolicy, actions() -
2933*/ -
2934void QWidget::insertAction(QAction *before, QAction *action) -
2935{ -
2936 if(!action) {
partially evaluated: !action
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3574
0-3574
2937 qWarning("QWidget::insertAction: Attempt to insert null action");
never executed (the execution status of this line is deduced): QMessageLogger("kernel/qwidget.cpp", 2937, __PRETTY_FUNCTION__).warning("QWidget::insertAction: Attempt to insert null action");
-
2938 return;
never executed: return;
0
2939 } -
2940 -
2941 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
2942 if(d->actions.contains(action))
partially evaluated: d->actions.contains(action)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3574
0-3574
2943 removeAction(action);
never executed: removeAction(action);
0
2944 -
2945 int pos = d->actions.indexOf(before);
executed (the execution status of this line is deduced): int pos = d->actions.indexOf(before);
-
2946 if (pos < 0) {
partially evaluated: pos < 0
TRUEFALSE
yes
Evaluation Count:3574
no
Evaluation Count:0
0-3574
2947 before = 0;
executed (the execution status of this line is deduced): before = 0;
-
2948 pos = d->actions.size();
executed (the execution status of this line is deduced): pos = d->actions.size();
-
2949 }
executed: }
Execution Count:3574
3574
2950 d->actions.insert(pos, action);
executed (the execution status of this line is deduced): d->actions.insert(pos, action);
-
2951 -
2952 QActionPrivate *apriv = action->d_func();
executed (the execution status of this line is deduced): QActionPrivate *apriv = action->d_func();
-
2953 apriv->widgets.append(this);
executed (the execution status of this line is deduced): apriv->widgets.append(this);
-
2954 -
2955 QActionEvent e(QEvent::ActionAdded, action, before);
executed (the execution status of this line is deduced): QActionEvent e(QEvent::ActionAdded, action, before);
-
2956 QApplication::sendEvent(this, &e);
executed (the execution status of this line is deduced): QApplication::sendEvent(this, &e);
-
2957}
executed: }
Execution Count:3574
3574
2958 -
2959/*! -
2960 Inserts the actions \a actions to this widget's list of actions, -
2961 before the action \a before. It appends the action if \a before is 0 or -
2962 \a before is not a valid action for this widget. -
2963 -
2964 A QWidget can have at most one of each action. -
2965 -
2966 \sa removeAction(), QMenu, insertAction(), contextMenuPolicy -
2967*/ -
2968void QWidget::insertActions(QAction *before, QList<QAction*> actions) -
2969{ -
2970 for(int i = 0; i < actions.count(); ++i)
never evaluated: i < actions.count()
0
2971 insertAction(before, actions.at(i));
never executed: insertAction(before, actions.at(i));
0
2972}
never executed: }
0
2973 -
2974/*! -
2975 Removes the action \a action from this widget's list of actions. -
2976 \sa insertAction(), actions(), insertAction() -
2977*/ -
2978void QWidget::removeAction(QAction *action) -
2979{ -
2980 if (!action)
partially evaluated: !action
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:369
0-369
2981 return;
never executed: return;
0
2982 -
2983 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
2984 -
2985 QActionPrivate *apriv = action->d_func();
executed (the execution status of this line is deduced): QActionPrivate *apriv = action->d_func();
-
2986 apriv->widgets.removeAll(this);
executed (the execution status of this line is deduced): apriv->widgets.removeAll(this);
-
2987 -
2988 if (d->actions.removeAll(action)) {
evaluated: d->actions.removeAll(action)
TRUEFALSE
yes
Evaluation Count:360
yes
Evaluation Count:9
9-360
2989 QActionEvent e(QEvent::ActionRemoved, action);
executed (the execution status of this line is deduced): QActionEvent e(QEvent::ActionRemoved, action);
-
2990 QApplication::sendEvent(this, &e);
executed (the execution status of this line is deduced): QApplication::sendEvent(this, &e);
-
2991 }
executed: }
Execution Count:360
360
2992}
executed: }
Execution Count:369
369
2993 -
2994/*! -
2995 Returns the (possibly empty) list of this widget's actions. -
2996 -
2997 \sa contextMenuPolicy, insertAction(), removeAction() -
2998*/ -
2999QList<QAction*> QWidget::actions() const -
3000{ -
3001 Q_D(const QWidget);
executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
3002 return d->actions;
executed: return d->actions;
Execution Count:637
637
3003} -
3004#endif // QT_NO_ACTION -
3005 -
3006/*! -
3007 \fn bool QWidget::isEnabledToTLW() const -
3008 \obsolete -
3009 -
3010 This function is deprecated. It is equivalent to isEnabled() -
3011*/ -
3012 -
3013/*! -
3014 \property QWidget::enabled -
3015 \brief whether the widget is enabled -
3016 -
3017 In general an enabled widget handles keyboard and mouse events; a disabled -
3018 widget does not. An exception is made with \l{QAbstractButton}. -
3019 -
3020 Some widgets display themselves differently when they are -
3021 disabled. For example a button might draw its label grayed out. If -
3022 your widget needs to know when it becomes enabled or disabled, you -
3023 can use the changeEvent() with type QEvent::EnabledChange. -
3024 -
3025 Disabling a widget implicitly disables all its children. Enabling -
3026 respectively enables all child widgets unless they have been -
3027 explicitly disabled. -
3028 -
3029 By default, this property is true. -
3030 -
3031 \sa isEnabledTo(), QKeyEvent, QMouseEvent, changeEvent() -
3032*/ -
3033void QWidget::setEnabled(bool enable) -
3034{ -
3035 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
3036 setAttribute(Qt::WA_ForceDisabled, !enable);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_ForceDisabled, !enable);
-
3037 d->setEnabled_helper(enable);
executed (the execution status of this line is deduced): d->setEnabled_helper(enable);
-
3038}
executed: }
Execution Count:6266
6266
3039 -
3040void QWidgetPrivate::setEnabled_helper(bool enable) -
3041{ -
3042 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
3043 -
3044 if (enable && !q->isWindow() && q->parentWidget() && !q->parentWidget()->isEnabled())
evaluated: enable
TRUEFALSE
yes
Evaluation Count:33345
yes
Evaluation Count:2920
evaluated: !q->isWindow()
TRUEFALSE
yes
Evaluation Count:33265
yes
Evaluation Count:80
partially evaluated: q->parentWidget()
TRUEFALSE
yes
Evaluation Count:33265
no
Evaluation Count:0
evaluated: !q->parentWidget()->isEnabled()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:33264
0-33345
3045 return; // nothing we can do
executed: return;
Execution Count:1
1
3046 -
3047 if (enable != q->testAttribute(Qt::WA_Disabled))
evaluated: enable != q->testAttribute(Qt::WA_Disabled)
TRUEFALSE
yes
Evaluation Count:33909
yes
Evaluation Count:2355
2355-33909
3048 return; // nothing to do
executed: return;
Execution Count:33909
33909
3049 -
3050 q->setAttribute(Qt::WA_Disabled, !enable);
executed (the execution status of this line is deduced): q->setAttribute(Qt::WA_Disabled, !enable);
-
3051 updateSystemBackground();
executed (the execution status of this line is deduced): updateSystemBackground();
-
3052 -
3053 if (!enable && q->window()->focusWidget() == q) {
evaluated: !enable
TRUEFALSE
yes
Evaluation Count:1468
yes
Evaluation Count:887
evaluated: q->window()->focusWidget() == q
TRUEFALSE
yes
Evaluation Count:89
yes
Evaluation Count:1379
89-1468
3054 bool parentIsEnabled = (!q->parentWidget() || q->parentWidget()->isEnabled());
partially evaluated: !q->parentWidget()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:89
evaluated: q->parentWidget()->isEnabled()
TRUEFALSE
yes
Evaluation Count:88
yes
Evaluation Count:1
0-89
3055 if (!parentIsEnabled || !q->focusNextChild())
evaluated: !parentIsEnabled
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:88
partially evaluated: !q->focusNextChild()
TRUEFALSE
yes
Evaluation Count:88
no
Evaluation Count:0
0-88
3056 q->clearFocus();
executed: q->clearFocus();
Execution Count:89
89
3057 }
executed: }
Execution Count:89
89
3058 -
3059 Qt::WidgetAttribute attribute = enable ? Qt::WA_ForceDisabled : Qt::WA_Disabled;
evaluated: enable
TRUEFALSE
yes
Evaluation Count:887
yes
Evaluation Count:1468
887-1468
3060 for (int i = 0; i < children.size(); ++i) {
evaluated: i < children.size()
TRUEFALSE
yes
Evaluation Count:358
yes
Evaluation Count:2355
358-2355
3061 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));
-
3062 if (w && !w->testAttribute(attribute))
evaluated: w
TRUEFALSE
yes
Evaluation Count:206
yes
Evaluation Count:152
evaluated: !w->testAttribute(attribute)
TRUEFALSE
yes
Evaluation Count:194
yes
Evaluation Count:12
12-206
3063 w->d_func()->setEnabled_helper(enable);
executed: w->d_func()->setEnabled_helper(enable);
Execution Count:194
194
3064 }
executed: }
Execution Count:358
358
3065#if defined(Q_WS_X11) -
3066 if (q->testAttribute(Qt::WA_SetCursor) || q->isWindow()) { -
3067 // enforce the windows behavior of clearing the cursor on -
3068 // disabled widgets -
3069 qt_x11_enforce_cursor(q); -
3070 } -
3071#endif -
3072#ifndef QT_NO_CURSOR -
3073 if (q->testAttribute(Qt::WA_SetCursor) || q->isWindow()) {
evaluated: q->testAttribute(Qt::WA_SetCursor)
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:2342
evaluated: q->isWindow()
TRUEFALSE
yes
Evaluation Count:57
yes
Evaluation Count:2285
13-2342
3074 // enforce the windows behavior of clearing the cursor on -
3075 // disabled widgets -
3076 qt_qpa_set_cursor(q, false);
executed (the execution status of this line is deduced): qt_qpa_set_cursor(q, false);
-
3077 }
executed: }
Execution Count:70
70
3078#endif -
3079#if defined(Q_WS_MAC) -
3080 setEnabled_helper_sys(enable); -
3081#endif -
3082#ifndef QT_NO_IM -
3083 if (q->testAttribute(Qt::WA_InputMethodEnabled) && q->hasFocus()) {
evaluated: q->testAttribute(Qt::WA_InputMethodEnabled)
TRUEFALSE
yes
Evaluation Count:32
yes
Evaluation Count:2323
partially evaluated: q->hasFocus()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:32
0-2323
3084 QWidget *focusWidget = effectiveFocusWidget();
never executed (the execution status of this line is deduced): QWidget *focusWidget = effectiveFocusWidget();
-
3085 -
3086 if (enable) {
never evaluated: enable
0
3087 if (focusWidget->testAttribute(Qt::WA_InputMethodEnabled))
never evaluated: focusWidget->testAttribute(Qt::WA_InputMethodEnabled)
0
3088 qApp->inputMethod()->update(Qt::ImEnabled);
never executed: (static_cast<QApplication *>(QCoreApplication::instance()))->inputMethod()->update(Qt::ImEnabled);
0
3089 } else {
never executed: }
0
3090 qApp->inputMethod()->commit();
never executed (the execution status of this line is deduced): (static_cast<QApplication *>(QCoreApplication::instance()))->inputMethod()->commit();
-
3091 qApp->inputMethod()->update(Qt::ImEnabled);
never executed (the execution status of this line is deduced): (static_cast<QApplication *>(QCoreApplication::instance()))->inputMethod()->update(Qt::ImEnabled);
-
3092 }
never executed: }
0
3093 } -
3094#endif //QT_NO_IM -
3095 QEvent e(QEvent::EnabledChange);
executed (the execution status of this line is deduced): QEvent e(QEvent::EnabledChange);
-
3096 QApplication::sendEvent(q, &e);
executed (the execution status of this line is deduced): QApplication::sendEvent(q, &e);
-
3097}
executed: }
Execution Count:2355
2355
3098 -
3099/*! -
3100 \property QWidget::acceptDrops -
3101 \brief whether drop events are enabled for this widget -
3102 -
3103 Setting this property to true announces to the system that this -
3104 widget \e may be able to accept drop events. -
3105 -
3106 If the widget is the desktop (windowType() == Qt::Desktop), this may -
3107 fail if another application is using the desktop; you can call -
3108 acceptDrops() to test if this occurs. -
3109 -
3110 \warning Do not modify this property in a drag and drop event handler. -
3111 -
3112 By default, this property is false. -
3113 -
3114 \sa {Drag and Drop} -
3115*/ -
3116bool QWidget::acceptDrops() const -
3117{ -
3118 return testAttribute(Qt::WA_AcceptDrops);
executed: return testAttribute(Qt::WA_AcceptDrops);
Execution Count:1002
1002
3119} -
3120 -
3121void QWidget::setAcceptDrops(bool on) -
3122{ -
3123 setAttribute(Qt::WA_AcceptDrops, on);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_AcceptDrops, on);
-
3124 -
3125}
executed: }
Execution Count:3488
3488
3126 -
3127 -
3128/*! -
3129 Disables widget input events if \a disable is true; otherwise -
3130 enables input events. -
3131 -
3132 See the \l enabled documentation for more information. -
3133 -
3134 \sa isEnabledTo(), QKeyEvent, QMouseEvent, changeEvent() -
3135*/ -
3136void QWidget::setDisabled(bool disable) -
3137{ -
3138 setEnabled(!disable);
executed (the execution status of this line is deduced): setEnabled(!disable);
-
3139}
executed: }
Execution Count:14
14
3140 -
3141/*! -
3142 \property QWidget::frameGeometry -
3143 \brief geometry of the widget relative to its parent including any -
3144 window frame -
3145 -
3146 See the \l{Window Geometry} documentation for an overview of geometry -
3147 issues with windows. -
3148 -
3149 By default, this property contains a value that depends on the user's -
3150 platform and screen geometry. -
3151 -
3152 \sa geometry(), x(), y(), pos() -
3153*/ -
3154QRect QWidget::frameGeometry() const -
3155{ -
3156 Q_D(const QWidget);
executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
3157 if (isWindow() && ! (windowType() == Qt::Popup)) {
evaluated: isWindow()
TRUEFALSE
yes
Evaluation Count:1145
yes
Evaluation Count:26
evaluated: ! (windowType() == Qt::Popup)
TRUEFALSE
yes
Evaluation Count:455
yes
Evaluation Count:690
26-1145
3158 QRect fs = d->frameStrut();
executed (the execution status of this line is deduced): QRect fs = d->frameStrut();
-
3159 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:455
455
3160 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:455
455
3161 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:455
455
3162 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:455
455
3163 } -
3164 return data->crect;
executed: return data->crect;
Execution Count:716
716
3165} -
3166 -
3167/*! -
3168 \property QWidget::x -
3169 -
3170 \brief the x coordinate of the widget relative to its parent including -
3171 any window frame -
3172 -
3173 See the \l{Window Geometry} documentation for an overview of geometry -
3174 issues with windows. -
3175 -
3176 By default, this property has a value of 0. -
3177 -
3178 \sa frameGeometry, y, pos -
3179*/ -
3180int QWidget::x() const -
3181{ -
3182 Q_D(const QWidget);
executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
3183 if (isWindow() && ! (windowType() == Qt::Popup))
evaluated: isWindow()
TRUEFALSE
yes
Evaluation Count:814
yes
Evaluation Count:21807
evaluated: ! (windowType() == Qt::Popup)
TRUEFALSE
yes
Evaluation Count:806
yes
Evaluation Count:8
8-21807
3184 return data->crect.x() - d->frameStrut().left();
executed: return data->crect.x() - d->frameStrut().left();
Execution Count:806
806
3185 return data->crect.x();
executed: return data->crect.x();
Execution Count:21815
21815
3186} -
3187 -
3188/*! -
3189 \property QWidget::y -
3190 \brief the y coordinate of the widget relative to its parent and -
3191 including any window frame -
3192 -
3193 See the \l{Window Geometry} documentation for an overview of geometry -
3194 issues with windows. -
3195 -
3196 By default, this property has a value of 0. -
3197 -
3198 \sa frameGeometry, x, pos -
3199*/ -
3200int QWidget::y() const -
3201{ -
3202 Q_D(const QWidget);
executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
3203 if (isWindow() && ! (windowType() == Qt::Popup))
evaluated: isWindow()
TRUEFALSE
yes
Evaluation Count:807
yes
Evaluation Count:21748
evaluated: ! (windowType() == Qt::Popup)
TRUEFALSE
yes
Evaluation Count:805
yes
Evaluation Count:2
2-21748
3204 return data->crect.y() - d->frameStrut().top();
executed: return data->crect.y() - d->frameStrut().top();
Execution Count:805
805
3205 return data->crect.y();
executed: return data->crect.y();
Execution Count:21750
21750
3206} -
3207 -
3208/*! -
3209 \property QWidget::pos -
3210 \brief the position of the widget within its parent widget -
3211 -
3212 If the widget is a window, the position is that of the widget on -
3213 the desktop, including its frame. -
3214 -
3215 When changing the position, the widget, if visible, receives a -
3216 move event (moveEvent()) immediately. If the widget is not -
3217 currently visible, it is guaranteed to receive an event before it -
3218 is shown. -
3219 -
3220 By default, this property contains a position that refers to the -
3221 origin. -
3222 -
3223 \warning Calling move() or setGeometry() inside moveEvent() can -
3224 lead to infinite recursion. -
3225 -
3226 See the \l{Window Geometry} documentation for an overview of geometry -
3227 issues with windows. -
3228 -
3229 \sa frameGeometry, size, x(), y() -
3230*/ -
3231QPoint QWidget::pos() const -
3232{ -
3233 Q_D(const QWidget);
executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
3234 QPoint result = data->crect.topLeft();
executed (the execution status of this line is deduced): QPoint result = data->crect.topLeft();
-
3235 if (isWindow() && ! (windowType() == Qt::Popup))
evaluated: isWindow()
TRUEFALSE
yes
Evaluation Count:3516
yes
Evaluation Count:9675
evaluated: ! (windowType() == Qt::Popup)
TRUEFALSE
yes
Evaluation Count:3424
yes
Evaluation Count:92
92-9675
3236 if (!d->maybeTopData() || !d->maybeTopData()->posIncludesFrame)
evaluated: !d->maybeTopData()
TRUEFALSE
yes
Evaluation Count:459
yes
Evaluation Count:2965
evaluated: !d->maybeTopData()->posIncludesFrame
TRUEFALSE
yes
Evaluation Count:2648
yes
Evaluation Count:317
317-2965
3237 result -= d->frameStrut().topLeft();
executed: result -= d->frameStrut().topLeft();
Execution Count:3107
3107
3238 return result;
executed: return result;
Execution Count:13191
13191
3239} -
3240 -
3241/*! -
3242 \property QWidget::geometry -
3243 \brief the geometry of the widget relative to its parent and -
3244 excluding the window frame -
3245 -
3246 When changing the geometry, the widget, if visible, receives a -
3247 move event (moveEvent()) and/or a resize event (resizeEvent()) -
3248 immediately. If the widget is not currently visible, it is -
3249 guaranteed to receive appropriate events before it is shown. -
3250 -
3251 The size component is adjusted if it lies outside the range -
3252 defined by minimumSize() and maximumSize(). -
3253 -
3254 \warning Calling setGeometry() inside resizeEvent() or moveEvent() -
3255 can lead to infinite recursion. -
3256 -
3257 See the \l{Window Geometry} documentation for an overview of geometry -
3258 issues with windows. -
3259 -
3260 By default, this property contains a value that depends on the user's -
3261 platform and screen geometry. -
3262 -
3263 \sa frameGeometry(), rect(), move(), resize(), moveEvent(), -
3264 resizeEvent(), minimumSize(), maximumSize() -
3265*/ -
3266 -
3267/*! -
3268 \property QWidget::normalGeometry -
3269 -
3270 \brief the geometry of the widget as it will appear when shown as -
3271 a normal (not maximized or full screen) top-level widget -
3272 -
3273 For child widgets this property always holds an empty rectangle. -
3274 -
3275 By default, this property contains an empty rectangle. -
3276 -
3277 \sa QWidget::windowState(), QWidget::geometry -
3278*/ -
3279 -
3280/*! -
3281 \property QWidget::size -
3282 \brief the size of the widget excluding any window frame -
3283 -
3284 If the widget is visible when it is being resized, it receives a resize event -
3285 (resizeEvent()) immediately. If the widget is not currently -
3286 visible, it is guaranteed to receive an event before it is shown. -
3287 -
3288 The size is adjusted if it lies outside the range defined by -
3289 minimumSize() and maximumSize(). -
3290 -
3291 By default, this property contains a value that depends on the user's -
3292 platform and screen geometry. -
3293 -
3294 \warning Calling resize() or setGeometry() inside resizeEvent() can -
3295 lead to infinite recursion. -
3296 -
3297 \note Setting the size to \c{QSize(0, 0)} will cause the widget to not -
3298 appear on screen. This also applies to windows. -
3299 -
3300 \sa pos, geometry, minimumSize, maximumSize, resizeEvent(), adjustSize() -
3301*/ -
3302 -
3303/*! -
3304 \property QWidget::width -
3305 \brief the width of the widget excluding any window frame -
3306 -
3307 See the \l{Window Geometry} documentation for an overview of geometry -
3308 issues with windows. -
3309 -
3310 \note Do not use this function to find the width of a screen on -
3311 a \l{QDesktopWidget}{multiple screen desktop}. Read -
3312 \l{QDesktopWidget#Screen Geometry}{this note} for details. -
3313 -
3314 By default, this property contains a value that depends on the user's -
3315 platform and screen geometry. -
3316 -
3317 \sa geometry, height, size -
3318*/ -
3319 -
3320/*! -
3321 \property QWidget::height -
3322 \brief the height of the widget excluding any window frame -
3323 -
3324 See the \l{Window Geometry} documentation for an overview of geometry -
3325 issues with windows. -
3326 -
3327 \note Do not use this function to find the height of a screen -
3328 on a \l{QDesktopWidget}{multiple screen desktop}. Read -
3329 \l{QDesktopWidget#Screen Geometry}{this note} for details. -
3330 -
3331 By default, this property contains a value that depends on the user's -
3332 platform and screen geometry. -
3333 -
3334 \sa geometry, width, size -
3335*/ -
3336 -
3337/*! -
3338 \property QWidget::rect -
3339 \brief the internal geometry of the widget excluding any window -
3340 frame -
3341 -
3342 The rect property equals QRect(0, 0, width(), height()). -
3343 -
3344 See the \l{Window Geometry} documentation for an overview of geometry -
3345 issues with windows. -
3346 -
3347 By default, this property contains a value that depends on the user's -
3348 platform and screen geometry. -
3349 -
3350 \sa size -
3351*/ -
3352 -
3353 -
3354QRect QWidget::normalGeometry() const -
3355{ -
3356 Q_D(const QWidget);
never executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
3357 if (!d->extra || !d->extra->topextra)
never evaluated: !d->extra
never evaluated: !d->extra->topextra
0
3358 return QRect();
never executed: return QRect();
0
3359 -
3360 if (!isMaximized() && !isFullScreen())
never evaluated: !isMaximized()
never evaluated: !isFullScreen()
0
3361 return geometry();
never executed: return geometry();
0
3362 -
3363 return d->topData()->normalGeometry;
never executed: return d->topData()->normalGeometry;
0
3364} -
3365 -
3366 -
3367/*! -
3368 \property QWidget::childrenRect -
3369 \brief the bounding rectangle of the widget's children -
3370 -
3371 Hidden children are excluded. -
3372 -
3373 By default, for a widget with no children, this property contains a -
3374 rectangle with zero width and height located at the origin. -
3375 -
3376 \sa childrenRegion(), geometry() -
3377*/ -
3378 -
3379QRect QWidget::childrenRect() const -
3380{ -
3381 Q_D(const QWidget);
executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
3382 QRect r(0, 0, 0, 0);
executed (the execution status of this line is deduced): QRect r(0, 0, 0, 0);
-
3383 for (int i = 0; i < d->children.size(); ++i) {
evaluated: i < d->children.size()
TRUEFALSE
yes
Evaluation Count:418
yes
Evaluation Count:682
418-682
3384 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));
-
3385 if (w && !w->isWindow() && !w->isHidden())
evaluated: w
TRUEFALSE
yes
Evaluation Count:414
yes
Evaluation Count:4
evaluated: !w->isWindow()
TRUEFALSE
yes
Evaluation Count:409
yes
Evaluation Count:5
partially evaluated: !w->isHidden()
TRUEFALSE
yes
Evaluation Count:409
no
Evaluation Count:0
0-414
3386 r |= w->geometry();
executed: r |= w->geometry();
Execution Count:409
409
3387 }
executed: }
Execution Count:418
418
3388 return r;
executed: return r;
Execution Count:682
682
3389} -
3390 -
3391/*! -
3392 \property QWidget::childrenRegion -
3393 \brief the combined region occupied by the widget's children -
3394 -
3395 Hidden children are excluded. -
3396 -
3397 By default, for a widget with no children, this property contains an -
3398 empty region. -
3399 -
3400 \sa childrenRect(), geometry(), mask() -
3401*/ -
3402 -
3403QRegion QWidget::childrenRegion() const -
3404{ -
3405 Q_D(const QWidget);
never executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
3406 QRegion r;
never executed (the execution status of this line is deduced): QRegion r;
-
3407 for (int i = 0; i < d->children.size(); ++i) {
never evaluated: i < d->children.size()
0
3408 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));
-
3409 if (w && !w->isWindow() && !w->isHidden()) {
never evaluated: w
never evaluated: !w->isWindow()
never evaluated: !w->isHidden()
0
3410 QRegion mask = w->mask();
never executed (the execution status of this line is deduced): QRegion mask = w->mask();
-
3411 if (mask.isEmpty())
never evaluated: mask.isEmpty()
0
3412 r |= w->geometry();
never executed: r |= w->geometry();
0
3413 else -
3414 r |= mask.translated(w->pos());
never executed: r |= mask.translated(w->pos());
0
3415 } -
3416 }
never executed: }
0
3417 return r;
never executed: return r;
0
3418} -
3419 -
3420 -
3421/*! -
3422 \property QWidget::minimumSize -
3423 \brief the widget's minimum size -
3424 -
3425 The widget cannot be resized to a smaller size than the minimum -
3426 widget size. The widget's size is forced to the minimum size if -
3427 the current size is smaller. -
3428 -
3429 The minimum size set by this function will override the minimum size -
3430 defined by QLayout. In order to unset the minimum size, use a -
3431 value of \c{QSize(0, 0)}. -
3432 -
3433 By default, this property contains a size with zero width and height. -
3434 -
3435 \sa minimumWidth, minimumHeight, maximumSize, sizeIncrement -
3436*/ -
3437 -
3438QSize QWidget::minimumSize() const -
3439{ -
3440 Q_D(const QWidget);
executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
3441 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:67878
67878
3442} -
3443 -
3444/*! -
3445 \property QWidget::maximumSize -
3446 \brief the widget's maximum size in pixels -
3447 -
3448 The widget cannot be resized to a larger size than the maximum -
3449 widget size. -
3450 -
3451 By default, this property contains a size in which both width and height -
3452 have values of 16777215. -
3453 -
3454 \note The definition of the \c QWIDGETSIZE_MAX macro limits the maximum size -
3455 of widgets. -
3456 -
3457 \sa maximumWidth, maximumHeight, minimumSize, sizeIncrement -
3458*/ -
3459 -
3460QSize QWidget::maximumSize() const -
3461{ -
3462 Q_D(const QWidget);
executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
3463 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:68271
68271
3464 : 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:68271
68271
3465} -
3466 -
3467 -
3468/*! -
3469 \property QWidget::minimumWidth -
3470 \brief the widget's minimum width in pixels -
3471 -
3472 This property corresponds to the width held by the \l minimumSize property. -
3473 -
3474 By default, this property has a value of 0. -
3475 -
3476 \sa minimumSize, minimumHeight -
3477*/ -
3478 -
3479/*! -
3480 \property QWidget::minimumHeight -
3481 \brief the widget's minimum height in pixels -
3482 -
3483 This property corresponds to the height held by the \l minimumSize property. -
3484 -
3485 By default, this property has a value of 0. -
3486 -
3487 \sa minimumSize, minimumWidth -
3488*/ -
3489 -
3490/*! -
3491 \property QWidget::maximumWidth -
3492 \brief the widget's maximum width in pixels -
3493 -
3494 This property corresponds to the width held by the \l maximumSize property. -
3495 -
3496 By default, this property contains a value of 16777215. -
3497 -
3498 \note The definition of the \c QWIDGETSIZE_MAX macro limits the maximum size -
3499 of widgets. -
3500 -
3501 \sa maximumSize, maximumHeight -
3502*/ -
3503 -
3504/*! -
3505 \property QWidget::maximumHeight -
3506 \brief the widget's maximum height in pixels -
3507 -
3508 This property corresponds to the height held by the \l maximumSize property. -
3509 -
3510 By default, this property contains a value of 16777215. -
3511 -
3512 \note The definition of the \c QWIDGETSIZE_MAX macro limits the maximum size -
3513 of widgets. -
3514 -
3515 \sa maximumSize, maximumWidth -
3516*/ -
3517 -
3518/*! -
3519 \property QWidget::sizeIncrement -
3520 \brief the size increment of the widget -
3521 -
3522 When the user resizes the window, the size will move in steps of -
3523 sizeIncrement().width() pixels horizontally and -
3524 sizeIncrement.height() pixels vertically, with baseSize() as the -
3525 basis. Preferred widget sizes are for non-negative integers \e i -
3526 and \e j: -
3527 \snippet code/src_gui_kernel_qwidget.cpp 2 -
3528 -
3529 Note that while you can set the size increment for all widgets, it -
3530 only affects windows. -
3531 -
3532 By default, this property contains a size with zero width and height. -
3533 -
3534 \warning The size increment has no effect under Windows, and may -
3535 be disregarded by the window manager on X11. -
3536 -
3537 \sa size, minimumSize, maximumSize -
3538*/ -
3539QSize QWidget::sizeIncrement() const -
3540{ -
3541 Q_D(const QWidget);
never executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
3542 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
3543 ? 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
3544 : QSize(0, 0);
never executed: return (d->extra && d->extra->topextra) ? QSize(d->extra->topextra->incw, d->extra->topextra->inch) : QSize(0, 0);
0
3545} -
3546 -
3547/*! -
3548 \property QWidget::baseSize -
3549 \brief the base size of the widget -
3550 -
3551 The base size is used to calculate a proper widget size if the -
3552 widget defines sizeIncrement(). -
3553 -
3554 By default, for a newly-created widget, this property contains a size with -
3555 zero width and height. -
3556 -
3557 \sa setSizeIncrement() -
3558*/ -
3559 -
3560QSize QWidget::baseSize() const -
3561{ -
3562 Q_D(const QWidget);
never executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
3563 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
3564 ? 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
3565 : 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
3566} -
3567 -
3568bool QWidgetPrivate::setMinimumSize_helper(int &minw, int &minh) -
3569{ -
3570 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
3571 -
3572 int mw = minw, mh = minh;
executed (the execution status of this line is deduced): int mw = minw, mh = minh;
-
3573 if (mw == QWIDGETSIZE_MAX)
evaluated: mw == ((1<<24)-1)
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:7246
2-7246
3574 mw = 0;
executed: mw = 0;
Execution Count:2
2
3575 if (mh == QWIDGETSIZE_MAX)
evaluated: mh == ((1<<24)-1)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:7247
1-7247
3576 mh = 0;
executed: mh = 0;
Execution Count:1
1
3577 if (minw > QWIDGETSIZE_MAX || minh > QWIDGETSIZE_MAX) {
evaluated: minw > ((1<<24)-1)
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:7246
evaluated: minh > ((1<<24)-1)
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:7244
2-7246
3578 qWarning("QWidget::setMinimumSize: (%s/%s) "
executed (the execution status of this line is deduced): QMessageLogger("kernel/qwidget.cpp", 3578, __PRETTY_FUNCTION__).warning("QWidget::setMinimumSize: (%s/%s) "
-
3579 "The largest allowed size is (%d,%d)",
executed (the execution status of this line is deduced): "The largest allowed size is (%d,%d)",
-
3580 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),
-
3581 QWIDGETSIZE_MAX);
executed (the execution status of this line is deduced): ((1<<24)-1));
-
3582 minw = mw = qMin<int>(minw, QWIDGETSIZE_MAX);
executed (the execution status of this line is deduced): minw = mw = qMin<int>(minw, ((1<<24)-1));
-
3583 minh = mh = qMin<int>(minh, QWIDGETSIZE_MAX);
executed (the execution status of this line is deduced): minh = mh = qMin<int>(minh, ((1<<24)-1));
-
3584 }
executed: }
Execution Count:4
4
3585 if (minw < 0 || minh < 0) {
evaluated: minw < 0
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:7246
evaluated: minh < 0
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:7244
2-7246
3586 qWarning("QWidget::setMinimumSize: (%s/%s) Negative sizes (%d,%d) "
executed (the execution status of this line is deduced): QMessageLogger("kernel/qwidget.cpp", 3586, __PRETTY_FUNCTION__).warning("QWidget::setMinimumSize: (%s/%s) Negative sizes (%d,%d) "
-
3587 "are not possible",
executed (the execution status of this line is deduced): "are not possible",
-
3588 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);
-
3589 minw = mw = qMax(minw, 0);
executed (the execution status of this line is deduced): minw = mw = qMax(minw, 0);
-
3590 minh = mh = qMax(minh, 0);
executed (the execution status of this line is deduced): minh = mh = qMax(minh, 0);
-
3591 }
executed: }
Execution Count:4
4
3592 createExtra();
executed (the execution status of this line is deduced): createExtra();
-
3593 if (extra->minw == mw && extra->minh == mh)
evaluated: extra->minw == mw
TRUEFALSE
yes
Evaluation Count:2953
yes
Evaluation Count:4295
evaluated: extra->minh == mh
TRUEFALSE
yes
Evaluation Count:2725
yes
Evaluation Count:228
228-4295
3594 return false;
executed: return false;
Execution Count:2725
2725
3595 extra->minw = mw;
executed (the execution status of this line is deduced): extra->minw = mw;
-
3596 extra->minh = mh;
executed (the execution status of this line is deduced): extra->minh = mh;
-
3597 extra->explicitMinSize = (mw ? Qt::Horizontal : 0) | (mh ? Qt::Vertical : 0);
evaluated: mw
TRUEFALSE
yes
Evaluation Count:3672
yes
Evaluation Count:851
851-3672
3598 return true;
executed: return true;
Execution Count:4523
4523
3599} -
3600 -
3601/*! -
3602 \overload -
3603 -
3604 This function corresponds to setMinimumSize(QSize(minw, minh)). -
3605 Sets the minimum width to \a minw and the minimum height to \a -
3606 minh. -
3607*/ -
3608 -
3609void QWidget::setMinimumSize(int minw, int minh) -
3610{ -
3611 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
3612 if (!d->setMinimumSize_helper(minw, minh))
evaluated: !d->setMinimumSize_helper(minw, minh)
TRUEFALSE
yes
Evaluation Count:2612
yes
Evaluation Count:2813
2612-2813
3613 return;
executed: return;
Execution Count:2612
2612
3614 -
3615 if (isWindow())
evaluated: isWindow()
TRUEFALSE
yes
Evaluation Count:648
yes
Evaluation Count:2165
648-2165
3616 d->setConstraints_sys();
executed: d->setConstraints_sys();
Execution Count:648
648
3617 if (minw > width() || minh > height()) {
evaluated: minw > width()
TRUEFALSE
yes
Evaluation Count:58
yes
Evaluation Count:2755
evaluated: minh > height()
TRUEFALSE
yes
Evaluation Count:41
yes
Evaluation Count:2714
41-2755
3618 bool resized = testAttribute(Qt::WA_Resized);
executed (the execution status of this line is deduced): bool resized = testAttribute(Qt::WA_Resized);
-
3619 bool maximized = isMaximized();
executed (the execution status of this line is deduced): bool maximized = isMaximized();
-
3620 resize(qMax(minw,width()), qMax(minh,height()));
executed (the execution status of this line is deduced): resize(qMax(minw,width()), qMax(minh,height()));
-
3621 setAttribute(Qt::WA_Resized, resized); //not a user resize
executed (the execution status of this line is deduced): setAttribute(Qt::WA_Resized, resized);
-
3622 if (maximized)
partially evaluated: maximized
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:99
0-99
3623 data->window_state = data->window_state | Qt::WindowMaximized;
never executed: data->window_state = data->window_state | Qt::WindowMaximized;
0
3624 }
executed: }
Execution Count:99
99
3625#ifndef QT_NO_GRAPHICSVIEW -
3626 if (d->extra) {
partially evaluated: d->extra
TRUEFALSE
yes
Evaluation Count:2813
no
Evaluation Count:0
0-2813
3627 if (d->extra->proxyWidget)
partially evaluated: d->extra->proxyWidget
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2813
0-2813
3628 d->extra->proxyWidget->setMinimumSize(minw, minh);
never executed: d->extra->proxyWidget->setMinimumSize(minw, minh);
0
3629 }
executed: }
Execution Count:2813
2813
3630#endif -
3631 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);
-
3632}
executed: }
Execution Count:2813
2813
3633 -
3634bool QWidgetPrivate::setMaximumSize_helper(int &maxw, int &maxh) -
3635{ -
3636 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
3637 if (maxw > QWIDGETSIZE_MAX || maxh > QWIDGETSIZE_MAX) {
evaluated: maxw > ((1<<24)-1)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:3775
evaluated: maxh > ((1<<24)-1)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:3774
1-3775
3638 qWarning("QWidget::setMaximumSize: (%s/%s) "
executed (the execution status of this line is deduced): QMessageLogger("kernel/qwidget.cpp", 3638, __PRETTY_FUNCTION__).warning("QWidget::setMaximumSize: (%s/%s) "
-
3639 "The largest allowed size is (%d,%d)",
executed (the execution status of this line is deduced): "The largest allowed size is (%d,%d)",
-
3640 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),
-
3641 QWIDGETSIZE_MAX);
executed (the execution status of this line is deduced): ((1<<24)-1));
-
3642 maxw = qMin<int>(maxw, QWIDGETSIZE_MAX);
executed (the execution status of this line is deduced): maxw = qMin<int>(maxw, ((1<<24)-1));
-
3643 maxh = qMin<int>(maxh, QWIDGETSIZE_MAX);
executed (the execution status of this line is deduced): maxh = qMin<int>(maxh, ((1<<24)-1));
-
3644 }
executed: }
Execution Count:2
2
3645 if (maxw < 0 || maxh < 0) {
evaluated: maxw < 0
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:3775
evaluated: maxh < 0
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:3774
1-3775
3646 qWarning("QWidget::setMaximumSize: (%s/%s) Negative sizes (%d,%d) "
executed (the execution status of this line is deduced): QMessageLogger("kernel/qwidget.cpp", 3646, __PRETTY_FUNCTION__).warning("QWidget::setMaximumSize: (%s/%s) Negative sizes (%d,%d) "
-
3647 "are not possible",
executed (the execution status of this line is deduced): "are not possible",
-
3648 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);
-
3649 maxw = qMax(maxw, 0);
executed (the execution status of this line is deduced): maxw = qMax(maxw, 0);
-
3650 maxh = qMax(maxh, 0);
executed (the execution status of this line is deduced): maxh = qMax(maxh, 0);
-
3651 }
executed: }
Execution Count:2
2
3652 createExtra();
executed (the execution status of this line is deduced): createExtra();
-
3653 if (extra->maxw == maxw && extra->maxh == maxh)
evaluated: extra->maxw == maxw
TRUEFALSE
yes
Evaluation Count:1314
yes
Evaluation Count:2462
evaluated: extra->maxh == maxh
TRUEFALSE
yes
Evaluation Count:1174
yes
Evaluation Count:140
140-2462
3654 return false;
executed: return false;
Execution Count:1174
1174
3655 extra->maxw = maxw;
executed (the execution status of this line is deduced): extra->maxw = maxw;
-
3656 extra->maxh = maxh;
executed (the execution status of this line is deduced): extra->maxh = maxh;
-
3657 extra->explicitMaxSize = (maxw != QWIDGETSIZE_MAX ? Qt::Horizontal : 0) |
evaluated: maxw != ((1<<24)-1)
TRUEFALSE
yes
Evaluation Count:2527
yes
Evaluation Count:75
75-2527
3658 (maxh != QWIDGETSIZE_MAX ? Qt::Vertical : 0);
executed (the execution status of this line is deduced): (maxh != ((1<<24)-1) ? Qt::Vertical : 0);
-
3659 return true;
executed: return true;
Execution Count:2602
2602
3660} -
3661 -
3662/*! -
3663 \overload -
3664 -
3665 This function corresponds to setMaximumSize(QSize(\a maxw, \a -
3666 maxh)). Sets the maximum width to \a maxw and the maximum height -
3667 to \a maxh. -
3668*/ -
3669void QWidget::setMaximumSize(int maxw, int maxh) -
3670{ -
3671 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
3672 if (!d->setMaximumSize_helper(maxw, maxh))
evaluated: !d->setMaximumSize_helper(maxw, maxh)
TRUEFALSE
yes
Evaluation Count:1061
yes
Evaluation Count:892
892-1061
3673 return;
executed: return;
Execution Count:1061
1061
3674 -
3675 if (isWindow())
evaluated: isWindow()
TRUEFALSE
yes
Evaluation Count:193
yes
Evaluation Count:699
193-699
3676 d->setConstraints_sys();
executed: d->setConstraints_sys();
Execution Count:193
193
3677 if (maxw < width() || maxh < height()) {
evaluated: maxw < width()
TRUEFALSE
yes
Evaluation Count:41
yes
Evaluation Count:851
evaluated: maxh < height()
TRUEFALSE
yes
Evaluation Count:74
yes
Evaluation Count:777
41-851
3678 bool resized = testAttribute(Qt::WA_Resized);
executed (the execution status of this line is deduced): bool resized = testAttribute(Qt::WA_Resized);
-
3679 resize(qMin(maxw,width()), qMin(maxh,height()));
executed (the execution status of this line is deduced): resize(qMin(maxw,width()), qMin(maxh,height()));
-
3680 setAttribute(Qt::WA_Resized, resized); //not a user resize
executed (the execution status of this line is deduced): setAttribute(Qt::WA_Resized, resized);
-
3681 }
executed: }
Execution Count:115
115
3682 -
3683#ifndef QT_NO_GRAPHICSVIEW -
3684 if (d->extra) {
partially evaluated: d->extra
TRUEFALSE
yes
Evaluation Count:892
no
Evaluation Count:0
0-892
3685 if (d->extra->proxyWidget)
partially evaluated: d->extra->proxyWidget
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:892
0-892
3686 d->extra->proxyWidget->setMaximumSize(maxw, maxh);
never executed: d->extra->proxyWidget->setMaximumSize(maxw, maxh);
0
3687 }
executed: }
Execution Count:892
892
3688#endif -
3689 -
3690 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);
-
3691}
executed: }
Execution Count:892
892
3692 -
3693/*! -
3694 \overload -
3695 -
3696 Sets the x (width) size increment to \a w and the y (height) size -
3697 increment to \a h. -
3698*/ -
3699void QWidget::setSizeIncrement(int w, int h) -
3700{ -
3701 Q_D(QWidget);
never executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
3702 d->createTLExtra();
never executed (the execution status of this line is deduced): d->createTLExtra();
-
3703 QTLWExtra* x = d->topData();
never executed (the execution status of this line is deduced): QTLWExtra* x = d->topData();
-
3704 if (x->incw == w && x->inch == h)
never evaluated: x->incw == w
never evaluated: x->inch == h
0
3705 return;
never executed: return;
0
3706 x->incw = w;
never executed (the execution status of this line is deduced): x->incw = w;
-
3707 x->inch = h;
never executed (the execution status of this line is deduced): x->inch = h;
-
3708 if (isWindow())
never evaluated: isWindow()
0
3709 d->setConstraints_sys();
never executed: d->setConstraints_sys();
0
3710}
never executed: }
0
3711 -
3712/*! -
3713 \overload -
3714 -
3715 This corresponds to setBaseSize(QSize(\a basew, \a baseh)). Sets -
3716 the widgets base size to width \a basew and height \a baseh. -
3717*/ -
3718void QWidget::setBaseSize(int basew, int baseh) -
3719{ -
3720 Q_D(QWidget);
never executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
3721 d->createTLExtra();
never executed (the execution status of this line is deduced): d->createTLExtra();
-
3722 QTLWExtra* x = d->topData();
never executed (the execution status of this line is deduced): QTLWExtra* x = d->topData();
-
3723 if (x->basew == basew && x->baseh == baseh)
never evaluated: x->basew == basew
never evaluated: x->baseh == baseh
0
3724 return;
never executed: return;
0
3725 x->basew = basew;
never executed (the execution status of this line is deduced): x->basew = basew;
-
3726 x->baseh = baseh;
never executed (the execution status of this line is deduced): x->baseh = baseh;
-
3727 if (isWindow())
never evaluated: isWindow()
0
3728 d->setConstraints_sys();
never executed: d->setConstraints_sys();
0
3729}
never executed: }
0
3730 -
3731/*! -
3732 Sets both the minimum and maximum sizes of the widget to \a s, -
3733 thereby preventing it from ever growing or shrinking. -
3734 -
3735 This will override the default size constraints set by QLayout. -
3736 -
3737 To remove constraints, set the size to QWIDGETSIZE_MAX. -
3738 -
3739 Alternatively, if you want the widget to have a -
3740 fixed size based on its contents, you can call -
3741 QLayout::setSizeConstraint(QLayout::SetFixedSize); -
3742 -
3743 \sa maximumSize, minimumSize -
3744*/ -
3745 -
3746void QWidget::setFixedSize(const QSize & s) -
3747{ -
3748 setFixedSize(s.width(), s.height());
executed (the execution status of this line is deduced): setFixedSize(s.width(), s.height());
-
3749}
executed: }
Execution Count:890
890
3750 -
3751 -
3752/*! -
3753 \fn void QWidget::setFixedSize(int w, int h) -
3754 \overload -
3755 -
3756 Sets the width of the widget to \a w and the height to \a h. -
3757*/ -
3758 -
3759void QWidget::setFixedSize(int w, int h) -
3760{ -
3761 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
3762 bool minSizeSet = d->setMinimumSize_helper(w, h);
executed (the execution status of this line is deduced): bool minSizeSet = d->setMinimumSize_helper(w, h);
-
3763 bool maxSizeSet = d->setMaximumSize_helper(w, h);
executed (the execution status of this line is deduced): bool maxSizeSet = d->setMaximumSize_helper(w, h);
-
3764 if (!minSizeSet && !maxSizeSet)
evaluated: !minSizeSet
TRUEFALSE
yes
Evaluation Count:113
yes
Evaluation Count:1710
partially evaluated: !maxSizeSet
TRUEFALSE
yes
Evaluation Count:113
no
Evaluation Count:0
0-1710
3765 return;
executed: return;
Execution Count:113
113
3766 -
3767 if (isWindow())
evaluated: isWindow()
TRUEFALSE
yes
Evaluation Count:980
yes
Evaluation Count:730
730-980
3768 d->setConstraints_sys();
executed: d->setConstraints_sys();
Execution Count:980
980
3769 else -
3770 d->updateGeometry_helper(true);
executed: d->updateGeometry_helper(true);
Execution Count:730
730
3771 -
3772 if (w != QWIDGETSIZE_MAX || h != QWIDGETSIZE_MAX)
partially evaluated: w != ((1<<24)-1)
TRUEFALSE
yes
Evaluation Count:1710
no
Evaluation Count:0
never evaluated: h != ((1<<24)-1)
0-1710
3773 resize(w, h);
executed: resize(w, h);
Execution Count:1710
1710
3774}
executed: }
Execution Count:1710
1710
3775 -
3776void QWidget::setMinimumWidth(int w) -
3777{ -
3778 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
3779 d->createExtra();
executed (the execution status of this line is deduced): d->createExtra();
-
3780 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);
-
3781 setMinimumSize(w, minimumSize().height());
executed (the execution status of this line is deduced): setMinimumSize(w, minimumSize().height());
-
3782 d->extra->explicitMinSize = expl;
executed (the execution status of this line is deduced): d->extra->explicitMinSize = expl;
-
3783}
executed: }
Execution Count:1685
1685
3784 -
3785void QWidget::setMinimumHeight(int h) -
3786{ -
3787 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
3788 d->createExtra();
executed (the execution status of this line is deduced): d->createExtra();
-
3789 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);
-
3790 setMinimumSize(minimumSize().width(), h);
executed (the execution status of this line is deduced): setMinimumSize(minimumSize().width(), h);
-
3791 d->extra->explicitMinSize = expl;
executed (the execution status of this line is deduced): d->extra->explicitMinSize = expl;
-
3792}
executed: }
Execution Count:478
478
3793 -
3794void QWidget::setMaximumWidth(int w) -
3795{ -
3796 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
3797 d->createExtra();
executed (the execution status of this line is deduced): d->createExtra();
-
3798 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);
-
3799 setMaximumSize(w, maximumSize().height());
executed (the execution status of this line is deduced): setMaximumSize(w, maximumSize().height());
-
3800 d->extra->explicitMaxSize = expl;
executed (the execution status of this line is deduced): d->extra->explicitMaxSize = expl;
-
3801}
executed: }
Execution Count:501
501
3802 -
3803void QWidget::setMaximumHeight(int h) -
3804{ -
3805 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
3806 d->createExtra();
executed (the execution status of this line is deduced): d->createExtra();
-
3807 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);
-
3808 setMaximumSize(maximumSize().width(), h);
executed (the execution status of this line is deduced): setMaximumSize(maximumSize().width(), h);
-
3809 d->extra->explicitMaxSize = expl;
executed (the execution status of this line is deduced): d->extra->explicitMaxSize = expl;
-
3810}
executed: }
Execution Count:448
448
3811 -
3812/*! -
3813 Sets both the minimum and maximum width of the widget to \a w -
3814 without changing the heights. Provided for convenience. -
3815 -
3816 \sa sizeHint(), minimumSize(), maximumSize(), setFixedSize() -
3817*/ -
3818 -
3819void QWidget::setFixedWidth(int w) -
3820{ -
3821 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
3822 d->createExtra();
executed (the execution status of this line is deduced): d->createExtra();
-
3823 uint explMin = d->extra->explicitMinSize | Qt::Horizontal;
executed (the execution status of this line is deduced): uint explMin = d->extra->explicitMinSize | Qt::Horizontal;
-
3824 uint explMax = d->extra->explicitMaxSize | Qt::Horizontal;
executed (the execution status of this line is deduced): uint explMax = d->extra->explicitMaxSize | Qt::Horizontal;
-
3825 setMinimumSize(w, minimumSize().height());
executed (the execution status of this line is deduced): setMinimumSize(w, minimumSize().height());
-
3826 setMaximumSize(w, maximumSize().height());
executed (the execution status of this line is deduced): setMaximumSize(w, maximumSize().height());
-
3827 d->extra->explicitMinSize = explMin;
executed (the execution status of this line is deduced): d->extra->explicitMinSize = explMin;
-
3828 d->extra->explicitMaxSize = explMax;
executed (the execution status of this line is deduced): d->extra->explicitMaxSize = explMax;
-
3829}
executed: }
Execution Count:6
6
3830 -
3831 -
3832/*! -
3833 Sets both the minimum and maximum heights of the widget to \a h -
3834 without changing the widths. Provided for convenience. -
3835 -
3836 \sa sizeHint(), minimumSize(), maximumSize(), setFixedSize() -
3837*/ -
3838 -
3839void QWidget::setFixedHeight(int h) -
3840{ -
3841 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
3842 d->createExtra();
executed (the execution status of this line is deduced): d->createExtra();
-
3843 uint explMin = d->extra->explicitMinSize | Qt::Vertical;
executed (the execution status of this line is deduced): uint explMin = d->extra->explicitMinSize | Qt::Vertical;
-
3844 uint explMax = d->extra->explicitMaxSize | Qt::Vertical;
executed (the execution status of this line is deduced): uint explMax = d->extra->explicitMaxSize | Qt::Vertical;
-
3845 setMinimumSize(minimumSize().width(), h);
executed (the execution status of this line is deduced): setMinimumSize(minimumSize().width(), h);
-
3846 setMaximumSize(maximumSize().width(), h);
executed (the execution status of this line is deduced): setMaximumSize(maximumSize().width(), h);
-
3847 d->extra->explicitMinSize = explMin;
executed (the execution status of this line is deduced): d->extra->explicitMinSize = explMin;
-
3848 d->extra->explicitMaxSize = explMax;
executed (the execution status of this line is deduced): d->extra->explicitMaxSize = explMax;
-
3849}
executed: }
Execution Count:83
83
3850 -
3851 -
3852/*! -
3853 Translates the widget coordinate \a pos to the coordinate system -
3854 of \a parent. The \a parent must not be 0 and must be a parent -
3855 of the calling widget. -
3856 -
3857 \sa mapFrom(), mapToParent(), mapToGlobal(), underMouse() -
3858*/ -
3859 -
3860QPoint QWidget::mapTo(const QWidget * parent, const QPoint & pos) const -
3861{ -
3862 QPoint p = pos;
executed (the execution status of this line is deduced): QPoint p = pos;
-
3863 if (parent) {
partially evaluated: parent
TRUEFALSE
yes
Evaluation Count:75191
no
Evaluation Count:0
0-75191
3864 const QWidget * w = this;
executed (the execution status of this line is deduced): const QWidget * w = this;
-
3865 while (w != parent) {
evaluated: w != parent
TRUEFALSE
yes
Evaluation Count:96296
yes
Evaluation Count:75191
75191-96296
3866 Q_ASSERT_X(w, "QWidget::mapTo(const QWidget *parent, const QPoint &pos)",
executed (the execution status of this line is deduced): qt_noop();
-
3867 "parent must be in parent hierarchy"); -
3868 p = w->mapToParent(p);
executed (the execution status of this line is deduced): p = w->mapToParent(p);
-
3869 w = w->parentWidget();
executed (the execution status of this line is deduced): w = w->parentWidget();
-
3870 }
executed: }
Execution Count:96296
96296
3871 }
executed: }
Execution Count:75191
75191
3872 return p;
executed: return p;
Execution Count:75191
75191
3873} -
3874 -
3875 -
3876/*! -
3877 Translates the widget coordinate \a pos from the coordinate system -
3878 of \a parent to this widget's coordinate system. The \a parent -
3879 must not be 0 and must be a parent of the calling widget. -
3880 -
3881 \sa mapTo(), mapFromParent(), mapFromGlobal(), underMouse() -
3882*/ -
3883 -
3884QPoint QWidget::mapFrom(const QWidget * parent, const QPoint & pos) const -
3885{ -
3886 QPoint p(pos);
executed (the execution status of this line is deduced): QPoint p(pos);
-
3887 if (parent) {
partially evaluated: parent
TRUEFALSE
yes
Evaluation Count:348
no
Evaluation Count:0
0-348
3888 const QWidget * w = this;
executed (the execution status of this line is deduced): const QWidget * w = this;
-
3889 while (w != parent) {
evaluated: w != parent
TRUEFALSE
yes
Evaluation Count:475
yes
Evaluation Count:348
348-475
3890 Q_ASSERT_X(w, "QWidget::mapFrom(const QWidget *parent, const QPoint &pos)",
executed (the execution status of this line is deduced): qt_noop();
-
3891 "parent must be in parent hierarchy"); -
3892 -
3893 p = w->mapFromParent(p);
executed (the execution status of this line is deduced): p = w->mapFromParent(p);
-
3894 w = w->parentWidget();
executed (the execution status of this line is deduced): w = w->parentWidget();
-
3895 }
executed: }
Execution Count:475
475
3896 }
executed: }
Execution Count:348
348
3897 return p;
executed: return p;
Execution Count:348
348
3898} -
3899 -
3900 -
3901/*! -
3902 Translates the widget coordinate \a pos to a coordinate in the -
3903 parent widget. -
3904 -
3905 Same as mapToGlobal() if the widget has no parent. -
3906 -
3907 \sa mapFromParent(), mapTo(), mapToGlobal(), underMouse() -
3908*/ -
3909 -
3910QPoint QWidget::mapToParent(const QPoint &pos) const -
3911{ -
3912 return pos + data->crect.topLeft();
executed: return pos + data->crect.topLeft();
Execution Count:96656
96656
3913} -
3914 -
3915/*! -
3916 Translates the parent widget coordinate \a pos to widget -
3917 coordinates. -
3918 -
3919 Same as mapFromGlobal() if the widget has no parent. -
3920 -
3921 \sa mapToParent(), mapFrom(), mapFromGlobal(), underMouse() -
3922*/ -
3923 -
3924QPoint QWidget::mapFromParent(const QPoint &pos) const -
3925{ -
3926 return pos - data->crect.topLeft();
executed: return pos - data->crect.topLeft();
Execution Count:476
476
3927} -
3928 -
3929 -
3930/*! -
3931 Returns the window for this widget, i.e. the next ancestor widget -
3932 that has (or could have) a window-system frame. -
3933 -
3934 If the widget is a window, the widget itself is returned. -
3935 -
3936 Typical usage is changing the window title: -
3937 -
3938 \snippet code/src_gui_kernel_qwidget.cpp 3 -
3939 -
3940 \sa isWindow() -
3941*/ -
3942 -
3943QWidget *QWidget::window() const -
3944{ -
3945 QWidget *w = (QWidget *)this;
executed (the execution status of this line is deduced): QWidget *w = (QWidget *)this;
-
3946 QWidget *p = w->parentWidget();
executed (the execution status of this line is deduced): QWidget *p = w->parentWidget();
-
3947 while (!w->isWindow() && p) {
evaluated: !w->isWindow()
TRUEFALSE
yes
Evaluation Count:1807506
yes
Evaluation Count:1494151
evaluated: p
TRUEFALSE
yes
Evaluation Count:1752827
yes
Evaluation Count:54679
54679-1807506
3948 w = p;
executed (the execution status of this line is deduced): w = p;
-
3949 p = p->parentWidget();
executed (the execution status of this line is deduced): p = p->parentWidget();
-
3950 }
executed: }
Execution Count:1752827
1752827
3951 return w;
executed: return w;
Execution Count:1548830
1548830
3952} -
3953 -
3954/*! -
3955 \since 4.4 -
3956 -
3957 Returns the native parent for this widget, i.e. the next ancestor widget -
3958 that has a system identifier, or 0 if it does not have any native parent. -
3959 -
3960 \sa effectiveWinId() -
3961*/ -
3962QWidget *QWidget::nativeParentWidget() const -
3963{ -
3964 QWidget *parent = parentWidget();
executed (the execution status of this line is deduced): QWidget *parent = parentWidget();
-
3965 while (parent && !parent->internalWinId())
evaluated: parent
TRUEFALSE
yes
Evaluation Count:12671
yes
Evaluation Count:1511
evaluated: !parent->internalWinId()
TRUEFALSE
yes
Evaluation Count:5119
yes
Evaluation Count:7552
1511-12671
3966 parent = parent->parentWidget();
executed: parent = parent->parentWidget();
Execution Count:5119
5119
3967 return parent;
executed: return parent;
Execution Count:9063
9063
3968} -
3969 -
3970/*! \fn QWidget *QWidget::topLevelWidget() const -
3971 \obsolete -
3972 -
3973 Use window() instead. -
3974*/ -
3975 -
3976 -
3977 -
3978/*! -
3979 Returns the background role of the widget. -
3980 -
3981 The background role defines the brush from the widget's \l palette that -
3982 is used to render the background. -
3983 -
3984 If no explicit background role is set, the widget inherts its parent -
3985 widget's background role. -
3986 -
3987 \sa setBackgroundRole(), foregroundRole() -
3988 */ -
3989QPalette::ColorRole QWidget::backgroundRole() const -
3990{ -
3991 -
3992 const QWidget *w = this;
executed (the execution status of this line is deduced): const QWidget *w = this;
-
3993 do { -
3994 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;
-
3995 if (role != QPalette::NoRole)
evaluated: role != QPalette::NoRole
TRUEFALSE
yes
Evaluation Count:29946
yes
Evaluation Count:24759
24759-29946
3996 return role;
executed: return role;
Execution Count:29946
29946
3997 if (w->isWindow() || w->windowType() == Qt::SubWindow)
evaluated: w->isWindow()
TRUEFALSE
yes
Evaluation Count:14031
yes
Evaluation Count:10728
partially evaluated: w->windowType() == Qt::SubWindow
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:10728
0-14031
3998 break;
executed: break;
Execution Count:14031
14031
3999 w = w->parentWidget();
executed (the execution status of this line is deduced): w = w->parentWidget();
-
4000 } while (w);
executed: }
Execution Count:10728
partially evaluated: w
TRUEFALSE
yes
Evaluation Count:10728
no
Evaluation Count:0
0-10728
4001 return QPalette::Window;
executed: return QPalette::Window;
Execution Count:14031
14031
4002} -
4003 -
4004/*! -
4005 Sets the background role of the widget to \a role. -
4006 -
4007 The background role defines the brush from the widget's \l palette that -
4008 is used to render the background. -
4009 -
4010 If \a role is QPalette::NoRole, then the widget inherits its -
4011 parent's background role. -
4012 -
4013 Note that styles are free to choose any color from the palette. -
4014 You can modify the palette or set a style sheet if you don't -
4015 achieve the result you want with setBackgroundRole(). -
4016 -
4017 \sa backgroundRole(), foregroundRole() -
4018 */ -
4019 -
4020void QWidget::setBackgroundRole(QPalette::ColorRole role) -
4021{ -
4022 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
4023 d->bg_role = role;
executed (the execution status of this line is deduced): d->bg_role = role;
-
4024 d->updateSystemBackground();
executed (the execution status of this line is deduced): d->updateSystemBackground();
-
4025 d->propagatePaletteChange();
executed (the execution status of this line is deduced): d->propagatePaletteChange();
-
4026 d->updateIsOpaque();
executed (the execution status of this line is deduced): d->updateIsOpaque();
-
4027}
executed: }
Execution Count:13252
13252
4028 -
4029/*! -
4030 Returns the foreground role. -
4031 -
4032 The foreground role defines the color from the widget's \l palette that -
4033 is used to draw the foreground. -
4034 -
4035 If no explicit foreground role is set, the function returns a role -
4036 that contrasts with the background role. -
4037 -
4038 \sa setForegroundRole(), backgroundRole() -
4039 */ -
4040QPalette::ColorRole QWidget::foregroundRole() const -
4041{ -
4042 Q_D(const QWidget);
executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
4043 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);
-
4044 if (rl != QPalette::NoRole)
evaluated: rl != QPalette::NoRole
TRUEFALSE
yes
Evaluation Count:1328
yes
Evaluation Count:12563
1328-12563
4045 return rl;
executed: return rl;
Execution Count:1328
1328
4046 QPalette::ColorRole role = QPalette::WindowText;
executed (the execution status of this line is deduced): QPalette::ColorRole role = QPalette::WindowText;
-
4047 switch (backgroundRole()) { -
4048 case QPalette::Button: -
4049 role = QPalette::ButtonText;
executed (the execution status of this line is deduced): role = QPalette::ButtonText;
-
4050 break;
executed: break;
Execution Count:1034
1034
4051 case QPalette::Base: -
4052 role = QPalette::Text;
executed (the execution status of this line is deduced): role = QPalette::Text;
-
4053 break;
executed: break;
Execution Count:4150
4150
4054 case QPalette::Dark: -
4055 case QPalette::Shadow: -
4056 role = QPalette::Light;
never executed (the execution status of this line is deduced): role = QPalette::Light;
-
4057 break;
never executed: break;
0
4058 case QPalette::Highlight: -
4059 role = QPalette::HighlightedText;
executed (the execution status of this line is deduced): role = QPalette::HighlightedText;
-
4060 break;
executed: break;
Execution Count:84
84
4061 case QPalette::ToolTipBase: -
4062 role = QPalette::ToolTipText;
never executed (the execution status of this line is deduced): role = QPalette::ToolTipText;
-
4063 break;
never executed: break;
0
4064 default: -
4065 ; -
4066 }
executed: }
Execution Count:7295
7295
4067 return role;
executed: return role;
Execution Count:12563
12563
4068} -
4069 -
4070/*! -
4071 Sets the foreground role of the widget to \a role. -
4072 -
4073 The foreground role defines the color from the widget's \l palette that -
4074 is used to draw the foreground. -
4075 -
4076 If \a role is QPalette::NoRole, the widget uses a foreground role -
4077 that contrasts with the background role. -
4078 -
4079 Note that styles are free to choose any color from the palette. -
4080 You can modify the palette or set a style sheet if you don't -
4081 achieve the result you want with setForegroundRole(). -
4082 -
4083 \sa foregroundRole(), backgroundRole() -
4084 */ -
4085void QWidget::setForegroundRole(QPalette::ColorRole role) -
4086{ -
4087 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
4088 d->fg_role = role;
executed (the execution status of this line is deduced): d->fg_role = role;
-
4089 d->updateSystemBackground();
executed (the execution status of this line is deduced): d->updateSystemBackground();
-
4090 d->propagatePaletteChange();
executed (the execution status of this line is deduced): d->propagatePaletteChange();
-
4091}
executed: }
Execution Count:3216
3216
4092 -
4093/*! -
4094 \property QWidget::palette -
4095 \brief the widget's palette -
4096 -
4097 This property describes the widget's palette. The palette is used by the -
4098 widget's style when rendering standard components, and is available as a -
4099 means to ensure that custom widgets can maintain consistency with the -
4100 native platform's look and feel. It's common that different platforms, or -
4101 different styles, have different palettes. -
4102 -
4103 When you assign a new palette to a widget, the color roles from this -
4104 palette are combined with the widget's default palette to form the -
4105 widget's final palette. The palette entry for the widget's background role -
4106 is used to fill the widget's background (see QWidget::autoFillBackground), -
4107 and the foreground role initializes QPainter's pen. -
4108 -
4109 The default depends on the system environment. QApplication maintains a -
4110 system/theme palette which serves as a default for all widgets. There may -
4111 also be special palette defaults for certain types of widgets (e.g., on -
4112 Windows XP and Vista, all classes that derive from QMenuBar have a special -
4113 default palette). You can also define default palettes for widgets -
4114 yourself by passing a custom palette and the name of a widget to -
4115 QApplication::setPalette(). Finally, the style always has the option of -
4116 polishing the palette as it's assigned (see QStyle::polish()). -
4117 -
4118 QWidget propagates explicit palette roles from parent to child. If you -
4119 assign a brush or color to a specific role on a palette and assign that -
4120 palette to a widget, that role will propagate to all the widget's -
4121 children, overriding any system defaults for that role. Note that palettes -
4122 by default don't propagate to windows (see isWindow()) unless the -
4123 Qt::WA_WindowPropagation attribute is enabled. -
4124 -
4125 QWidget's palette propagation is similar to its font propagation. -
4126 -
4127 The current style, which is used to render the content of all standard Qt -
4128 widgets, is free to choose colors and brushes from the widget palette, or -
4129 in some cases, to ignore the palette (partially, or completely). In -
4130 particular, certain styles like GTK style, Mac style, Windows XP, and -
4131 Vista style, depend on third party APIs to render the content of widgets, -
4132 and these styles typically do not follow the palette. Because of this, -
4133 assigning roles to a widget's palette is not guaranteed to change the -
4134 appearance of the widget. Instead, you may choose to apply a \l -
4135 styleSheet. You can refer to our Knowledge Base article -
4136 \l{http://qt.nokia.com/developer/knowledgebase/22}{here} for more -
4137 information. -
4138 -
4139 \warning Do not use this function in conjunction with \l{Qt Style Sheets}. -
4140 When using style sheets, the palette of a widget can be customized using -
4141 the "color", "background-color", "selection-color", -
4142 "selection-background-color" and "alternate-background-color". -
4143 -
4144 \sa QApplication::palette(), QWidget::font() -
4145*/ -
4146const QPalette &QWidget::palette() const -
4147{ -
4148 if (!isEnabled()) {
evaluated: !isEnabled()
TRUEFALSE
yes
Evaluation Count:823
yes
Evaluation Count:386830
823-386830
4149 data->pal.setCurrentColorGroup(QPalette::Disabled);
executed (the execution status of this line is deduced): data->pal.setCurrentColorGroup(QPalette::Disabled);
-
4150 } else if ((!isVisible() || isActiveWindow())
executed: }
Execution Count:823
evaluated: !isVisible()
TRUEFALSE
yes
Evaluation Count:265743
yes
Evaluation Count:121087
evaluated: isActiveWindow()
TRUEFALSE
yes
Evaluation Count:67310
yes
Evaluation Count:53777
823-265743
4151#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) -
4152 && !QApplicationPrivate::isBlockedByModal(const_cast<QWidget *>(this)) -
4153#endif -
4154 ) { -
4155 data->pal.setCurrentColorGroup(QPalette::Active);
executed (the execution status of this line is deduced): data->pal.setCurrentColorGroup(QPalette::Active);
-
4156 } else {
executed: }
Execution Count:333053
333053
4157#ifdef Q_WS_MAC -
4158 extern bool qt_mac_can_clickThrough(const QWidget *); //qwidget_mac.cpp -
4159 if (qt_mac_can_clickThrough(this)) -
4160 data->pal.setCurrentColorGroup(QPalette::Active); -
4161 else -
4162#endif -
4163 data->pal.setCurrentColorGroup(QPalette::Inactive);
executed (the execution status of this line is deduced): data->pal.setCurrentColorGroup(QPalette::Inactive);
-
4164 }
executed: }
Execution Count:53777
53777
4165 return data->pal;
executed: return data->pal;
Execution Count:387653
387653
4166} -
4167 -
4168void QWidget::setPalette(const QPalette &palette) -
4169{ -
4170 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
4171 setAttribute(Qt::WA_SetPalette, palette.resolve() != 0);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_SetPalette, palette.resolve() != 0);
-
4172 -
4173 // Determine which palette is inherited from this widget's ancestors and -
4174 // QApplication::palette, resolve this against \a palette (attributes from -
4175 // the inherited palette are copied over this widget's palette). Then -
4176 // propagate this palette to this widget's children. -
4177 QPalette naturalPalette = d->naturalWidgetPalette(d->inheritedPaletteResolveMask);
executed (the execution status of this line is deduced): QPalette naturalPalette = d->naturalWidgetPalette(d->inheritedPaletteResolveMask);
-
4178 QPalette resolvedPalette = palette.resolve(naturalPalette);
executed (the execution status of this line is deduced): QPalette resolvedPalette = palette.resolve(naturalPalette);
-
4179 d->setPalette_helper(resolvedPalette);
executed (the execution status of this line is deduced): d->setPalette_helper(resolvedPalette);
-
4180}
executed: }
Execution Count:458
458
4181 -
4182/*! -
4183 \internal -
4184 -
4185 Returns the palette that the widget \a w inherits from its ancestors and -
4186 QApplication::palette. \a inheritedMask is the combination of the widget's -
4187 ancestors palette request masks (i.e., which attributes from the parent -
4188 widget's palette are implicitly imposed on this widget by the user). Note -
4189 that this font does not take into account the palette set on \a w itself. -
4190*/ -
4191QPalette QWidgetPrivate::naturalWidgetPalette(uint inheritedMask) const -
4192{ -
4193 Q_Q(const QWidget);
executed (the execution status of this line is deduced): const QWidget * const q = q_func();
-
4194 QPalette naturalPalette = QApplication::palette(q);
executed (the execution status of this line is deduced): QPalette naturalPalette = QApplication::palette(q);
-
4195 if (!q->testAttribute(Qt::WA_StyleSheet)
evaluated: !q->testAttribute(Qt::WA_StyleSheet)
TRUEFALSE
yes
Evaluation Count:32405
yes
Evaluation Count:4
4-32405
4196 && (!q->isWindow() || q->testAttribute(Qt::WA_WindowPropagation)
evaluated: !q->isWindow()
TRUEFALSE
yes
Evaluation Count:30815
yes
Evaluation Count:1590
evaluated: q->testAttribute(Qt::WA_WindowPropagation)
TRUEFALSE
yes
Evaluation Count:536
yes
Evaluation Count:1054
536-30815
4197#ifndef QT_NO_GRAPHICSVIEW
executed (the execution status of this line is deduced):
-
4198 || (extra && extra->proxyWidget)
evaluated: extra
TRUEFALSE
yes
Evaluation Count:93
yes
Evaluation Count:961
evaluated: extra->proxyWidget
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:85
8-961
4199#endif //QT_NO_GRAPHICSVIEW
executed (the execution status of this line is deduced):
-
4200 )) {
executed (the execution status of this line is deduced): )) {
-
4201 if (QWidget *p = q->parentWidget()) {
evaluated: QWidget *p = q->parentWidget()
TRUEFALSE
yes
Evaluation Count:31351
yes
Evaluation Count:8
8-31351
4202 if (!p->testAttribute(Qt::WA_StyleSheet)) {
partially evaluated: !p->testAttribute(Qt::WA_StyleSheet)
TRUEFALSE
yes
Evaluation Count:31351
no
Evaluation Count:0
0-31351
4203 if (!naturalPalette.isCopyOf(QApplication::palette())) {
evaluated: !naturalPalette.isCopyOf(QApplication::palette())
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:31347
4-31347
4204 QPalette inheritedPalette = p->palette();
executed (the execution status of this line is deduced): QPalette inheritedPalette = p->palette();
-
4205 inheritedPalette.resolve(inheritedMask);
executed (the execution status of this line is deduced): inheritedPalette.resolve(inheritedMask);
-
4206 naturalPalette = inheritedPalette.resolve(naturalPalette);
executed (the execution status of this line is deduced): naturalPalette = inheritedPalette.resolve(naturalPalette);
-
4207 } else {
executed: }
Execution Count:4
4
4208 naturalPalette = p->palette();
executed (the execution status of this line is deduced): naturalPalette = p->palette();
-
4209 }
executed: }
Execution Count:31347
31347
4210 } -
4211 }
executed: }
Execution Count:31351
31351
4212#ifndef QT_NO_GRAPHICSVIEW -
4213 else if (extra && extra->proxyWidget) {
partially evaluated: extra
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
partially evaluated: extra->proxyWidget
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
0-8
4214 QPalette inheritedPalette = extra->proxyWidget->palette();
executed (the execution status of this line is deduced): QPalette inheritedPalette = extra->proxyWidget->palette();
-
4215 inheritedPalette.resolve(inheritedMask);
executed (the execution status of this line is deduced): inheritedPalette.resolve(inheritedMask);
-
4216 naturalPalette = inheritedPalette.resolve(naturalPalette);
executed (the execution status of this line is deduced): naturalPalette = inheritedPalette.resolve(naturalPalette);
-
4217 }
executed: }
Execution Count:8
8
4218#endif //QT_NO_GRAPHICSVIEW -
4219 } -
4220 naturalPalette.resolve(0);
executed (the execution status of this line is deduced): naturalPalette.resolve(0);
-
4221 return naturalPalette;
executed: return naturalPalette;
Execution Count:32409
32409
4222} -
4223/*! -
4224 \internal -
4225 -
4226 Determine which palette is inherited from this widget's ancestors and -
4227 QApplication::palette, resolve this against this widget's palette -
4228 (attributes from the inherited palette are copied over this widget's -
4229 palette). Then propagate this palette to this widget's children. -
4230*/ -
4231void QWidgetPrivate::resolvePalette() -
4232{ -
4233 QPalette naturalPalette = naturalWidgetPalette(inheritedPaletteResolveMask);
executed (the execution status of this line is deduced): QPalette naturalPalette = naturalWidgetPalette(inheritedPaletteResolveMask);
-
4234 QPalette resolvedPalette = data.pal.resolve(naturalPalette);
executed (the execution status of this line is deduced): QPalette resolvedPalette = data.pal.resolve(naturalPalette);
-
4235 setPalette_helper(resolvedPalette);
executed (the execution status of this line is deduced): setPalette_helper(resolvedPalette);
-
4236}
executed: }
Execution Count:31951
31951
4237 -
4238void QWidgetPrivate::setPalette_helper(const QPalette &palette) -
4239{ -
4240 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
4241 if (data.pal == palette && data.pal.resolve() == palette.resolve())
evaluated: data.pal == palette
TRUEFALSE
yes
Evaluation Count:32274
yes
Evaluation Count:135
evaluated: data.pal.resolve() == palette.resolve()
TRUEFALSE
yes
Evaluation Count:32261
yes
Evaluation Count:13
13-32274
4242 return;
executed: return;
Execution Count:32261
32261
4243 data.pal = palette;
executed (the execution status of this line is deduced): data.pal = palette;
-
4244 updateSystemBackground();
executed (the execution status of this line is deduced): updateSystemBackground();
-
4245 propagatePaletteChange();
executed (the execution status of this line is deduced): propagatePaletteChange();
-
4246 updateIsOpaque();
executed (the execution status of this line is deduced): updateIsOpaque();
-
4247 q->update();
executed (the execution status of this line is deduced): q->update();
-
4248 updateIsOpaque();
executed (the execution status of this line is deduced): updateIsOpaque();
-
4249}
executed: }
Execution Count:148
148
4250 -
4251/*! -
4252 \property QWidget::font -
4253 \brief the font currently set for the widget -
4254 -
4255 This property describes the widget's requested font. The font is used by -
4256 the widget's style when rendering standard components, and is available as -
4257 a means to ensure that custom widgets can maintain consistency with the -
4258 native platform's look and feel. It's common that different platforms, or -
4259 different styles, define different fonts for an application. -
4260 -
4261 When you assign a new font to a widget, the properties from this font are -
4262 combined with the widget's default font to form the widget's final -
4263 font. You can call fontInfo() to get a copy of the widget's final -
4264 font. The final font is also used to initialize QPainter's font. -
4265 -
4266 The default depends on the system environment. QApplication maintains a -
4267 system/theme font which serves as a default for all widgets. There may -
4268 also be special font defaults for certain types of widgets. You can also -
4269 define default fonts for widgets yourself by passing a custom font and the -
4270 name of a widget to QApplication::setFont(). Finally, the font is matched -
4271 against Qt's font database to find the best match. -
4272 -
4273 QWidget propagates explicit font properties from parent to child. If you -
4274 change a specific property on a font and assign that font to a widget, -
4275 that property will propagate to all the widget's children, overriding any -
4276 system defaults for that property. Note that fonts by default don't -
4277 propagate to windows (see isWindow()) unless the Qt::WA_WindowPropagation -
4278 attribute is enabled. -
4279 -
4280 QWidget's font propagation is similar to its palette propagation. -
4281 -
4282 The current style, which is used to render the content of all standard Qt -
4283 widgets, is free to choose to use the widget font, or in some cases, to -
4284 ignore it (partially, or completely). In particular, certain styles like -
4285 GTK style, Mac style, Windows XP, and Vista style, apply special -
4286 modifications to the widget font to match the platform's native look and -
4287 feel. Because of this, assigning properties to a widget's font is not -
4288 guaranteed to change the appearance of the widget. Instead, you may choose -
4289 to apply a \l styleSheet. -
4290 -
4291 \note If \l{Qt Style Sheets} are used on the same widget as setFont(), -
4292 style sheets will take precedence if the settings conflict. -
4293 -
4294 \sa fontInfo(), fontMetrics() -
4295*/ -
4296 -
4297void QWidget::setFont(const QFont &font) -
4298{ -
4299 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
4300 -
4301#ifndef QT_NO_STYLE_STYLESHEET -
4302 const QStyleSheetStyle* style;
executed (the execution status of this line is deduced): const QStyleSheetStyle* style;
-
4303 if (d->extra && (style = qobject_cast<const QStyleSheetStyle*>(d->extra->style))) {
evaluated: d->extra
TRUEFALSE
yes
Evaluation Count:144
yes
Evaluation Count:84
partially evaluated: (style = qobject_cast<const QStyleSheetStyle*>(d->extra->style))
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:144
0-144
4304 style->saveWidgetFont(this, font);
never executed (the execution status of this line is deduced): style->saveWidgetFont(this, font);
-
4305 }
never executed: }
0
4306#endif -
4307 -
4308 setAttribute(Qt::WA_SetFont, font.resolve() != 0);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_SetFont, font.resolve() != 0);
-
4309 -
4310 // Determine which font is inherited from this widget's ancestors and -
4311 // QApplication::font, resolve this against \a font (attributes from the -
4312 // inherited font are copied over). Then propagate this font to this -
4313 // widget's children. -
4314 QFont naturalFont = d->naturalWidgetFont(d->inheritedFontResolveMask);
executed (the execution status of this line is deduced): QFont naturalFont = d->naturalWidgetFont(d->inheritedFontResolveMask);
-
4315 QFont resolvedFont = font.resolve(naturalFont);
executed (the execution status of this line is deduced): QFont resolvedFont = font.resolve(naturalFont);
-
4316 d->setFont_helper(resolvedFont);
executed (the execution status of this line is deduced): d->setFont_helper(resolvedFont);
-
4317}
executed: }
Execution Count:228
228
4318 -
4319/* -
4320 \internal -
4321 -
4322 Returns the font that the widget \a w inherits from its ancestors and -
4323 QApplication::font. \a inheritedMask is the combination of the widget's -
4324 ancestors font request masks (i.e., which attributes from the parent -
4325 widget's font are implicitly imposed on this widget by the user). Note -
4326 that this font does not take into account the font set on \a w itself. -
4327 -
4328 ### Stylesheet has a different font propagation mechanism. When a stylesheet -
4329 is applied, fonts are not propagated anymore -
4330*/ -
4331QFont QWidgetPrivate::naturalWidgetFont(uint inheritedMask) const -
4332{ -
4333 Q_Q(const QWidget);
executed (the execution status of this line is deduced): const QWidget * const q = q_func();
-
4334 QFont naturalFont = QApplication::font(q);
executed (the execution status of this line is deduced): QFont naturalFont = QApplication::font(q);
-
4335 if (!q->testAttribute(Qt::WA_StyleSheet)
evaluated: !q->testAttribute(Qt::WA_StyleSheet)
TRUEFALSE
yes
Evaluation Count:31468
yes
Evaluation Count:1
1-31468
4336 && (!q->isWindow() || q->testAttribute(Qt::WA_WindowPropagation)
evaluated: !q->isWindow()
TRUEFALSE
yes
Evaluation Count:30139
yes
Evaluation Count:1329
evaluated: q->testAttribute(Qt::WA_WindowPropagation)
TRUEFALSE
yes
Evaluation Count:270
yes
Evaluation Count:1059
270-30139
4337#ifndef QT_NO_GRAPHICSVIEW
executed (the execution status of this line is deduced):
-
4338 || (extra && extra->proxyWidget)
evaluated: extra
TRUEFALSE
yes
Evaluation Count:101
yes
Evaluation Count:958
partially evaluated: extra->proxyWidget
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:101
0-958
4339#endif //QT_NO_GRAPHICSVIEW
executed (the execution status of this line is deduced):
-
4340 )) {
executed (the execution status of this line is deduced): )) {
-
4341 if (QWidget *p = q->parentWidget()) {
partially evaluated: QWidget *p = q->parentWidget()
TRUEFALSE
yes
Evaluation Count:30409
no
Evaluation Count:0
0-30409
4342 if (!p->testAttribute(Qt::WA_StyleSheet)) {
partially evaluated: !p->testAttribute(Qt::WA_StyleSheet)
TRUEFALSE
yes
Evaluation Count:30409
no
Evaluation Count:0
0-30409
4343 if (!naturalFont.isCopyOf(QApplication::font())) {
evaluated: !naturalFont.isCopyOf(QApplication::font())
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:30405
4-30405
4344 QFont inheritedFont = p->font();
executed (the execution status of this line is deduced): QFont inheritedFont = p->font();
-
4345 inheritedFont.resolve(inheritedMask);
executed (the execution status of this line is deduced): inheritedFont.resolve(inheritedMask);
-
4346 naturalFont = inheritedFont.resolve(naturalFont);
executed (the execution status of this line is deduced): naturalFont = inheritedFont.resolve(naturalFont);
-
4347 } else {
executed: }
Execution Count:4
4
4348 naturalFont = p->font();
executed (the execution status of this line is deduced): naturalFont = p->font();
-
4349 }
executed: }
Execution Count:30405
30405
4350 } -
4351 }
executed: }
Execution Count:30409
30409
4352#ifndef QT_NO_GRAPHICSVIEW -
4353 else if (extra && extra->proxyWidget) {
never evaluated: extra
never evaluated: extra->proxyWidget
0
4354 QFont inheritedFont = extra->proxyWidget->font();
never executed (the execution status of this line is deduced): QFont inheritedFont = extra->proxyWidget->font();
-
4355 inheritedFont.resolve(inheritedMask);
never executed (the execution status of this line is deduced): inheritedFont.resolve(inheritedMask);
-
4356 naturalFont = inheritedFont.resolve(naturalFont);
never executed (the execution status of this line is deduced): naturalFont = inheritedFont.resolve(naturalFont);
-
4357 }
never executed: }
0
4358#endif //QT_NO_GRAPHICSVIEW -
4359 } -
4360 naturalFont.resolve(0);
executed (the execution status of this line is deduced): naturalFont.resolve(0);
-
4361 return naturalFont;
executed: return naturalFont;
Execution Count:31469
31469
4362} -
4363 -
4364/*! -
4365 \internal -
4366 -
4367 Determine which font is implicitly imposed on this widget by its ancestors -
4368 and QApplication::font, resolve this against its own font (attributes from -
4369 the implicit font are copied over). Then propagate this font to this -
4370 widget's children. -
4371*/ -
4372void QWidgetPrivate::resolveFont() -
4373{ -
4374 QFont naturalFont = naturalWidgetFont(inheritedFontResolveMask);
executed (the execution status of this line is deduced): QFont naturalFont = naturalWidgetFont(inheritedFontResolveMask);
-
4375 QFont resolvedFont = data.fnt.resolve(naturalFont);
executed (the execution status of this line is deduced): QFont resolvedFont = data.fnt.resolve(naturalFont);
-
4376 setFont_helper(resolvedFont);
executed (the execution status of this line is deduced): setFont_helper(resolvedFont);
-
4377}
executed: }
Execution Count:31241
31241
4378 -
4379/*! -
4380 \internal -
4381 -
4382 Assign \a font to this widget, and propagate it to all children, except -
4383 style sheet widgets (handled differently) and windows that don't enable -
4384 window propagation. \a implicitMask is the union of all ancestor widgets' -
4385 font request masks, and determines which attributes from this widget's -
4386 font should propagate. -
4387*/ -
4388void QWidgetPrivate::updateFont(const QFont &font) -
4389{ -
4390 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
4391#ifndef QT_NO_STYLE_STYLESHEET -
4392 const QStyleSheetStyle* cssStyle;
executed (the execution status of this line is deduced): const QStyleSheetStyle* cssStyle;
-
4393 cssStyle = extra ? qobject_cast<const QStyleSheetStyle*>(extra->style) : 0;
evaluated: extra
TRUEFALSE
yes
Evaluation Count:134
yes
Evaluation Count:248
134-248
4394#endif -
4395 -
4396 data.fnt = QFont(font, q);
executed (the execution status of this line is deduced): data.fnt = QFont(font, q);
-
4397#if defined(Q_WS_X11) -
4398 // make sure the font set on this widget is associated with the correct screen -
4399 data.fnt.x11SetScreen(xinfo.screen()); -
4400#endif -
4401 // Combine new mask with natural mask and propagate to children. -
4402#ifndef QT_NO_GRAPHICSVIEW -
4403 if (!q->parentWidget() && extra && extra->proxyWidget) {
evaluated: !q->parentWidget()
TRUEFALSE
yes
Evaluation Count:33
yes
Evaluation Count:349
evaluated: extra
TRUEFALSE
yes
Evaluation Count:22
yes
Evaluation Count:11
partially evaluated: extra->proxyWidget
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:22
0-349
4404 QGraphicsProxyWidget *p = extra->proxyWidget;
never executed (the execution status of this line is deduced): QGraphicsProxyWidget *p = extra->proxyWidget;
-
4405 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();
-
4406 } else
never executed: }
0
4407#endif //QT_NO_GRAPHICSVIEW -
4408 if (q->isWindow() && !q->testAttribute(Qt::WA_WindowPropagation)) {
evaluated: q->isWindow()
TRUEFALSE
yes
Evaluation Count:33
yes
Evaluation Count:349
partially evaluated: !q->testAttribute(Qt::WA_WindowPropagation)
TRUEFALSE
yes
Evaluation Count:33
no
Evaluation Count:0
0-349
4409 inheritedFontResolveMask = 0;
executed (the execution status of this line is deduced): inheritedFontResolveMask = 0;
-
4410 }
executed: }
Execution Count:33
33
4411 uint newMask = data.fnt.resolve() | inheritedFontResolveMask;
executed (the execution status of this line is deduced): uint newMask = data.fnt.resolve() | inheritedFontResolveMask;
-
4412 -
4413 for (int i = 0; i < children.size(); ++i) {
evaluated: i < children.size()
TRUEFALSE
yes
Evaluation Count:293
yes
Evaluation Count:382
293-382
4414 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));
-
4415 if (w) {
evaluated: w
TRUEFALSE
yes
Evaluation Count:164
yes
Evaluation Count:129
129-164
4416 if (0) {
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:164
0-164
4417#ifndef QT_NO_STYLE_STYLESHEET -
4418 } else if (w->testAttribute(Qt::WA_StyleSheet)) {
never executed: }
partially evaluated: w->testAttribute(Qt::WA_StyleSheet)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:164
0-164
4419 // Style sheets follow a different font propagation scheme. -
4420 if (cssStyle)
never evaluated: cssStyle
0
4421 cssStyle->updateStyleSheetFont(w);
never executed: cssStyle->updateStyleSheetFont(w);
0
4422#endif -
4423 } else if ((!w->isWindow() || w->testAttribute(Qt::WA_WindowPropagation))) {
never executed: }
evaluated: !w->isWindow()
TRUEFALSE
yes
Evaluation Count:139
yes
Evaluation Count:25
partially evaluated: w->testAttribute(Qt::WA_WindowPropagation)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:25
0-139
4424 // Propagate font changes. -
4425 QWidgetPrivate *wd = w->d_func();
executed (the execution status of this line is deduced): QWidgetPrivate *wd = w->d_func();
-
4426 wd->inheritedFontResolveMask = newMask;
executed (the execution status of this line is deduced): wd->inheritedFontResolveMask = newMask;
-
4427 wd->resolveFont();
executed (the execution status of this line is deduced): wd->resolveFont();
-
4428 }
executed: }
Execution Count:139
139
4429 } -
4430 }
executed: }
Execution Count:293
293
4431 -
4432#ifndef QT_NO_STYLE_STYLESHEET -
4433 if (cssStyle) {
partially evaluated: cssStyle
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:382
0-382
4434 cssStyle->updateStyleSheetFont(q);
never executed (the execution status of this line is deduced): cssStyle->updateStyleSheetFont(q);
-
4435 }
never executed: }
0
4436#endif -
4437 -
4438 QEvent e(QEvent::FontChange);
executed (the execution status of this line is deduced): QEvent e(QEvent::FontChange);
-
4439 QApplication::sendEvent(q, &e);
executed (the execution status of this line is deduced): QApplication::sendEvent(q, &e);
-
4440}
executed: }
Execution Count:382
382
4441 -
4442void QWidgetPrivate::setLayoutDirection_helper(Qt::LayoutDirection direction) -
4443{ -
4444 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
4445 -
4446 if ( (direction == Qt::RightToLeft) == q->testAttribute(Qt::WA_RightToLeft))
evaluated: (direction == Qt::RightToLeft) == q->testAttribute(Qt::WA_RightToLeft)
TRUEFALSE
yes
Evaluation Count:37309
yes
Evaluation Count:378
378-37309
4447 return;
executed: return;
Execution Count:37309
37309
4448 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));
-
4449 if (!children.isEmpty()) {
evaluated: !children.isEmpty()
TRUEFALSE
yes
Evaluation Count:246
yes
Evaluation Count:132
132-246
4450 for (int i = 0; i < children.size(); ++i) {
evaluated: i < children.size()
TRUEFALSE
yes
Evaluation Count:1105
yes
Evaluation Count:246
246-1105
4451 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));
-
4452 if (w && !w->isWindow() && !w->testAttribute(Qt::WA_SetLayoutDirection))
evaluated: w
TRUEFALSE
yes
Evaluation Count:327
yes
Evaluation Count:778
evaluated: !w->isWindow()
TRUEFALSE
yes
Evaluation Count:194
yes
Evaluation Count:133
evaluated: !w->testAttribute(Qt::WA_SetLayoutDirection)
TRUEFALSE
yes
Evaluation Count:193
yes
Evaluation Count:1
1-778
4453 w->d_func()->setLayoutDirection_helper(direction);
executed: w->d_func()->setLayoutDirection_helper(direction);
Execution Count:193
193
4454 }
executed: }
Execution Count:1105
1105
4455 }
executed: }
Execution Count:246
246
4456 QEvent e(QEvent::LayoutDirectionChange);
executed (the execution status of this line is deduced): QEvent e(QEvent::LayoutDirectionChange);
-
4457 QApplication::sendEvent(q, &e);
executed (the execution status of this line is deduced): QApplication::sendEvent(q, &e);
-
4458}
executed: }
Execution Count:378
378
4459 -
4460void QWidgetPrivate::resolveLayoutDirection() -
4461{ -
4462 Q_Q(const QWidget);
executed (the execution status of this line is deduced): const QWidget * const q = q_func();
-
4463 if (!q->testAttribute(Qt::WA_SetLayoutDirection))
partially evaluated: !q->testAttribute(Qt::WA_SetLayoutDirection)
TRUEFALSE
yes
Evaluation Count:36611
no
Evaluation Count:0
0-36611
4464 setLayoutDirection_helper(q->isWindow() ? QApplication::layoutDirection() : q->parentWidget()->layoutDirection());
executed: setLayoutDirection_helper(q->isWindow() ? QApplication::layoutDirection() : q->parentWidget()->layoutDirection());
Execution Count:36611
36611
4465}
executed: }
Execution Count:36611
36611
4466 -
4467/*! -
4468 \property QWidget::layoutDirection -
4469 -
4470 \brief the layout direction for this widget -
4471 -
4472 By default, this property is set to Qt::LeftToRight. -
4473 -
4474 When the layout direction is set on a widget, it will propagate to -
4475 the widget's children, but not to a child that is a window and not -
4476 to a child for which setLayoutDirection() has been explicitly -
4477 called. Also, child widgets added \e after setLayoutDirection() -
4478 has been called for the parent do not inherit the parent's layout -
4479 direction. -
4480 -
4481 This method no longer affects text layout direction since Qt 4.7. -
4482 -
4483 \sa QApplication::layoutDirection -
4484*/ -
4485void QWidget::setLayoutDirection(Qt::LayoutDirection direction) -
4486{ -
4487 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
4488 -
4489 if (direction == Qt::LayoutDirectionAuto) {
partially evaluated: direction == Qt::LayoutDirectionAuto
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:586
0-586
4490 unsetLayoutDirection();
never executed (the execution status of this line is deduced): unsetLayoutDirection();
-
4491 return;
never executed: return;
0
4492 } -
4493 -
4494 setAttribute(Qt::WA_SetLayoutDirection);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_SetLayoutDirection);
-
4495 d->setLayoutDirection_helper(direction);
executed (the execution status of this line is deduced): d->setLayoutDirection_helper(direction);
-
4496}
executed: }
Execution Count:586
586
4497 -
4498Qt::LayoutDirection QWidget::layoutDirection() const -
4499{ -
4500 return testAttribute(Qt::WA_RightToLeft) ? Qt::RightToLeft : Qt::LeftToRight;
executed: return testAttribute(Qt::WA_RightToLeft) ? Qt::RightToLeft : Qt::LeftToRight;
Execution Count:457997
457997
4501} -
4502 -
4503void QWidget::unsetLayoutDirection() -
4504{ -
4505 Q_D(QWidget);
never executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
4506 setAttribute(Qt::WA_SetLayoutDirection, false);
never executed (the execution status of this line is deduced): setAttribute(Qt::WA_SetLayoutDirection, false);
-
4507 d->resolveLayoutDirection();
never executed (the execution status of this line is deduced): d->resolveLayoutDirection();
-
4508}
never executed: }
0
4509 -
4510/*! -
4511 \fn QFontMetrics QWidget::fontMetrics() const -
4512 -
4513 Returns the font metrics for the widget's current font. -
4514 Equivalent to QFontMetrics(widget->font()). -
4515 -
4516 \sa font(), fontInfo(), setFont() -
4517*/ -
4518 -
4519/*! -
4520 \fn QFontInfo QWidget::fontInfo() const -
4521 -
4522 Returns the font info for the widget's current font. -
4523 Equivalent to QFontInto(widget->font()). -
4524 -
4525 \sa font(), fontMetrics(), setFont() -
4526*/ -
4527 -
4528 -
4529/*! -
4530 \property QWidget::cursor -
4531 \brief the cursor shape for this widget -
4532 -
4533 The mouse cursor will assume this shape when it's over this -
4534 widget. See the \l{Qt::CursorShape}{list of predefined cursor objects} for a range of useful shapes. -
4535 -
4536 An editor widget might use an I-beam cursor: -
4537 \snippet code/src_gui_kernel_qwidget.cpp 6 -
4538 -
4539 If no cursor has been set, or after a call to unsetCursor(), the -
4540 parent's cursor is used. -
4541 -
4542 By default, this property contains a cursor with the Qt::ArrowCursor -
4543 shape. -
4544 -
4545 Some underlying window implementations will reset the cursor if it -
4546 leaves a widget even if the mouse is grabbed. If you want to have -
4547 a cursor set for all widgets, even when outside the window, consider -
4548 QApplication::setOverrideCursor(). -
4549 -
4550 \sa QApplication::setOverrideCursor() -
4551*/ -
4552 -
4553#ifndef QT_NO_CURSOR -
4554QCursor QWidget::cursor() const -
4555{ -
4556 Q_D(const QWidget);
executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
4557 if (testAttribute(Qt::WA_SetCursor))
evaluated: testAttribute(Qt::WA_SetCursor)
TRUEFALSE
yes
Evaluation Count:40
yes
Evaluation Count:1983
40-1983
4558 return (d->extra && d->extra->curs)
executed: return (d->extra && d->extra->curs) ? *d->extra->curs : QCursor(Qt::ArrowCursor);
Execution Count:40
40
4559 ? *d->extra->curs
executed: return (d->extra && d->extra->curs) ? *d->extra->curs : QCursor(Qt::ArrowCursor);
Execution Count:40
40
4560 : QCursor(Qt::ArrowCursor);
executed: return (d->extra && d->extra->curs) ? *d->extra->curs : QCursor(Qt::ArrowCursor);
Execution Count:40
40
4561 if (isWindow() || !parentWidget())
partially evaluated: isWindow()
TRUEFALSE
yes
Evaluation Count:1983
no
Evaluation Count:0
never evaluated: !parentWidget()
0-1983
4562 return QCursor(Qt::ArrowCursor);
executed: return QCursor(Qt::ArrowCursor);
Execution Count:1983
1983
4563 return parentWidget()->cursor();
never executed: return parentWidget()->cursor();
0
4564} -
4565 -
4566void QWidget::setCursor(const QCursor &cursor) -
4567{ -
4568 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
4569// On Mac we must set the cursor even if it is the ArrowCursor. -
4570#if !defined(Q_WS_MAC) -
4571 if (cursor.shape() != Qt::ArrowCursor
evaluated: cursor.shape() != Qt::ArrowCursor
TRUEFALSE
yes
Evaluation Count:1786
yes
Evaluation Count:119
119-1786
4572 || (d->extra && d->extra->curs))
evaluated: d->extra
TRUEFALSE
yes
Evaluation Count:36
yes
Evaluation Count:83
evaluated: d->extra->curs
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:23
13-83
4573#endif -
4574 { -
4575 d->createExtra();
executed (the execution status of this line is deduced): d->createExtra();
-
4576 QCursor *newCursor = new QCursor(cursor);
executed (the execution status of this line is deduced): QCursor *newCursor = new QCursor(cursor);
-
4577 delete d->extra->curs;
executed (the execution status of this line is deduced): delete d->extra->curs;
-
4578 d->extra->curs = newCursor;
executed (the execution status of this line is deduced): d->extra->curs = newCursor;
-
4579 }
executed: }
Execution Count:1799
1799
4580 setAttribute(Qt::WA_SetCursor);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_SetCursor);
-
4581 d->setCursor_sys(cursor);
executed (the execution status of this line is deduced): d->setCursor_sys(cursor);
-
4582 -
4583 QEvent event(QEvent::CursorChange);
executed (the execution status of this line is deduced): QEvent event(QEvent::CursorChange);
-
4584 QApplication::sendEvent(this, &event);
executed (the execution status of this line is deduced): QApplication::sendEvent(this, &event);
-
4585}
executed: }
Execution Count:1905
1905
4586 -
4587void QWidget::unsetCursor() -
4588{ -
4589 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
4590 if (d->extra) {
evaluated: d->extra
TRUEFALSE
yes
Evaluation Count:41
yes
Evaluation Count:16
16-41
4591 delete d->extra->curs;
executed (the execution status of this line is deduced): delete d->extra->curs;
-
4592 d->extra->curs = 0;
executed (the execution status of this line is deduced): d->extra->curs = 0;
-
4593 }
executed: }
Execution Count:41
41
4594 if (!isWindow())
evaluated: !isWindow()
TRUEFALSE
yes
Evaluation Count:32
yes
Evaluation Count:25
25-32
4595 setAttribute(Qt::WA_SetCursor, false);
executed: setAttribute(Qt::WA_SetCursor, false);
Execution Count:32
32
4596 d->unsetCursor_sys();
executed (the execution status of this line is deduced): d->unsetCursor_sys();
-
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:57
57
4601 -
4602#endif -
4603 -
4604/*! -
4605 \enum QWidget::RenderFlag -
4606 -
4607 This enum describes how to render the widget when calling QWidget::render(). -
4608 -
4609 \value DrawWindowBackground If you enable this option, the widget's background -
4610 is rendered into the target even if autoFillBackground is not set. By default, -
4611 this option is enabled. -
4612 -
4613 \value DrawChildren If you enable this option, the widget's children -
4614 are rendered recursively into the target. By default, this option is enabled. -
4615 -
4616 \value IgnoreMask If you enable this option, the widget's QWidget::mask() -
4617 is ignored when rendering into the target. By default, this option is disabled. -
4618 -
4619 \since 4.3 -
4620*/ -
4621 -
4622/*! -
4623 \since 4.3 -
4624 -
4625 Renders the \a sourceRegion of this widget into the \a target -
4626 using \a renderFlags to determine how to render. Rendering -
4627 starts at \a targetOffset in the \a target. For example: -
4628 -
4629 \snippet code/src_gui_kernel_qwidget.cpp 7 -
4630 -
4631 If \a sourceRegion is a null region, this function will use QWidget::rect() as -
4632 the region, i.e. the entire widget. -
4633 -
4634 Ensure that you call QPainter::end() for the \a target device's -
4635 active painter (if any) before rendering. For example: -
4636 -
4637 \snippet code/src_gui_kernel_qwidget.cpp 8 -
4638 -
4639 \note To obtain the contents of an OpenGL widget, use QGLWidget::grabFrameBuffer() -
4640 or QGLWidget::renderPixmap() instead. -
4641*/ -
4642void QWidget::render(QPaintDevice *target, const QPoint &targetOffset, -
4643 const QRegion &sourceRegion, RenderFlags renderFlags) -
4644{ -
4645 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);
-
4646}
executed: }
Execution Count:44
44
4647 -
4648/*! -
4649 \overload -
4650 -
4651 Renders the widget into the \a painter's QPainter::device(). -
4652 -
4653 Transformations and settings applied to the \a painter will be used -
4654 when rendering. -
4655 -
4656 \note The \a painter must be active. On Mac OS X the widget will be -
4657 rendered into a QPixmap and then drawn by the \a painter. -
4658 -
4659 \sa QPainter::device() -
4660*/ -
4661void QWidget::render(QPainter *painter, const QPoint &targetOffset, -
4662 const QRegion &sourceRegion, RenderFlags renderFlags) -
4663{ -
4664 if (!painter) {
partially evaluated: !painter
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
4665 qWarning("QWidget::render: Null pointer to painter");
never executed (the execution status of this line is deduced): QMessageLogger("kernel/qwidget.cpp", 4665, __PRETTY_FUNCTION__).warning("QWidget::render: Null pointer to painter");
-
4666 return;
never executed: return;
0
4667 } -
4668 -
4669 if (!painter->isActive()) {
partially evaluated: !painter->isActive()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
4670 qWarning("QWidget::render: Cannot render with an inactive painter");
never executed (the execution status of this line is deduced): QMessageLogger("kernel/qwidget.cpp", 4670, __PRETTY_FUNCTION__).warning("QWidget::render: Cannot render with an inactive painter");
-
4671 return;
never executed: return;
0
4672 } -
4673 -
4674 const qreal opacity = painter->opacity();
executed (the execution status of this line is deduced): const qreal opacity = painter->opacity();
-
4675 if (qFuzzyIsNull(opacity))
partially evaluated: qFuzzyIsNull(opacity)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
4676 return; // Fully transparent.
never executed: return;
0
4677 -
4678 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
4679 const bool inRenderWithPainter = d->extra && d->extra->inRenderWithPainter;
partially evaluated: d->extra
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
partially evaluated: d->extra->inRenderWithPainter
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
4680 const QRegion toBePainted = !inRenderWithPainter ? d->prepareToRender(sourceRegion, renderFlags)
partially evaluated: !inRenderWithPainter
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
4681 : sourceRegion;
executed (the execution status of this line is deduced): : sourceRegion;
-
4682 if (toBePainted.isEmpty())
partially evaluated: toBePainted.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
4683 return;
never executed: return;
0
4684 -
4685 if (!d->extra)
partially evaluated: !d->extra
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
4686 d->createExtra();
never executed: d->createExtra();
0
4687 d->extra->inRenderWithPainter = true;
executed (the execution status of this line is deduced): d->extra->inRenderWithPainter = true;
-
4688 -
4689#ifdef Q_WS_MAC -
4690 d->render_helper(painter, targetOffset, toBePainted, renderFlags); -
4691#else -
4692 QPaintEngine *engine = painter->paintEngine();
executed (the execution status of this line is deduced): QPaintEngine *engine = painter->paintEngine();
-
4693 Q_ASSERT(engine);
executed (the execution status of this line is deduced): qt_noop();
-
4694 QPaintEnginePrivate *enginePriv = engine->d_func();
executed (the execution status of this line is deduced): QPaintEnginePrivate *enginePriv = engine->d_func();
-
4695 Q_ASSERT(enginePriv);
executed (the execution status of this line is deduced): qt_noop();
-
4696 QPaintDevice *target = engine->paintDevice();
executed (the execution status of this line is deduced): QPaintDevice *target = engine->paintDevice();
-
4697 Q_ASSERT(target);
executed (the execution status of this line is deduced): qt_noop();
-
4698 -
4699 // Render via a pixmap when dealing with non-opaque painters or printers. -
4700 if (!inRenderWithPainter && (opacity < 1.0 || (target->devType() == QInternal::Printer))) {
partially evaluated: !inRenderWithPainter
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
partially evaluated: opacity < 1.0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
partially evaluated: (target->devType() == QInternal::Printer)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
4701 d->render_helper(painter, targetOffset, toBePainted, renderFlags);
never executed (the execution status of this line is deduced): d->render_helper(painter, targetOffset, toBePainted, renderFlags);
-
4702 d->extra->inRenderWithPainter = false;
never executed (the execution status of this line is deduced): d->extra->inRenderWithPainter = false;
-
4703 return;
never executed: return;
0
4704 } -
4705 -
4706 // Set new shared painter. -
4707 QPainter *oldPainter = d->sharedPainter();
executed (the execution status of this line is deduced): QPainter *oldPainter = d->sharedPainter();
-
4708 d->setSharedPainter(painter);
executed (the execution status of this line is deduced): d->setSharedPainter(painter);
-
4709 -
4710 // Save current system clip, viewport and transform, -
4711 const QTransform oldTransform = enginePriv->systemTransform;
executed (the execution status of this line is deduced): const QTransform oldTransform = enginePriv->systemTransform;
-
4712 const QRegion oldSystemClip = enginePriv->systemClip;
executed (the execution status of this line is deduced): const QRegion oldSystemClip = enginePriv->systemClip;
-
4713 const QRegion oldSystemViewport = enginePriv->systemViewport;
executed (the execution status of this line is deduced): const QRegion oldSystemViewport = enginePriv->systemViewport;
-
4714 -
4715 // This ensures that all painting triggered by render() is clipped to the current engine clip. -
4716 if (painter->hasClipping()) {
partially evaluated: painter->hasClipping()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
4717 const QRegion painterClip = painter->deviceTransform().map(painter->clipRegion());
never executed (the execution status of this line is deduced): const QRegion painterClip = painter->deviceTransform().map(painter->clipRegion());
-
4718 enginePriv->setSystemViewport(oldSystemClip.isEmpty() ? painterClip : oldSystemClip & painterClip);
never executed (the execution status of this line is deduced): enginePriv->setSystemViewport(oldSystemClip.isEmpty() ? painterClip : oldSystemClip & painterClip);
-
4719 } else {
never executed: }
0
4720 enginePriv->setSystemViewport(oldSystemClip);
executed (the execution status of this line is deduced): enginePriv->setSystemViewport(oldSystemClip);
-
4721 }
executed: }
Execution Count:1
1
4722 -
4723 render(target, targetOffset, toBePainted, renderFlags);
executed (the execution status of this line is deduced): render(target, targetOffset, toBePainted, renderFlags);
-
4724 -
4725 // Restore system clip, viewport and transform. -
4726 enginePriv->systemClip = oldSystemClip;
executed (the execution status of this line is deduced): enginePriv->systemClip = oldSystemClip;
-
4727 enginePriv->setSystemViewport(oldSystemViewport);
executed (the execution status of this line is deduced): enginePriv->setSystemViewport(oldSystemViewport);
-
4728 enginePriv->setSystemTransform(oldTransform);
executed (the execution status of this line is deduced): enginePriv->setSystemTransform(oldTransform);
-
4729 -
4730 // Restore shared painter. -
4731 d->setSharedPainter(oldPainter);
executed (the execution status of this line is deduced): d->setSharedPainter(oldPainter);
-
4732#endif -
4733 -
4734 d->extra->inRenderWithPainter = false;
executed (the execution status of this line is deduced): d->extra->inRenderWithPainter = false;
-
4735}
executed: }
Execution Count:1
1
4736 -
4737static void sendResizeEvents(QWidget *target) -
4738{ -
4739 QResizeEvent e(target->size(), QSize());
never executed (the execution status of this line is deduced): QResizeEvent e(target->size(), QSize());
-
4740 QApplication::sendEvent(target, &e);
never executed (the execution status of this line is deduced): QApplication::sendEvent(target, &e);
-
4741 -
4742 const QObjectList children = target->children();
never executed (the execution status of this line is deduced): const QObjectList children = target->children();
-
4743 for (int i = 0; i < children.size(); ++i) {
never evaluated: i < children.size()
0
4744 QWidget *child = static_cast<QWidget*>(children.at(i));
never executed (the execution status of this line is deduced): QWidget *child = static_cast<QWidget*>(children.at(i));
-
4745 if (child->isWidgetType() && !child->isWindow() && child->testAttribute(Qt::WA_PendingResizeEvent))
never evaluated: child->isWidgetType()
never evaluated: !child->isWindow()
never evaluated: child->testAttribute(Qt::WA_PendingResizeEvent)
0
4746 sendResizeEvents(child);
never executed: sendResizeEvents(child);
0
4747 }
never executed: }
0
4748}
never executed: }
0
4749 -
4750/*! -
4751 \since 5.0 -
4752 -
4753 Renders the widget into a pixmap restricted by the -
4754 given \a rectangle. If the widget has any children, then -
4755 they are also painted in the appropriate positions. -
4756 -
4757 If a rectangle with an invalid size is specified (the default), -
4758 the entire widget is painted. -
4759 -
4760 \sa render(), QPixmap -
4761*/ -
4762 -
4763/* INVOKABLE since used by QPixmap::grabWidget(). */ -
4764QPixmap QWidget::grab(const QRect &rectangle) -
4765{ -
4766 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
4767 if (testAttribute(Qt::WA_PendingResizeEvent) || !testAttribute(Qt::WA_WState_Created))
partially evaluated: testAttribute(Qt::WA_PendingResizeEvent)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:41
partially evaluated: !testAttribute(Qt::WA_WState_Created)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:41
0-41
4768 sendResizeEvents(this);
never executed: sendResizeEvents(this);
0
4769 -
4770 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;
-
4771 -
4772 const bool oldDirtyOpaqueChildren = d->dirtyOpaqueChildren;
executed (the execution status of this line is deduced): const bool oldDirtyOpaqueChildren = d->dirtyOpaqueChildren;
-
4773 QRect r(rectangle);
executed (the execution status of this line is deduced): QRect r(rectangle);
-
4774 if (r.width() < 0 || r.height() < 0) {
partially evaluated: r.width() < 0
TRUEFALSE
yes
Evaluation Count:41
no
Evaluation Count:0
never evaluated: r.height() < 0
0-41
4775 // For grabbing widgets that haven't been shown yet, -
4776 // we trigger the layouting mechanism to determine the widget's size. -
4777 r = d->prepareToRender(QRegion(), renderFlags).boundingRect();
executed (the execution status of this line is deduced): r = d->prepareToRender(QRegion(), renderFlags).boundingRect();
-
4778 r.setTopLeft(rectangle.topLeft());
executed (the execution status of this line is deduced): r.setTopLeft(rectangle.topLeft());
-
4779 }
executed: }
Execution Count:41
41
4780 -
4781 if (!r.intersects(rect()))
partially evaluated: !r.intersects(rect())
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:41
0-41
4782 return QPixmap();
never executed: return QPixmap();
0
4783 -
4784 QPixmap res(r.size());
executed (the execution status of this line is deduced): QPixmap res(r.size());
-
4785 if (!d->isOpaque)
evaluated: !d->isOpaque
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:39
2-39
4786 res.fill(Qt::transparent);
executed: res.fill(Qt::transparent);
Execution Count:2
2
4787 render(&res, QPoint(), QRegion(r), renderFlags);
executed (the execution status of this line is deduced): render(&res, QPoint(), QRegion(r), renderFlags);
-
4788 -
4789 d->dirtyOpaqueChildren = oldDirtyOpaqueChildren;
executed (the execution status of this line is deduced): d->dirtyOpaqueChildren = oldDirtyOpaqueChildren;
-
4790 return res;
executed: return res;
Execution Count:41
41
4791} -
4792 -
4793/*! -
4794 \brief The graphicsEffect function returns a pointer to the -
4795 widget's graphics effect. -
4796 -
4797 If the widget has no graphics effect, 0 is returned. -
4798 -
4799 \since 4.6 -
4800 -
4801 \sa setGraphicsEffect() -
4802*/ -
4803#ifndef QT_NO_GRAPHICSEFFECT -
4804QGraphicsEffect *QWidget::graphicsEffect() const -
4805{ -
4806 Q_D(const QWidget);
executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
4807 return d->graphicsEffect;
executed: return d->graphicsEffect;
Execution Count:535252
535252
4808} -
4809#endif //QT_NO_GRAPHICSEFFECT -
4810 -
4811/*! -
4812 -
4813 \brief The setGraphicsEffect function is for setting the widget's graphics effect. -
4814 -
4815 Sets \a effect as the widget's effect. If there already is an effect installed -
4816 on this widget, QWidget will delete the existing effect before installing -
4817 the new \a effect. -
4818 -
4819 If \a effect is the installed on a different widget, setGraphicsEffect() will remove -
4820 the effect from the widget and install it on this widget. -
4821 -
4822 QWidget takes ownership of \a effect. -
4823 -
4824 \note This function will apply the effect on itself and all its children. -
4825 -
4826 \since 4.6 -
4827 -
4828 \sa graphicsEffect() -
4829*/ -
4830#ifndef QT_NO_GRAPHICSEFFECT -
4831void QWidget::setGraphicsEffect(QGraphicsEffect *effect) -
4832{ -
4833 Q_D(QWidget);
never executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
4834 if (d->graphicsEffect == effect)
never evaluated: d->graphicsEffect == effect
0
4835 return;
never executed: return;
0
4836 -
4837 if (d->graphicsEffect) {
never evaluated: d->graphicsEffect
0
4838 d->invalidateBuffer(rect());
never executed (the execution status of this line is deduced): d->invalidateBuffer(rect());
-
4839 delete d->graphicsEffect;
never executed (the execution status of this line is deduced): delete d->graphicsEffect;
-
4840 d->graphicsEffect = 0;
never executed (the execution status of this line is deduced): d->graphicsEffect = 0;
-
4841 }
never executed: }
0
4842 -
4843 if (effect) {
never evaluated: effect
0
4844 // Set new effect. -
4845 QGraphicsEffectSourcePrivate *sourced = new QWidgetEffectSourcePrivate(this);
never executed (the execution status of this line is deduced): QGraphicsEffectSourcePrivate *sourced = new QWidgetEffectSourcePrivate(this);
-
4846 QGraphicsEffectSource *source = new QGraphicsEffectSource(*sourced);
never executed (the execution status of this line is deduced): QGraphicsEffectSource *source = new QGraphicsEffectSource(*sourced);
-
4847 d->graphicsEffect = effect;
never executed (the execution status of this line is deduced): d->graphicsEffect = effect;
-
4848 effect->d_func()->setGraphicsEffectSource(source);
never executed (the execution status of this line is deduced): effect->d_func()->setGraphicsEffectSource(source);
-
4849 update();
never executed (the execution status of this line is deduced): update();
-
4850 }
never executed: }
0
4851 -
4852 d->updateIsOpaque();
never executed (the execution status of this line is deduced): d->updateIsOpaque();
-
4853}
never executed: }
0
4854#endif //QT_NO_GRAPHICSEFFECT -
4855 -
4856bool QWidgetPrivate::isAboutToShow() const -
4857{ -
4858 if (data.in_show)
never evaluated: data.in_show
0
4859 return true;
never executed: return true;
0
4860 -
4861 Q_Q(const QWidget);
never executed (the execution status of this line is deduced): const QWidget * const q = q_func();
-
4862 if (q->isHidden())
never evaluated: q->isHidden()
0
4863 return false;
never executed: return false;
0
4864 -
4865 // The widget will be shown if any of its ancestors are about to show. -
4866 QWidget *parent = q->parentWidget();
never executed (the execution status of this line is deduced): QWidget *parent = q->parentWidget();
-
4867 return parent ? parent->d_func()->isAboutToShow() : false;
never executed: return parent ? parent->d_func()->isAboutToShow() : false;
0
4868} -
4869 -
4870QRegion QWidgetPrivate::prepareToRender(const QRegion &region, QWidget::RenderFlags renderFlags) -
4871{ -
4872 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
4873 const bool isVisible = q->isVisible();
executed (the execution status of this line is deduced): const bool isVisible = q->isVisible();
-
4874 -
4875 // Make sure the widget is laid out correctly. -
4876 if (!isVisible && !isAboutToShow()) {
partially evaluated: !isVisible
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:85
never evaluated: !isAboutToShow()
0-85
4877 QWidget *topLevel = q->window();
never executed (the execution status of this line is deduced): QWidget *topLevel = q->window();
-
4878 (void)topLevel->d_func()->topData(); // Make sure we at least have top-data.
never executed (the execution status of this line is deduced): (void)topLevel->d_func()->topData();
-
4879 topLevel->ensurePolished();
never executed (the execution status of this line is deduced): topLevel->ensurePolished();
-
4880 -
4881 // Invalidate the layout of hidden ancestors (incl. myself) and pretend -
4882 // they're not explicitly hidden. -
4883 QWidget *widget = q;
never executed (the execution status of this line is deduced): QWidget *widget = q;
-
4884 QWidgetList hiddenWidgets;
never executed (the execution status of this line is deduced): QWidgetList hiddenWidgets;
-
4885 while (widget) {
never evaluated: widget
0
4886 if (widget->isHidden()) {
never evaluated: widget->isHidden()
0
4887 widget->setAttribute(Qt::WA_WState_Hidden, false);
never executed (the execution status of this line is deduced): widget->setAttribute(Qt::WA_WState_Hidden, false);
-
4888 hiddenWidgets.append(widget);
never executed (the execution status of this line is deduced): hiddenWidgets.append(widget);
-
4889 if (!widget->isWindow() && widget->parentWidget()->d_func()->layout)
never evaluated: !widget->isWindow()
never evaluated: widget->parentWidget()->d_func()->layout
0
4890 widget->d_func()->updateGeometry_helper(true);
never executed: widget->d_func()->updateGeometry_helper(true);
0
4891 }
never executed: }
0
4892 widget = widget->parentWidget();
never executed (the execution status of this line is deduced): widget = widget->parentWidget();
-
4893 }
never executed: }
0
4894 -
4895 // Activate top-level layout. -
4896 if (topLevel->d_func()->layout)
never evaluated: topLevel->d_func()->layout
0
4897 topLevel->d_func()->layout->activate();
never executed: topLevel->d_func()->layout->activate();
0
4898 -
4899 // Adjust size if necessary. -
4900 QTLWExtra *topLevelExtra = topLevel->d_func()->maybeTopData();
never executed (the execution status of this line is deduced): QTLWExtra *topLevelExtra = topLevel->d_func()->maybeTopData();
-
4901 if (topLevelExtra && !topLevelExtra->sizeAdjusted
never evaluated: topLevelExtra
never evaluated: !topLevelExtra->sizeAdjusted
0
4902 && !topLevel->testAttribute(Qt::WA_Resized)) {
never evaluated: !topLevel->testAttribute(Qt::WA_Resized)
0
4903 topLevel->adjustSize();
never executed (the execution status of this line is deduced): topLevel->adjustSize();
-
4904 topLevel->setAttribute(Qt::WA_Resized, false);
never executed (the execution status of this line is deduced): topLevel->setAttribute(Qt::WA_Resized, false);
-
4905 }
never executed: }
0
4906 -
4907 // Activate child layouts. -
4908 topLevel->d_func()->activateChildLayoutsRecursively();
never executed (the execution status of this line is deduced): topLevel->d_func()->activateChildLayoutsRecursively();
-
4909 -
4910 // We're not cheating with WA_WState_Hidden anymore. -
4911 for (int i = 0; i < hiddenWidgets.size(); ++i) {
never evaluated: i < hiddenWidgets.size()
0
4912 QWidget *widget = hiddenWidgets.at(i);
never executed (the execution status of this line is deduced): QWidget *widget = hiddenWidgets.at(i);
-
4913 widget->setAttribute(Qt::WA_WState_Hidden);
never executed (the execution status of this line is deduced): widget->setAttribute(Qt::WA_WState_Hidden);
-
4914 if (!widget->isWindow() && widget->parentWidget()->d_func()->layout)
never evaluated: !widget->isWindow()
never evaluated: widget->parentWidget()->d_func()->layout
0
4915 widget->parentWidget()->d_func()->layout->invalidate();
never executed: widget->parentWidget()->d_func()->layout->invalidate();
0
4916 }
never executed: }
0
4917 } else if (isVisible) {
never executed: }
partially evaluated: isVisible
TRUEFALSE
yes
Evaluation Count:85
no
Evaluation Count:0
0-85
4918 q->window()->d_func()->sendPendingMoveAndResizeEvents(true, true);
executed (the execution status of this line is deduced): q->window()->d_func()->sendPendingMoveAndResizeEvents(true, true);
-
4919 }
executed: }
Execution Count:85
85
4920 -
4921 // Calculate the region to be painted. -
4922 QRegion toBePainted = !region.isEmpty() ? region : QRegion(q->rect());
evaluated: !region.isEmpty()
TRUEFALSE
yes
Evaluation Count:42
yes
Evaluation Count:43
42-43
4923 if (!(renderFlags & QWidget::IgnoreMask) && extra && extra->hasMask)
evaluated: !(renderFlags & QWidget::IgnoreMask)
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:82
evaluated: extra
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:2
partially evaluated: extra->hasMask
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-82
4924 toBePainted &= extra->mask;
never executed: toBePainted &= extra->mask;
0
4925 return toBePainted;
executed: return toBePainted;
Execution Count:85
85
4926} -
4927 -
4928void QWidgetPrivate::render_helper(QPainter *painter, const QPoint &targetOffset, const QRegion &toBePainted, -
4929 QWidget::RenderFlags renderFlags) -
4930{ -
4931 Q_ASSERT(painter);
never executed (the execution status of this line is deduced): qt_noop();
-
4932 Q_ASSERT(!toBePainted.isEmpty());
never executed (the execution status of this line is deduced): qt_noop();
-
4933 -
4934 Q_Q(QWidget);
never executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
4935#ifndef Q_WS_MAC -
4936 const QTransform originalTransform = painter->worldTransform();
never executed (the execution status of this line is deduced): const QTransform originalTransform = painter->worldTransform();
-
4937 const bool useDeviceCoordinates = originalTransform.isScaling();
never executed (the execution status of this line is deduced): const bool useDeviceCoordinates = originalTransform.isScaling();
-
4938 if (!useDeviceCoordinates) {
never evaluated: !useDeviceCoordinates
0
4939#endif -
4940 // Render via a pixmap. -
4941 const QRect rect = toBePainted.boundingRect();
never executed (the execution status of this line is deduced): const QRect rect = toBePainted.boundingRect();
-
4942 const QSize size = rect.size();
never executed (the execution status of this line is deduced): const QSize size = rect.size();
-
4943 if (size.isNull())
never evaluated: size.isNull()
0
4944 return;
never executed: return;
0
4945 -
4946 QPixmap pixmap(size);
never executed (the execution status of this line is deduced): QPixmap pixmap(size);
-
4947 if (!(renderFlags & QWidget::DrawWindowBackground) || !isOpaque)
never evaluated: !(renderFlags & QWidget::DrawWindowBackground)
never evaluated: !isOpaque
0
4948 pixmap.fill(Qt::transparent);
never executed: pixmap.fill(Qt::transparent);
0
4949 q->render(&pixmap, QPoint(), toBePainted, renderFlags);
never executed (the execution status of this line is deduced): q->render(&pixmap, QPoint(), toBePainted, renderFlags);
-
4950 -
4951 const bool restore = !(painter->renderHints() & QPainter::SmoothPixmapTransform);
never executed (the execution status of this line is deduced): const bool restore = !(painter->renderHints() & QPainter::SmoothPixmapTransform);
-
4952 painter->setRenderHints(QPainter::SmoothPixmapTransform, true);
never executed (the execution status of this line is deduced): painter->setRenderHints(QPainter::SmoothPixmapTransform, true);
-
4953 -
4954 painter->drawPixmap(targetOffset, pixmap);
never executed (the execution status of this line is deduced): painter->drawPixmap(targetOffset, pixmap);
-
4955 -
4956 if (restore)
never evaluated: restore
0
4957 painter->setRenderHints(QPainter::SmoothPixmapTransform, false);
never executed: painter->setRenderHints(QPainter::SmoothPixmapTransform, false);
0
4958 -
4959#ifndef Q_WS_MAC -
4960 } else {
never executed: }
0
4961 // Render via a pixmap in device coordinates (to avoid pixmap scaling). -
4962 QTransform transform = originalTransform;
never executed (the execution status of this line is deduced): QTransform transform = originalTransform;
-
4963 transform.translate(targetOffset.x(), targetOffset.y());
never executed (the execution status of this line is deduced): transform.translate(targetOffset.x(), targetOffset.y());
-
4964 -
4965 QPaintDevice *device = painter->device();
never executed (the execution status of this line is deduced): QPaintDevice *device = painter->device();
-
4966 Q_ASSERT(device);
never executed (the execution status of this line is deduced): qt_noop();
-
4967 -
4968 // Calculate device rect. -
4969 const QRectF rect(toBePainted.boundingRect());
never executed (the execution status of this line is deduced): const QRectF rect(toBePainted.boundingRect());
-
4970 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();
-
4971 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());
-
4972 -
4973 QPixmap pixmap(deviceRect.size());
never executed (the execution status of this line is deduced): QPixmap pixmap(deviceRect.size());
-
4974 pixmap.fill(Qt::transparent);
never executed (the execution status of this line is deduced): pixmap.fill(Qt::transparent);
-
4975 -
4976 // Create a pixmap device coordinate painter. -
4977 QPainter pixmapPainter(&pixmap);
never executed (the execution status of this line is deduced): QPainter pixmapPainter(&pixmap);
-
4978 pixmapPainter.setRenderHints(painter->renderHints());
never executed (the execution status of this line is deduced): pixmapPainter.setRenderHints(painter->renderHints());
-
4979 transform *= QTransform::fromTranslate(-deviceRect.x(), -deviceRect.y());
never executed (the execution status of this line is deduced): transform *= QTransform::fromTranslate(-deviceRect.x(), -deviceRect.y());
-
4980 pixmapPainter.setTransform(transform);
never executed (the execution status of this line is deduced): pixmapPainter.setTransform(transform);
-
4981 -
4982 q->render(&pixmapPainter, QPoint(), toBePainted, renderFlags);
never executed (the execution status of this line is deduced): q->render(&pixmapPainter, QPoint(), toBePainted, renderFlags);
-
4983 pixmapPainter.end();
never executed (the execution status of this line is deduced): pixmapPainter.end();
-
4984 -
4985 // And then draw the pixmap. -
4986 painter->setTransform(QTransform());
never executed (the execution status of this line is deduced): painter->setTransform(QTransform());
-
4987 painter->drawPixmap(deviceRect.topLeft(), pixmap);
never executed (the execution status of this line is deduced): painter->drawPixmap(deviceRect.topLeft(), pixmap);
-
4988 painter->setTransform(originalTransform);
never executed (the execution status of this line is deduced): painter->setTransform(originalTransform);
-
4989 }
never executed: }
0
4990#endif -
4991} -
4992 -
4993void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QPoint &offset, int flags, -
4994 QPainter *sharedPainter, QWidgetBackingStore *backingStore) -
4995{ -
4996 if (rgn.isEmpty())
evaluated: rgn.isEmpty()
TRUEFALSE
yes
Evaluation Count:377
yes
Evaluation Count:9715
377-9715
4997 return;
executed: return;
Execution Count:377
377
4998 -
4999#ifdef Q_WS_MAC -
5000 if (qt_mac_clearDirtyOnWidgetInsideDrawWidget) -
5001 dirtyOnWidget = QRegion(); -
5002 -
5003 // We disable the rendering of QToolBar in the backingStore if -
5004 // it's supposed to be in the unified toolbar on Mac OS X. -
5005 if (backingStore && isInUnifiedToolbar) -
5006 return; -
5007#endif // Q_WS_MAC -
5008 -
5009 -
5010 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
5011#ifndef QT_NO_GRAPHICSEFFECT -
5012 if (graphicsEffect && graphicsEffect->isEnabled()) {
partially evaluated: graphicsEffect
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:9715
never evaluated: graphicsEffect->isEnabled()
0-9715
5013 QGraphicsEffectSource *source = graphicsEffect->d_func()->source;
never executed (the execution status of this line is deduced): QGraphicsEffectSource *source = graphicsEffect->d_func()->source;
-
5014 QWidgetEffectSourcePrivate *sourced = static_cast<QWidgetEffectSourcePrivate *>
never executed (the execution status of this line is deduced): QWidgetEffectSourcePrivate *sourced = static_cast<QWidgetEffectSourcePrivate *>
-
5015 (source->d_func());
never executed (the execution status of this line is deduced): (source->d_func());
-
5016 if (!sourced->context) {
never evaluated: !sourced->context
0
5017 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);
-
5018 sourced->context = &context;
never executed (the execution status of this line is deduced): sourced->context = &context;
-
5019 if (!sharedPainter) {
never evaluated: !sharedPainter
0
5020 setSystemClip(pdev, rgn.translated(offset));
never executed (the execution status of this line is deduced): setSystemClip(pdev, rgn.translated(offset));
-
5021 QPainter p(pdev);
never executed (the execution status of this line is deduced): QPainter p(pdev);
-
5022 p.translate(offset);
never executed (the execution status of this line is deduced): p.translate(offset);
-
5023 context.painter = &p;
never executed (the execution status of this line is deduced): context.painter = &p;
-
5024 graphicsEffect->draw(&p);
never executed (the execution status of this line is deduced): graphicsEffect->draw(&p);
-
5025 setSystemClip(pdev, QRegion());
never executed (the execution status of this line is deduced): setSystemClip(pdev, QRegion());
-
5026 } else {
never executed: }
0
5027 context.painter = sharedPainter;
never executed (the execution status of this line is deduced): context.painter = sharedPainter;
-
5028 if (sharedPainter->worldTransform() != sourced->lastEffectTransform) {
never evaluated: sharedPainter->worldTransform() != sourced->lastEffectTransform
0
5029 sourced->invalidateCache();
never executed (the execution status of this line is deduced): sourced->invalidateCache();
-
5030 sourced->lastEffectTransform = sharedPainter->worldTransform();
never executed (the execution status of this line is deduced): sourced->lastEffectTransform = sharedPainter->worldTransform();
-
5031 }
never executed: }
0
5032 sharedPainter->save();
never executed (the execution status of this line is deduced): sharedPainter->save();
-
5033 sharedPainter->translate(offset);
never executed (the execution status of this line is deduced): sharedPainter->translate(offset);
-
5034 graphicsEffect->draw(sharedPainter);
never executed (the execution status of this line is deduced): graphicsEffect->draw(sharedPainter);
-
5035 sharedPainter->restore();
never executed (the execution status of this line is deduced): sharedPainter->restore();
-
5036 }
never executed: }
0
5037 sourced->context = 0;
never executed (the execution status of this line is deduced): sourced->context = 0;
-
5038 return;
never executed: return;
0
5039 } -
5040 }
never executed: }
0
5041#endif //QT_NO_GRAFFICSEFFECT -
5042 -
5043 const bool asRoot = flags & DrawAsRoot;
executed (the execution status of this line is deduced): const bool asRoot = flags & DrawAsRoot;
-
5044 const bool alsoOnScreen = flags & DrawPaintOnScreen;
executed (the execution status of this line is deduced): const bool alsoOnScreen = flags & DrawPaintOnScreen;
-
5045 const bool recursive = flags & DrawRecursive;
executed (the execution status of this line is deduced): const bool recursive = flags & DrawRecursive;
-
5046 const bool alsoInvisible = flags & DrawInvisible;
executed (the execution status of this line is deduced): const bool alsoInvisible = flags & DrawInvisible;
-
5047 -
5048 Q_ASSERT(sharedPainter ? sharedPainter->isActive() : true);
executed (the execution status of this line is deduced): qt_noop();
-
5049 -
5050 QRegion toBePainted(rgn);
executed (the execution status of this line is deduced): QRegion toBePainted(rgn);
-
5051 if (asRoot && !alsoInvisible)
evaluated: asRoot
TRUEFALSE
yes
Evaluation Count:2334
yes
Evaluation Count:7381
evaluated: !alsoInvisible
TRUEFALSE
yes
Evaluation Count:2290
yes
Evaluation Count:44
44-7381
5052 toBePainted &= clipRect(); //(rgn & visibleRegion());
executed: toBePainted &= clipRect();
Execution Count:2290
2290
5053 if (!(flags & DontSubtractOpaqueChildren))
partially evaluated: !(flags & DontSubtractOpaqueChildren)
TRUEFALSE
yes
Evaluation Count:9715
no
Evaluation Count:0
0-9715
5054 subtractOpaqueChildren(toBePainted, q->rect());
executed: subtractOpaqueChildren(toBePainted, q->rect());
Execution Count:9715
9715
5055 -
5056 if (!toBePainted.isEmpty()) {
evaluated: !toBePainted.isEmpty()
TRUEFALSE
yes
Evaluation Count:8720
yes
Evaluation Count:995
995-8720
5057 bool onScreen = paintOnScreen();
never executed (the execution status of this line is deduced): bool onScreen = paintOnScreen();
-
5058 if (!onScreen || alsoOnScreen) {
partially evaluated: !onScreen
TRUEFALSE
yes
Evaluation Count:8720
no
Evaluation Count:0
never evaluated: alsoOnScreen
0-8720
5059 //update the "in paint event" flag -
5060 if (q->testAttribute(Qt::WA_WState_InPaintEvent))
partially evaluated: q->testAttribute(Qt::WA_WState_InPaintEvent)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8720
0-8720
5061 qWarning("QWidget::repaint: Recursive repaint detected");
never executed: QMessageLogger("kernel/qwidget.cpp", 5061, __PRETTY_FUNCTION__).warning("QWidget::repaint: Recursive repaint detected");
0
5062 q->setAttribute(Qt::WA_WState_InPaintEvent);
executed (the execution status of this line is deduced): q->setAttribute(Qt::WA_WState_InPaintEvent);
-
5063 -
5064 //clip away the new area -
5065#ifndef QT_NO_PAINT_DEBUG -
5066 bool flushed = QWidgetBackingStore::flushPaint(q, toBePainted); -
5067#endif -
5068 QPaintEngine *paintEngine = pdev->paintEngine();
executed (the execution status of this line is deduced): QPaintEngine *paintEngine = pdev->paintEngine();
-
5069 if (paintEngine) {
partially evaluated: paintEngine
TRUEFALSE
yes
Evaluation Count:8720
no
Evaluation Count:0
0-8720
5070 setRedirected(pdev, -offset);
executed (the execution status of this line is deduced): setRedirected(pdev, -offset);
-
5071 -
5072#ifdef Q_WS_MAC -
5073 // (Alien support) Special case for Mac when redirecting: If the paint device -
5074 // is of the Widget type we need to set WA_WState_InPaintEvent since painting -
5075 // outside the paint event is not supported on QWidgets. The attributeis -
5076 // restored further down. -
5077 if (pdev->devType() == QInternal::Widget) -
5078 static_cast<QWidget *>(pdev)->setAttribute(Qt::WA_WState_InPaintEvent); -
5079 -
5080#endif -
5081 if (sharedPainter)
evaluated: sharedPainter
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:8719
1-8719
5082 setSystemClip(pdev, toBePainted);
executed: setSystemClip(pdev, toBePainted);
Execution Count:1
1
5083 else -
5084 paintEngine->d_func()->systemRect = q->data->crect;
executed: paintEngine->d_func()->systemRect = q->data->crect;
Execution Count:8719
8719
5085 -
5086 //paint the background -
5087 if ((asRoot || q->autoFillBackground() || onScreen || q->testAttribute(Qt::WA_StyledBackground))
evaluated: asRoot
TRUEFALSE
yes
Evaluation Count:2053
yes
Evaluation Count:6667
evaluated: q->autoFillBackground()
TRUEFALSE
yes
Evaluation Count:2390
yes
Evaluation Count:4277
partially evaluated: onScreen
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4277
partially evaluated: q->testAttribute(Qt::WA_StyledBackground)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4277
0-6667
5088 && !q->testAttribute(Qt::WA_OpaquePaintEvent) && !q->testAttribute(Qt::WA_NoSystemBackground)) {
evaluated: !q->testAttribute(Qt::WA_OpaquePaintEvent)
TRUEFALSE
yes
Evaluation Count:4442
yes
Evaluation Count:1
evaluated: !q->testAttribute(Qt::WA_NoSystemBackground)
TRUEFALSE
yes
Evaluation Count:4440
yes
Evaluation Count:2
1-4442
5089 QPainter p(q);
executed (the execution status of this line is deduced): QPainter p(q);
-
5090 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);
-
5091 }
executed: }
Execution Count:4440
4440
5092 -
5093 if (!sharedPainter)
evaluated: !sharedPainter
TRUEFALSE
yes
Evaluation Count:8719
yes
Evaluation Count:1
1-8719
5094 setSystemClip(pdev, toBePainted.translated(offset));
executed: setSystemClip(pdev, toBePainted.translated(offset));
Execution Count:8719
8719
5095 -
5096 if (!onScreen && !asRoot && !isOpaque && q->testAttribute(Qt::WA_TintedBackground)) {
partially evaluated: !onScreen
TRUEFALSE
yes
Evaluation Count:8720
no
Evaluation Count:0
evaluated: !asRoot
TRUEFALSE
yes
Evaluation Count:6667
yes
Evaluation Count:2053
evaluated: !isOpaque
TRUEFALSE
yes
Evaluation Count:3552
yes
Evaluation Count:3115
partially evaluated: q->testAttribute(Qt::WA_TintedBackground)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3552
0-8720
5097 QPainter p(q);
never executed (the execution status of this line is deduced): QPainter p(q);
-
5098 QColor tint = q->palette().window().color();
never executed (the execution status of this line is deduced): QColor tint = q->palette().window().color();
-
5099 tint.setAlphaF(qreal(.6));
never executed (the execution status of this line is deduced): tint.setAlphaF(qreal(.6));
-
5100 p.fillRect(toBePainted.boundingRect(), tint);
never executed (the execution status of this line is deduced): p.fillRect(toBePainted.boundingRect(), tint);
-
5101 }
never executed: }
0
5102 }
executed: }
Execution Count:8720
8720
5103 -
5104#if 0 -
5105 qDebug() << "painting" << q << "opaque ==" << isOpaque(); -
5106 qDebug() << "clipping to" << toBePainted << "location == " << offset -
5107 << "geometry ==" << QRect(q->mapTo(q->window(), QPoint(0, 0)), q->size()); -
5108#endif -
5109 -
5110 //actually send the paint event -
5111 QPaintEvent e(toBePainted);
executed (the execution status of this line is deduced): QPaintEvent e(toBePainted);
-
5112 QCoreApplication::sendSpontaneousEvent(q, &e);
executed (the execution status of this line is deduced): QCoreApplication::sendSpontaneousEvent(q, &e);
-
5113 -
5114 // Native widgets need to be marked dirty on screen so painting will be done in correct context -
5115 if (backingStore && !onScreen && !asRoot && (q->internalWinId() || !q->nativeParentWidget()->isWindow()))
evaluated: backingStore
TRUEFALSE
yes
Evaluation Count:8356
yes
Evaluation Count:364
partially evaluated: !onScreen
TRUEFALSE
yes
Evaluation Count:8356
no
Evaluation Count:0
evaluated: !asRoot
TRUEFALSE
yes
Evaluation Count:6347
yes
Evaluation Count:2009
evaluated: q->internalWinId()
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:6338
evaluated: !q->nativeParentWidget()->isWindow()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:6336
0-8356
5116 backingStore->markDirtyOnScreen(toBePainted, q, offset);
executed: backingStore->markDirtyOnScreen(toBePainted, q, offset);
Execution Count:11
11
5117 -
5118 //restore -
5119 if (paintEngine) {
partially evaluated: paintEngine
TRUEFALSE
yes
Evaluation Count:8720
no
Evaluation Count:0
0-8720
5120#ifdef Q_WS_MAC -
5121 if (pdev->devType() == QInternal::Widget) -
5122 static_cast<QWidget *>(pdev)->setAttribute(Qt::WA_WState_InPaintEvent, false); -
5123#endif -
5124 restoreRedirected();
executed (the execution status of this line is deduced): restoreRedirected();
-
5125 if (!sharedPainter)
evaluated: !sharedPainter
TRUEFALSE
yes
Evaluation Count:8719
yes
Evaluation Count:1
1-8719
5126 paintEngine->d_func()->systemRect = QRect();
executed: paintEngine->d_func()->systemRect = QRect();
Execution Count:8719
8719
5127 else -
5128 paintEngine->d_func()->currentClipDevice = 0;
executed: paintEngine->d_func()->currentClipDevice = 0;
Execution Count:1
1
5129 -
5130 setSystemClip(pdev, QRegion());
executed (the execution status of this line is deduced): setSystemClip(pdev, QRegion());
-
5131 }
executed: }
Execution Count:8720
8720
5132 q->setAttribute(Qt::WA_WState_InPaintEvent, false);
executed (the execution status of this line is deduced): q->setAttribute(Qt::WA_WState_InPaintEvent, false);
-
5133 if (q->paintingActive())
partially evaluated: q->paintingActive()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8720
0-8720
5134 qWarning("QWidget::repaint: It is dangerous to leave painters active on a widget outside of the PaintEvent");
never executed: QMessageLogger("kernel/qwidget.cpp", 5134, __PRETTY_FUNCTION__).warning("QWidget::repaint: It is dangerous to leave painters active on a widget outside of the PaintEvent");
0
5135 -
5136 if (paintEngine && paintEngine->autoDestruct()) {
partially evaluated: paintEngine
TRUEFALSE
yes
Evaluation Count:8720
no
Evaluation Count:0
partially evaluated: paintEngine->autoDestruct()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8720
0-8720
5137 delete paintEngine;
never executed (the execution status of this line is deduced): delete paintEngine;
-
5138 }
never executed: }
0
5139 -
5140#ifndef QT_NO_PAINT_DEBUG -
5141 if (flushed) -
5142 QWidgetBackingStore::unflushPaint(q, toBePainted); -
5143#endif -
5144 } else if (q->isWindow()) {
executed: }
Execution Count:8720
never evaluated: q->isWindow()
0-8720
5145 QPaintEngine *engine = pdev->paintEngine();
never executed (the execution status of this line is deduced): QPaintEngine *engine = pdev->paintEngine();
-
5146 if (engine) {
never evaluated: engine
0
5147 QPainter p(pdev);
never executed (the execution status of this line is deduced): QPainter p(pdev);
-
5148 p.setClipRegion(toBePainted);
never executed (the execution status of this line is deduced): p.setClipRegion(toBePainted);
-
5149 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);
-
5150 if (bg.style() == Qt::TexturePattern)
never evaluated: bg.style() == Qt::TexturePattern
0
5151 p.drawTiledPixmap(q->rect(), bg.texture());
never executed: p.drawTiledPixmap(q->rect(), bg.texture());
0
5152 else -
5153 p.fillRect(q->rect(), bg);
never executed: p.fillRect(q->rect(), bg);
0
5154 -
5155 if (engine->autoDestruct())
never evaluated: engine->autoDestruct()
0
5156 delete engine;
never executed: delete engine;
0
5157 }
never executed: }
0
5158 }
never executed: }
0
5159 } -
5160 -
5161 if (recursive && !children.isEmpty()) {
partially evaluated: recursive
TRUEFALSE
yes
Evaluation Count:9715
no
Evaluation Count:0
evaluated: !children.isEmpty()
TRUEFALSE
yes
Evaluation Count:4604
yes
Evaluation Count:5111
0-9715
5162 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
-
5163 , sharedPainter, backingStore);
executed (the execution status of this line is deduced): , sharedPainter, backingStore);
-
5164 }
executed: }
Execution Count:4604
4604
5165}
executed: }
Execution Count:9715
9715
5166 -
5167void QWidgetPrivate::render(QPaintDevice *target, const QPoint &targetOffset, -
5168 const QRegion &sourceRegion, QWidget::RenderFlags renderFlags, -
5169 bool readyToRender) -
5170{ -
5171 if (!target) {
partially evaluated: !target
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:44
0-44
5172 qWarning("QWidget::render: null pointer to paint device");
never executed (the execution status of this line is deduced): QMessageLogger("kernel/qwidget.cpp", 5172, __PRETTY_FUNCTION__).warning("QWidget::render: null pointer to paint device");
-
5173 return;
never executed: return;
0
5174 } -
5175 -
5176 const bool inRenderWithPainter = extra && extra->inRenderWithPainter;
evaluated: extra
TRUEFALSE
yes
Evaluation Count:42
yes
Evaluation Count:2
evaluated: extra->inRenderWithPainter
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:41
1-42
5177 QRegion paintRegion = !inRenderWithPainter && !readyToRender
evaluated: !inRenderWithPainter
TRUEFALSE
yes
Evaluation Count:43
yes
Evaluation Count:1
partially evaluated: !readyToRender
TRUEFALSE
yes
Evaluation Count:43
no
Evaluation Count:0
0-43
5178 ? prepareToRender(sourceRegion, renderFlags)
executed (the execution status of this line is deduced): ? prepareToRender(sourceRegion, renderFlags)
-
5179 : sourceRegion;
executed (the execution status of this line is deduced): : sourceRegion;
-
5180 if (paintRegion.isEmpty())
partially evaluated: paintRegion.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:44
0-44
5181 return;
never executed: return;
0
5182 -
5183#ifndef Q_WS_MAC -
5184 QPainter *oldSharedPainter = inRenderWithPainter ? sharedPainter() : 0;
evaluated: inRenderWithPainter
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:43
1-43
5185 -
5186 // Use the target's shared painter if set (typically set when doing -
5187 // "other->render(widget);" in the widget's paintEvent. -
5188 if (target->devType() == QInternal::Widget) {
partially evaluated: target->devType() == QInternal::Widget
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:44
0-44
5189 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();
-
5190 if (targetPrivate->extra && targetPrivate->extra->inRenderWithPainter) {
never evaluated: targetPrivate->extra
never evaluated: targetPrivate->extra->inRenderWithPainter
0
5191 QPainter *targetPainter = targetPrivate->sharedPainter();
never executed (the execution status of this line is deduced): QPainter *targetPainter = targetPrivate->sharedPainter();
-
5192 if (targetPainter && targetPainter->isActive())
never evaluated: targetPainter
never evaluated: targetPainter->isActive()
0
5193 setSharedPainter(targetPainter);
never executed: setSharedPainter(targetPainter);
0
5194 }
never executed: }
0
5195 }
never executed: }
0
5196#endif -
5197 -
5198 // Use the target's redirected device if set and adjust offset and paint -
5199 // region accordingly. This is typically the case when people call render -
5200 // from the paintEvent. -
5201 QPoint offset = targetOffset;
executed (the execution status of this line is deduced): QPoint offset = targetOffset;
-
5202 offset -= paintRegion.boundingRect().topLeft();
executed (the execution status of this line is deduced): offset -= paintRegion.boundingRect().topLeft();
-
5203 QPoint redirectionOffset;
executed (the execution status of this line is deduced): QPoint redirectionOffset;
-
5204 QPaintDevice *redirected = 0;
executed (the execution status of this line is deduced): QPaintDevice *redirected = 0;
-
5205 -
5206 if (target->devType() == QInternal::Widget)
partially evaluated: target->devType() == QInternal::Widget
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:44
0-44
5207 redirected = static_cast<QWidget *>(target)->d_func()->redirected(&redirectionOffset);
never executed: redirected = static_cast<QWidget *>(target)->d_func()->redirected(&redirectionOffset);
0
5208 if (!redirected)
partially evaluated: !redirected
TRUEFALSE
yes
Evaluation Count:44
no
Evaluation Count:0
0-44
5209 redirected = QPainter::redirected(target, &redirectionOffset);
executed: redirected = QPainter::redirected(target, &redirectionOffset);
Execution Count:44
44
5210 -
5211 if (redirected) {
partially evaluated: redirected
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:44
0-44
5212 target = redirected;
never executed (the execution status of this line is deduced): target = redirected;
-
5213 offset -= redirectionOffset;
never executed (the execution status of this line is deduced): offset -= redirectionOffset;
-
5214 }
never executed: }
0
5215 -
5216 if (!inRenderWithPainter) { // Clip handled by shared painter (in qpainter.cpp).
evaluated: !inRenderWithPainter
TRUEFALSE
yes
Evaluation Count:43
yes
Evaluation Count:1
1-43
5217 if (QPaintEngine *targetEngine = target->paintEngine()) {
partially evaluated: QPaintEngine *targetEngine = target->paintEngine()
TRUEFALSE
yes
Evaluation Count:43
no
Evaluation Count:0
0-43
5218 const QRegion targetSystemClip = targetEngine->systemClip();
executed (the execution status of this line is deduced): const QRegion targetSystemClip = targetEngine->systemClip();
-
5219 if (!targetSystemClip.isEmpty())
partially evaluated: !targetSystemClip.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:43
0-43
5220 paintRegion &= targetSystemClip.translated(-offset);
never executed: paintRegion &= targetSystemClip.translated(-offset);
0
5221 }
executed: }
Execution Count:43
43
5222 }
executed: }
Execution Count:43
43
5223 -
5224 // Set backingstore flags. -
5225 int flags = DrawPaintOnScreen | DrawInvisible;
executed (the execution status of this line is deduced): int flags = DrawPaintOnScreen | DrawInvisible;
-
5226 if (renderFlags & QWidget::DrawWindowBackground)
partially evaluated: renderFlags & QWidget::DrawWindowBackground
TRUEFALSE
yes
Evaluation Count:44
no
Evaluation Count:0
0-44
5227 flags |= DrawAsRoot;
executed: flags |= DrawAsRoot;
Execution Count:44
44
5228 -
5229 if (renderFlags & QWidget::DrawChildren)
partially evaluated: renderFlags & QWidget::DrawChildren
TRUEFALSE
yes
Evaluation Count:44
no
Evaluation Count:0
0-44
5230 flags |= DrawRecursive;
executed: flags |= DrawRecursive;
Execution Count:44
44
5231 else -
5232 flags |= DontSubtractOpaqueChildren;
never executed: flags |= DontSubtractOpaqueChildren;
0
5233 -
5234 flags |= DontSetCompositionMode;
executed (the execution status of this line is deduced): flags |= DontSetCompositionMode;
-
5235 -
5236 if (target->devType() == QInternal::Printer) {
partially evaluated: target->devType() == QInternal::Printer
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:44
0-44
5237 QPainter p(target);
never executed (the execution status of this line is deduced): QPainter p(target);
-
5238 render_helper(&p, targetOffset, paintRegion, renderFlags);
never executed (the execution status of this line is deduced): render_helper(&p, targetOffset, paintRegion, renderFlags);
-
5239 return;
never executed: return;
0
5240 } -
5241 -
5242#ifndef Q_WS_MAC -
5243 // Render via backingstore. -
5244 drawWidget(target, paintRegion, offset, flags, sharedPainter());
executed (the execution status of this line is deduced): drawWidget(target, paintRegion, offset, flags, sharedPainter());
-
5245 -
5246 // Restore shared painter. -
5247 if (oldSharedPainter)
evaluated: oldSharedPainter
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:43
1-43
5248 setSharedPainter(oldSharedPainter);
executed: setSharedPainter(oldSharedPainter);
Execution Count:1
1
5249#else -
5250 // Render via backingstore (no shared painter). -
5251 drawWidget(target, paintRegion, offset, flags, 0); -
5252#endif -
5253}
executed: }
Execution Count:44
44
5254 -
5255void QWidgetPrivate::paintSiblingsRecursive(QPaintDevice *pdev, const QObjectList& siblings, int index, const QRegion &rgn, -
5256 const QPoint &offset, int flags -
5257 , QPainter *sharedPainter, QWidgetBackingStore *backingStore) -
5258{ -
5259 QWidget *w = 0;
executed (the execution status of this line is deduced): QWidget *w = 0;
-
5260 QRect boundingRect;
executed (the execution status of this line is deduced): QRect boundingRect;
-
5261 bool dirtyBoundingRect = true;
executed (the execution status of this line is deduced): bool dirtyBoundingRect = true;
-
5262 const bool exludeOpaqueChildren = (flags & DontDrawOpaqueChildren);
executed (the execution status of this line is deduced): const bool exludeOpaqueChildren = (flags & DontDrawOpaqueChildren);
-
5263 const bool excludeNativeChildren = (flags & DontDrawNativeChildren);
executed (the execution status of this line is deduced): const bool excludeNativeChildren = (flags & DontDrawNativeChildren);
-
5264 -
5265 do { -
5266 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));
-
5267 if (x && !(exludeOpaqueChildren && x->d_func()->isOpaque) && !x->isHidden() && !x->isWindow()
evaluated: x
TRUEFALSE
yes
Evaluation Count:12130
yes
Evaluation Count:6573
evaluated: exludeOpaqueChildren
TRUEFALSE
yes
Evaluation Count:1137
yes
Evaluation Count:10993
evaluated: x->d_func()->isOpaque
TRUEFALSE
yes
Evaluation Count:247
yes
Evaluation Count:890
evaluated: !x->isHidden()
TRUEFALSE
yes
Evaluation Count:8569
yes
Evaluation Count:3314
evaluated: !x->isWindow()
TRUEFALSE
yes
Evaluation Count:8546
yes
Evaluation Count:23
23-12130
5268 && !(excludeNativeChildren && x->internalWinId())) {
partially evaluated: excludeNativeChildren
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8546
never evaluated: x->internalWinId()
0-8546
5269 if (dirtyBoundingRect) {
evaluated: dirtyBoundingRect
TRUEFALSE
yes
Evaluation Count:6600
yes
Evaluation Count:1946
1946-6600
5270 boundingRect = rgn.boundingRect();
executed (the execution status of this line is deduced): boundingRect = rgn.boundingRect();
-
5271 dirtyBoundingRect = false;
executed (the execution status of this line is deduced): dirtyBoundingRect = false;
-
5272 }
executed: }
Execution Count:6600
6600
5273 -
5274 if (qRectIntersects(boundingRect, x->d_func()->effectiveRectFor(x->data->crect))) {
evaluated: qRectIntersects(boundingRect, x->d_func()->effectiveRectFor(x->data->crect))
TRUEFALSE
yes
Evaluation Count:6076
yes
Evaluation Count:2470
2470-6076
5275 w = x;
executed (the execution status of this line is deduced): w = x;
-
5276 break;
executed: break;
Execution Count:6076
6076
5277 } -
5278 }
executed: }
Execution Count:2470
2470
5279 --index;
executed (the execution status of this line is deduced): --index;
-
5280 } while (index >= 0);
executed: }
Execution Count:12627
evaluated: index >= 0
TRUEFALSE
yes
Evaluation Count:10123
yes
Evaluation Count:2504
2504-12627
5281 -
5282 if (!w)
evaluated: !w
TRUEFALSE
yes
Evaluation Count:2504
yes
Evaluation Count:6076
2504-6076
5283 return;
executed: return;
Execution Count:2504
2504
5284 -
5285 QWidgetPrivate *wd = w->d_func();
executed (the execution status of this line is deduced): QWidgetPrivate *wd = w->d_func();
-
5286 const QPoint widgetPos(w->data->crect.topLeft());
executed (the execution status of this line is deduced): const QPoint widgetPos(w->data->crect.topLeft());
-
5287 const bool hasMask = wd->extra && wd->extra->hasMask && !wd->graphicsEffect;
evaluated: wd->extra
TRUEFALSE
yes
Evaluation Count:3148
yes
Evaluation Count:2928
partially evaluated: wd->extra->hasMask
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3148
never evaluated: !wd->graphicsEffect
0-3148
5288 if (index > 0) {
evaluated: index > 0
TRUEFALSE
yes
Evaluation Count:3976
yes
Evaluation Count:2100
2100-3976
5289 QRegion wr(rgn);
executed (the execution status of this line is deduced): QRegion wr(rgn);
-
5290 if (wd->isOpaque)
evaluated: wd->isOpaque
TRUEFALSE
yes
Evaluation Count:445
yes
Evaluation Count:3531
445-3531
5291 wr -= hasMask ? wd->extra->mask.translated(widgetPos) : w->data->crect;
executed: wr -= hasMask ? wd->extra->mask.translated(widgetPos) : w->data->crect;
Execution Count:445
partially evaluated: hasMask
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:445
0-445
5292 paintSiblingsRecursive(pdev, siblings, --index, wr, offset, flags
executed (the execution status of this line is deduced): paintSiblingsRecursive(pdev, siblings, --index, wr, offset, flags
-
5293 , sharedPainter, backingStore);
executed (the execution status of this line is deduced): , sharedPainter, backingStore);
-
5294 }
executed: }
Execution Count:3976
3976
5295 -
5296 if (w->updatesEnabled()
partially evaluated: w->updatesEnabled()
TRUEFALSE
yes
Evaluation Count:6076
no
Evaluation Count:0
0-6076
5297#ifndef QT_NO_GRAPHICSVIEW
executed (the execution status of this line is deduced):
-
5298 && (!w->d_func()->extra || !w->d_func()->extra->proxyWidget)
evaluated: !w->d_func()->extra
TRUEFALSE
yes
Evaluation Count:2928
yes
Evaluation Count:3148
partially evaluated: !w->d_func()->extra->proxyWidget
TRUEFALSE
yes
Evaluation Count:3148
no
Evaluation Count:0
0-3148
5299#endif //QT_NO_GRAPHICSVIEW -
5300 ) { -
5301 QRegion wRegion(rgn);
executed (the execution status of this line is deduced): QRegion wRegion(rgn);
-
5302 wRegion &= wd->effectiveRectFor(w->data->crect);
executed (the execution status of this line is deduced): wRegion &= wd->effectiveRectFor(w->data->crect);
-
5303 wRegion.translate(-widgetPos);
executed (the execution status of this line is deduced): wRegion.translate(-widgetPos);
-
5304 if (hasMask)
partially evaluated: hasMask
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6076
0-6076
5305 wRegion &= wd->extra->mask;
never executed: wRegion &= wd->extra->mask;
0
5306 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);
-
5307 }
executed: }
Execution Count:6076
6076
5308}
executed: }
Execution Count:6076
6076
5309 -
5310#ifndef QT_NO_GRAPHICSEFFECT -
5311QRectF QWidgetEffectSourcePrivate::boundingRect(Qt::CoordinateSystem system) const -
5312{ -
5313 if (system != Qt::DeviceCoordinates)
never evaluated: system != Qt::DeviceCoordinates
0
5314 return m_widget->rect();
never executed: return m_widget->rect();
0
5315 -
5316 if (!context) {
never evaluated: !context
0
5317 // Device coordinates without context not yet supported. -
5318 qWarning("QGraphicsEffectSource::boundingRect: Not yet implemented, lacking device context");
never executed (the execution status of this line is deduced): QMessageLogger("kernel/qwidget.cpp", 5318, __PRETTY_FUNCTION__).warning("QGraphicsEffectSource::boundingRect: Not yet implemented, lacking device context");
-
5319 return QRectF();
never executed: return QRectF();
0
5320 } -
5321 -
5322 return context->painter->worldTransform().mapRect(m_widget->rect());
never executed: return context->painter->worldTransform().mapRect(m_widget->rect());
0
5323} -
5324 -
5325void QWidgetEffectSourcePrivate::draw(QPainter *painter) -
5326{ -
5327 if (!context || context->painter != painter) {
never evaluated: !context
never evaluated: context->painter != painter
0
5328 m_widget->render(painter);
never executed (the execution status of this line is deduced): m_widget->render(painter);
-
5329 return;
never executed: return;
0
5330 } -
5331 -
5332 // The region saved in the context is neither clipped to the rect -
5333 // nor the mask, so we have to clip it here before calling drawWidget. -
5334 QRegion toBePainted = context->rgn;
never executed (the execution status of this line is deduced): QRegion toBePainted = context->rgn;
-
5335 toBePainted &= m_widget->rect();
never executed (the execution status of this line is deduced): toBePainted &= m_widget->rect();
-
5336 QWidgetPrivate *wd = qt_widget_private(m_widget);
never executed (the execution status of this line is deduced): QWidgetPrivate *wd = qt_widget_private(m_widget);
-
5337 if (wd->extra && wd->extra->hasMask)
never evaluated: wd->extra
never evaluated: wd->extra->hasMask
0
5338 toBePainted &= wd->extra->mask;
never executed: toBePainted &= wd->extra->mask;
0
5339 -
5340 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,
-
5341 context->sharedPainter, context->backingStore);
never executed (the execution status of this line is deduced): context->sharedPainter, context->backingStore);
-
5342}
never executed: }
0
5343 -
5344QPixmap QWidgetEffectSourcePrivate::pixmap(Qt::CoordinateSystem system, QPoint *offset, -
5345 QGraphicsEffect::PixmapPadMode mode) const -
5346{ -
5347 const bool deviceCoordinates = (system == Qt::DeviceCoordinates);
never executed (the execution status of this line is deduced): const bool deviceCoordinates = (system == Qt::DeviceCoordinates);
-
5348 if (!context && deviceCoordinates) {
never evaluated: !context
never evaluated: deviceCoordinates
0
5349 // Device coordinates without context not yet supported. -
5350 qWarning("QGraphicsEffectSource::pixmap: Not yet implemented, lacking device context");
never executed (the execution status of this line is deduced): QMessageLogger("kernel/qwidget.cpp", 5350, __PRETTY_FUNCTION__).warning("QGraphicsEffectSource::pixmap: Not yet implemented, lacking device context");
-
5351 return QPixmap();
never executed: return QPixmap();
0
5352 } -
5353 -
5354 QPoint pixmapOffset;
never executed (the execution status of this line is deduced): QPoint pixmapOffset;
-
5355 QRectF sourceRect = m_widget->rect();
never executed (the execution status of this line is deduced): QRectF sourceRect = m_widget->rect();
-
5356 -
5357 if (deviceCoordinates) {
never evaluated: deviceCoordinates
0
5358 const QTransform &painterTransform = context->painter->worldTransform();
never executed (the execution status of this line is deduced): const QTransform &painterTransform = context->painter->worldTransform();
-
5359 sourceRect = painterTransform.mapRect(sourceRect);
never executed (the execution status of this line is deduced): sourceRect = painterTransform.mapRect(sourceRect);
-
5360 pixmapOffset = painterTransform.map(pixmapOffset);
never executed (the execution status of this line is deduced): pixmapOffset = painterTransform.map(pixmapOffset);
-
5361 }
never executed: }
0
5362 -
5363 QRect effectRect;
never executed (the execution status of this line is deduced): QRect effectRect;
-
5364 -
5365 if (mode == QGraphicsEffect::PadToEffectiveBoundingRect)
never evaluated: mode == QGraphicsEffect::PadToEffectiveBoundingRect
0
5366 effectRect = m_widget->graphicsEffect()->boundingRectFor(sourceRect).toAlignedRect();
never executed: effectRect = m_widget->graphicsEffect()->boundingRectFor(sourceRect).toAlignedRect();
0
5367 else if (mode == QGraphicsEffect::PadToTransparentBorder)
never evaluated: mode == QGraphicsEffect::PadToTransparentBorder
0
5368 effectRect = sourceRect.adjusted(-1, -1, 1, 1).toAlignedRect();
never executed: effectRect = sourceRect.adjusted(-1, -1, 1, 1).toAlignedRect();
0
5369 else -
5370 effectRect = sourceRect.toAlignedRect();
never executed: effectRect = sourceRect.toAlignedRect();
0
5371 -
5372 if (offset)
never evaluated: offset
0
5373 *offset = effectRect.topLeft();
never executed: *offset = effectRect.topLeft();
0
5374 -
5375 pixmapOffset -= effectRect.topLeft();
never executed (the execution status of this line is deduced): pixmapOffset -= effectRect.topLeft();
-
5376 -
5377 QPixmap pixmap(effectRect.size());
never executed (the execution status of this line is deduced): QPixmap pixmap(effectRect.size());
-
5378 pixmap.fill(Qt::transparent);
never executed (the execution status of this line is deduced): pixmap.fill(Qt::transparent);
-
5379 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);
-
5380 return pixmap;
never executed: return pixmap;
0
5381} -
5382#endif //QT_NO_GRAPHICSEFFECT -
5383 -
5384#ifndef QT_NO_GRAPHICSVIEW -
5385/*! -
5386 \internal -
5387 -
5388 Finds the nearest widget embedded in a graphics proxy widget along the chain formed by this -
5389 widget and its ancestors. The search starts at \a origin (inclusive). -
5390 If successful, the function returns the proxy that embeds the widget, or 0 if no embedded -
5391 widget was found. -
5392*/ -
5393QGraphicsProxyWidget * QWidgetPrivate::nearestGraphicsProxyWidget(const QWidget *origin) -
5394{ -
5395 if (origin) {
evaluated: origin
TRUEFALSE
yes
Evaluation Count:5344
yes
Evaluation Count:5465
5344-5465
5396 QWExtra *extra = origin->d_func()->extra;
executed (the execution status of this line is deduced): QWExtra *extra = origin->d_func()->extra;
-
5397 if (extra && extra->proxyWidget)
evaluated: extra
TRUEFALSE
yes
Evaluation Count:3746
yes
Evaluation Count:1598
partially evaluated: extra->proxyWidget
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3746
0-3746
5398 return extra->proxyWidget;
never executed: return extra->proxyWidget;
0
5399 return nearestGraphicsProxyWidget(origin->parentWidget());
executed: return nearestGraphicsProxyWidget(origin->parentWidget());
Execution Count:5344
5344
5400 } -
5401 return 0;
executed: return 0;
Execution Count:5465
5465
5402} -
5403#endif -
5404 -
5405/*! -
5406 \property QWidget::locale -
5407 \brief the widget's locale -
5408 \since 4.3 -
5409 -
5410 As long as no special locale has been set, this is either -
5411 the parent's locale or (if this widget is a top level widget), -
5412 the default locale. -
5413 -
5414 If the widget displays dates or numbers, these should be formatted -
5415 using the widget's locale. -
5416 -
5417 \sa QLocale, QLocale::setDefault() -
5418*/ -
5419 -
5420void QWidgetPrivate::setLocale_helper(const QLocale &loc, bool forceUpdate) -
5421{ -
5422 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
5423 if (locale == loc && !forceUpdate)
evaluated: locale == loc
TRUEFALSE
yes
Evaluation Count:31091
yes
Evaluation Count:65
partially evaluated: !forceUpdate
TRUEFALSE
yes
Evaluation Count:31091
no
Evaluation Count:0
0-31091
5424 return;
executed: return;
Execution Count:31091
31091
5425 -
5426 locale = loc;
executed (the execution status of this line is deduced): locale = loc;
-
5427 -
5428 if (!children.isEmpty()) {
evaluated: !children.isEmpty()
TRUEFALSE
yes
Evaluation Count:35
yes
Evaluation Count:30
30-35
5429 for (int i = 0; i < children.size(); ++i) {
evaluated: i < children.size()
TRUEFALSE
yes
Evaluation Count:98
yes
Evaluation Count:35
35-98
5430 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));
-
5431 if (!w)
evaluated: !w
TRUEFALSE
yes
Evaluation Count:40
yes
Evaluation Count:58
40-58
5432 continue;
executed: continue;
Execution Count:40
40
5433 if (w->testAttribute(Qt::WA_SetLocale))
evaluated: w->testAttribute(Qt::WA_SetLocale)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:57
1-57
5434 continue;
executed: continue;
Execution Count:1
1
5435 if (w->isWindow() && !w->testAttribute(Qt::WA_WindowPropagation))
evaluated: w->isWindow()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:55
partially evaluated: !w->testAttribute(Qt::WA_WindowPropagation)
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-55
5436 continue;
executed: continue;
Execution Count:2
2
5437 w->d_func()->setLocale_helper(loc, forceUpdate);
executed (the execution status of this line is deduced): w->d_func()->setLocale_helper(loc, forceUpdate);
-
5438 }
executed: }
Execution Count:55
55
5439 }
executed: }
Execution Count:35
35
5440 QEvent e(QEvent::LocaleChange);
executed (the execution status of this line is deduced): QEvent e(QEvent::LocaleChange);
-
5441 QApplication::sendEvent(q, &e);
executed (the execution status of this line is deduced): QApplication::sendEvent(q, &e);
-
5442}
executed: }
Execution Count:65
65
5443 -
5444void QWidget::setLocale(const QLocale &locale) -
5445{ -
5446 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
5447 -
5448 setAttribute(Qt::WA_SetLocale);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_SetLocale);
-
5449 d->setLocale_helper(locale);
executed (the execution status of this line is deduced): d->setLocale_helper(locale);
-
5450}
executed: }
Execution Count:7
7
5451 -
5452QLocale QWidget::locale() const -
5453{ -
5454 Q_D(const QWidget);
executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
5455 -
5456 return d->locale;
executed: return d->locale;
Execution Count:74698
74698
5457} -
5458 -
5459void QWidgetPrivate::resolveLocale() -
5460{ -
5461 Q_Q(const QWidget);
executed (the execution status of this line is deduced): const QWidget * const q = q_func();
-
5462 -
5463 if (!q->testAttribute(Qt::WA_SetLocale)) {
evaluated: !q->testAttribute(Qt::WA_SetLocale)
TRUEFALSE
yes
Evaluation Count:31094
yes
Evaluation Count:1
1-31094
5464 setLocale_helper(q->isWindow()
executed (the execution status of this line is deduced): setLocale_helper(q->isWindow()
-
5465 ? QLocale()
executed (the execution status of this line is deduced): ? QLocale()
-
5466 : q->parentWidget()->locale());
executed (the execution status of this line is deduced): : q->parentWidget()->locale());
-
5467 }
executed: }
Execution Count:31094
31094
5468}
executed: }
Execution Count:31095
31095
5469 -
5470void QWidget::unsetLocale() -
5471{ -
5472 Q_D(QWidget);
never executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
5473 setAttribute(Qt::WA_SetLocale, false);
never executed (the execution status of this line is deduced): setAttribute(Qt::WA_SetLocale, false);
-
5474 d->resolveLocale();
never executed (the execution status of this line is deduced): d->resolveLocale();
-
5475}
never executed: }
0
5476 -
5477/*! -
5478 \property QWidget::windowTitle -
5479 \brief the window title (caption) -
5480 -
5481 This property only makes sense for top-level widgets, such as -
5482 windows and dialogs. If no caption has been set, the title is based of the -
5483 \l windowFilePath. If neither of these is set, then the title is -
5484 an empty string. -
5485 -
5486 If you use the \l windowModified mechanism, the window title must -
5487 contain a "[*]" placeholder, which indicates where the '*' should -
5488 appear. Normally, it should appear right after the file name -
5489 (e.g., "document1.txt[*] - Text Editor"). If the \l -
5490 windowModified property is false (the default), the placeholder -
5491 is simply removed. -
5492 -
5493 On some desktop platforms (including Windows and Unix), the application name -
5494 (from QGuiApplication::applicationDisplayName) is added at the end of the -
5495 window title, if set. This is done by the QPA plugin, so it is shown to the -
5496 user, but isn't part of the \l windowTitle string. -
5497 -
5498 \sa windowIcon, windowIconText, windowModified, windowFilePath -
5499*/ -
5500QString QWidget::windowTitle() const -
5501{ -
5502 Q_D(const QWidget);
executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
5503 if (d->extra && d->extra->topextra) {
evaluated: d->extra
TRUEFALSE
yes
Evaluation Count:5104
yes
Evaluation Count:576
evaluated: d->extra->topextra
TRUEFALSE
yes
Evaluation Count:4813
yes
Evaluation Count:291
291-5104
5504 if (!d->extra->topextra->caption.isEmpty())
evaluated: !d->extra->topextra->caption.isEmpty()
TRUEFALSE
yes
Evaluation Count:1275
yes
Evaluation Count:3538
1275-3538
5505 return d->extra->topextra->caption;
executed: return d->extra->topextra->caption;
Execution Count:1275
1275
5506 if (!d->extra->topextra->filePath.isEmpty())
evaluated: !d->extra->topextra->filePath.isEmpty()
TRUEFALSE
yes
Evaluation Count:20
yes
Evaluation Count:3518
20-3518
5507 return QFileInfo(d->extra->topextra->filePath).fileName() + QLatin1String("[*]");
executed: return QFileInfo(d->extra->topextra->filePath).fileName() + QLatin1String("[*]");
Execution Count:20
20
5508 }
executed: }
Execution Count:3518
3518
5509 return QString();
executed: return QString();
Execution Count:4385
4385
5510} -
5511 -
5512/*! -
5513 Returns a modified window title with the [*] place holder -
5514 replaced according to the rules described in QWidget::setWindowTitle -
5515 -
5516 This function assumes that "[*]" can be quoted by another -
5517 "[*]", so it will replace two place holders by one and -
5518 a single last one by either "*" or nothing depending on -
5519 the modified flag. -
5520 -
5521 \internal -
5522*/ -
5523QString qt_setWindowTitle_helperHelper(const QString &title, const QWidget *widget) -
5524{ -
5525 Q_ASSERT(widget);
executed (the execution status of this line is deduced): qt_noop();
-
5526 -
5527#ifdef QT_EVAL -
5528 extern QString qt_eval_adapt_window_title(const QString &title); -
5529 QString cap = qt_eval_adapt_window_title(title); -
5530#else -
5531 QString cap = title;
executed (the execution status of this line is deduced): QString cap = title;
-
5532#endif -
5533 -
5534 if (cap.isEmpty())
evaluated: cap.isEmpty()
TRUEFALSE
yes
Evaluation Count:3531
yes
Evaluation Count:276
276-3531
5535 return cap;
executed: return cap;
Execution Count:3531
3531
5536 -
5537 QLatin1String placeHolder("[*]");
executed (the execution status of this line is deduced): QLatin1String placeHolder("[*]");
-
5538 int index = cap.indexOf(placeHolder);
executed (the execution status of this line is deduced): int index = cap.indexOf(placeHolder);
-
5539 -
5540 // here the magic begins -
5541 while (index != -1) {
evaluated: index != -1
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:276
13-276
5542 index += placeHolder.size();
executed (the execution status of this line is deduced): index += placeHolder.size();
-
5543 int count = 1;
executed (the execution status of this line is deduced): int count = 1;
-
5544 while (cap.indexOf(placeHolder, index) == index) {
partially evaluated: cap.indexOf(placeHolder, index) == index
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13
0-13
5545 ++count;
never executed (the execution status of this line is deduced): ++count;
-
5546 index += placeHolder.size();
never executed (the execution status of this line is deduced): index += placeHolder.size();
-
5547 }
never executed: }
0
5548 -
5549 if (count%2) { // odd number of [*] -> replace last one
partially evaluated: count%2
TRUEFALSE
yes
Evaluation Count:13
no
Evaluation Count:0
0-13
5550 int lastIndex = cap.lastIndexOf(placeHolder, index - 1);
executed (the execution status of this line is deduced): int lastIndex = cap.lastIndexOf(placeHolder, index - 1);
-
5551 if (widget->isWindowModified()
evaluated: widget->isWindowModified()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:10
3-10
5552 && widget->style()->styleHint(QStyle::SH_TitleBar_ModifyNotification, 0, widget))
partially evaluated: widget->style()->styleHint(QStyle::SH_TitleBar_ModifyNotification, 0, widget)
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
5553 cap.replace(lastIndex, 3, QWidget::tr("*"));
executed: cap.replace(lastIndex, 3, QWidget::tr("*"));
Execution Count:3
3
5554 else -
5555 cap.remove(lastIndex, 3);
executed: cap.remove(lastIndex, 3);
Execution Count:10
10
5556 } -
5557 -
5558 index = cap.indexOf(placeHolder, index);
executed (the execution status of this line is deduced): index = cap.indexOf(placeHolder, index);
-
5559 }
executed: }
Execution Count:13
13
5560 -
5561 cap.replace(QLatin1String("[*][*]"), placeHolder);
executed (the execution status of this line is deduced): cap.replace(QLatin1String("[*][*]"), placeHolder);
-
5562 -
5563 return cap;
executed: return cap;
Execution Count:276
276
5564} -
5565 -
5566void QWidgetPrivate::setWindowTitle_helper(const QString &title) -
5567{ -
5568 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
5569 if (q->testAttribute(Qt::WA_WState_Created))
evaluated: q->testAttribute(Qt::WA_WState_Created)
TRUEFALSE
yes
Evaluation Count:1979
yes
Evaluation Count:270
270-1979
5570 setWindowTitle_sys(qt_setWindowTitle_helperHelper(title, q));
executed: setWindowTitle_sys(qt_setWindowTitle_helperHelper(title, q));
Execution Count:1979
1979
5571}
executed: }
Execution Count:2249
2249
5572 -
5573void QWidgetPrivate::setWindowIconText_helper(const QString &title) -
5574{ -
5575 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
5576 if (q->testAttribute(Qt::WA_WState_Created))
partially evaluated: q->testAttribute(Qt::WA_WState_Created)
TRUEFALSE
yes
Evaluation Count:1776
no
Evaluation Count:0
0-1776
5577 setWindowIconText_sys(qt_setWindowTitle_helperHelper(title, q));
executed: setWindowIconText_sys(qt_setWindowTitle_helperHelper(title, q));
Execution Count:1776
1776
5578}
executed: }
Execution Count:1776
1776
5579 -
5580void QWidget::setWindowIconText(const QString &iconText) -
5581{ -
5582 if (QWidget::windowIconText() == iconText)
never evaluated: QWidget::windowIconText() == iconText
0
5583 return;
never executed: return;
0
5584 -
5585 Q_D(QWidget);
never executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
5586 d->topData()->iconText = iconText;
never executed (the execution status of this line is deduced): d->topData()->iconText = iconText;
-
5587 d->setWindowIconText_helper(iconText);
never executed (the execution status of this line is deduced): d->setWindowIconText_helper(iconText);
-
5588 -
5589 QEvent e(QEvent::IconTextChange);
never executed (the execution status of this line is deduced): QEvent e(QEvent::IconTextChange);
-
5590 QApplication::sendEvent(this, &e);
never executed (the execution status of this line is deduced): QApplication::sendEvent(this, &e);
-
5591}
never executed: }
0
5592 -
5593void QWidget::setWindowTitle(const QString &title) -
5594{ -
5595 if (QWidget::windowTitle() == title && !title.isEmpty() && !title.isNull())
evaluated: QWidget::windowTitle() == title
TRUEFALSE
yes
Evaluation Count:337
yes
Evaluation Count:272
evaluated: !title.isEmpty()
TRUEFALSE
yes
Evaluation Count:210
yes
Evaluation Count:127
partially evaluated: !title.isNull()
TRUEFALSE
yes
Evaluation Count:210
no
Evaluation Count:0
0-337
5596 return;
executed: return;
Execution Count:210
210
5597 -
5598 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
5599 d->topData()->caption = title;
executed (the execution status of this line is deduced): d->topData()->caption = title;
-
5600 d->setWindowTitle_helper(title);
executed (the execution status of this line is deduced): d->setWindowTitle_helper(title);
-
5601 -
5602 QEvent e(QEvent::WindowTitleChange);
executed (the execution status of this line is deduced): QEvent e(QEvent::WindowTitleChange);
-
5603 QApplication::sendEvent(this, &e);
executed (the execution status of this line is deduced): QApplication::sendEvent(this, &e);
-
5604}
executed: }
Execution Count:399
399
5605 -
5606 -
5607/*! -
5608 \property QWidget::windowIcon -
5609 \brief the widget's icon -
5610 -
5611 This property only makes sense for windows. If no icon -
5612 has been set, windowIcon() returns the application icon -
5613 (QApplication::windowIcon()). -
5614 -
5615 \sa windowIconText, windowTitle -
5616*/ -
5617QIcon QWidget::windowIcon() const -
5618{ -
5619 const QWidget *w = this;
executed (the execution status of this line is deduced): const QWidget *w = this;
-
5620 while (w) {
evaluated: w
TRUEFALSE
yes
Evaluation Count:3612
yes
Evaluation Count:2106
2106-3612
5621 const QWidgetPrivate *d = w->d_func();
executed (the execution status of this line is deduced): const QWidgetPrivate *d = w->d_func();
-
5622 if (d->extra && d->extra->topextra && d->extra->topextra->icon)
evaluated: d->extra
TRUEFALSE
yes
Evaluation Count:2929
yes
Evaluation Count:683
evaluated: d->extra->topextra
TRUEFALSE
yes
Evaluation Count:2071
yes
Evaluation Count:858
evaluated: d->extra->topextra->icon
TRUEFALSE
yes
Evaluation Count:248
yes
Evaluation Count:1823
248-2929
5623 return *d->extra->topextra->icon;
executed: return *d->extra->topextra->icon;
Execution Count:248
248
5624 w = w->parentWidget();
executed (the execution status of this line is deduced): w = w->parentWidget();
-
5625 }
executed: }
Execution Count:3364
3364
5626 return QApplication::windowIcon();
executed: return QApplication::windowIcon();
Execution Count:2106
2106
5627} -
5628 -
5629void QWidgetPrivate::setWindowIcon_helper() -
5630{ -
5631 QEvent e(QEvent::WindowIconChange);
executed (the execution status of this line is deduced): QEvent e(QEvent::WindowIconChange);
-
5632 QApplication::sendEvent(q_func(), &e);
executed (the execution status of this line is deduced): QApplication::sendEvent(q_func(), &e);
-
5633 for (int i = 0; i < children.size(); ++i) {
partially evaluated: i < children.size()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:124
0-124
5634 QWidget *w = qobject_cast<QWidget *>(children.at(i));
never executed (the execution status of this line is deduced): QWidget *w = qobject_cast<QWidget *>(children.at(i));
-
5635 if (w && !w->isWindow())
never evaluated: w
never evaluated: !w->isWindow()
0
5636 QApplication::sendEvent(w, &e);
never executed: QApplication::sendEvent(w, &e);
0
5637 }
never executed: }
0
5638}
executed: }
Execution Count:124
124
5639 -
5640void QWidget::setWindowIcon(const QIcon &icon) -
5641{ -
5642 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
5643 -
5644 setAttribute(Qt::WA_SetWindowIcon, !icon.isNull());
executed (the execution status of this line is deduced): setAttribute(Qt::WA_SetWindowIcon, !icon.isNull());
-
5645 d->createTLExtra();
executed (the execution status of this line is deduced): d->createTLExtra();
-
5646 -
5647 if (!d->extra->topextra->icon)
partially evaluated: !d->extra->topextra->icon
TRUEFALSE
yes
Evaluation Count:124
no
Evaluation Count:0
0-124
5648 d->extra->topextra->icon = new QIcon();
executed: d->extra->topextra->icon = new QIcon();
Execution Count:124
124
5649 *d->extra->topextra->icon = icon;
executed (the execution status of this line is deduced): *d->extra->topextra->icon = icon;
-
5650 -
5651 d->setWindowIcon_sys();
executed (the execution status of this line is deduced): d->setWindowIcon_sys();
-
5652 d->setWindowIcon_helper();
executed (the execution status of this line is deduced): d->setWindowIcon_helper();
-
5653}
executed: }
Execution Count:124
124
5654 -
5655 -
5656/*! -
5657 \property QWidget::windowIconText -
5658 \brief the widget's icon text -
5659 -
5660 This property only makes sense for windows. If no icon -
5661 text has been set, this functions returns an empty string. -
5662 -
5663 \sa windowIcon, windowTitle -
5664*/ -
5665 -
5666QString QWidget::windowIconText() const -
5667{ -
5668 Q_D(const QWidget);
executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
5669 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:1776
1776
5670} -
5671 -
5672/*! -
5673 \property QWidget::windowFilePath -
5674 \since 4.4 -
5675 \brief the file path associated with a widget -
5676 -
5677 This property only makes sense for windows. It associates a file path with -
5678 a window. If you set the file path, but have not set the window title, Qt -
5679 sets the window title to the file name of the specified path, obtained using -
5680 QFileInfo::fileName(). -
5681 -
5682 If the window title is set at any point, then the window title takes precedence and -
5683 will be shown instead of the file path string. -
5684 -
5685 Additionally, on Mac OS X, this has an added benefit that it sets the -
5686 \l{http://developer.apple.com/documentation/UserExperience/Conceptual/OSXHIGuidelines/XHIGWindows/chapter_17_section_3.html}{proxy icon} -
5687 for the window, assuming that the file path exists. -
5688 -
5689 If no file path is set, this property contains an empty string. -
5690 -
5691 By default, this property contains an empty string. -
5692 -
5693 \sa windowTitle, windowIcon -
5694*/ -
5695 -
5696QString QWidget::windowFilePath() const -
5697{ -
5698 Q_D(const QWidget);
executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
5699 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
5700} -
5701 -
5702void QWidget::setWindowFilePath(const QString &filePath) -
5703{ -
5704 if (filePath == windowFilePath())
evaluated: filePath == windowFilePath()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:18
3-18
5705 return;
executed: return;
Execution Count:3
3
5706 -
5707 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
5708 -
5709 d->createTLExtra();
executed (the execution status of this line is deduced): d->createTLExtra();
-
5710 d->extra->topextra->filePath = filePath;
executed (the execution status of this line is deduced): d->extra->topextra->filePath = filePath;
-
5711 d->setWindowFilePath_helper(filePath);
executed (the execution status of this line is deduced): d->setWindowFilePath_helper(filePath);
-
5712}
executed: }
Execution Count:18
18
5713 -
5714void QWidgetPrivate::setWindowFilePath_helper(const QString &filePath) -
5715{ -
5716 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
5717#ifdef Q_OS_MAC -
5718 setWindowTitle_helper(QFileInfo(filePath).fileName()); -
5719#else -
5720 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
5721 Q_UNUSED(filePath);
executed (the execution status of this line is deduced): (void)filePath;;
-
5722 setWindowTitle_helper(q->windowTitle());
executed (the execution status of this line is deduced): setWindowTitle_helper(q->windowTitle());
-
5723#endif -
5724 }
executed: }
Execution Count:14
14
5725#ifdef Q_OS_MAC -
5726 setWindowFilePath_sys(filePath); -
5727#endif -
5728}
executed: }
Execution Count:18
18
5729 -
5730/*! -
5731 Returns the window's role, or an empty string. -
5732 -
5733 \sa windowIcon, windowTitle -
5734*/ -
5735 -
5736QString QWidget::windowRole() const -
5737{ -
5738 Q_D(const QWidget);
never executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
5739 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
5740} -
5741 -
5742/*! -
5743 Sets the window's role to \a role. This only makes sense for -
5744 windows on X11. -
5745*/ -
5746void QWidget::setWindowRole(const QString &role) -
5747{ -
5748#if defined(Q_WS_X11) -
5749 Q_D(QWidget); -
5750 d->topData()->role = role; -
5751 d->setWindowRole(); -
5752#else -
5753 Q_UNUSED(role)
never executed (the execution status of this line is deduced): (void)role;
-
5754#endif -
5755}
never executed: }
0
5756 -
5757/*! -
5758 \property QWidget::mouseTracking -
5759 \brief whether mouse tracking is enabled for the widget -
5760 -
5761 If mouse tracking is disabled (the default), the widget only -
5762 receives mouse move events when at least one mouse button is -
5763 pressed while the mouse is being moved. -
5764 -
5765 If mouse tracking is enabled, the widget receives mouse move -
5766 events even if no buttons are pressed. -
5767 -
5768 \sa mouseMoveEvent() -
5769*/ -
5770 -
5771 -
5772/*! -
5773 Sets the widget's focus proxy to widget \a w. If \a w is 0, the -
5774 function resets this widget to have no focus proxy. -
5775 -
5776 Some widgets can "have focus", but create a child widget, such as -
5777 QLineEdit, to actually handle the focus. In this case, the widget -
5778 can set the line edit to be its focus proxy. -
5779 -
5780 setFocusProxy() sets the widget which will actually get focus when -
5781 "this widget" gets it. If there is a focus proxy, setFocus() and -
5782 hasFocus() operate on the focus proxy. -
5783 -
5784 \sa focusProxy() -
5785*/ -
5786 -
5787void QWidget::setFocusProxy(QWidget * w) -
5788{ -
5789 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
5790 if (!w && !d->extra)
evaluated: !w
TRUEFALSE
yes
Evaluation Count:717
yes
Evaluation Count:5177
evaluated: !d->extra
TRUEFALSE
yes
Evaluation Count:422
yes
Evaluation Count:295
295-5177
5791 return;
executed: return;
Execution Count:422
422
5792 -
5793 for (QWidget* fp = w; fp; fp = fp->focusProxy()) {
evaluated: fp
TRUEFALSE
yes
Evaluation Count:5177
yes
Evaluation Count:5472
5177-5472
5794 if (fp == this) {
partially evaluated: fp == this
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5177
0-5177
5795 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", 5795, __PRETTY_FUNCTION__).warning("QWidget: %s (%s) already in focus proxy chain", metaObject()->className(), objectName().toLocal8Bit().constData());
-
5796 return;
never executed: return;
0
5797 } -
5798 }
executed: }
Execution Count:5177
5177
5799 -
5800 d->createExtra();
executed (the execution status of this line is deduced): d->createExtra();
-
5801 d->extra->focus_proxy = w;
executed (the execution status of this line is deduced): d->extra->focus_proxy = w;
-
5802}
executed: }
Execution Count:5472
5472
5803 -
5804 -
5805/*! -
5806 Returns the focus proxy, or 0 if there is no focus proxy. -
5807 -
5808 \sa setFocusProxy() -
5809*/ -
5810 -
5811QWidget * QWidget::focusProxy() const -
5812{ -
5813 Q_D(const QWidget);
executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
5814 return d->extra ? (QWidget *)d->extra->focus_proxy : 0;
executed: return d->extra ? (QWidget *)d->extra->focus_proxy : 0;
Execution Count:10625
10625
5815} -
5816 -
5817 -
5818/*! -
5819 \property QWidget::focus -
5820 \brief whether this widget (or its focus proxy) has the keyboard -
5821 input focus -
5822 -
5823 By default, this property is false. -
5824 -
5825 \note Obtaining the value of this property for a widget is effectively equivalent -
5826 to checking whether QApplication::focusWidget() refers to the widget. -
5827 -
5828 \sa setFocus(), clearFocus(), setFocusPolicy(), QApplication::focusWidget() -
5829*/ -
5830bool QWidget::hasFocus() const -
5831{ -
5832 const QWidget* w = this;
executed (the execution status of this line is deduced): const QWidget* w = this;
-
5833 while (w->d_func()->extra && w->d_func()->extra->focus_proxy)
evaluated: w->d_func()->extra
TRUEFALSE
yes
Evaluation Count:147935
yes
Evaluation Count:232424
evaluated: w->d_func()->extra->focus_proxy
TRUEFALSE
yes
Evaluation Count:28149
yes
Evaluation Count:119786
28149-232424
5834 w = w->d_func()->extra->focus_proxy;
executed: w = w->d_func()->extra->focus_proxy;
Execution Count:28149
28149
5835 if (QWidget *window = w->window()) {
partially evaluated: QWidget *window = w->window()
TRUEFALSE
yes
Evaluation Count:352210
no
Evaluation Count:0
0-352210
5836#ifndef QT_NO_GRAPHICSVIEW -
5837 QWExtra *e = window->d_func()->extra;
executed (the execution status of this line is deduced): QWExtra *e = window->d_func()->extra;
-
5838 if (e && e->proxyWidget && e->proxyWidget->hasFocus() && window->focusWidget() == w)
evaluated: e
TRUEFALSE
yes
Evaluation Count:235303
yes
Evaluation Count:116907
partially evaluated: e->proxyWidget
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:235303
never evaluated: e->proxyWidget->hasFocus()
never evaluated: window->focusWidget() == w
0-235303
5839 return true;
never executed: return true;
0
5840#endif -
5841 }
executed: }
Execution Count:352210
352210
5842 return (QApplication::focusWidget() == w);
executed: return (QApplication::focusWidget() == w);
Execution Count:352210
352210
5843} -
5844 -
5845/*! -
5846 Gives the keyboard input focus to this widget (or its focus -
5847 proxy) if this widget or one of its parents is the \l{isActiveWindow()}{active window}. The \a reason argument will -
5848 be passed into any focus event sent from this function, it is used -
5849 to give an explanation of what caused the widget to get focus. -
5850 If the window is not active, the widget will be given the focus when -
5851 the window becomes active. -
5852 -
5853 First, a focus about to change event is sent to the focus widget (if any) to -
5854 tell it that it is about to lose the focus. Then focus is changed, a -
5855 focus out event is sent to the previous focus item and a focus in event is sent -
5856 to the new item to tell it that it just received the focus. -
5857 (Nothing happens if the focus in and focus out widgets are the -
5858 same.) -
5859 -
5860 \note On embedded platforms, setFocus() will not cause an input panel -
5861 to be opened by the input method. If you want this to happen, you -
5862 have to send a QEvent::RequestSoftwareInputPanel event to the -
5863 widget yourself. -
5864 -
5865 setFocus() gives focus to a widget regardless of its focus policy, -
5866 but does not clear any keyboard grab (see grabKeyboard()). -
5867 -
5868 Be aware that if the widget is hidden, it will not accept focus -
5869 until it is shown. -
5870 -
5871 \warning If you call setFocus() in a function which may itself be -
5872 called from focusOutEvent() or focusInEvent(), you may get an -
5873 infinite recursion. -
5874 -
5875 \sa hasFocus(), clearFocus(), focusInEvent(), focusOutEvent(), -
5876 setFocusPolicy(), focusWidget(), QApplication::focusWidget(), grabKeyboard(), -
5877 grabMouse(), {Keyboard Focus in Widgets}, QEvent::RequestSoftwareInputPanel -
5878*/ -
5879 -
5880void QWidget::setFocus(Qt::FocusReason reason) -
5881{ -
5882 if (!isEnabled())
evaluated: !isEnabled()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:7672
2-7672
5883 return;
executed: return;
Execution Count:2
2
5884 -
5885 QWidget *f = this;
executed (the execution status of this line is deduced): QWidget *f = this;
-
5886 while (f->d_func()->extra && f->d_func()->extra->focus_proxy)
evaluated: f->d_func()->extra
TRUEFALSE
yes
Evaluation Count:6866
yes
Evaluation Count:837
evaluated: f->d_func()->extra->focus_proxy
TRUEFALSE
yes
Evaluation Count:31
yes
Evaluation Count:6835
31-6866
5887 f = f->d_func()->extra->focus_proxy;
executed: f = f->d_func()->extra->focus_proxy;
Execution Count:31
31
5888 -
5889 if (QApplication::focusWidget() == f
evaluated: QApplication::focusWidget() == f
TRUEFALSE
yes
Evaluation Count:6188
yes
Evaluation Count:1484
1484-6188
5890#if defined(Q_WS_WIN) -
5891 && GetFocus() == f->internalWinId() -
5892#endif -
5893 ) -
5894 return;
executed: return;
Execution Count:6188
6188
5895 -
5896#ifndef QT_NO_GRAPHICSVIEW -
5897 QWidget *previousProxyFocus = 0;
executed (the execution status of this line is deduced): QWidget *previousProxyFocus = 0;
-
5898 if (QWExtra *topData = window()->d_func()->extra) {
evaluated: QWExtra *topData = window()->d_func()->extra
TRUEFALSE
yes
Evaluation Count:1383
yes
Evaluation Count:101
101-1383
5899 if (topData->proxyWidget && topData->proxyWidget->hasFocus()) {
partially evaluated: topData->proxyWidget
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1383
never evaluated: topData->proxyWidget->hasFocus()
0-1383
5900 previousProxyFocus = topData->proxyWidget->widget()->focusWidget();
never executed (the execution status of this line is deduced): previousProxyFocus = topData->proxyWidget->widget()->focusWidget();
-
5901 if (previousProxyFocus && previousProxyFocus->focusProxy())
never evaluated: previousProxyFocus
never evaluated: previousProxyFocus->focusProxy()
0
5902 previousProxyFocus = previousProxyFocus->focusProxy();
never executed: previousProxyFocus = previousProxyFocus->focusProxy();
0
5903 if (previousProxyFocus == this && !topData->proxyWidget->d_func()->proxyIsGivingFocus)
never evaluated: previousProxyFocus == this
never evaluated: !topData->proxyWidget->d_func()->proxyIsGivingFocus
0
5904 return;
never executed: return;
0
5905 }
never executed: }
0
5906 }
executed: }
Execution Count:1383
1383
5907#endif -
5908 -
5909#ifndef QT_NO_GRAPHICSVIEW -
5910 // Update proxy state -
5911 if (QWExtra *topData = window()->d_func()->extra) {
evaluated: QWExtra *topData = window()->d_func()->extra
TRUEFALSE
yes
Evaluation Count:1383
yes
Evaluation Count:101
101-1383
5912 if (topData->proxyWidget && !topData->proxyWidget->hasFocus()) {
partially evaluated: topData->proxyWidget
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1383
never evaluated: !topData->proxyWidget->hasFocus()
0-1383
5913 f->d_func()->updateFocusChild();
never executed (the execution status of this line is deduced): f->d_func()->updateFocusChild();
-
5914 topData->proxyWidget->d_func()->focusFromWidgetToProxy = 1;
never executed (the execution status of this line is deduced): topData->proxyWidget->d_func()->focusFromWidgetToProxy = 1;
-
5915 topData->proxyWidget->setFocus(reason);
never executed (the execution status of this line is deduced): topData->proxyWidget->setFocus(reason);
-
5916 topData->proxyWidget->d_func()->focusFromWidgetToProxy = 0;
never executed (the execution status of this line is deduced): topData->proxyWidget->d_func()->focusFromWidgetToProxy = 0;
-
5917 }
never executed: }
0
5918 }
executed: }
Execution Count:1383
1383
5919#endif -
5920 -
5921 if (f->isActiveWindow()) {
evaluated: f->isActiveWindow()
TRUEFALSE
yes
Evaluation Count:619
yes
Evaluation Count:865
619-865
5922 QWidget *prev = QApplicationPrivate::focus_widget;
executed (the execution status of this line is deduced): QWidget *prev = QApplicationPrivate::focus_widget;
-
5923 if (prev) {
evaluated: prev
TRUEFALSE
yes
Evaluation Count:194
yes
Evaluation Count:425
194-425
5924 if (reason != Qt::PopupFocusReason && reason != Qt::MenuBarFocusReason
evaluated: reason != Qt::PopupFocusReason
TRUEFALSE
yes
Evaluation Count:184
yes
Evaluation Count:10
evaluated: reason != Qt::MenuBarFocusReason
TRUEFALSE
yes
Evaluation Count:181
yes
Evaluation Count:3
3-184
5925 && prev->testAttribute(Qt::WA_InputMethodEnabled)) {
evaluated: prev->testAttribute(Qt::WA_InputMethodEnabled)
TRUEFALSE
yes
Evaluation Count:79
yes
Evaluation Count:102
79-102
5926 qApp->inputMethod()->commit();
executed (the execution status of this line is deduced): (static_cast<QApplication *>(QCoreApplication::instance()))->inputMethod()->commit();
-
5927 }
executed: }
Execution Count:79
79
5928 -
5929 if (reason != Qt::NoFocusReason) {
evaluated: reason != Qt::NoFocusReason
TRUEFALSE
yes
Evaluation Count:193
yes
Evaluation Count:1
1-193
5930 QFocusEvent focusAboutToChange(QEvent::FocusAboutToChange, reason);
executed (the execution status of this line is deduced): QFocusEvent focusAboutToChange(QEvent::FocusAboutToChange, reason);
-
5931 QApplication::sendEvent(prev, &focusAboutToChange);
executed (the execution status of this line is deduced): QApplication::sendEvent(prev, &focusAboutToChange);
-
5932 }
executed: }
Execution Count:193
193
5933 }
executed: }
Execution Count:194
194
5934 -
5935 f->d_func()->updateFocusChild();
executed (the execution status of this line is deduced): f->d_func()->updateFocusChild();
-
5936 -
5937 QApplicationPrivate::setFocusWidget(f, reason);
executed (the execution status of this line is deduced): QApplicationPrivate::setFocusWidget(f, reason);
-
5938#ifndef QT_NO_ACCESSIBILITY -
5939# ifdef Q_OS_WIN -
5940 // The negation of the condition in setFocus_sys -
5941 if (!(testAttribute(Qt::WA_WState_Created) && window()->windowType() != Qt::Popup && internalWinId())) -
5942 //setFocusWidget will already post a focus event for us (that the AT client receives) on Windows -
5943# endif -
5944# ifdef Q_OS_UNIX -
5945 // menus update the focus manually and this would create bogus events -
5946 if (!(f->inherits("QMenuBar") || f->inherits("QMenu") || f->inherits("QMenuItem")))
evaluated: f->inherits("QMenuBar")
TRUEFALSE
yes
Evaluation Count:16
yes
Evaluation Count:603
evaluated: f->inherits("QMenu")
TRUEFALSE
yes
Evaluation Count:11
yes
Evaluation Count:592
partially evaluated: f->inherits("QMenuItem")
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:592
0-603
5947# endif -
5948 { -
5949 QAccessibleEvent event(f, QAccessible::Focus);
executed (the execution status of this line is deduced): QAccessibleEvent event(f, QAccessible::Focus);
-
5950 QAccessible::updateAccessibility(&event);
executed (the execution status of this line is deduced): QAccessible::updateAccessibility(&event);
-
5951 }
executed: }
Execution Count:592
592
5952#endif -
5953#ifndef QT_NO_GRAPHICSVIEW -
5954 if (QWExtra *topData = window()->d_func()->extra) {
partially evaluated: QWExtra *topData = window()->d_func()->extra
TRUEFALSE
yes
Evaluation Count:619
no
Evaluation Count:0
0-619
5955 if (topData->proxyWidget) {
partially evaluated: topData->proxyWidget
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:619
0-619
5956 if (previousProxyFocus && previousProxyFocus != f) {
never evaluated: previousProxyFocus
never evaluated: previousProxyFocus != f
0
5957 // Send event to self -
5958 QFocusEvent event(QEvent::FocusOut, reason);
never executed (the execution status of this line is deduced): QFocusEvent event(QEvent::FocusOut, reason);
-
5959 QPointer<QWidget> that = previousProxyFocus;
never executed (the execution status of this line is deduced): QPointer<QWidget> that = previousProxyFocus;
-
5960 QApplication::sendEvent(previousProxyFocus, &event);
never executed (the execution status of this line is deduced): QApplication::sendEvent(previousProxyFocus, &event);
-
5961 if (that)
never evaluated: that
0
5962 QApplication::sendEvent(that->style(), &event);
never executed: QApplication::sendEvent(that->style(), &event);
0
5963 }
never executed: }
0
5964 if (!isHidden()) {
never evaluated: !isHidden()
0
5965#ifndef QT_NO_GRAPHICSVIEW -
5966 // Update proxy state -
5967 if (QWExtra *topData = window()->d_func()->extra)
never evaluated: QWExtra *topData = window()->d_func()->extra
0
5968 if (topData->proxyWidget && topData->proxyWidget->hasFocus())
never evaluated: topData->proxyWidget
never evaluated: topData->proxyWidget->hasFocus()
0
5969 topData->proxyWidget->d_func()->updateProxyInputMethodAcceptanceFromWidget();
never executed: topData->proxyWidget->d_func()->updateProxyInputMethodAcceptanceFromWidget();
0
5970#endif -
5971 // Send event to self -
5972 QFocusEvent event(QEvent::FocusIn, reason);
never executed (the execution status of this line is deduced): QFocusEvent event(QEvent::FocusIn, reason);
-
5973 QPointer<QWidget> that = f;
never executed (the execution status of this line is deduced): QPointer<QWidget> that = f;
-
5974 QApplication::sendEvent(f, &event);
never executed (the execution status of this line is deduced): QApplication::sendEvent(f, &event);
-
5975 if (that)
never evaluated: that
0
5976 QApplication::sendEvent(that->style(), &event);
never executed: QApplication::sendEvent(that->style(), &event);
0
5977 }
never executed: }
0
5978 }
never executed: }
0
5979 }
executed: }
Execution Count:619
619
5980#endif -
5981 } else {
executed: }
Execution Count:619
619
5982 f->d_func()->updateFocusChild();
executed (the execution status of this line is deduced): f->d_func()->updateFocusChild();
-
5983 }
executed: }
Execution Count:865
865
5984 -
5985 if (QTLWExtra *extra = f->window()->d_func()->maybeTopData()) {
evaluated: QTLWExtra *extra = f->window()->d_func()->maybeTopData()
TRUEFALSE
yes
Evaluation Count:1164
yes
Evaluation Count:320
320-1164
5986 if (extra->window)
partially evaluated: extra->window
TRUEFALSE
yes
Evaluation Count:1164
no
Evaluation Count:0
0-1164
5987 emit extra->window->focusObjectChanged(f);
executed: extra->window->focusObjectChanged(f);
Execution Count:1164
1164
5988 }
executed: }
Execution Count:1164
1164
5989}
executed: }
Execution Count:1484
1484
5990 -
5991// updates focus_child on parent widgets to point into this widget -
5992void QWidgetPrivate::updateFocusChild() -
5993{ -
5994 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
5995 -
5996 QWidget *w = q;
executed (the execution status of this line is deduced): QWidget *w = q;
-
5997 if (q->isHidden()) {
evaluated: q->isHidden()
TRUEFALSE
yes
Evaluation Count:90
yes
Evaluation Count:1394
90-1394
5998 while (w && w->isHidden()) {
evaluated: w
TRUEFALSE
yes
Evaluation Count:158
yes
Evaluation Count:58
evaluated: w->isHidden()
TRUEFALSE
yes
Evaluation Count:126
yes
Evaluation Count:32
32-158
5999 w->d_func()->focus_child = q;
executed (the execution status of this line is deduced): w->d_func()->focus_child = q;
-
6000 w = w->isWindow() ? 0 : w->parentWidget();
evaluated: w->isWindow()
TRUEFALSE
yes
Evaluation Count:58
yes
Evaluation Count:68
58-68
6001 }
executed: }
Execution Count:126
126
6002 } else {
executed: }
Execution Count:90
90
6003 while (w) {
evaluated: w
TRUEFALSE
yes
Evaluation Count:3623
yes
Evaluation Count:1394
1394-3623
6004 w->d_func()->focus_child = q;
executed (the execution status of this line is deduced): w->d_func()->focus_child = q;
-
6005 w = w->isWindow() ? 0 : w->parentWidget();
evaluated: w->isWindow()
TRUEFALSE
yes
Evaluation Count:1394
yes
Evaluation Count:2229
1394-2229
6006 }
executed: }
Execution Count:3623
3623
6007 }
executed: }
Execution Count:1394
1394
6008} -
6009 -
6010/*! -
6011 \fn void QWidget::setFocus() -
6012 \overload -
6013 -
6014 Gives the keyboard input focus to this widget (or its focus -
6015 proxy) if this widget or one of its parents is the -
6016 \l{isActiveWindow()}{active window}. -
6017*/ -
6018 -
6019/*! -
6020 Takes keyboard input focus from the widget. -
6021 -
6022 If the widget has active focus, a \l{focusOutEvent()}{focus out event} is sent to this widget to tell it that it has -
6023 lost the focus. -
6024 -
6025 This widget must enable focus setting in order to get the keyboard -
6026 input focus, i.e. it must call setFocusPolicy(). -
6027 -
6028 \sa hasFocus(), setFocus(), focusInEvent(), focusOutEvent(), -
6029 setFocusPolicy(), QApplication::focusWidget() -
6030*/ -
6031 -
6032void QWidget::clearFocus() -
6033{ -
6034 if (hasFocus()) {
evaluated: hasFocus()
TRUEFALSE
yes
Evaluation Count:422
yes
Evaluation Count:29149
422-29149
6035 if (testAttribute(Qt::WA_InputMethodEnabled))
evaluated: testAttribute(Qt::WA_InputMethodEnabled)
TRUEFALSE
yes
Evaluation Count:66
yes
Evaluation Count:356
66-356
6036 qApp->inputMethod()->commit();
executed: (static_cast<QApplication *>(QCoreApplication::instance()))->inputMethod()->commit();
Execution Count:66
66
6037 -
6038 QFocusEvent focusAboutToChange(QEvent::FocusAboutToChange);
executed (the execution status of this line is deduced): QFocusEvent focusAboutToChange(QEvent::FocusAboutToChange);
-
6039 QApplication::sendEvent(this, &focusAboutToChange);
executed (the execution status of this line is deduced): QApplication::sendEvent(this, &focusAboutToChange);
-
6040 }
executed: }
Execution Count:422
422
6041 -
6042 QWidget *w = this;
executed (the execution status of this line is deduced): QWidget *w = this;
-
6043 while (w) {
evaluated: w
TRUEFALSE
yes
Evaluation Count:91918
yes
Evaluation Count:29571
29571-91918
6044 if (w->d_func()->focus_child == this)
evaluated: w->d_func()->focus_child == this
TRUEFALSE
yes
Evaluation Count:1712
yes
Evaluation Count:90206
1712-90206
6045 w->d_func()->focus_child = 0;
executed: w->d_func()->focus_child = 0;
Execution Count:1712
1712
6046 w = w->parentWidget();
executed (the execution status of this line is deduced): w = w->parentWidget();
-
6047 }
executed: }
Execution Count:91918
91918
6048#ifndef QT_NO_GRAPHICSVIEW -
6049 QWExtra *topData = d_func()->extra;
executed (the execution status of this line is deduced): QWExtra *topData = d_func()->extra;
-
6050 if (topData && topData->proxyWidget)
evaluated: topData
TRUEFALSE
yes
Evaluation Count:10146
yes
Evaluation Count:19425
partially evaluated: topData->proxyWidget
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:10146
0-19425
6051 topData->proxyWidget->clearFocus();
never executed: topData->proxyWidget->clearFocus();
0
6052#endif -
6053 -
6054 if (hasFocus()) {
evaluated: hasFocus()
TRUEFALSE
yes
Evaluation Count:422
yes
Evaluation Count:29149
422-29149
6055 // Update proxy state -
6056 QApplicationPrivate::setFocusWidget(0, Qt::OtherFocusReason);
executed (the execution status of this line is deduced): QApplicationPrivate::setFocusWidget(0, Qt::OtherFocusReason);
-
6057#if defined(Q_WS_WIN) -
6058 if (!(windowType() == Qt::Popup) && GetFocus() == internalWinId()) -
6059 SetFocus(0); -
6060 else -
6061#endif -
6062 { -
6063#ifndef QT_NO_ACCESSIBILITY -
6064 QAccessibleEvent event(this, QAccessible::Focus);
executed (the execution status of this line is deduced): QAccessibleEvent event(this, QAccessible::Focus);
-
6065 QAccessible::updateAccessibility(&event);
executed (the execution status of this line is deduced): QAccessible::updateAccessibility(&event);
-
6066#endif -
6067 } -
6068 }
executed: }
Execution Count:422
422
6069}
executed: }
Execution Count:29571
29571
6070 -
6071 -
6072/*! -
6073 \fn bool QWidget::focusNextChild() -
6074 -
6075 Finds a new widget to give the keyboard focus to, as appropriate -
6076 for \uicontrol Tab, and returns true if it can find a new widget, or -
6077 false if it can't. -
6078 -
6079 \sa focusPreviousChild() -
6080*/ -
6081 -
6082/*! -
6083 \fn bool QWidget::focusPreviousChild() -
6084 -
6085 Finds a new widget to give the keyboard focus to, as appropriate -
6086 for \uicontrol Shift+Tab, and returns true if it can find a new widget, -
6087 or false if it can't. -
6088 -
6089 \sa focusNextChild() -
6090*/ -
6091 -
6092/*! -
6093 Finds a new widget to give the keyboard focus to, as appropriate -
6094 for Tab and Shift+Tab, and returns true if it can find a new -
6095 widget, or false if it can't. -
6096 -
6097 If \a next is true, this function searches forward, if \a next -
6098 is false, it searches backward. -
6099 -
6100 Sometimes, you will want to reimplement this function. For -
6101 example, a web browser might reimplement it to move its "current -
6102 active link" forward or backward, and call -
6103 focusNextPrevChild() only when it reaches the last or -
6104 first link on the "page". -
6105 -
6106 Child widgets call focusNextPrevChild() on their parent widgets, -
6107 but only the window that contains the child widgets decides where -
6108 to redirect focus. By reimplementing this function for an object, -
6109 you thus gain control of focus traversal for all child widgets. -
6110 -
6111 \sa focusNextChild(), focusPreviousChild() -
6112*/ -
6113 -
6114bool QWidget::focusNextPrevChild(bool next) -
6115{ -
6116 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
6117 QWidget* p = parentWidget();
executed (the execution status of this line is deduced): QWidget* p = parentWidget();
-
6118 bool isSubWindow = (windowType() == Qt::SubWindow);
executed (the execution status of this line is deduced): bool isSubWindow = (windowType() == Qt::SubWindow);
-
6119 if (!isWindow() && !isSubWindow && p)
evaluated: !isWindow()
TRUEFALSE
yes
Evaluation Count:398
yes
Evaluation Count:183
evaluated: !isSubWindow
TRUEFALSE
yes
Evaluation Count:277
yes
Evaluation Count:121
partially evaluated: p
TRUEFALSE
yes
Evaluation Count:277
no
Evaluation Count:0
0-398
6120 return p->focusNextPrevChild(next);
executed: return p->focusNextPrevChild(next);
Execution Count:277
277
6121#ifndef QT_NO_GRAPHICSVIEW -
6122 if (d->extra && d->extra->proxyWidget)
partially evaluated: d->extra
TRUEFALSE
yes
Evaluation Count:304
no
Evaluation Count:0
partially evaluated: d->extra->proxyWidget
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:304
0-304
6123 return d->extra->proxyWidget->focusNextPrevChild(next);
never executed: return d->extra->proxyWidget->focusNextPrevChild(next);
0
6124#endif -
6125 QWidget *w = QApplicationPrivate::focusNextPrevChild_helper(this, next);
executed (the execution status of this line is deduced): QWidget *w = QApplicationPrivate::focusNextPrevChild_helper(this, next);
-
6126 if (!w) return false;
executed: return false;
Execution Count:264
evaluated: !w
TRUEFALSE
yes
Evaluation Count:264
yes
Evaluation Count:40
40-264
6127 -
6128 w->setFocus(next ? Qt::TabFocusReason : Qt::BacktabFocusReason);
executed (the execution status of this line is deduced): w->setFocus(next ? Qt::TabFocusReason : Qt::BacktabFocusReason);
-
6129 return true;
executed: return true;
Execution Count:40
40
6130} -
6131 -
6132/*! -
6133 Returns the last child of this widget that setFocus had been -
6134 called on. For top level widgets this is the widget that will get -
6135 focus in case this window gets activated -
6136 -
6137 This is not the same as QApplication::focusWidget(), which returns -
6138 the focus widget in the currently active window. -
6139*/ -
6140 -
6141QWidget *QWidget::focusWidget() const -
6142{ -
6143 return const_cast<QWidget *>(d_func()->focus_child);
executed: return const_cast<QWidget *>(d_func()->focus_child);
Execution Count:43305
43305
6144} -
6145 -
6146/*! -
6147 Returns the next widget in this widget's focus chain. -
6148 -
6149 \sa previousInFocusChain() -
6150*/ -
6151QWidget *QWidget::nextInFocusChain() const -
6152{ -
6153 return const_cast<QWidget *>(d_func()->focus_next);
executed: return const_cast<QWidget *>(d_func()->focus_next);
Execution Count:34879
34879
6154} -
6155 -
6156/*! -
6157 \brief The previousInFocusChain function returns the previous -
6158 widget in this widget's focus chain. -
6159 -
6160 \sa nextInFocusChain() -
6161 -
6162 \since 4.6 -
6163*/ -
6164QWidget *QWidget::previousInFocusChain() const -
6165{ -
6166 return const_cast<QWidget *>(d_func()->focus_prev);
never executed: return const_cast<QWidget *>(d_func()->focus_prev);
0
6167} -
6168 -
6169/*! -
6170 \property QWidget::isActiveWindow -
6171 \brief whether this widget's window is the active window -
6172 -
6173 The active window is the window that contains the widget that has -
6174 keyboard focus (The window may still have focus if it has no -
6175 widgets or none of its widgets accepts keyboard focus). -
6176 -
6177 When popup windows are visible, this property is true for both the -
6178 active window \e and for the popup. -
6179 -
6180 By default, this property is false. -
6181 -
6182 \sa activateWindow(), QApplication::activeWindow() -
6183*/ -
6184bool QWidget::isActiveWindow() const -
6185{ -
6186 QWidget *tlw = window();
executed (the execution status of this line is deduced): QWidget *tlw = window();
-
6187 if(tlw == QApplication::activeWindow() || (isVisible() && (tlw->windowType() == Qt::Popup)))
evaluated: tlw == QApplication::activeWindow()
TRUEFALSE
yes
Evaluation Count:125256
yes
Evaluation Count:261608
evaluated: isVisible()
TRUEFALSE
yes
Evaluation Count:125930
yes
Evaluation Count:135678
evaluated: (tlw->windowType() == Qt::Popup)
TRUEFALSE
yes
Evaluation Count:6597
yes
Evaluation Count:119333
6597-261608
6188 return true;
executed: return true;
Execution Count:131853
131853
6189 -
6190#ifndef QT_NO_GRAPHICSVIEW -
6191 if (QWExtra *tlwExtra = tlw->d_func()->extra) {
evaluated: QWExtra *tlwExtra = tlw->d_func()->extra
TRUEFALSE
yes
Evaluation Count:159900
yes
Evaluation Count:95111
95111-159900
6192 if (isVisible() && tlwExtra->proxyWidget)
evaluated: isVisible()
TRUEFALSE
yes
Evaluation Count:119333
yes
Evaluation Count:40567
evaluated: tlwExtra->proxyWidget
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:119329
4-119333
6193 return tlwExtra->proxyWidget->isActiveWindow();
executed: return tlwExtra->proxyWidget->isActiveWindow();
Execution Count:4
4
6194 }
executed: }
Execution Count:159896
159896
6195#endif -
6196 -
6197 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:255007
0-255007
6198 if(tlw->windowType() == Qt::Tool &&
never evaluated: tlw->windowType() == Qt::Tool
0
6199 !tlw->isModal() &&
never evaluated: !tlw->isModal()
0
6200 (!tlw->parentWidget() || tlw->parentWidget()->isActiveWindow()))
never evaluated: !tlw->parentWidget()
never evaluated: tlw->parentWidget()->isActiveWindow()
0
6201 return true;
never executed: return true;
0
6202 QWidget *w = QApplication::activeWindow();
never executed (the execution status of this line is deduced): QWidget *w = QApplication::activeWindow();
-
6203 while(w && tlw->windowType() == Qt::Tool &&
never evaluated: w
never evaluated: tlw->windowType() == Qt::Tool
0
6204 !w->isModal() && w->parentWidget()) {
never evaluated: !w->isModal()
never evaluated: w->parentWidget()
0
6205 w = w->parentWidget()->window();
never executed (the execution status of this line is deduced): w = w->parentWidget()->window();
-
6206 if(w == tlw)
never evaluated: w == tlw
0
6207 return true;
never executed: return true;
0
6208 }
never executed: }
0
6209 }
never executed: }
0
6210 -
6211 // Check if platform adaptation thinks the window is active. This is necessary for -
6212 // example in case of ActiveQt servers that are embedded into another application. -
6213 // Those are separate processes that are not part of the parent application Qt window/widget -
6214 // hierarchy, so they need to rely on native methods to determine if they are part of the -
6215 // active window. -
6216 if (const QWindow *w = tlw->windowHandle()) {
evaluated: const QWindow *w = tlw->windowHandle()
TRUEFALSE
yes
Evaluation Count:152647
yes
Evaluation Count:102360
102360-152647
6217 if (w->handle())
evaluated: w->handle()
TRUEFALSE
yes
Evaluation Count:138743
yes
Evaluation Count:13904
13904-138743
6218 return w->handle()->isActive();
executed: return w->handle()->isActive();
Execution Count:138743
138743
6219 }
executed: }
Execution Count:13904
13904
6220 -
6221 return false;
executed: return false;
Execution Count:116264
116264
6222} -
6223 -
6224/*! -
6225 Puts the \a second widget after the \a first widget in the focus order. -
6226 -
6227 Note that since the tab order of the \a second widget is changed, you -
6228 should order a chain like this: -
6229 -
6230 \snippet code/src_gui_kernel_qwidget.cpp 9 -
6231 -
6232 \e not like this: -
6233 -
6234 \snippet code/src_gui_kernel_qwidget.cpp 10 -
6235 -
6236 If \a first or \a second has a focus proxy, setTabOrder() -
6237 correctly substitutes the proxy. -
6238 -
6239 \sa setFocusPolicy(), setFocusProxy(), {Keyboard Focus in Widgets} -
6240*/ -
6241void QWidget::setTabOrder(QWidget* first, QWidget *second) -
6242{ -
6243 if (!first || !second || first->focusPolicy() == Qt::NoFocus || second->focusPolicy() == Qt::NoFocus)
partially evaluated: !first
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2802
partially evaluated: !second
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2802
evaluated: first->focusPolicy() == Qt::NoFocus
TRUEFALSE
yes
Evaluation Count:114
yes
Evaluation Count:2688
evaluated: second->focusPolicy() == Qt::NoFocus
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2686
0-2802
6244 return;
executed: return;
Execution Count:116
116
6245 -
6246 if (first->window() != second->window()) {
partially evaluated: first->window() != second->window()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2686
0-2686
6247 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", 6247, __PRETTY_FUNCTION__).warning("QWidget::setTabOrder: 'first' and 'second' must be in the same window");
-
6248 return;
never executed: return;
0
6249 } -
6250 -
6251 QWidget *fp = first->focusProxy();
executed (the execution status of this line is deduced): QWidget *fp = first->focusProxy();
-
6252 if (fp) {
evaluated: fp
TRUEFALSE
yes
Evaluation Count:119
yes
Evaluation Count:2567
119-2567
6253 // If first is redirected, set first to the last child of first -
6254 // that can take keyboard focus so that second is inserted after -
6255 // that last child, and the focus order within first is (more -
6256 // likely to be) preserved. -
6257 QList<QWidget *> l = first->findChildren<QWidget *>();
executed (the execution status of this line is deduced): QList<QWidget *> l = first->findChildren<QWidget *>();
-
6258 for (int i = l.size()-1; i >= 0; --i) {
partially evaluated: i >= 0
TRUEFALSE
yes
Evaluation Count:119
no
Evaluation Count:0
0-119
6259 QWidget * next = l.at(i);
executed (the execution status of this line is deduced): QWidget * next = l.at(i);
-
6260 if (next->window() == fp->window()) {
partially evaluated: next->window() == fp->window()
TRUEFALSE
yes
Evaluation Count:119
no
Evaluation Count:0
0-119
6261 fp = next;
executed (the execution status of this line is deduced): fp = next;
-
6262 if (fp->focusPolicy() != Qt::NoFocus)
partially evaluated: fp->focusPolicy() != Qt::NoFocus
TRUEFALSE
yes
Evaluation Count:119
no
Evaluation Count:0
0-119
6263 break;
executed: break;
Execution Count:119
119
6264 }
never executed: }
0
6265 }
never executed: }
0
6266 first = fp;
executed (the execution status of this line is deduced): first = fp;
-
6267 }
executed: }
Execution Count:119
119
6268 -
6269 if (fp == second)
partially evaluated: fp == second
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2686
0-2686
6270 return;
never executed: return;
0
6271 -
6272 if (QWidget *sp = second->focusProxy())
evaluated: QWidget *sp = second->focusProxy()
TRUEFALSE
yes
Evaluation Count:119
yes
Evaluation Count:2567
119-2567
6273 second = sp;
executed: second = sp;
Execution Count:119
119
6274 -
6275// QWidget *fp = first->d_func()->focus_prev; -
6276 QWidget *fn = first->d_func()->focus_next;
executed (the execution status of this line is deduced): QWidget *fn = first->d_func()->focus_next;
-
6277 -
6278 if (fn == second || first == second)
evaluated: fn == second
TRUEFALSE
yes
Evaluation Count:1450
yes
Evaluation Count:1236
partially evaluated: first == second
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1236
0-1450
6279 return;
executed: return;
Execution Count:1450
1450
6280 -
6281 QWidget *sp = second->d_func()->focus_prev;
executed (the execution status of this line is deduced): QWidget *sp = second->d_func()->focus_prev;
-
6282 QWidget *sn = second->d_func()->focus_next;
executed (the execution status of this line is deduced): QWidget *sn = second->d_func()->focus_next;
-
6283 -
6284 fn->d_func()->focus_prev = second;
executed (the execution status of this line is deduced): fn->d_func()->focus_prev = second;
-
6285 first->d_func()->focus_next = second;
executed (the execution status of this line is deduced): first->d_func()->focus_next = second;
-
6286 -
6287 second->d_func()->focus_next = fn;
executed (the execution status of this line is deduced): second->d_func()->focus_next = fn;
-
6288 second->d_func()->focus_prev = first;
executed (the execution status of this line is deduced): second->d_func()->focus_prev = first;
-
6289 -
6290 sp->d_func()->focus_next = sn;
executed (the execution status of this line is deduced): sp->d_func()->focus_next = sn;
-
6291 sn->d_func()->focus_prev = sp;
executed (the execution status of this line is deduced): sn->d_func()->focus_prev = sp;
-
6292 -
6293 -
6294 Q_ASSERT(first->d_func()->focus_next->d_func()->focus_prev == first);
executed (the execution status of this line is deduced): qt_noop();
-
6295 Q_ASSERT(first->d_func()->focus_prev->d_func()->focus_next == first);
executed (the execution status of this line is deduced): qt_noop();
-
6296 -
6297 Q_ASSERT(second->d_func()->focus_next->d_func()->focus_prev == second);
executed (the execution status of this line is deduced): qt_noop();
-
6298 Q_ASSERT(second->d_func()->focus_prev->d_func()->focus_next == second);
executed (the execution status of this line is deduced): qt_noop();
-
6299}
executed: }
Execution Count:1236
1236
6300 -
6301/*!\internal -
6302 -
6303 Moves the relevant subwidgets of this widget from the \a oldtlw's -
6304 tab chain to that of the new parent, if there's anything to move and -
6305 we're really moving -
6306 -
6307 This function is called from QWidget::reparent() *after* the widget -
6308 has been reparented. -
6309 -
6310 \sa reparent() -
6311*/ -
6312 -
6313void QWidgetPrivate::reparentFocusWidgets(QWidget * oldtlw) -
6314{ -
6315 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
6316 if (oldtlw == q->window())
evaluated: oldtlw == q->window()
TRUEFALSE
yes
Evaluation Count:937
yes
Evaluation Count:29888
937-29888
6317 return; // nothing to do
executed: return;
Execution Count:937
937
6318 -
6319 if(focus_child)
evaluated: focus_child
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:29878
10-29878
6320 focus_child->clearFocus();
executed: focus_child->clearFocus();
Execution Count:10
10
6321 -
6322 // separate the focus chain into new (children of myself) and old (the rest) -
6323 QWidget *firstOld = 0;
executed (the execution status of this line is deduced): QWidget *firstOld = 0;
-
6324 //QWidget *firstNew = q; //invariant -
6325 QWidget *o = 0; // last in the old list
executed (the execution status of this line is deduced): QWidget *o = 0;
-
6326 QWidget *n = q; // last in the new list
executed (the execution status of this line is deduced): QWidget *n = q;
-
6327 -
6328 bool prevWasNew = true;
executed (the execution status of this line is deduced): bool prevWasNew = true;
-
6329 QWidget *w = focus_next;
executed (the execution status of this line is deduced): QWidget *w = focus_next;
-
6330 -
6331 //Note: for efficiency, we do not maintain the list invariant inside the loop -
6332 //we append items to the relevant list, and we optimize by not changing pointers -
6333 //when subsequent items are going into the same list. -
6334 while (w != q) {
evaluated: w != q
TRUEFALSE
yes
Evaluation Count:7426
yes
Evaluation Count:29888
7426-29888
6335 bool currentIsNew = q->isAncestorOf(w);
executed (the execution status of this line is deduced): bool currentIsNew = q->isAncestorOf(w);
-
6336 if (currentIsNew) {
evaluated: currentIsNew
TRUEFALSE
yes
Evaluation Count:4708
yes
Evaluation Count:2718
2718-4708
6337 if (!prevWasNew) {
partially evaluated: !prevWasNew
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4708
0-4708
6338 //prev was old -- append to new list -
6339 n->d_func()->focus_next = w;
never executed (the execution status of this line is deduced): n->d_func()->focus_next = w;
-
6340 w->d_func()->focus_prev = n;
never executed (the execution status of this line is deduced): w->d_func()->focus_prev = n;
-
6341 }
never executed: }
0
6342 n = w;
executed (the execution status of this line is deduced): n = w;
-
6343 } else {
executed: }
Execution Count:4708
4708
6344 if (prevWasNew) {
evaluated: prevWasNew
TRUEFALSE
yes
Evaluation Count:287
yes
Evaluation Count:2431
287-2431
6345 //prev was new -- append to old list, if there is one -
6346 if (o) {
partially evaluated: o
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:287
0-287
6347 o->d_func()->focus_next = w;
never executed (the execution status of this line is deduced): o->d_func()->focus_next = w;
-
6348 w->d_func()->focus_prev = o;
never executed (the execution status of this line is deduced): w->d_func()->focus_prev = o;
-
6349 } else {
never executed: }
0
6350 // "create" the old list -
6351 firstOld = w;
executed (the execution status of this line is deduced): firstOld = w;
-
6352 }
executed: }
Execution Count:287
287
6353 } -
6354 o = w;
executed (the execution status of this line is deduced): o = w;
-
6355 }
executed: }
Execution Count:2718
2718
6356 w = w->d_func()->focus_next;
executed (the execution status of this line is deduced): w = w->d_func()->focus_next;
-
6357 prevWasNew = currentIsNew;
executed (the execution status of this line is deduced): prevWasNew = currentIsNew;
-
6358 }
executed: }
Execution Count:7426
7426
6359 -
6360 //repair the old list: -
6361 if (firstOld) {
evaluated: firstOld
TRUEFALSE
yes
Evaluation Count:287
yes
Evaluation Count:29601
287-29601
6362 o->d_func()->focus_next = firstOld;
executed (the execution status of this line is deduced): o->d_func()->focus_next = firstOld;
-
6363 firstOld->d_func()->focus_prev = o;
executed (the execution status of this line is deduced): firstOld->d_func()->focus_prev = o;
-
6364 }
executed: }
Execution Count:287
287
6365 -
6366 if (!q->isWindow()) {
evaluated: !q->isWindow()
TRUEFALSE
yes
Evaluation Count:29766
yes
Evaluation Count:122
122-29766
6367 QWidget *topLevel = q->window();
executed (the execution status of this line is deduced): QWidget *topLevel = q->window();
-
6368 //insert new chain into toplevel's chain -
6369 -
6370 QWidget *prev = topLevel->d_func()->focus_prev;
executed (the execution status of this line is deduced): QWidget *prev = topLevel->d_func()->focus_prev;
-
6371 -
6372 topLevel->d_func()->focus_prev = n;
executed (the execution status of this line is deduced): topLevel->d_func()->focus_prev = n;
-
6373 prev->d_func()->focus_next = q;
executed (the execution status of this line is deduced): prev->d_func()->focus_next = q;
-
6374 -
6375 focus_prev = prev;
executed (the execution status of this line is deduced): focus_prev = prev;
-
6376 n->d_func()->focus_next = topLevel;
executed (the execution status of this line is deduced): n->d_func()->focus_next = topLevel;
-
6377 } else {
executed: }
Execution Count:29766
29766
6378 //repair the new list -
6379 n->d_func()->focus_next = q;
executed (the execution status of this line is deduced): n->d_func()->focus_next = q;
-
6380 focus_prev = n;
executed (the execution status of this line is deduced): focus_prev = n;
-
6381 }
executed: }
Execution Count:122
122
6382 -
6383} -
6384 -
6385/*!\internal -
6386 -
6387 Measures the shortest distance from a point to a rect. -
6388 -
6389 This function is called from QDesktopwidget::screen(QPoint) to find the -
6390 closest screen for a point. -
6391 In directional KeypadNavigation, it is called to find the closest -
6392 widget to the current focus widget center. -
6393*/ -
6394int QWidgetPrivate::pointToRect(const QPoint &p, const QRect &r) -
6395{ -
6396 int dx = 0;
never executed (the execution status of this line is deduced): int dx = 0;
-
6397 int dy = 0;
never executed (the execution status of this line is deduced): int dy = 0;
-
6398 if (p.x() < r.left())
never evaluated: p.x() < r.left()
0
6399 dx = r.left() - p.x();
never executed: dx = r.left() - p.x();
0
6400 else if (p.x() > r.right())
never evaluated: p.x() > r.right()
0
6401 dx = p.x() - r.right();
never executed: dx = p.x() - r.right();
0
6402 if (p.y() < r.top())
never evaluated: p.y() < r.top()
0
6403 dy = r.top() - p.y();
never executed: dy = r.top() - p.y();
0
6404 else if (p.y() > r.bottom())
never evaluated: p.y() > r.bottom()
0
6405 dy = p.y() - r.bottom();
never executed: dy = p.y() - r.bottom();
0
6406 return dx + dy;
never executed: return dx + dy;
0
6407} -
6408 -
6409/*! -
6410 \property QWidget::frameSize -
6411 \brief the size of the widget including any window frame -
6412 -
6413 By default, this property contains a value that depends on the user's -
6414 platform and screen geometry. -
6415*/ -
6416QSize QWidget::frameSize() const -
6417{ -
6418 Q_D(const QWidget);
never executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
6419 if (isWindow() && !(windowType() == Qt::Popup)) {
never evaluated: isWindow()
never evaluated: !(windowType() == Qt::Popup)
0
6420 QRect fs = d->frameStrut();
never executed (the execution status of this line is deduced): QRect fs = d->frameStrut();
-
6421 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
6422 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
6423 } -
6424 return data->crect.size();
never executed: return data->crect.size();
0
6425} -
6426 -
6427/*! \fn void QWidget::move(int x, int y) -
6428 -
6429 \overload -
6430 -
6431 This corresponds to move(QPoint(\a x, \a y)). -
6432*/ -
6433 -
6434void QWidget::move(const QPoint &p) -
6435{ -
6436 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
6437 setAttribute(Qt::WA_Moved);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_Moved);
-
6438 if (testAttribute(Qt::WA_WState_Created)) {
evaluated: testAttribute(Qt::WA_WState_Created)
TRUEFALSE
yes
Evaluation Count:595
yes
Evaluation Count:425
425-595
6439 if (isWindow())
evaluated: isWindow()
TRUEFALSE
yes
Evaluation Count:532
yes
Evaluation Count:63
63-532
6440 d->topData()->posIncludesFrame = false;
executed: d->topData()->posIncludesFrame = false;
Execution Count:532
532
6441 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(),
-
6442 p.y() + geometry().y() - QWidget::y(),
executed (the execution status of this line is deduced): p.y() + geometry().y() - QWidget::y(),
-
6443 width(), height(), true);
executed (the execution status of this line is deduced): width(), height(), true);
-
6444 d->setDirtyOpaqueRegion();
executed (the execution status of this line is deduced): d->setDirtyOpaqueRegion();
-
6445 } else {
executed: }
Execution Count:595
595
6446 // no frame yet: see also QWidgetPrivate::fixPosIncludesFrame(), QWindowPrivate::PositionPolicy. -
6447 if (isWindow())
evaluated: isWindow()
TRUEFALSE
yes
Evaluation Count:194
yes
Evaluation Count:231
194-231
6448 d->topData()->posIncludesFrame = true;
executed: d->topData()->posIncludesFrame = true;
Execution Count:194
194
6449 data->crect.moveTopLeft(p); // no frame yet
executed (the execution status of this line is deduced): data->crect.moveTopLeft(p);
-
6450 setAttribute(Qt::WA_PendingMoveEvent);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_PendingMoveEvent);
-
6451 }
executed: }
Execution Count:425
425
6452} -
6453 -
6454/*! \fn void QWidget::resize(int w, int h) -
6455 \overload -
6456 -
6457 This corresponds to resize(QSize(\a w, \a h)). -
6458*/ -
6459 -
6460void QWidget::resize(const QSize &s) -
6461{ -
6462 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
6463 setAttribute(Qt::WA_Resized);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_Resized);
-
6464 if (testAttribute(Qt::WA_WState_Created)) {
evaluated: testAttribute(Qt::WA_WState_Created)
TRUEFALSE
yes
Evaluation Count:1984
yes
Evaluation Count:3918
1984-3918
6465 d->fixPosIncludesFrame();
executed (the execution status of this line is deduced): d->fixPosIncludesFrame();
-
6466 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);
-
6467 d->setDirtyOpaqueRegion();
executed (the execution status of this line is deduced): d->setDirtyOpaqueRegion();
-
6468 } else {
executed: }
Execution Count:1984
1984
6469 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()));
-
6470 setAttribute(Qt::WA_PendingResizeEvent);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_PendingResizeEvent);
-
6471 }
executed: }
Execution Count:3918
3918
6472} -
6473 -
6474void QWidget::setGeometry(const QRect &r) -
6475{ -
6476 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
6477 setAttribute(Qt::WA_Resized);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_Resized);
-
6478 setAttribute(Qt::WA_Moved);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_Moved);
-
6479 if (isWindow())
evaluated: isWindow()
TRUEFALSE
yes
Evaluation Count:304
yes
Evaluation Count:49212
304-49212
6480 d->topData()->posIncludesFrame = 0;
executed: d->topData()->posIncludesFrame = 0;
Execution Count:304
304
6481 if (testAttribute(Qt::WA_WState_Created)) {
evaluated: testAttribute(Qt::WA_WState_Created)
TRUEFALSE
yes
Evaluation Count:20021
yes
Evaluation Count:29495
20021-29495
6482 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);
-
6483 d->setDirtyOpaqueRegion();
executed (the execution status of this line is deduced): d->setDirtyOpaqueRegion();
-
6484 } else {
executed: }
Execution Count:20021
20021
6485 data->crect.setTopLeft(r.topLeft());
executed (the execution status of this line is deduced): data->crect.setTopLeft(r.topLeft());
-
6486 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()));
-
6487 setAttribute(Qt::WA_PendingMoveEvent);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_PendingMoveEvent);
-
6488 setAttribute(Qt::WA_PendingResizeEvent);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_PendingResizeEvent);
-
6489 }
executed: }
Execution Count:29495
29495
6490} -
6491 -
6492/*! -
6493 \since 4.2 -
6494 Saves the current geometry and state for top-level widgets. -
6495 -
6496 To save the geometry when the window closes, you can -
6497 implement a close event like this: -
6498 -
6499 \snippet code/src_gui_kernel_qwidget.cpp 11 -
6500 -
6501 See the \l{Window Geometry} documentation for an overview of geometry -
6502 issues with windows. -
6503 -
6504 Use QMainWindow::saveState() to save the geometry and the state of -
6505 toolbars and dock widgets. -
6506 -
6507 \sa restoreGeometry(), QMainWindow::saveState(), QMainWindow::restoreState() -
6508*/ -
6509QByteArray QWidget::saveGeometry() const -
6510{ -
6511#ifdef Q_WS_MAC -
6512 // We check if the window was maximized during this invocation. If so, we need to record the -
6513 // starting position as 0,0. -
6514 Q_D(const QWidget); -
6515 QRect newFramePosition = frameGeometry(); -
6516 QRect newNormalPosition = normalGeometry(); -
6517 if(d->topData()->wasMaximized && !(windowState() & Qt::WindowMaximized)) { -
6518 // Change the starting position -
6519 newFramePosition.moveTo(0, 0); -
6520 newNormalPosition.moveTo(0, 0); -
6521 } -
6522#endif // Q_WS_MAC -
6523 QByteArray array;
never executed (the execution status of this line is deduced): QByteArray array;
-
6524 QDataStream stream(&array, QIODevice::WriteOnly);
never executed (the execution status of this line is deduced): QDataStream stream(&array, QIODevice::WriteOnly);
-
6525 stream.setVersion(QDataStream::Qt_4_0);
never executed (the execution status of this line is deduced): stream.setVersion(QDataStream::Qt_4_0);
-
6526 const quint32 magicNumber = 0x1D9D0CB;
never executed (the execution status of this line is deduced): const quint32 magicNumber = 0x1D9D0CB;
-
6527 quint16 majorVersion = 1;
never executed (the execution status of this line is deduced): quint16 majorVersion = 1;
-
6528 quint16 minorVersion = 0;
never executed (the execution status of this line is deduced): quint16 minorVersion = 0;
-
6529 stream << magicNumber
never executed (the execution status of this line is deduced): stream << magicNumber
-
6530 << majorVersion
never executed (the execution status of this line is deduced): << majorVersion
-
6531 << minorVersion
never executed (the execution status of this line is deduced): << minorVersion
-
6532#ifdef Q_WS_MAC
never executed (the execution status of this line is deduced):
-
6533 << newFramePosition
never executed (the execution status of this line is deduced):
-
6534 << newNormalPosition
never executed (the execution status of this line is deduced):
-
6535#else
never executed (the execution status of this line is deduced):
-
6536 << frameGeometry()
never executed (the execution status of this line is deduced): << frameGeometry()
-
6537 << normalGeometry()
never executed (the execution status of this line is deduced): << normalGeometry()
-
6538#endif // Q_WS_MAC
never executed (the execution status of this line is deduced):
-
6539 << qint32(QApplication::desktop()->screenNumber(this))
never executed (the execution status of this line is deduced): << qint32(QApplication::desktop()->screenNumber(this))
-
6540 << quint8(windowState() & Qt::WindowMaximized)
never executed (the execution status of this line is deduced): << quint8(windowState() & Qt::WindowMaximized)
-
6541 << quint8(windowState() & Qt::WindowFullScreen);
never executed (the execution status of this line is deduced): << quint8(windowState() & Qt::WindowFullScreen);
-
6542 return array;
never executed: return array;
0
6543} -
6544 -
6545/*! -
6546 \since 4.2 -
6547 -
6548 Restores the geometry and state top-level widgets stored in the -
6549 byte array \a geometry. Returns true on success; otherwise -
6550 returns false. -
6551 -
6552 If the restored geometry is off-screen, it will be modified to be -
6553 inside the available screen geometry. -
6554 -
6555 To restore geometry saved using QSettings, you can use code like -
6556 this: -
6557 -
6558 \snippet code/src_gui_kernel_qwidget.cpp 12 -
6559 -
6560 See the \l{Window Geometry} documentation for an overview of geometry -
6561 issues with windows. -
6562 -
6563 Use QMainWindow::restoreState() to restore the geometry and the -
6564 state of toolbars and dock widgets. -
6565 -
6566 \sa saveGeometry(), QSettings, QMainWindow::saveState(), QMainWindow::restoreState() -
6567*/ -
6568bool QWidget::restoreGeometry(const QByteArray &geometry) -
6569{ -
6570 if (geometry.size() < 4)
never evaluated: geometry.size() < 4
0
6571 return false;
never executed: return false;
0
6572 QDataStream stream(geometry);
never executed (the execution status of this line is deduced): QDataStream stream(geometry);
-
6573 stream.setVersion(QDataStream::Qt_4_0);
never executed (the execution status of this line is deduced): stream.setVersion(QDataStream::Qt_4_0);
-
6574 -
6575 const quint32 magicNumber = 0x1D9D0CB;
never executed (the execution status of this line is deduced): const quint32 magicNumber = 0x1D9D0CB;
-
6576 quint32 storedMagicNumber;
never executed (the execution status of this line is deduced): quint32 storedMagicNumber;
-
6577 stream >> storedMagicNumber;
never executed (the execution status of this line is deduced): stream >> storedMagicNumber;
-
6578 if (storedMagicNumber != magicNumber)
never evaluated: storedMagicNumber != magicNumber
0
6579 return false;
never executed: return false;
0
6580 -
6581 const quint16 currentMajorVersion = 1;
never executed (the execution status of this line is deduced): const quint16 currentMajorVersion = 1;
-
6582 quint16 majorVersion = 0;
never executed (the execution status of this line is deduced): quint16 majorVersion = 0;
-
6583 quint16 minorVersion = 0;
never executed (the execution status of this line is deduced): quint16 minorVersion = 0;
-
6584 -
6585 stream >> majorVersion >> minorVersion;
never executed (the execution status of this line is deduced): stream >> majorVersion >> minorVersion;
-
6586 -
6587 if (majorVersion != currentMajorVersion)
never evaluated: majorVersion != currentMajorVersion
0
6588 return false;
never executed: return false;
0
6589 // (Allow all minor versions.) -
6590 -
6591 QRect restoredFrameGeometry;
never executed (the execution status of this line is deduced): QRect restoredFrameGeometry;
-
6592 QRect restoredNormalGeometry;
never executed (the execution status of this line is deduced): QRect restoredNormalGeometry;
-
6593 qint32 restoredScreenNumber;
never executed (the execution status of this line is deduced): qint32 restoredScreenNumber;
-
6594 quint8 maximized;
never executed (the execution status of this line is deduced): quint8 maximized;
-
6595 quint8 fullScreen;
never executed (the execution status of this line is deduced): quint8 fullScreen;
-
6596 -
6597 stream >> restoredFrameGeometry
never executed (the execution status of this line is deduced): stream >> restoredFrameGeometry
-
6598 >> restoredNormalGeometry
never executed (the execution status of this line is deduced): >> restoredNormalGeometry
-
6599 >> restoredScreenNumber
never executed (the execution status of this line is deduced): >> restoredScreenNumber
-
6600 >> maximized
never executed (the execution status of this line is deduced): >> maximized
-
6601 >> fullScreen;
never executed (the execution status of this line is deduced): >> fullScreen;
-
6602 -
6603 const int frameHeight = 20;
never executed (the execution status of this line is deduced): const int frameHeight = 20;
-
6604 if (!restoredFrameGeometry.isValid())
never evaluated: !restoredFrameGeometry.isValid()
0
6605 restoredFrameGeometry = QRect(QPoint(0,0), sizeHint());
never executed: restoredFrameGeometry = QRect(QPoint(0,0), sizeHint());
0
6606 -
6607 if (!restoredNormalGeometry.isValid())
never evaluated: !restoredNormalGeometry.isValid()
0
6608 restoredNormalGeometry = QRect(QPoint(0, frameHeight), sizeHint());
never executed: restoredNormalGeometry = QRect(QPoint(0, frameHeight), sizeHint());
0
6609 if (!restoredNormalGeometry.isValid()) {
never evaluated: !restoredNormalGeometry.isValid()
0
6610 // use the widget's adjustedSize if the sizeHint() doesn't help -
6611 restoredNormalGeometry.setSize(restoredNormalGeometry
never executed (the execution status of this line is deduced): restoredNormalGeometry.setSize(restoredNormalGeometry
-
6612 .size()
never executed (the execution status of this line is deduced): .size()
-
6613 .expandedTo(d_func()->adjustedSize()));
never executed (the execution status of this line is deduced): .expandedTo(d_func()->adjustedSize()));
-
6614 }
never executed: }
0
6615 -
6616 const QDesktopWidget * const desktop = QApplication::desktop();
never executed (the execution status of this line is deduced): const QDesktopWidget * const desktop = QApplication::desktop();
-
6617 if (restoredScreenNumber >= desktop->numScreens())
never evaluated: restoredScreenNumber >= desktop->numScreens()
0
6618 restoredScreenNumber = desktop->primaryScreen();
never executed: restoredScreenNumber = desktop->primaryScreen();
0
6619 -
6620 const QRect availableGeometry = desktop->availableGeometry(restoredScreenNumber);
never executed (the execution status of this line is deduced): const QRect availableGeometry = desktop->availableGeometry(restoredScreenNumber);
-
6621 -
6622 // Modify the restored geometry if we are about to restore to coordinates -
6623 // that would make the window "lost". This happens if: -
6624 // - The restored geometry is completely oustside the available geometry -
6625 // - The title bar is outside the available geometry. -
6626 // - (Mac only) The window is higher than the available geometry. It must -
6627 // be possible to bring the size grip on screen by moving the window. -
6628#ifdef Q_WS_MAC -
6629 restoredFrameGeometry.setHeight(qMin(restoredFrameGeometry.height(), availableGeometry.height())); -
6630 restoredNormalGeometry.setHeight(qMin(restoredNormalGeometry.height(), availableGeometry.height() - frameHeight)); -
6631#endif -
6632 -
6633 if (!restoredFrameGeometry.intersects(availableGeometry)) {
never evaluated: !restoredFrameGeometry.intersects(availableGeometry)
0
6634 restoredFrameGeometry.moveBottom(qMin(restoredFrameGeometry.bottom(), availableGeometry.bottom()));
never executed (the execution status of this line is deduced): restoredFrameGeometry.moveBottom(qMin(restoredFrameGeometry.bottom(), availableGeometry.bottom()));
-
6635 restoredFrameGeometry.moveLeft(qMax(restoredFrameGeometry.left(), availableGeometry.left()));
never executed (the execution status of this line is deduced): restoredFrameGeometry.moveLeft(qMax(restoredFrameGeometry.left(), availableGeometry.left()));
-
6636 restoredFrameGeometry.moveRight(qMin(restoredFrameGeometry.right(), availableGeometry.right()));
never executed (the execution status of this line is deduced): restoredFrameGeometry.moveRight(qMin(restoredFrameGeometry.right(), availableGeometry.right()));
-
6637 }
never executed: }
0
6638 restoredFrameGeometry.moveTop(qMax(restoredFrameGeometry.top(), availableGeometry.top()));
never executed (the execution status of this line is deduced): restoredFrameGeometry.moveTop(qMax(restoredFrameGeometry.top(), availableGeometry.top()));
-
6639 -
6640 if (!restoredNormalGeometry.intersects(availableGeometry)) {
never evaluated: !restoredNormalGeometry.intersects(availableGeometry)
0
6641 restoredNormalGeometry.moveBottom(qMin(restoredNormalGeometry.bottom(), availableGeometry.bottom()));
never executed (the execution status of this line is deduced): restoredNormalGeometry.moveBottom(qMin(restoredNormalGeometry.bottom(), availableGeometry.bottom()));
-
6642 restoredNormalGeometry.moveLeft(qMax(restoredNormalGeometry.left(), availableGeometry.left()));
never executed (the execution status of this line is deduced): restoredNormalGeometry.moveLeft(qMax(restoredNormalGeometry.left(), availableGeometry.left()));
-
6643 restoredNormalGeometry.moveRight(qMin(restoredNormalGeometry.right(), availableGeometry.right()));
never executed (the execution status of this line is deduced): restoredNormalGeometry.moveRight(qMin(restoredNormalGeometry.right(), availableGeometry.right()));
-
6644 }
never executed: }
0
6645 restoredNormalGeometry.moveTop(qMax(restoredNormalGeometry.top(), availableGeometry.top() + frameHeight));
never executed (the execution status of this line is deduced): restoredNormalGeometry.moveTop(qMax(restoredNormalGeometry.top(), availableGeometry.top() + frameHeight));
-
6646 -
6647 if (maximized || fullScreen) {
never evaluated: maximized
never evaluated: fullScreen
0
6648 // set geometry before setting the window state to make -
6649 // sure the window is maximized to the right screen. -
6650 // Skip on windows: the window is restored into a broken -
6651 // half-maximized state. -
6652#ifndef Q_OS_WIN -
6653 setGeometry(restoredNormalGeometry);
never executed (the execution status of this line is deduced): setGeometry(restoredNormalGeometry);
-
6654#endif -
6655 Qt::WindowStates ws = windowState();
never executed (the execution status of this line is deduced): Qt::WindowStates ws = windowState();
-
6656 if (maximized)
never evaluated: maximized
0
6657 ws |= Qt::WindowMaximized;
never executed: ws |= Qt::WindowMaximized;
0
6658 if (fullScreen)
never evaluated: fullScreen
0
6659 ws |= Qt::WindowFullScreen;
never executed: ws |= Qt::WindowFullScreen;
0
6660 setWindowState(ws);
never executed (the execution status of this line is deduced): setWindowState(ws);
-
6661 d_func()->topData()->normalGeometry = restoredNormalGeometry;
never executed (the execution status of this line is deduced): d_func()->topData()->normalGeometry = restoredNormalGeometry;
-
6662 } else {
never executed: }
0
6663 QPoint offset;
never executed (the execution status of this line is deduced): QPoint offset;
-
6664#ifdef Q_WS_X11 -
6665 if (isFullScreen()) -
6666 offset = d_func()->topData()->fullScreenOffset; -
6667#endif -
6668 setWindowState(windowState() & ~(Qt::WindowMaximized | Qt::WindowFullScreen));
never executed (the execution status of this line is deduced): setWindowState(windowState() & ~(Qt::WindowMaximized | Qt::WindowFullScreen));
-
6669 move(restoredFrameGeometry.topLeft() + offset);
never executed (the execution status of this line is deduced): move(restoredFrameGeometry.topLeft() + offset);
-
6670 resize(restoredNormalGeometry.size());
never executed (the execution status of this line is deduced): resize(restoredNormalGeometry.size());
-
6671 }
never executed: }
0
6672 return true;
never executed: return true;
0
6673} -
6674 -
6675/*!\fn void QWidget::setGeometry(int x, int y, int w, int h) -
6676 \overload -
6677 -
6678 This corresponds to setGeometry(QRect(\a x, \a y, \a w, \a h)). -
6679*/ -
6680 -
6681/*! -
6682 Sets the margins around the contents of the widget to have the sizes -
6683 \a left, \a top, \a right, and \a bottom. The margins are used by -
6684 the layout system, and may be used by subclasses to specify the area -
6685 to draw in (e.g. excluding the frame). -
6686 -
6687 Changing the margins will trigger a resizeEvent(). -
6688 -
6689 \sa contentsRect(), getContentsMargins() -
6690*/ -
6691void QWidget::setContentsMargins(int left, int top, int right, int bottom) -
6692{ -
6693 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
6694 if (left == d->leftmargin && top == d->topmargin
evaluated: left == d->leftmargin
TRUEFALSE
yes
Evaluation Count:27041
yes
Evaluation Count:6434
evaluated: top == d->topmargin
TRUEFALSE
yes
Evaluation Count:26937
yes
Evaluation Count:104
104-27041
6695 && right == d->rightmargin && bottom == d->bottommargin)
evaluated: right == d->rightmargin
TRUEFALSE
yes
Evaluation Count:26936
yes
Evaluation Count:1
partially evaluated: bottom == d->bottommargin
TRUEFALSE
yes
Evaluation Count:26936
no
Evaluation Count:0
0-26936
6696 return;
executed: return;
Execution Count:26936
26936
6697 d->leftmargin = left;
executed (the execution status of this line is deduced): d->leftmargin = left;
-
6698 d->topmargin = top;
executed (the execution status of this line is deduced): d->topmargin = top;
-
6699 d->rightmargin = right;
executed (the execution status of this line is deduced): d->rightmargin = right;
-
6700 d->bottommargin = bottom;
executed (the execution status of this line is deduced): d->bottommargin = bottom;
-
6701 -
6702 if (QLayout *l=d->layout)
evaluated: QLayout *l=d->layout
TRUEFALSE
yes
Evaluation Count:485
yes
Evaluation Count:6054
485-6054
6703 l->update(); //force activate; will do updateGeometry
executed: l->update();
Execution Count:485
485
6704 else -
6705 updateGeometry();
executed: updateGeometry();
Execution Count:6054
6054
6706 -
6707 if (isVisible()) {
evaluated: isVisible()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:6537
2-6537
6708 update();
executed (the execution status of this line is deduced): update();
-
6709 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());
-
6710 QApplication::sendEvent(this, &e);
executed (the execution status of this line is deduced): QApplication::sendEvent(this, &e);
-
6711 } else {
executed: }
Execution Count:2
2
6712 setAttribute(Qt::WA_PendingResizeEvent, true);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_PendingResizeEvent, true);
-
6713 }
executed: }
Execution Count:6537
6537
6714 -
6715 QEvent e(QEvent::ContentsRectChange);
executed (the execution status of this line is deduced): QEvent e(QEvent::ContentsRectChange);
-
6716 QApplication::sendEvent(this, &e);
executed (the execution status of this line is deduced): QApplication::sendEvent(this, &e);
-
6717}
executed: }
Execution Count:6539
6539
6718 -
6719/*! -
6720 \overload -
6721 \since 4.6 -
6722 -
6723 \brief The setContentsMargins function sets the margins around the -
6724 widget's contents. -
6725 -
6726 Sets the margins around the contents of the widget to have the -
6727 sizes determined by \a margins. The margins are -
6728 used by the layout system, and may be used by subclasses to -
6729 specify the area to draw in (e.g. excluding the frame). -
6730 -
6731 Changing the margins will trigger a resizeEvent(). -
6732 -
6733 \sa contentsRect(), getContentsMargins() -
6734*/ -
6735void QWidget::setContentsMargins(const QMargins &margins) -
6736{ -
6737 setContentsMargins(margins.left(), margins.top(),
never executed (the execution status of this line is deduced): setContentsMargins(margins.left(), margins.top(),
-
6738 margins.right(), margins.bottom());
never executed (the execution status of this line is deduced): margins.right(), margins.bottom());
-
6739}
never executed: }
0
6740 -
6741/*! -
6742 Returns the widget's contents margins for \a left, \a top, \a -
6743 right, and \a bottom. -
6744 -
6745 \sa setContentsMargins(), contentsRect() -
6746 */ -
6747void QWidget::getContentsMargins(int *left, int *top, int *right, int *bottom) const -
6748{ -
6749 Q_D(const QWidget);
executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
6750 if (left)
partially evaluated: left
TRUEFALSE
yes
Evaluation Count:2788
no
Evaluation Count:0
0-2788
6751 *left = d->leftmargin;
executed: *left = d->leftmargin;
Execution Count:2788
2788
6752 if (top)
evaluated: top
TRUEFALSE
yes
Evaluation Count:2739
yes
Evaluation Count:49
49-2739
6753 *top = d->topmargin;
executed: *top = d->topmargin;
Execution Count:2739
2739
6754 if (right)
partially evaluated: right
TRUEFALSE
yes
Evaluation Count:2788
no
Evaluation Count:0
0-2788
6755 *right = d->rightmargin;
executed: *right = d->rightmargin;
Execution Count:2788
2788
6756 if (bottom)
evaluated: bottom
TRUEFALSE
yes
Evaluation Count:2739
yes
Evaluation Count:49
49-2739
6757 *bottom = d->bottommargin;
executed: *bottom = d->bottommargin;
Execution Count:2739
2739
6758}
executed: }
Execution Count:2788
2788
6759 -
6760/*! -
6761 \since 4.6 -
6762 -
6763 \brief The contentsMargins function returns the widget's contents margins. -
6764 -
6765 \sa getContentsMargins(), setContentsMargins(), contentsRect() -
6766 */ -
6767QMargins QWidget::contentsMargins() const -
6768{ -
6769 Q_D(const QWidget);
never executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
6770 return QMargins(d->leftmargin, d->topmargin, d->rightmargin, d->bottommargin);
never executed: return QMargins(d->leftmargin, d->topmargin, d->rightmargin, d->bottommargin);
0
6771} -
6772 -
6773 -
6774/*! -
6775 Returns the area inside the widget's margins. -
6776 -
6777 \sa setContentsMargins(), getContentsMargins() -
6778*/ -
6779QRect QWidget::contentsRect() const -
6780{ -
6781 Q_D(const QWidget);
executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
6782 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:241352
241352
6783 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:241352
241352
6784 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:241352
241352
6785 -
6786} -
6787 -
6788 -
6789 -
6790/*! -
6791 \fn void QWidget::customContextMenuRequested(const QPoint &pos) -
6792 -
6793 This signal is emitted when the widget's \l contextMenuPolicy is -
6794 Qt::CustomContextMenu, and the user has requested a context menu on -
6795 the widget. The position \a pos is the position of the context menu -
6796 event that the widget receives. Normally this is in widget -
6797 coordinates. The exception to this rule is QAbstractScrollArea and -
6798 its subclasses that map the context menu event to coordinates of the -
6799 \l{QAbstractScrollArea::viewport()}{viewport()}. -
6800 -
6801 -
6802 \sa mapToGlobal(), QMenu, contextMenuPolicy -
6803*/ -
6804 -
6805 -
6806/*! -
6807 \property QWidget::contextMenuPolicy -
6808 \brief how the widget shows a context menu -
6809 -
6810 The default value of this property is Qt::DefaultContextMenu, -
6811 which means the contextMenuEvent() handler is called. Other values -
6812 are Qt::NoContextMenu, Qt::PreventContextMenu, -
6813 Qt::ActionsContextMenu, and Qt::CustomContextMenu. With -
6814 Qt::CustomContextMenu, the signal customContextMenuRequested() is -
6815 emitted. -
6816 -
6817 \sa contextMenuEvent(), customContextMenuRequested(), actions() -
6818*/ -
6819 -
6820Qt::ContextMenuPolicy QWidget::contextMenuPolicy() const -
6821{ -
6822 return (Qt::ContextMenuPolicy)data->context_menu_policy;
never executed: return (Qt::ContextMenuPolicy)data->context_menu_policy;
0
6823} -
6824 -
6825void QWidget::setContextMenuPolicy(Qt::ContextMenuPolicy policy) -
6826{ -
6827 data->context_menu_policy = (uint) policy;
executed (the execution status of this line is deduced): data->context_menu_policy = (uint) policy;
-
6828}
executed: }
Execution Count:972
972
6829 -
6830/*! -
6831 \property QWidget::focusPolicy -
6832 \brief the way the widget accepts keyboard focus -
6833 -
6834 The policy is Qt::TabFocus if the widget accepts keyboard -
6835 focus by tabbing, Qt::ClickFocus if the widget accepts -
6836 focus by clicking, Qt::StrongFocus if it accepts both, and -
6837 Qt::NoFocus (the default) if it does not accept focus at -
6838 all. -
6839 -
6840 You must enable keyboard focus for a widget if it processes -
6841 keyboard events. This is normally done from the widget's -
6842 constructor. For instance, the QLineEdit constructor calls -
6843 setFocusPolicy(Qt::StrongFocus). -
6844 -
6845 If the widget has a focus proxy, then the focus policy will -
6846 be propagated to it. -
6847 -
6848 \sa focusInEvent(), focusOutEvent(), keyPressEvent(), keyReleaseEvent(), enabled -
6849*/ -
6850 -
6851 -
6852Qt::FocusPolicy QWidget::focusPolicy() const -
6853{ -
6854 return (Qt::FocusPolicy)data->focus_policy;
executed: return (Qt::FocusPolicy)data->focus_policy;
Execution Count:62115
62115
6855} -
6856 -
6857void QWidget::setFocusPolicy(Qt::FocusPolicy policy) -
6858{ -
6859 data->focus_policy = (uint) policy;
executed (the execution status of this line is deduced): data->focus_policy = (uint) policy;
-
6860 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
6861 if (d->extra && d->extra->focus_proxy)
evaluated: d->extra
TRUEFALSE
yes
Evaluation Count:1249
yes
Evaluation Count:19695
evaluated: d->extra->focus_proxy
TRUEFALSE
yes
Evaluation Count:263
yes
Evaluation Count:986
263-19695
6862 d->extra->focus_proxy->setFocusPolicy(policy);
executed: d->extra->focus_proxy->setFocusPolicy(policy);
Execution Count:263
263
6863}
executed: }
Execution Count:20944
20944
6864 -
6865/*! -
6866 \property QWidget::updatesEnabled -
6867 \brief whether updates are enabled -
6868 -
6869 An updates enabled widget receives paint events and has a system -
6870 background; a disabled widget does not. This also implies that -
6871 calling update() and repaint() has no effect if updates are -
6872 disabled. -
6873 -
6874 By default, this property is true. -
6875 -
6876 setUpdatesEnabled() is normally used to disable updates for a -
6877 short period of time, for instance to avoid screen flicker during -
6878 large changes. In Qt, widgets normally do not generate screen -
6879 flicker, but on X11 the server might erase regions on the screen -
6880 when widgets get hidden before they can be replaced by other -
6881 widgets. Disabling updates solves this. -
6882 -
6883 Example: -
6884 \snippet code/src_gui_kernel_qwidget.cpp 13 -
6885 -
6886 Disabling a widget implicitly disables all its children. Enabling a widget -
6887 enables all child widgets \e except top-level widgets or those that -
6888 have been explicitly disabled. Re-enabling updates implicitly calls -
6889 update() on the widget. -
6890 -
6891 \sa paintEvent() -
6892*/ -
6893void QWidget::setUpdatesEnabled(bool enable) -
6894{ -
6895 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
6896 setAttribute(Qt::WA_ForceUpdatesDisabled, !enable);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_ForceUpdatesDisabled, !enable);
-
6897 d->setUpdatesEnabled_helper(enable);
executed (the execution status of this line is deduced): d->setUpdatesEnabled_helper(enable);
-
6898}
executed: }
Execution Count:2362
2362
6899 -
6900/*! -
6901 Shows the widget and its child widgets. This function is -
6902 equivalent to setVisible(true) in the normal case, and equivalent -
6903 to showFullScreen() if the QStyleHints::showIsFullScreen() hint -
6904 is true. -
6905 -
6906 \sa raise(), showEvent(), hide(), setVisible(), showMinimized(), showMaximized(), -
6907 showNormal(), isVisible() -
6908*/ -
6909void QWidget::show() -
6910{ -
6911 if (isWindow() && qApp->styleHints()->showIsFullScreen())
evaluated: isWindow()
TRUEFALSE
yes
Evaluation Count:1817
yes
Evaluation Count:8811
partially evaluated: (static_cast<QApplication *>(QCoreApplication::instance()))->styleHints()->showIsFullScreen()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1817
0-8811
6912 showFullScreen();
never executed: showFullScreen();
0
6913 else -
6914 setVisible(true);
executed: setVisible(true);
Execution Count:10628
10628
6915} -
6916 -
6917/*! \internal -
6918 -
6919 Makes the widget visible in the isVisible() meaning of the word. -
6920 It is only called for toplevels or widgets with visible parents. -
6921 */ -
6922void QWidgetPrivate::show_recursive() -
6923{ -
6924 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
6925 // polish if necessary -
6926 -
6927 if (!q->testAttribute(Qt::WA_WState_Created))
evaluated: !q->testAttribute(Qt::WA_WState_Created)
TRUEFALSE
yes
Evaluation Count:571
yes
Evaluation Count:3155
571-3155
6928 createRecursively();
executed: createRecursively();
Execution Count:571
571
6929 q->ensurePolished();
executed (the execution status of this line is deduced): q->ensurePolished();
-
6930 -
6931 if (!q->isWindow() && q->parentWidget()->d_func()->layout && !q->parentWidget()->data->in_show)
partially evaluated: !q->isWindow()
TRUEFALSE
yes
Evaluation Count:3726
no
Evaluation Count:0
evaluated: q->parentWidget()->d_func()->layout
TRUEFALSE
yes
Evaluation Count:3180
yes
Evaluation Count:546
partially evaluated: !q->parentWidget()->data->in_show
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3180
0-3726
6932 q->parentWidget()->d_func()->layout->activate();
never executed: q->parentWidget()->d_func()->layout->activate();
0
6933 // activate our layout before we and our children become visible -
6934 if (layout)
evaluated: layout
TRUEFALSE
yes
Evaluation Count:656
yes
Evaluation Count:3070
656-3070
6935 layout->activate();
executed: layout->activate();
Execution Count:656
656
6936 -
6937 show_helper();
executed (the execution status of this line is deduced): show_helper();
-
6938}
executed: }
Execution Count:3726
3726
6939 -
6940void QWidgetPrivate::sendPendingMoveAndResizeEvents(bool recursive, bool disableUpdates) -
6941{ -
6942 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
6943 -
6944 disableUpdates = disableUpdates && q->updatesEnabled();
evaluated: disableUpdates
TRUEFALSE
yes
Evaluation Count:1361
yes
Evaluation Count:10789
partially evaluated: q->updatesEnabled()
TRUEFALSE
yes
Evaluation Count:1361
no
Evaluation Count:0
0-10789
6945 if (disableUpdates)
evaluated: disableUpdates
TRUEFALSE
yes
Evaluation Count:1361
yes
Evaluation Count:10789
1361-10789
6946 q->setAttribute(Qt::WA_UpdatesDisabled);
executed: q->setAttribute(Qt::WA_UpdatesDisabled);
Execution Count:1361
1361
6947 -
6948 if (q->testAttribute(Qt::WA_PendingMoveEvent)) {
evaluated: q->testAttribute(Qt::WA_PendingMoveEvent)
TRUEFALSE
yes
Evaluation Count:7747
yes
Evaluation Count:4403
4403-7747
6949 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());
-
6950 QApplication::sendEvent(q, &e);
executed (the execution status of this line is deduced): QApplication::sendEvent(q, &e);
-
6951 q->setAttribute(Qt::WA_PendingMoveEvent, false);
executed (the execution status of this line is deduced): q->setAttribute(Qt::WA_PendingMoveEvent, false);
-
6952 }
executed: }
Execution Count:7747
7747
6953 -
6954 if (q->testAttribute(Qt::WA_PendingResizeEvent)) {
evaluated: q->testAttribute(Qt::WA_PendingResizeEvent)
TRUEFALSE
yes
Evaluation Count:7900
yes
Evaluation Count:4250
4250-7900
6955 QResizeEvent e(data.crect.size(), QSize());
executed (the execution status of this line is deduced): QResizeEvent e(data.crect.size(), QSize());
-
6956 QApplication::sendEvent(q, &e);
executed (the execution status of this line is deduced): QApplication::sendEvent(q, &e);
-
6957 q->setAttribute(Qt::WA_PendingResizeEvent, false);
executed (the execution status of this line is deduced): q->setAttribute(Qt::WA_PendingResizeEvent, false);
-
6958 }
executed: }
Execution Count:7900
7900
6959 -
6960 if (disableUpdates)
evaluated: disableUpdates
TRUEFALSE
yes
Evaluation Count:1361
yes
Evaluation Count:10789
1361-10789
6961 q->setAttribute(Qt::WA_UpdatesDisabled, false);
executed: q->setAttribute(Qt::WA_UpdatesDisabled, false);
Execution Count:1361
1361
6962 -
6963 if (!recursive)
evaluated: !recursive
TRUEFALSE
yes
Evaluation Count:10789
yes
Evaluation Count:1361
1361-10789
6964 return;
executed: return;
Execution Count:10789
10789
6965 -
6966 for (int i = 0; i < children.size(); ++i) {
evaluated: i < children.size()
TRUEFALSE
yes
Evaluation Count:1582
yes
Evaluation Count:1361
1361-1582
6967 if (QWidget *child = qobject_cast<QWidget *>(children.at(i)))
evaluated: QWidget *child = qobject_cast<QWidget *>(children.at(i))
TRUEFALSE
yes
Evaluation Count:1276
yes
Evaluation Count:306
306-1276
6968 child->d_func()->sendPendingMoveAndResizeEvents(recursive, disableUpdates);
executed: child->d_func()->sendPendingMoveAndResizeEvents(recursive, disableUpdates);
Execution Count:1276
1276
6969 }
executed: }
Execution Count:1582
1582
6970}
executed: }
Execution Count:1361
1361
6971 -
6972void QWidgetPrivate::activateChildLayoutsRecursively() -
6973{ -
6974 sendPendingMoveAndResizeEvents(false, true);
never executed (the execution status of this line is deduced): sendPendingMoveAndResizeEvents(false, true);
-
6975 -
6976 for (int i = 0; i < children.size(); ++i) {
never evaluated: i < children.size()
0
6977 QWidget *child = qobject_cast<QWidget *>(children.at(i));
never executed (the execution status of this line is deduced): QWidget *child = qobject_cast<QWidget *>(children.at(i));
-
6978 if (!child || child->isHidden() || child->isWindow())
never evaluated: !child
never evaluated: child->isHidden()
never evaluated: child->isWindow()
0
6979 continue;
never executed: continue;
0
6980 -
6981 child->ensurePolished();
never executed (the execution status of this line is deduced): child->ensurePolished();
-
6982 -
6983 // Activate child's layout -
6984 QWidgetPrivate *childPrivate = child->d_func();
never executed (the execution status of this line is deduced): QWidgetPrivate *childPrivate = child->d_func();
-
6985 if (childPrivate->layout)
never evaluated: childPrivate->layout
0
6986 childPrivate->layout->activate();
never executed: childPrivate->layout->activate();
0
6987 -
6988 // Pretend we're visible. -
6989 const bool wasVisible = child->isVisible();
never executed (the execution status of this line is deduced): const bool wasVisible = child->isVisible();
-
6990 if (!wasVisible)
never evaluated: !wasVisible
0
6991 child->setAttribute(Qt::WA_WState_Visible);
never executed: child->setAttribute(Qt::WA_WState_Visible);
0
6992 -
6993 // Do the same for all my children. -
6994 childPrivate->activateChildLayoutsRecursively();
never executed (the execution status of this line is deduced): childPrivate->activateChildLayoutsRecursively();
-
6995 -
6996 // We're not cheating anymore. -
6997 if (!wasVisible)
never evaluated: !wasVisible
0
6998 child->setAttribute(Qt::WA_WState_Visible, false);
never executed: child->setAttribute(Qt::WA_WState_Visible, false);
0
6999 }
never executed: }
0
7000}
never executed: }
0
7001 -
7002void QWidgetPrivate::show_helper() -
7003{ -
7004 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
7005 data.in_show = true; // qws optimization
executed (the execution status of this line is deduced): data.in_show = true;
-
7006 // make sure we receive pending move and resize events -
7007 sendPendingMoveAndResizeEvents();
executed (the execution status of this line is deduced): sendPendingMoveAndResizeEvents();
-
7008 -
7009 // become visible before showing all children -
7010 q->setAttribute(Qt::WA_WState_Visible);
executed (the execution status of this line is deduced): q->setAttribute(Qt::WA_WState_Visible);
-
7011 -
7012 // finally show all children recursively -
7013 showChildren(false);
executed (the execution status of this line is deduced): showChildren(false);
-
7014 -
7015 -
7016 -
7017 // popup handling: new popups and tools need to be raised, and -
7018 // existing popups must be closed. Also propagate the current -
7019 // windows's KeyboardFocusChange status. -
7020 if (q->isWindow()) {
evaluated: q->isWindow()
TRUEFALSE
yes
Evaluation Count:1533
yes
Evaluation Count:9256
1533-9256
7021 if ((q->windowType() == Qt::Tool) || (q->windowType() == Qt::Popup) || q->windowType() == Qt::ToolTip) {
evaluated: (q->windowType() == Qt::Tool)
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:1520
evaluated: (q->windowType() == Qt::Popup)
TRUEFALSE
yes
Evaluation Count:69
yes
Evaluation Count:1451
evaluated: q->windowType() == Qt::ToolTip
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:1441
10-1520
7022 q->raise();
executed (the execution status of this line is deduced): q->raise();
-
7023 if (q->parentWidget() && q->parentWidget()->window()->testAttribute(Qt::WA_KeyboardFocusChange))
evaluated: q->parentWidget()
TRUEFALSE
yes
Evaluation Count:47
yes
Evaluation Count:45
evaluated: q->parentWidget()->window()->testAttribute(Qt::WA_KeyboardFocusChange)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:46
1-47
7024 q->setAttribute(Qt::WA_KeyboardFocusChange);
executed: q->setAttribute(Qt::WA_KeyboardFocusChange);
Execution Count:1
1
7025 } else {
executed: }
Execution Count:92
92
7026 while (QApplication::activePopupWidget()) {
evaluated: QApplication::activePopupWidget()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1441
1-1441
7027 if (!QApplication::activePopupWidget()->close())
partially evaluated: !QApplication::activePopupWidget()->close()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
7028 break;
never executed: break;
0
7029 }
executed: }
Execution Count:1
1
7030 }
executed: }
Execution Count:1441
1441
7031 } -
7032 -
7033 // Automatic embedding of child windows of widgets already embedded into -
7034 // QGraphicsProxyWidget when they are shown the first time. -
7035 bool isEmbedded = false;
executed (the execution status of this line is deduced): bool isEmbedded = false;
-
7036#ifndef QT_NO_GRAPHICSVIEW -
7037 if (q->isWindow()) {
evaluated: q->isWindow()
TRUEFALSE
yes
Evaluation Count:1533
yes
Evaluation Count:9256
1533-9256
7038 isEmbedded = q->graphicsProxyWidget() ? true : false;
evaluated: q->graphicsProxyWidget()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:1530
3-1530
7039 if (!isEmbedded && !bypassGraphicsProxyWidget(q)) {
evaluated: !isEmbedded
TRUEFALSE
yes
Evaluation Count:1530
yes
Evaluation Count:3
evaluated: !bypassGraphicsProxyWidget(q)
TRUEFALSE
yes
Evaluation Count:1524
yes
Evaluation Count:6
3-1530
7040 QGraphicsProxyWidget *ancestorProxy = nearestGraphicsProxyWidget(q->parentWidget());
executed (the execution status of this line is deduced): QGraphicsProxyWidget *ancestorProxy = nearestGraphicsProxyWidget(q->parentWidget());
-
7041 if (ancestorProxy) {
partially evaluated: ancestorProxy
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1524
0-1524
7042 isEmbedded = true;
never executed (the execution status of this line is deduced): isEmbedded = true;
-
7043 ancestorProxy->d_func()->embedSubWindow(q);
never executed (the execution status of this line is deduced): ancestorProxy->d_func()->embedSubWindow(q);
-
7044 }
never executed: }
0
7045 }
executed: }
Execution Count:1524
1524
7046 }
executed: }
Execution Count:1533
1533
7047#else -
7048 Q_UNUSED(isEmbedded); -
7049#endif -
7050 -
7051 // On Windows, show the popup now so that our own focus handling -
7052 // stores the correct old focus widget even if it's stolen in the -
7053 // showevent -
7054#if defined(Q_WS_WIN) || defined(Q_WS_MAC) -
7055 if (!isEmbedded && q->windowType() == Qt::Popup) -
7056 qApp->d_func()->openPopup(q); -
7057#endif -
7058 -
7059 // send the show event before showing the window -
7060 QShowEvent showEvent;
executed (the execution status of this line is deduced): QShowEvent showEvent;
-
7061 QApplication::sendEvent(q, &showEvent);
executed (the execution status of this line is deduced): QApplication::sendEvent(q, &showEvent);
-
7062 -
7063 show_sys();
executed (the execution status of this line is deduced): show_sys();
-
7064 -
7065 if (!isEmbedded && q->windowType() == Qt::Popup)
evaluated: !isEmbedded
TRUEFALSE
yes
Evaluation Count:10786
yes
Evaluation Count:3
evaluated: q->windowType() == Qt::Popup
TRUEFALSE
yes
Evaluation Count:69
yes
Evaluation Count:10717
3-10786
7066 qApp->d_func()->openPopup(q);
executed: (static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->openPopup(q);
Execution Count:69
69
7067 -
7068#ifndef QT_NO_ACCESSIBILITY -
7069 if (q->windowType() != Qt::ToolTip) { // Tooltips are read aloud twice in MS narrator.
evaluated: q->windowType() != Qt::ToolTip
TRUEFALSE
yes
Evaluation Count:10779
yes
Evaluation Count:10
10-10779
7070 QAccessibleEvent event(q, QAccessible::ObjectShow);
executed (the execution status of this line is deduced): QAccessibleEvent event(q, QAccessible::ObjectShow);
-
7071 QAccessible::updateAccessibility(&event);
executed (the execution status of this line is deduced): QAccessible::updateAccessibility(&event);
-
7072 }
executed: }
Execution Count:10779
10779
7073#endif -
7074 -
7075 if (QApplicationPrivate::hidden_focus_widget == q) {
evaluated: QApplicationPrivate::hidden_focus_widget == q
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:10787
2-10787
7076 QApplicationPrivate::hidden_focus_widget = 0;
executed (the execution status of this line is deduced): QApplicationPrivate::hidden_focus_widget = 0;
-
7077 q->setFocus(Qt::OtherFocusReason);
executed (the execution status of this line is deduced): q->setFocus(Qt::OtherFocusReason);
-
7078 }
executed: }
Execution Count:2
2
7079 -
7080 // Process events when showing a Qt::SplashScreen widget before the event loop -
7081 // is spinnning; otherwise it might not show up on particular platforms. -
7082 // This makes QSplashScreen behave the same on all platforms. -
7083 if (!qApp->d_func()->in_exec && q->windowType() == Qt::SplashScreen)
evaluated: !(static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->in_exec
TRUEFALSE
yes
Evaluation Count:10655
yes
Evaluation Count:134
evaluated: q->windowType() == Qt::SplashScreen
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:10654
1-10655
7084 QApplication::processEvents();
executed: QApplication::processEvents();
Execution Count:1
1
7085 -
7086 data.in_show = false; // reset qws optimization
executed (the execution status of this line is deduced): data.in_show = false;
-
7087}
executed: }
Execution Count:10789
10789
7088 -
7089/*! -
7090 Hides the widget. This function is equivalent to -
7091 setVisible(false). -
7092 -
7093 -
7094 \note If you are working with QDialog or its subclasses and you invoke -
7095 the show() function after this function, the dialog will be displayed in -
7096 its original position. -
7097 -
7098 \sa hideEvent(), isHidden(), show(), setVisible(), isVisible(), close() -
7099*/ -
7100void QWidget::hide() -
7101{ -
7102 setVisible(false);
executed (the execution status of this line is deduced): setVisible(false);
-
7103}
executed: }
Execution Count:6087
6087
7104 -
7105/*!\internal -
7106 */ -
7107void QWidgetPrivate::hide_helper() -
7108{ -
7109 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
7110 -
7111 bool isEmbedded = false;
executed (the execution status of this line is deduced): bool isEmbedded = false;
-
7112#if !defined QT_NO_GRAPHICSVIEW -
7113 isEmbedded = q->isWindow() && !bypassGraphicsProxyWidget(q) && nearestGraphicsProxyWidget(q->parentWidget()) != 0;
evaluated: q->isWindow()
TRUEFALSE
yes
Evaluation Count:1485
yes
Evaluation Count:1248
evaluated: !bypassGraphicsProxyWidget(q)
TRUEFALSE
yes
Evaluation Count:1480
yes
Evaluation Count:5
partially evaluated: nearestGraphicsProxyWidget(q->parentWidget()) != 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1480
0-1485
7114#else -
7115 Q_UNUSED(isEmbedded); -
7116#endif -
7117 -
7118 if (!isEmbedded && (q->windowType() == Qt::Popup))
partially evaluated: !isEmbedded
TRUEFALSE
yes
Evaluation Count:2733
no
Evaluation Count:0
evaluated: (q->windowType() == Qt::Popup)
TRUEFALSE
yes
Evaluation Count:67
yes
Evaluation Count:2666
0-2733
7119 qApp->d_func()->closePopup(q);
executed: (static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->closePopup(q);
Execution Count:67
67
7120 -
7121#if defined(Q_WS_WIN) -
7122 if (q->isWindow() && !(q->windowType() == Qt::Popup) && q->parentWidget() -
7123 && !q->parentWidget()->isHidden() && q->isActiveWindow()) -
7124 q->parentWidget()->activateWindow(); // Activate parent -
7125#endif -
7126 -
7127 q->setAttribute(Qt::WA_Mapped, false);
executed (the execution status of this line is deduced): q->setAttribute(Qt::WA_Mapped, false);
-
7128 hide_sys();
executed (the execution status of this line is deduced): hide_sys();
-
7129 -
7130 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);
-
7131 -
7132 if (wasVisible) {
evaluated: wasVisible
TRUEFALSE
yes
Evaluation Count:2385
yes
Evaluation Count:348
348-2385
7133 q->setAttribute(Qt::WA_WState_Visible, false);
executed (the execution status of this line is deduced): q->setAttribute(Qt::WA_WState_Visible, false);
-
7134 -
7135 }
executed: }
Execution Count:2385
2385
7136 -
7137 QHideEvent hideEvent;
executed (the execution status of this line is deduced): QHideEvent hideEvent;
-
7138 QApplication::sendEvent(q, &hideEvent);
executed (the execution status of this line is deduced): QApplication::sendEvent(q, &hideEvent);
-
7139 hideChildren(false);
executed (the execution status of this line is deduced): hideChildren(false);
-
7140 -
7141 // next bit tries to move the focus if the focus widget is now -
7142 // hidden. -
7143 if (wasVisible) {
evaluated: wasVisible
TRUEFALSE
yes
Evaluation Count:2385
yes
Evaluation Count:348
348-2385
7144 qApp->d_func()->sendSyntheticEnterLeave(q);
executed (the execution status of this line is deduced): (static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->sendSyntheticEnterLeave(q);
-
7145 QWidget *fw = QApplication::focusWidget();
executed (the execution status of this line is deduced): QWidget *fw = QApplication::focusWidget();
-
7146 while (fw && !fw->isWindow()) {
evaluated: fw
TRUEFALSE
yes
Evaluation Count:1018
yes
Evaluation Count:1969
evaluated: !fw->isWindow()
TRUEFALSE
yes
Evaluation Count:772
yes
Evaluation Count:246
246-1969
7147 if (fw == q) {
evaluated: fw == q
TRUEFALSE
yes
Evaluation Count:170
yes
Evaluation Count:602
170-602
7148 q->focusNextPrevChild(true);
executed (the execution status of this line is deduced): q->focusNextPrevChild(true);
-
7149 break;
executed: break;
Execution Count:170
170
7150 } -
7151 fw = fw->parentWidget();
executed (the execution status of this line is deduced): fw = fw->parentWidget();
-
7152 }
executed: }
Execution Count:602
602
7153 }
executed: }
Execution Count:2385
2385
7154 -
7155 if (QWidgetBackingStore *bs = maybeBackingStore())
partially evaluated: QWidgetBackingStore *bs = maybeBackingStore()
TRUEFALSE
yes
Evaluation Count:2733
no
Evaluation Count:0
0-2733
7156 bs->removeDirtyWidget(q);
executed: bs->removeDirtyWidget(q);
Execution Count:2733
2733
7157 -
7158#ifndef QT_NO_ACCESSIBILITY -
7159 if (wasVisible) {
evaluated: wasVisible
TRUEFALSE
yes
Evaluation Count:2385
yes
Evaluation Count:348
348-2385
7160 QAccessibleEvent event(q, QAccessible::ObjectHide);
executed (the execution status of this line is deduced): QAccessibleEvent event(q, QAccessible::ObjectHide);
-
7161 QAccessible::updateAccessibility(&event);
executed (the execution status of this line is deduced): QAccessible::updateAccessibility(&event);
-
7162 }
executed: }
Execution Count:2385
2385
7163#endif -
7164}
executed: }
Execution Count:2733
2733
7165 -
7166/*! -
7167 \fn bool QWidget::isHidden() const -
7168 -
7169 Returns true if the widget is hidden, otherwise returns false. -
7170 -
7171 A hidden widget will only become visible when show() is called on -
7172 it. It will not be automatically shown when the parent is shown. -
7173 -
7174 To check visibility, use !isVisible() instead (notice the exclamation mark). -
7175 -
7176 isHidden() implies !isVisible(), but a widget can be not visible -
7177 and not hidden at the same time. This is the case for widgets that are children of -
7178 widgets that are not visible. -
7179 -
7180 -
7181 Widgets are hidden if: -
7182 \list -
7183 \li they were created as independent windows, -
7184 \li they were created as children of visible widgets, -
7185 \li hide() or setVisible(false) was called. -
7186 \endlist -
7187*/ -
7188 -
7189 -
7190void QWidget::setVisible(bool visible) -
7191{ -
7192 if (visible) { // show
evaluated: visible
TRUEFALSE
yes
Evaluation Count:19467
yes
Evaluation Count:55762
19467-55762
7193 if (testAttribute(Qt::WA_WState_ExplicitShowHide) && !testAttribute(Qt::WA_WState_Hidden))
evaluated: testAttribute(Qt::WA_WState_ExplicitShowHide)
TRUEFALSE
yes
Evaluation Count:11272
yes
Evaluation Count:8195
evaluated: !testAttribute(Qt::WA_WState_Hidden)
TRUEFALSE
yes
Evaluation Count:8010
yes
Evaluation Count:3262
3262-11272
7194 return;
executed: return;
Execution Count:8010
8010
7195 -
7196 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
7197 -
7198 // Designer uses a trick to make grabWidget work without showing -
7199 if (!isWindow() && parentWidget() && parentWidget()->isVisible()
evaluated: !isWindow()
TRUEFALSE
yes
Evaluation Count:9920
yes
Evaluation Count:1537
partially evaluated: parentWidget()
TRUEFALSE
yes
Evaluation Count:9920
no
Evaluation Count:0
evaluated: parentWidget()->isVisible()
TRUEFALSE
yes
Evaluation Count:5530
yes
Evaluation Count:4390
0-9920
7200 && !parentWidget()->testAttribute(Qt::WA_WState_Created))
partially evaluated: !parentWidget()->testAttribute(Qt::WA_WState_Created)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5530
0-5530
7201 parentWidget()->window()->d_func()->createRecursively();
never executed: parentWidget()->window()->d_func()->createRecursively();
0
7202 -
7203 //we have to at least create toplevels before applyX11SpecificCommandLineArguments -
7204 //but not children of non-visible parents -
7205 QWidget *pw = parentWidget();
executed (the execution status of this line is deduced): QWidget *pw = parentWidget();
-
7206 if (!testAttribute(Qt::WA_WState_Created)
evaluated: !testAttribute(Qt::WA_WState_Created)
TRUEFALSE
yes
Evaluation Count:9768
yes
Evaluation Count:1689
1689-9768
7207 && (isWindow() || pw->testAttribute(Qt::WA_WState_Created))) {
evaluated: isWindow()
TRUEFALSE
yes
Evaluation Count:1422
yes
Evaluation Count:8346
evaluated: pw->testAttribute(Qt::WA_WState_Created)
TRUEFALSE
yes
Evaluation Count:4382
yes
Evaluation Count:3964
1422-8346
7208 create();
executed (the execution status of this line is deduced): create();
-
7209 }
executed: }
Execution Count:5800
5800
7210 -
7211#if defined(Q_WS_X11) -
7212 if (windowType() == Qt::Window) -
7213 QApplicationPrivate::applyX11SpecificCommandLineArguments(this); -
7214#endif -
7215 -
7216 bool wasResized = testAttribute(Qt::WA_Resized);
executed (the execution status of this line is deduced): bool wasResized = testAttribute(Qt::WA_Resized);
-
7217 Qt::WindowStates initialWindowState = windowState();
executed (the execution status of this line is deduced): Qt::WindowStates initialWindowState = windowState();
-
7218 -
7219 // polish if necessary -
7220 ensurePolished();
executed (the execution status of this line is deduced): ensurePolished();
-
7221 -
7222 // remember that show was called explicitly -
7223 setAttribute(Qt::WA_WState_ExplicitShowHide);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_WState_ExplicitShowHide);
-
7224 // whether we need to inform the parent widget immediately -
7225 bool needUpdateGeometry = !isWindow() && testAttribute(Qt::WA_WState_Hidden);
evaluated: !isWindow()
TRUEFALSE
yes
Evaluation Count:9920
yes
Evaluation Count:1533
evaluated: testAttribute(Qt::WA_WState_Hidden)
TRUEFALSE
yes
Evaluation Count:3410
yes
Evaluation Count:6510
1533-9920
7226 // we are no longer hidden -
7227 setAttribute(Qt::WA_WState_Hidden, false);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_WState_Hidden, false);
-
7228 -
7229 if (needUpdateGeometry)
evaluated: needUpdateGeometry
TRUEFALSE
yes
Evaluation Count:3410
yes
Evaluation Count:8043
3410-8043
7230 d->updateGeometry_helper(true);
executed: d->updateGeometry_helper(true);
Execution Count:3410
3410
7231 -
7232 // activate our layout before we and our children become visible -
7233 if (d->layout)
evaluated: d->layout
TRUEFALSE
yes
Evaluation Count:2558
yes
Evaluation Count:8895
2558-8895
7234 d->layout->activate();
executed: d->layout->activate();
Execution Count:2558
2558
7235 -
7236 if (!isWindow()) {
evaluated: !isWindow()
TRUEFALSE
yes
Evaluation Count:9920
yes
Evaluation Count:1533
1533-9920
7237 QWidget *parent = parentWidget();
executed (the execution status of this line is deduced): QWidget *parent = parentWidget();
-
7238 while (parent && parent->isVisible() && parent->d_func()->layout && !parent->data->in_show) {
partially evaluated: parent
TRUEFALSE
yes
Evaluation Count:9990
no
Evaluation Count:0
evaluated: parent->isVisible()
TRUEFALSE
yes
Evaluation Count:5600
yes
Evaluation Count:4390
evaluated: parent->d_func()->layout
TRUEFALSE
yes
Evaluation Count:1987
yes
Evaluation Count:3613
evaluated: !parent->data->in_show
TRUEFALSE
yes
Evaluation Count:173
yes
Evaluation Count:1814
0-9990
7239 parent->d_func()->layout->activate();
executed (the execution status of this line is deduced): parent->d_func()->layout->activate();
-
7240 if (parent->isWindow())
evaluated: parent->isWindow()
TRUEFALSE
yes
Evaluation Count:103
yes
Evaluation Count:70
70-103
7241 break;
executed: break;
Execution Count:103
103
7242 parent = parent->parentWidget();
executed (the execution status of this line is deduced): parent = parent->parentWidget();
-
7243 }
executed: }
Execution Count:70
70
7244 if (parent)
partially evaluated: parent
TRUEFALSE
yes
Evaluation Count:9920
no
Evaluation Count:0
0-9920
7245 parent->d_func()->setDirtyOpaqueRegion();
executed: parent->d_func()->setDirtyOpaqueRegion();
Execution Count:9920
9920
7246 }
executed: }
Execution Count:9920
9920
7247 -
7248 // adjust size if necessary -
7249 if (!wasResized
evaluated: !wasResized
TRUEFALSE
yes
Evaluation Count:5127
yes
Evaluation Count:6326
5127-6326
7250 && (isWindow() || !parentWidget()->d_func()->layout)) {
evaluated: isWindow()
TRUEFALSE
yes
Evaluation Count:1226
yes
Evaluation Count:3901
evaluated: !parentWidget()->d_func()->layout
TRUEFALSE
yes
Evaluation Count:1635
yes
Evaluation Count:2266
1226-3901
7251 if (isWindow()) {
evaluated: isWindow()
TRUEFALSE
yes
Evaluation Count:1226
yes
Evaluation Count:1635
1226-1635
7252 adjustSize();
executed (the execution status of this line is deduced): adjustSize();
-
7253 if (windowState() != initialWindowState)
partially evaluated: windowState() != initialWindowState
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1226
0-1226
7254 setWindowState(initialWindowState);
never executed: setWindowState(initialWindowState);
0
7255 } else {
executed: }
Execution Count:1226
1226
7256 adjustSize();
executed (the execution status of this line is deduced): adjustSize();
-
7257 }
executed: }
Execution Count:1635
1635
7258 setAttribute(Qt::WA_Resized, false);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_Resized, false);
-
7259 }
executed: }
Execution Count:2861
2861
7260 -
7261 setAttribute(Qt::WA_KeyboardFocusChange, false);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_KeyboardFocusChange, false);
-
7262 -
7263 if (isWindow() || parentWidget()->isVisible()) {
evaluated: isWindow()
TRUEFALSE
yes
Evaluation Count:1533
yes
Evaluation Count:9920
evaluated: parentWidget()->isVisible()
TRUEFALSE
yes
Evaluation Count:5530
yes
Evaluation Count:4390
1533-9920
7264 d->show_helper();
executed (the execution status of this line is deduced): d->show_helper();
-
7265 -
7266 qApp->d_func()->sendSyntheticEnterLeave(this);
executed (the execution status of this line is deduced): (static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->sendSyntheticEnterLeave(this);
-
7267 }
executed: }
Execution Count:7063
7063
7268 -
7269 QEvent showToParentEvent(QEvent::ShowToParent);
executed (the execution status of this line is deduced): QEvent showToParentEvent(QEvent::ShowToParent);
-
7270 QApplication::sendEvent(this, &showToParentEvent);
executed (the execution status of this line is deduced): QApplication::sendEvent(this, &showToParentEvent);
-
7271 } else { // hide
executed: }
Execution Count:11453
11453
7272 if (testAttribute(Qt::WA_WState_ExplicitShowHide) && testAttribute(Qt::WA_WState_Hidden))
evaluated: testAttribute(Qt::WA_WState_ExplicitShowHide)
TRUEFALSE
yes
Evaluation Count:46548
yes
Evaluation Count:9214
evaluated: testAttribute(Qt::WA_WState_Hidden)
TRUEFALSE
yes
Evaluation Count:42527
yes
Evaluation Count:4021
4021-46548
7273 return;
executed: return;
Execution Count:42527
42527
7274#if defined(Q_WS_WIN) -
7275 // reset WS_DISABLED style in a Blocked window -
7276 if(isWindow() && testAttribute(Qt::WA_WState_Created) -
7277 && QApplicationPrivate::isBlockedByModal(this)) -
7278 { -
7279 LONG dwStyle = GetWindowLong(winId(), GWL_STYLE); -
7280 dwStyle &= ~WS_DISABLED; -
7281 SetWindowLong(winId(), GWL_STYLE, dwStyle); -
7282 } -
7283#endif -
7284 if (QApplicationPrivate::hidden_focus_widget == this)
partially evaluated: QApplicationPrivate::hidden_focus_widget == this
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13235
0-13235
7285 QApplicationPrivate::hidden_focus_widget = 0;
never executed: QApplicationPrivate::hidden_focus_widget = 0;
0
7286 -
7287 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
7288 -
7289 // hw: The test on getOpaqueRegion() needs to be more intelligent -
7290 // currently it doesn't work if the widget is hidden (the region will -
7291 // be clipped). The real check should be testing the cached region -
7292 // (and dirty flag) directly. -
7293 if (!isWindow() && parentWidget()) // && !d->getOpaqueRegion().isEmpty())
evaluated: !isWindow()
TRUEFALSE
yes
Evaluation Count:11426
yes
Evaluation Count:1809
partially evaluated: parentWidget()
TRUEFALSE
yes
Evaluation Count:11426
no
Evaluation Count:0
0-11426
7294 parentWidget()->d_func()->setDirtyOpaqueRegion();
executed: parentWidget()->d_func()->setDirtyOpaqueRegion();
Execution Count:11426
11426
7295 -
7296 setAttribute(Qt::WA_WState_Hidden);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_WState_Hidden);
-
7297 setAttribute(Qt::WA_WState_ExplicitShowHide);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_WState_ExplicitShowHide);
-
7298 if (testAttribute(Qt::WA_WState_Created))
evaluated: testAttribute(Qt::WA_WState_Created)
TRUEFALSE
yes
Evaluation Count:2733
yes
Evaluation Count:10502
2733-10502
7299 d->hide_helper();
executed: d->hide_helper();
Execution Count:2733
2733
7300 -
7301 // invalidate layout similar to updateGeometry() -
7302 if (!isWindow() && parentWidget()) {
evaluated: !isWindow()
TRUEFALSE
yes
Evaluation Count:11426
yes
Evaluation Count:1809
partially evaluated: parentWidget()
TRUEFALSE
yes
Evaluation Count:11426
no
Evaluation Count:0
0-11426
7303 if (parentWidget()->d_func()->layout)
evaluated: parentWidget()->d_func()->layout
TRUEFALSE
yes
Evaluation Count:1850
yes
Evaluation Count:9576
1850-9576
7304 parentWidget()->d_func()->layout->invalidate();
executed: parentWidget()->d_func()->layout->invalidate();
Execution Count:1850
1850
7305 else if (parentWidget()->isVisible())
evaluated: parentWidget()->isVisible()
TRUEFALSE
yes
Evaluation Count:749
yes
Evaluation Count:8827
749-8827
7306 QApplication::postEvent(parentWidget(), new QEvent(QEvent::LayoutRequest));
executed: QApplication::postEvent(parentWidget(), new QEvent(QEvent::LayoutRequest));
Execution Count:749
749
7307 } -
7308 -
7309 QEvent hideToParentEvent(QEvent::HideToParent);
executed (the execution status of this line is deduced): QEvent hideToParentEvent(QEvent::HideToParent);
-
7310 QApplication::sendEvent(this, &hideToParentEvent);
executed (the execution status of this line is deduced): QApplication::sendEvent(this, &hideToParentEvent);
-
7311 }
executed: }
Execution Count:13235
13235
7312} -
7313 -
7314/*! -
7315 Convenience function, equivalent to setVisible(!\a hidden). -
7316*/ -
7317void QWidget::setHidden(bool hidden) -
7318{ -
7319 setVisible(!hidden);
executed (the execution status of this line is deduced): setVisible(!hidden);
-
7320}
executed: }
Execution Count:5819
5819
7321 -
7322void QWidgetPrivate::_q_showIfNotHidden() -
7323{ -
7324 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
7325 if ( !(q->isHidden() && q->testAttribute(Qt::WA_WState_ExplicitShowHide)) )
evaluated: q->isHidden()
TRUEFALSE
yes
Evaluation Count:16
yes
Evaluation Count:12
evaluated: q->testAttribute(Qt::WA_WState_ExplicitShowHide)
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:12
4-16
7326 q->setVisible(true);
executed: q->setVisible(true);
Execution Count:24
24
7327}
executed: }
Execution Count:28
28
7328 -
7329void QWidgetPrivate::showChildren(bool spontaneous) -
7330{ -
7331 QList<QObject*> childList = children;
executed (the execution status of this line is deduced): QList<QObject*> childList = children;
-
7332 for (int i = 0; i < childList.size(); ++i) {
evaluated: i < childList.size()
TRUEFALSE
yes
Evaluation Count:19058
yes
Evaluation Count:10789
10789-19058
7333 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));
-
7334 if (!widget
evaluated: !widget
TRUEFALSE
yes
Evaluation Count:5741
yes
Evaluation Count:13317
5741-13317
7335 || widget->isWindow()
evaluated: widget->isWindow()
TRUEFALSE
yes
Evaluation Count:723
yes
Evaluation Count:12594
723-12594
7336 || widget->testAttribute(Qt::WA_WState_Hidden))
evaluated: widget->testAttribute(Qt::WA_WState_Hidden)
TRUEFALSE
yes
Evaluation Count:4770
yes
Evaluation Count:7824
4770-7824
7337 continue;
executed: continue;
Execution Count:11234
11234
7338 if (spontaneous) {
partially evaluated: spontaneous
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7824
0-7824
7339 widget->setAttribute(Qt::WA_Mapped);
never executed (the execution status of this line is deduced): widget->setAttribute(Qt::WA_Mapped);
-
7340 widget->d_func()->showChildren(true);
never executed (the execution status of this line is deduced): widget->d_func()->showChildren(true);
-
7341 QShowEvent e;
never executed (the execution status of this line is deduced): QShowEvent e;
-
7342 QApplication::sendSpontaneousEvent(widget, &e);
never executed (the execution status of this line is deduced): QApplication::sendSpontaneousEvent(widget, &e);
-
7343 } else {
never executed: }
0
7344 if (widget->testAttribute(Qt::WA_WState_ExplicitShowHide))
evaluated: widget->testAttribute(Qt::WA_WState_ExplicitShowHide)
TRUEFALSE
yes
Evaluation Count:3726
yes
Evaluation Count:4098
3726-4098
7345 widget->d_func()->show_recursive();
executed: widget->d_func()->show_recursive();
Execution Count:3726
3726
7346 else -
7347 widget->show();
executed: widget->show();
Execution Count:4098
4098
7348 } -
7349 } -
7350}
executed: }
Execution Count:10789
10789
7351 -
7352void QWidgetPrivate::hideChildren(bool spontaneous) -
7353{ -
7354 QList<QObject*> childList = children;
executed (the execution status of this line is deduced): QList<QObject*> childList = children;
-
7355 for (int i = 0; i < childList.size(); ++i) {
evaluated: i < childList.size()
TRUEFALSE
yes
Evaluation Count:18479
yes
Evaluation Count:10570
10570-18479
7356 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));
-
7357 if (!widget || widget->isWindow() || widget->testAttribute(Qt::WA_WState_Hidden))
evaluated: !widget
TRUEFALSE
yes
Evaluation Count:5545
yes
Evaluation Count:12934
evaluated: widget->isWindow()
TRUEFALSE
yes
Evaluation Count:760
yes
Evaluation Count:12174
evaluated: widget->testAttribute(Qt::WA_WState_Hidden)
TRUEFALSE
yes
Evaluation Count:4337
yes
Evaluation Count:7837
760-12934
7358 continue;
executed: continue;
Execution Count:10642
10642
7359#ifdef Q_WS_MAC -
7360 // Before doing anything we need to make sure that we don't leave anything in a non-consistent state. -
7361 // When hiding a widget we need to make sure that no mouse_down events are active, because -
7362 // the mouse_up event will never be received by a hidden widget or one of its descendants. -
7363 // The solution is simple, before going through with this we check if there are any mouse_down events in -
7364 // progress, if so we check if it is related to this widget or not. If so, we just reset the mouse_down and -
7365 // then we continue. -
7366 // In X11 and Windows we send a mouse_release event, however we don't do that here because we were already -
7367 // ignoring that from before. I.e. Carbon did not send the mouse release event, so we will not send the -
7368 // mouse release event. There are two ways to interpret this: -
7369 // 1. If we don't send the mouse release event, the widget might get into an inconsistent state, i.e. it -
7370 // might be waiting for a release event that will never arrive. -
7371 // 2. If we send the mouse release event, then the widget might decide to trigger an action that is not -
7372 // supposed to trigger because it is not visible. -
7373 if(widget == qt_button_down) -
7374 qt_button_down = 0; -
7375#endif // Q_WS_MAC -
7376 if (spontaneous)
partially evaluated: spontaneous
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7837
0-7837
7377 widget->setAttribute(Qt::WA_Mapped, false);
never executed: widget->setAttribute(Qt::WA_Mapped, false);
0
7378 else -
7379 widget->setAttribute(Qt::WA_WState_Visible, false);
executed: widget->setAttribute(Qt::WA_WState_Visible, false);
Execution Count:7837
7837
7380 widget->d_func()->hideChildren(spontaneous);
executed (the execution status of this line is deduced): widget->d_func()->hideChildren(spontaneous);
-
7381 QHideEvent e;
executed (the execution status of this line is deduced): QHideEvent e;
-
7382 if (spontaneous) {
partially evaluated: spontaneous
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7837
0-7837
7383 QApplication::sendSpontaneousEvent(widget, &e);
never executed (the execution status of this line is deduced): QApplication::sendSpontaneousEvent(widget, &e);
-
7384 } else {
never executed: }
0
7385 QApplication::sendEvent(widget, &e);
executed (the execution status of this line is deduced): QApplication::sendEvent(widget, &e);
-
7386 if (widget->internalWinId()
evaluated: widget->internalWinId()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:7833
4-7833
7387 && widget->testAttribute(Qt::WA_DontCreateNativeAncestors)) {
partially evaluated: widget->testAttribute(Qt::WA_DontCreateNativeAncestors)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
7388 // hide_sys() on an ancestor won't have any affect on this -
7389 // widget, so it needs an explicit hide_sys() of its own -
7390 widget->d_func()->hide_sys();
never executed (the execution status of this line is deduced): widget->d_func()->hide_sys();
-
7391 }
never executed: }
0
7392 }
executed: }
Execution Count:7837
7837
7393 qApp->d_func()->sendSyntheticEnterLeave(widget);
executed (the execution status of this line is deduced): (static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->sendSyntheticEnterLeave(widget);
-
7394#ifndef QT_NO_ACCESSIBILITY -
7395 if (!spontaneous) {
partially evaluated: !spontaneous
TRUEFALSE
yes
Evaluation Count:7837
no
Evaluation Count:0
0-7837
7396 QAccessibleEvent event(widget, QAccessible::ObjectHide);
executed (the execution status of this line is deduced): QAccessibleEvent event(widget, QAccessible::ObjectHide);
-
7397 QAccessible::updateAccessibility(&event);
executed (the execution status of this line is deduced): QAccessible::updateAccessibility(&event);
-
7398 }
executed: }
Execution Count:7837
7837
7399#endif -
7400 }
executed: }
Execution Count:7837
7837
7401}
executed: }
Execution Count:10570
10570
7402 -
7403bool QWidgetPrivate::close_helper(CloseMode mode) -
7404{ -
7405 if (data.is_closing)
evaluated: data.is_closing
TRUEFALSE
yes
Evaluation Count:24
yes
Evaluation Count:1335
24-1335
7406 return true;
executed: return true;
Execution Count:24
24
7407 -
7408 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
7409 data.is_closing = 1;
executed (the execution status of this line is deduced): data.is_closing = 1;
-
7410 -
7411 QPointer<QWidget> that = q;
executed (the execution status of this line is deduced): QPointer<QWidget> that = q;
-
7412 QPointer<QWidget> parentWidget = q->parentWidget();
executed (the execution status of this line is deduced): QPointer<QWidget> parentWidget = q->parentWidget();
-
7413 -
7414 bool quitOnClose = q->testAttribute(Qt::WA_QuitOnClose);
executed (the execution status of this line is deduced): bool quitOnClose = q->testAttribute(Qt::WA_QuitOnClose);
-
7415 if (mode != CloseNoEvent) {
evaluated: mode != CloseNoEvent
TRUEFALSE
yes
Evaluation Count:115
yes
Evaluation Count:1220
115-1220
7416 QCloseEvent e;
executed (the execution status of this line is deduced): QCloseEvent e;
-
7417 if (mode == CloseWithSpontaneousEvent)
partially evaluated: mode == CloseWithSpontaneousEvent
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:115
0-115
7418 QApplication::sendSpontaneousEvent(q, &e);
never executed: QApplication::sendSpontaneousEvent(q, &e);
0
7419 else -
7420 QApplication::sendEvent(q, &e);
executed: QApplication::sendEvent(q, &e);
Execution Count:115
115
7421 if (!that.isNull() && !e.isAccepted()) {
partially evaluated: !that.isNull()
TRUEFALSE
yes
Evaluation Count:115
no
Evaluation Count:0
evaluated: !e.isAccepted()
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:109
0-115
7422 data.is_closing = 0;
executed (the execution status of this line is deduced): data.is_closing = 0;
-
7423 return false;
executed: return false;
Execution Count:6
6
7424 } -
7425 }
executed: }
Execution Count:109
109
7426 -
7427 if (!that.isNull() && !q->isHidden())
partially evaluated: !that.isNull()
TRUEFALSE
yes
Evaluation Count:1329
no
Evaluation Count:0
evaluated: !q->isHidden()
TRUEFALSE
yes
Evaluation Count:1220
yes
Evaluation Count:109
0-1329
7428 q->hide();
executed: q->hide();
Execution Count:1220
1220
7429 -
7430 // Attempt to close the application only if this has WA_QuitOnClose set and a non-visible parent -
7431 quitOnClose = quitOnClose && (parentWidget.isNull() || !parentWidget->isVisible());
evaluated: quitOnClose
TRUEFALSE
yes
Evaluation Count:1272
yes
Evaluation Count:57
evaluated: parentWidget.isNull()
TRUEFALSE
yes
Evaluation Count:1200
yes
Evaluation Count:72
evaluated: !parentWidget->isVisible()
TRUEFALSE
yes
Evaluation Count:32
yes
Evaluation Count:40
32-1272
7432 -
7433 if (quitOnClose) {
evaluated: quitOnClose
TRUEFALSE
yes
Evaluation Count:1232
yes
Evaluation Count:97
97-1232
7434 /* if there is no non-withdrawn primary window left (except -
7435 the ones without QuitOnClose), we emit the lastWindowClosed -
7436 signal */ -
7437 QWidgetList list = QApplication::topLevelWidgets();
executed (the execution status of this line is deduced): QWidgetList list = QApplication::topLevelWidgets();
-
7438 bool lastWindowClosed = true;
executed (the execution status of this line is deduced): bool lastWindowClosed = true;
-
7439 for (int i = 0; i < list.size(); ++i) {
evaluated: i < list.size()
TRUEFALSE
yes
Evaluation Count:2214
yes
Evaluation Count:956
956-2214
7440 QWidget *w = list.at(i);
executed (the execution status of this line is deduced): QWidget *w = list.at(i);
-
7441 if (!w->isVisible() || w->parentWidget() || !w->testAttribute(Qt::WA_QuitOnClose))
evaluated: !w->isVisible()
TRUEFALSE
yes
Evaluation Count:1933
yes
Evaluation Count:281
evaluated: w->parentWidget()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:277
evaluated: !w->testAttribute(Qt::WA_QuitOnClose)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:276
1-1933
7442 continue;
executed: continue;
Execution Count:1938
1938
7443 lastWindowClosed = false;
executed (the execution status of this line is deduced): lastWindowClosed = false;
-
7444 break;
executed: break;
Execution Count:276
276
7445 } -
7446 if (lastWindowClosed) {
evaluated: lastWindowClosed
TRUEFALSE
yes
Evaluation Count:956
yes
Evaluation Count:276
276-956
7447 QGuiApplicationPrivate::emitLastWindowClosed();
executed (the execution status of this line is deduced): QGuiApplicationPrivate::emitLastWindowClosed();
-
7448 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()));
-
7449 applicationPrivate->maybeQuit();
executed (the execution status of this line is deduced): applicationPrivate->maybeQuit();
-
7450 }
executed: }
Execution Count:956
956
7451 }
executed: }
Execution Count:1232
1232
7452 -
7453 -
7454 if (!that.isNull()) {
partially evaluated: !that.isNull()
TRUEFALSE
yes
Evaluation Count:1329
no
Evaluation Count:0
0-1329
7455 data.is_closing = 0;
executed (the execution status of this line is deduced): data.is_closing = 0;
-
7456 if (q->testAttribute(Qt::WA_DeleteOnClose)) {
evaluated: q->testAttribute(Qt::WA_DeleteOnClose)
TRUEFALSE
yes
Evaluation Count:39
yes
Evaluation Count:1290
39-1290
7457 q->setAttribute(Qt::WA_DeleteOnClose, false);
executed (the execution status of this line is deduced): q->setAttribute(Qt::WA_DeleteOnClose, false);
-
7458 q->deleteLater();
executed (the execution status of this line is deduced): q->deleteLater();
-
7459 }
executed: }
Execution Count:39
39
7460 }
executed: }
Execution Count:1329
1329
7461 return true;
executed: return true;
Execution Count:1329
1329
7462} -
7463 -
7464 -
7465/*! -
7466 Closes this widget. Returns true if the widget was closed; -
7467 otherwise returns false. -
7468 -
7469 First it sends the widget a QCloseEvent. The widget is -
7470 \l{hide()}{hidden} if it \l{QCloseEvent::accept()}{accepts} -
7471 the close event. If it \l{QCloseEvent::ignore()}{ignores} -
7472 the event, nothing happens. The default -
7473 implementation of QWidget::closeEvent() accepts the close event. -
7474 -
7475 If the widget has the Qt::WA_DeleteOnClose flag, the widget -
7476 is also deleted. A close events is delivered to the widget no -
7477 matter if the widget is visible or not. -
7478 -
7479 The \l QApplication::lastWindowClosed() signal is emitted when the -
7480 last visible primary window (i.e. window with no parent) with the -
7481 Qt::WA_QuitOnClose attribute set is closed. By default this -
7482 attribute is set for all widgets except transient windows such as -
7483 splash screens, tool windows, and popup menus. -
7484 -
7485*/ -
7486 -
7487bool QWidget::close() -
7488{ -
7489 return d_func()->close_helper(QWidgetPrivate::CloseWithEvent);
executed: return d_func()->close_helper(QWidgetPrivate::CloseWithEvent);
Execution Count:115
115
7490} -
7491 -
7492/*! -
7493 \property QWidget::visible -
7494 \brief whether the widget is visible -
7495 -
7496 Calling setVisible(true) or show() sets the widget to visible -
7497 status if all its parent widgets up to the window are visible. If -
7498 an ancestor is not visible, the widget won't become visible until -
7499 all its ancestors are shown. If its size or position has changed, -
7500 Qt guarantees that a widget gets move and resize events just -
7501 before it is shown. If the widget has not been resized yet, Qt -
7502 will adjust the widget's size to a useful default using -
7503 adjustSize(). -
7504 -
7505 Calling setVisible(false) or hide() hides a widget explicitly. An -
7506 explicitly hidden widget will never become visible, even if all -
7507 its ancestors become visible, unless you show it. -
7508 -
7509 A widget receives show and hide events when its visibility status -
7510 changes. Between a hide and a show event, there is no need to -
7511 waste CPU cycles preparing or displaying information to the user. -
7512 A video application, for example, might simply stop generating new -
7513 frames. -
7514 -
7515 A widget that happens to be obscured by other windows on the -
7516 screen is considered to be visible. The same applies to iconified -
7517 windows and windows that exist on another virtual -
7518 desktop (on platforms that support this concept). A widget -
7519 receives spontaneous show and hide events when its mapping status -
7520 is changed by the window system, e.g. a spontaneous hide event -
7521 when the user minimizes the window, and a spontaneous show event -
7522 when the window is restored again. -
7523 -
7524 You almost never have to reimplement the setVisible() function. If -
7525 you need to change some settings before a widget is shown, use -
7526 showEvent() instead. If you need to do some delayed initialization -
7527 use the Polish event delivered to the event() function. -
7528 -
7529 \sa show(), hide(), isHidden(), isVisibleTo(), isMinimized(), -
7530 showEvent(), hideEvent() -
7531*/ -
7532 -
7533 -
7534/*! -
7535 Returns true if this widget would become visible if \a ancestor is -
7536 shown; otherwise returns false. -
7537 -
7538 The true case occurs if neither the widget itself nor any parent -
7539 up to but excluding \a ancestor has been explicitly hidden. -
7540 -
7541 This function will still return true if the widget is obscured by -
7542 other windows on the screen, but could be physically visible if it -
7543 or they were to be moved. -
7544 -
7545 isVisibleTo(0) is identical to isVisible(). -
7546 -
7547 \sa show(), hide(), isVisible() -
7548*/ -
7549 -
7550bool QWidget::isVisibleTo(const QWidget *ancestor) const -
7551{ -
7552 if (!ancestor)
partially evaluated: !ancestor
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1764
0-1764
7553 return isVisible();
never executed: return isVisible();
0
7554 const QWidget * w = this;
executed (the execution status of this line is deduced): const QWidget * w = this;
-
7555 while (!w->isHidden()
evaluated: !w->isHidden()
TRUEFALSE
yes
Evaluation Count:3035
yes
Evaluation Count:822
822-3035
7556 && !w->isWindow()
evaluated: !w->isWindow()
TRUEFALSE
yes
Evaluation Count:2678
yes
Evaluation Count:357
357-2678
7557 && w->parentWidget()
partially evaluated: w->parentWidget()
TRUEFALSE
yes
Evaluation Count:2678
no
Evaluation Count:0
0-2678
7558 && w->parentWidget() != ancestor)
evaluated: w->parentWidget() != ancestor
TRUEFALSE
yes
Evaluation Count:2093
yes
Evaluation Count:585
585-2093
7559 w = w->parentWidget();
executed: w = w->parentWidget();
Execution Count:2093
2093
7560 return !w->isHidden();
executed: return !w->isHidden();
Execution Count:1764
1764
7561} -
7562 -
7563 -
7564/*! -
7565 Returns the unobscured region where paint events can occur. -
7566 -
7567 For visible widgets, this is an approximation of the area not -
7568 covered by other widgets; otherwise, this is an empty region. -
7569 -
7570 The repaint() function calls this function if necessary, so in -
7571 general you do not need to call it. -
7572 -
7573*/ -
7574QRegion QWidget::visibleRegion() const -
7575{ -
7576 Q_D(const QWidget);
never executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
7577 -
7578 QRect clipRect = d->clipRect();
never executed (the execution status of this line is deduced): QRect clipRect = d->clipRect();
-
7579 if (clipRect.isEmpty())
never evaluated: clipRect.isEmpty()
0
7580 return QRegion();
never executed: return QRegion();
0
7581 QRegion r(clipRect);
never executed (the execution status of this line is deduced): QRegion r(clipRect);
-
7582 d->subtractOpaqueChildren(r, clipRect);
never executed (the execution status of this line is deduced): d->subtractOpaqueChildren(r, clipRect);
-
7583 d->subtractOpaqueSiblings(r);
never executed (the execution status of this line is deduced): d->subtractOpaqueSiblings(r);
-
7584 return r;
never executed: return r;
0
7585} -
7586 -
7587 -
7588QSize QWidgetPrivate::adjustedSize() const -
7589{ -
7590 Q_Q(const QWidget);
executed (the execution status of this line is deduced): const QWidget * const q = q_func();
-
7591 -
7592 QSize s = q->sizeHint();
executed (the execution status of this line is deduced): QSize s = q->sizeHint();
-
7593 -
7594 if (q->isWindow()) {
evaluated: q->isWindow()
TRUEFALSE
yes
Evaluation Count:1407
yes
Evaluation Count:1641
1407-1641
7595 Qt::Orientations exp;
executed (the execution status of this line is deduced): Qt::Orientations exp;
-
7596 if (layout) {
evaluated: layout
TRUEFALSE
yes
Evaluation Count:257
yes
Evaluation Count:1150
257-1150
7597 if (layout->hasHeightForWidth())
evaluated: layout->hasHeightForWidth()
TRUEFALSE
yes
Evaluation Count:15
yes
Evaluation Count:242
15-242
7598 s.setHeight(layout->totalHeightForWidth(s.width()));
executed: s.setHeight(layout->totalHeightForWidth(s.width()));
Execution Count:15
15
7599 exp = layout->expandingDirections();
executed (the execution status of this line is deduced): exp = layout->expandingDirections();
-
7600 } else
executed: }
Execution Count:257
257
7601 { -
7602 if (q->sizePolicy().hasHeightForWidth())
evaluated: q->sizePolicy().hasHeightForWidth()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1149
1-1149
7603 s.setHeight(q->heightForWidth(s.width()));
executed: s.setHeight(q->heightForWidth(s.width()));
Execution Count:1
1
7604 exp = q->sizePolicy().expandingDirections();
executed (the execution status of this line is deduced): exp = q->sizePolicy().expandingDirections();
-
7605 }
executed: }
Execution Count:1150
1150
7606 if (exp & Qt::Horizontal)
evaluated: exp & Qt::Horizontal
TRUEFALSE
yes
Evaluation Count:727
yes
Evaluation Count:680
680-727
7607 s.setWidth(qMax(s.width(), 200));
executed: s.setWidth(qMax(s.width(), 200));
Execution Count:727
727
7608 if (exp & Qt::Vertical)
evaluated: exp & Qt::Vertical
TRUEFALSE
yes
Evaluation Count:637
yes
Evaluation Count:770
637-770
7609 s.setHeight(qMax(s.height(), 100));
executed: s.setHeight(qMax(s.height(), 100));
Execution Count:637
637
7610#if defined(Q_WS_X11) -
7611 QRect screen = QApplication::desktop()->screenGeometry(q->x11Info().screen()); -
7612#else // all others -
7613 QRect screen = QApplication::desktop()->screenGeometry(q->pos());
executed (the execution status of this line is deduced): QRect screen = QApplication::desktop()->screenGeometry(q->pos());
-
7614#endif -
7615#if defined (Q_OS_WINCE) -
7616 s.setWidth(qMin(s.width(), screen.width())); -
7617 s.setHeight(qMin(s.height(), screen.height())); -
7618#else -
7619 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));
-
7620 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));
-
7621#endif -
7622 if (QTLWExtra *extra = maybeTopData())
evaluated: QTLWExtra *extra = maybeTopData()
TRUEFALSE
yes
Evaluation Count:1266
yes
Evaluation Count:141
141-1266
7623 extra->sizeAdjusted = true;
executed: extra->sizeAdjusted = true;
Execution Count:1266
1266
7624 }
executed: }
Execution Count:1407
1407
7625 -
7626 if (!s.isValid()) {
evaluated: !s.isValid()
TRUEFALSE
yes
Evaluation Count:607
yes
Evaluation Count:2441
607-2441
7627 QRect r = q->childrenRect(); // get children rectangle
executed (the execution status of this line is deduced): QRect r = q->childrenRect();
-
7628 if (r.isNull())
evaluated: r.isNull()
TRUEFALSE
yes
Evaluation Count:494
yes
Evaluation Count:113
113-494
7629 return s;
executed: return s;
Execution Count:494
494
7630 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());
-
7631 }
executed: }
Execution Count:113
113
7632 -
7633 return s;
executed: return s;
Execution Count:2554
2554
7634} -
7635 -
7636/*! -
7637 Adjusts the size of the widget to fit its contents. -
7638 -
7639 This function uses sizeHint() if it is valid, i.e., the size hint's width -
7640 and height are \>= 0. Otherwise, it sets the size to the children -
7641 rectangle that covers all child widgets (the union of all child widget -
7642 rectangles). -
7643 -
7644 For windows, the screen size is also taken into account. If the sizeHint() -
7645 is less than (200, 100) and the size policy is \l{QSizePolicy::Expanding} -
7646 {expanding}, the window will be at least (200, 100). The maximum size of -
7647 a window is 2/3 of the screen's width and height. -
7648 -
7649 \sa sizeHint(), childrenRect() -
7650*/ -
7651 -
7652void QWidget::adjustSize() -
7653{ -
7654 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
7655 ensurePolished();
executed (the execution status of this line is deduced): ensurePolished();
-
7656 QSize s = d->adjustedSize();
executed (the execution status of this line is deduced): QSize s = d->adjustedSize();
-
7657 -
7658 if (d->layout)
evaluated: d->layout
TRUEFALSE
yes
Evaluation Count:798
yes
Evaluation Count:2250
798-2250
7659 d->layout->activate();
executed: d->layout->activate();
Execution Count:798
798
7660 -
7661 if (s.isValid())
evaluated: s.isValid()
TRUEFALSE
yes
Evaluation Count:2554
yes
Evaluation Count:494
494-2554
7662 resize(s);
executed: resize(s);
Execution Count:2554
2554
7663}
executed: }
Execution Count:3048
3048
7664 -
7665 -
7666/*! -
7667 \property QWidget::sizeHint -
7668 \brief the recommended size for the widget -
7669 -
7670 If the value of this property is an invalid size, no size is -
7671 recommended. -
7672 -
7673 The default implementation of sizeHint() returns an invalid size -
7674 if there is no layout for this widget, and returns the layout's -
7675 preferred size otherwise. -
7676 -
7677 \sa QSize::isValid(), minimumSizeHint(), sizePolicy(), -
7678 setMinimumSize(), updateGeometry() -
7679*/ -
7680 -
7681QSize QWidget::sizeHint() const -
7682{ -
7683 Q_D(const QWidget);
executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
7684 if (d->layout)
evaluated: d->layout
TRUEFALSE
yes
Evaluation Count:7256
yes
Evaluation Count:10090
7256-10090
7685 return d->layout->totalSizeHint();
executed: return d->layout->totalSizeHint();
Execution Count:7256
7256
7686 return QSize(-1, -1);
executed: return QSize(-1, -1);
Execution Count:10090
10090
7687} -
7688 -
7689/*! -
7690 \property QWidget::minimumSizeHint -
7691 \brief the recommended minimum size for the widget -
7692 -
7693 If the value of this property is an invalid size, no minimum size -
7694 is recommended. -
7695 -
7696 The default implementation of minimumSizeHint() returns an invalid -
7697 size if there is no layout for this widget, and returns the -
7698 layout's minimum size otherwise. Most built-in widgets reimplement -
7699 minimumSizeHint(). -
7700 -
7701 \l QLayout will never resize a widget to a size smaller than the -
7702 minimum size hint unless minimumSize() is set or the size policy is -
7703 set to QSizePolicy::Ignore. If minimumSize() is set, the minimum -
7704 size hint will be ignored. -
7705 -
7706 \sa QSize::isValid(), resize(), setMinimumSize(), sizePolicy() -
7707*/ -
7708QSize QWidget::minimumSizeHint() const -
7709{ -
7710 Q_D(const QWidget);
executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
7711 if (d->layout)
evaluated: d->layout
TRUEFALSE
yes
Evaluation Count:2489
yes
Evaluation Count:10560
2489-10560
7712 return d->layout->totalMinimumSize();
executed: return d->layout->totalMinimumSize();
Execution Count:2489
2489
7713 return QSize(-1, -1);
executed: return QSize(-1, -1);
Execution Count:10560
10560
7714} -
7715 -
7716 -
7717/*! -
7718 \fn QWidget *QWidget::parentWidget() const -
7719 -
7720 Returns the parent of this widget, or 0 if it does not have any -
7721 parent widget. -
7722*/ -
7723 -
7724 -
7725/*! -
7726 Returns true if this widget is a parent, (or grandparent and so on -
7727 to any level), of the given \a child, and both widgets are within -
7728 the same window; otherwise returns false. -
7729*/ -
7730 -
7731bool QWidget::isAncestorOf(const QWidget *child) const -
7732{ -
7733 while (child) {
evaluated: child
TRUEFALSE
yes
Evaluation Count:71936
yes
Evaluation Count:31354
31354-71936
7734 if (child == this)
evaluated: child == this
TRUEFALSE
yes
Evaluation Count:5433
yes
Evaluation Count:66503
5433-66503
7735 return true;
executed: return true;
Execution Count:5433
5433
7736 if (child->isWindow())
evaluated: child->isWindow()
TRUEFALSE
yes
Evaluation Count:16650
yes
Evaluation Count:49853
16650-49853
7737 return false;
executed: return false;
Execution Count:16650
16650
7738 child = child->parentWidget();
executed (the execution status of this line is deduced): child = child->parentWidget();
-
7739 }
executed: }
Execution Count:49853
49853
7740 return false;
executed: return false;
Execution Count:31354
31354
7741} -
7742 -
7743#if defined(Q_WS_WIN) -
7744inline void setDisabledStyle(QWidget *w, bool setStyle) -
7745{ -
7746 // set/reset WS_DISABLED style. -
7747 if(w && w->isWindow() && w->isVisible() && w->isEnabled()) { -
7748 LONG dwStyle = GetWindowLong(w->winId(), GWL_STYLE); -
7749 LONG newStyle = dwStyle; -
7750 if (setStyle) -
7751 newStyle |= WS_DISABLED; -
7752 else -
7753 newStyle &= ~WS_DISABLED; -
7754 if (newStyle != dwStyle) { -
7755 SetWindowLong(w->winId(), GWL_STYLE, newStyle); -
7756 // we might need to repaint in some situations (eg. menu) -
7757 w->repaint(); -
7758 } -
7759 } -
7760} -
7761#endif -
7762 -
7763/***************************************************************************** -
7764 QWidget event handling -
7765 *****************************************************************************/ -
7766 -
7767/*! -
7768 This is the main event handler; it handles event \a event. You can -
7769 reimplement this function in a subclass, but we recommend using -
7770 one of the specialized event handlers instead. -
7771 -
7772 Key press and release events are treated differently from other -
7773 events. event() checks for Tab and Shift+Tab and tries to move the -
7774 focus appropriately. If there is no widget to move the focus to -
7775 (or the key press is not Tab or Shift+Tab), event() calls -
7776 keyPressEvent(). -
7777 -
7778 Mouse and tablet event handling is also slightly special: only -
7779 when the widget is \l enabled, event() will call the specialized -
7780 handlers such as mousePressEvent(); otherwise it will discard the -
7781 event. -
7782 -
7783 This function returns true if the event was recognized, otherwise -
7784 it returns false. If the recognized event was accepted (see \l -
7785 QEvent::accepted), any further processing such as event -
7786 propagation to the parent widget stops. -
7787 -
7788 \sa closeEvent(), focusInEvent(), focusOutEvent(), enterEvent(), -
7789 keyPressEvent(), keyReleaseEvent(), leaveEvent(), -
7790 mouseDoubleClickEvent(), mouseMoveEvent(), mousePressEvent(), -
7791 mouseReleaseEvent(), moveEvent(), paintEvent(), resizeEvent(), -
7792 QObject::event(), QObject::timerEvent() -
7793*/ -
7794 -
7795bool QWidget::event(QEvent *event) -
7796{ -
7797 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
7798 -
7799 // ignore mouse and key events when disabled -
7800 if (!isEnabled()) {
evaluated: !isEnabled()
TRUEFALSE
yes
Evaluation Count:4742
yes
Evaluation Count:413294
4742-413294
7801 switch(event->type()) { -
7802 case QEvent::TabletPress: -
7803 case QEvent::TabletRelease: -
7804 case QEvent::TabletMove: -
7805 case QEvent::MouseButtonPress: -
7806 case QEvent::MouseButtonRelease: -
7807 case QEvent::MouseButtonDblClick: -
7808 case QEvent::MouseMove: -
7809 case QEvent::TouchBegin: -
7810 case QEvent::TouchUpdate: -
7811 case QEvent::TouchEnd: -
7812 case QEvent::TouchCancel: -
7813 case QEvent::ContextMenu: -
7814 case QEvent::KeyPress: -
7815 case QEvent::KeyRelease: -
7816#ifndef QT_NO_WHEELEVENT -
7817 case QEvent::Wheel: -
7818#endif -
7819 return false;
executed: return false;
Execution Count:3
3
7820 default: -
7821 break;
executed: break;
Execution Count:4739
4739
7822 } -
7823 }
executed: }
Execution Count:4739
4739
7824 switch (event->type()) { -
7825 case QEvent::MouseMove: -
7826 mouseMoveEvent((QMouseEvent*)event);
executed (the execution status of this line is deduced): mouseMoveEvent((QMouseEvent*)event);
-
7827 break;
executed: break;
Execution Count:428
428
7828 -
7829 case QEvent::MouseButtonPress: -
7830 mousePressEvent((QMouseEvent*)event);
executed (the execution status of this line is deduced): mousePressEvent((QMouseEvent*)event);
-
7831 break;
executed: break;
Execution Count:6309
6309
7832 -
7833 case QEvent::MouseButtonRelease: -
7834 mouseReleaseEvent((QMouseEvent*)event);
executed (the execution status of this line is deduced): mouseReleaseEvent((QMouseEvent*)event);
-
7835 break;
executed: break;
Execution Count:6270
6270
7836 -
7837 case QEvent::MouseButtonDblClick: -
7838 mouseDoubleClickEvent((QMouseEvent*)event);
executed (the execution status of this line is deduced): mouseDoubleClickEvent((QMouseEvent*)event);
-
7839 break;
executed: break;
Execution Count:135
135
7840#ifndef QT_NO_WHEELEVENT -
7841 case QEvent::Wheel: -
7842 wheelEvent((QWheelEvent*)event);
executed (the execution status of this line is deduced): wheelEvent((QWheelEvent*)event);
-
7843 break;
executed: break;
Execution Count:20
20
7844#endif -
7845#ifndef QT_NO_TABLETEVENT -
7846 case QEvent::TabletMove: -
7847 case QEvent::TabletPress: -
7848 case QEvent::TabletRelease: -
7849 tabletEvent((QTabletEvent*)event);
never executed (the execution status of this line is deduced): tabletEvent((QTabletEvent*)event);
-
7850 break;
never executed: break;
0
7851#endif -
7852 case QEvent::KeyPress: { -
7853 QKeyEvent *k = (QKeyEvent *)event;
executed (the execution status of this line is deduced): QKeyEvent *k = (QKeyEvent *)event;
-
7854 bool res = false;
executed (the execution status of this line is deduced): bool res = false;
-
7855 if (!(k->modifiers() & (Qt::ControlModifier | Qt::AltModifier))) { //### Add MetaModifier?
evaluated: !(k->modifiers() & (Qt::ControlModifier | Qt::AltModifier))
TRUEFALSE
yes
Evaluation Count:4795
yes
Evaluation Count:125
125-4795
7856 if (k->key() == Qt::Key_Backtab
evaluated: k->key() == Qt::Key_Backtab
TRUEFALSE
yes
Evaluation Count:20
yes
Evaluation Count:4775
20-4775
7857 || (k->key() == Qt::Key_Tab && (k->modifiers() & Qt::ShiftModifier)))
evaluated: k->key() == Qt::Key_Tab
TRUEFALSE
yes
Evaluation Count:128
yes
Evaluation Count:4647
evaluated: (k->modifiers() & Qt::ShiftModifier)
TRUEFALSE
yes
Evaluation Count:11
yes
Evaluation Count:117
11-4647
7858 res = focusNextPrevChild(false);
executed: res = focusNextPrevChild(false);
Execution Count:31
31
7859 else if (k->key() == Qt::Key_Tab)
evaluated: k->key() == Qt::Key_Tab
TRUEFALSE
yes
Evaluation Count:117
yes
Evaluation Count:4647
117-4647
7860 res = focusNextPrevChild(true);
executed: res = focusNextPrevChild(true);
Execution Count:117
117
7861 if (res)
evaluated: res
TRUEFALSE
yes
Evaluation Count:36
yes
Evaluation Count:4759
36-4759
7862 break;
executed: break;
Execution Count:36
36
7863 }
executed: }
Execution Count:4759
4759
7864 keyPressEvent(k);
executed (the execution status of this line is deduced): keyPressEvent(k);
-
7865#ifdef QT_KEYPAD_NAVIGATION -
7866 if (!k->isAccepted() && QApplication::keypadNavigationEnabled() -
7867 && !(k->modifiers() & (Qt::ControlModifier | Qt::AltModifier | Qt::ShiftModifier))) { -
7868 if (QApplication::navigationMode() == Qt::NavigationModeKeypadTabOrder) { -
7869 if (k->key() == Qt::Key_Up) -
7870 res = focusNextPrevChild(false); -
7871 else if (k->key() == Qt::Key_Down) -
7872 res = focusNextPrevChild(true); -
7873 } else if (QApplication::navigationMode() == Qt::NavigationModeKeypadDirectional) { -
7874 if (k->key() == Qt::Key_Up) -
7875 res = QWidgetPrivate::navigateToDirection(QWidgetPrivate::DirectionNorth); -
7876 else if (k->key() == Qt::Key_Right) -
7877 res = QWidgetPrivate::navigateToDirection(QWidgetPrivate::DirectionEast); -
7878 else if (k->key() == Qt::Key_Down) -
7879 res = QWidgetPrivate::navigateToDirection(QWidgetPrivate::DirectionSouth); -
7880 else if (k->key() == Qt::Key_Left) -
7881 res = QWidgetPrivate::navigateToDirection(QWidgetPrivate::DirectionWest); -
7882 } -
7883 if (res) { -
7884 k->accept(); -
7885 break; -
7886 } -
7887 } -
7888#endif -
7889#ifndef QT_NO_WHATSTHIS -
7890 if (!k->isAccepted()
evaluated: !k->isAccepted()
TRUEFALSE
yes
Evaluation Count:808
yes
Evaluation Count:4075
808-4075
7891 && k->modifiers() & Qt::ShiftModifier && k->key() == Qt::Key_F1
evaluated: k->modifiers() & Qt::ShiftModifier
TRUEFALSE
yes
Evaluation Count:130
yes
Evaluation Count:678
partially evaluated: k->key() == Qt::Key_F1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:130
0-678
7892 && d->whatsThis.size()) {
never evaluated: d->whatsThis.size()
0
7893 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);
-
7894 k->accept();
never executed (the execution status of this line is deduced): k->accept();
-
7895 }
never executed: }
0
7896#endif -
7897 } -
7898 break;
executed: break;
Execution Count:4883
4883
7899 -
7900 case QEvent::KeyRelease: -
7901 keyReleaseEvent((QKeyEvent*)event);
executed (the execution status of this line is deduced): keyReleaseEvent((QKeyEvent*)event);
-
7902 // fall through -
7903 case QEvent::ShortcutOverride: -
7904 break;
executed: break;
Execution Count:11007
11007
7905 -
7906 case QEvent::InputMethod: -
7907 inputMethodEvent((QInputMethodEvent *) event);
never executed (the execution status of this line is deduced): inputMethodEvent((QInputMethodEvent *) event);
-
7908 break;
never executed: break;
0
7909 -
7910 case QEvent::InputMethodQuery: -
7911 if (testAttribute(Qt::WA_InputMethodEnabled)) {
evaluated: testAttribute(Qt::WA_InputMethodEnabled)
TRUEFALSE
yes
Evaluation Count:815
yes
Evaluation Count:1438
815-1438
7912 QInputMethodQueryEvent *query = static_cast<QInputMethodQueryEvent *>(event);
executed (the execution status of this line is deduced): QInputMethodQueryEvent *query = static_cast<QInputMethodQueryEvent *>(event);
-
7913 Qt::InputMethodQueries queries = query->queries();
executed (the execution status of this line is deduced): Qt::InputMethodQueries queries = query->queries();
-
7914 for (uint i = 0; i < 32; ++i) {
evaluated: i < 32
TRUEFALSE
yes
Evaluation Count:26080
yes
Evaluation Count:815
815-26080
7915 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));
-
7916 if (q) {
evaluated: q
TRUEFALSE
yes
Evaluation Count:815
yes
Evaluation Count:25265
815-25265
7917 QVariant v = inputMethodQuery(q);
executed (the execution status of this line is deduced): QVariant v = inputMethodQuery(q);
-
7918 if (q == Qt::ImEnabled && !v.isValid() && isEnabled())
partially evaluated: q == Qt::ImEnabled
TRUEFALSE
yes
Evaluation Count:815
no
Evaluation Count:0
partially evaluated: !v.isValid()
TRUEFALSE
yes
Evaluation Count:815
no
Evaluation Count:0
partially evaluated: isEnabled()
TRUEFALSE
yes
Evaluation Count:815
no
Evaluation Count:0
0-815
7919 v = QVariant(true); // special case for Qt4 compatibility
executed: v = QVariant(true);
Execution Count:815
815
7920 query->setValue(q, v);
executed (the execution status of this line is deduced): query->setValue(q, v);
-
7921 }
executed: }
Execution Count:815
815
7922 }
executed: }
Execution Count:26080
26080
7923 query->accept();
executed (the execution status of this line is deduced): query->accept();
-
7924 }
executed: }
Execution Count:815
815
7925 break;
executed: break;
Execution Count:2253
2253
7926 -
7927 case QEvent::PolishRequest: -
7928 ensurePolished();
executed (the execution status of this line is deduced): ensurePolished();
-
7929 break;
executed: break;
Execution Count:8065
8065
7930 -
7931 case QEvent::Polish: { -
7932 style()->polish(this);
executed (the execution status of this line is deduced): style()->polish(this);
-
7933 setAttribute(Qt::WA_WState_Polished);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_WState_Polished);
-
7934 if (!QApplication::font(this).isCopyOf(QApplication::font()))
evaluated: !QApplication::font(this).isCopyOf(QApplication::font())
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:26640
2-26640
7935 d->resolveFont();
executed: d->resolveFont();
Execution Count:2
2
7936 if (!QApplication::palette(this).isCopyOf(QApplication::palette()))
evaluated: !QApplication::palette(this).isCopyOf(QApplication::palette())
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:26640
2-26640
7937 d->resolvePalette();
executed: d->resolvePalette();
Execution Count:2
2
7938 } -
7939 break;
executed: break;
Execution Count:26642
26642
7940 -
7941 case QEvent::ApplicationWindowIconChange: -
7942 if (isWindow() && !testAttribute(Qt::WA_SetWindowIcon)) {
never evaluated: isWindow()
never evaluated: !testAttribute(Qt::WA_SetWindowIcon)
0
7943 d->setWindowIcon_sys();
never executed (the execution status of this line is deduced): d->setWindowIcon_sys();
-
7944 d->setWindowIcon_helper();
never executed (the execution status of this line is deduced): d->setWindowIcon_helper();
-
7945 }
never executed: }
0
7946 break;
never executed: break;
0
7947 case QEvent::FocusIn: -
7948 focusInEvent((QFocusEvent*)event);
executed (the execution status of this line is deduced): focusInEvent((QFocusEvent*)event);
-
7949 d->updateWidgetTransform();
executed (the execution status of this line is deduced): d->updateWidgetTransform();
-
7950 break;
executed: break;
Execution Count:1186
1186
7951 -
7952 case QEvent::FocusOut: -
7953 focusOutEvent((QFocusEvent*)event);
executed (the execution status of this line is deduced): focusOutEvent((QFocusEvent*)event);
-
7954 break;
executed: break;
Execution Count:904
904
7955 -
7956 case QEvent::Enter: -
7957#ifndef QT_NO_STATUSTIP -
7958 if (d->statusTip.size()) {
partially evaluated: d->statusTip.size()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1412
0-1412
7959 QStatusTipEvent tip(d->statusTip);
never executed (the execution status of this line is deduced): QStatusTipEvent tip(d->statusTip);
-
7960 QApplication::sendEvent(const_cast<QWidget *>(this), &tip);
never executed (the execution status of this line is deduced): QApplication::sendEvent(const_cast<QWidget *>(this), &tip);
-
7961 }
never executed: }
0
7962#endif -
7963 enterEvent(event);
executed (the execution status of this line is deduced): enterEvent(event);
-
7964 break;
executed: break;
Execution Count:1412
1412
7965 -
7966 case QEvent::Leave: -
7967#ifndef QT_NO_STATUSTIP -
7968 if (d->statusTip.size()) {
partially evaluated: d->statusTip.size()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:697
0-697
7969 QString empty;
never executed (the execution status of this line is deduced): QString empty;
-
7970 QStatusTipEvent tip(empty);
never executed (the execution status of this line is deduced): QStatusTipEvent tip(empty);
-
7971 QApplication::sendEvent(const_cast<QWidget *>(this), &tip);
never executed (the execution status of this line is deduced): QApplication::sendEvent(const_cast<QWidget *>(this), &tip);
-
7972 }
never executed: }
0
7973#endif -
7974 leaveEvent(event);
executed (the execution status of this line is deduced): leaveEvent(event);
-
7975 break;
executed: break;
Execution Count:697
697
7976 -
7977 case QEvent::HoverEnter: -
7978 case QEvent::HoverLeave: -
7979 update();
executed (the execution status of this line is deduced): update();
-
7980 break;
executed: break;
Execution Count:5
5
7981 -
7982 case QEvent::Paint: -
7983 // At this point the event has to be delivered, regardless -
7984 // whether the widget isVisible() or not because it -
7985 // already went through the filters -
7986 paintEvent((QPaintEvent*)event);
executed (the execution status of this line is deduced): paintEvent((QPaintEvent*)event);
-
7987 break;
executed: break;
Execution Count:7989
7989
7988 -
7989 case QEvent::Move: -
7990 moveEvent((QMoveEvent*)event);
executed (the execution status of this line is deduced): moveEvent((QMoveEvent*)event);
-
7991 d->updateWidgetTransform();
executed (the execution status of this line is deduced): d->updateWidgetTransform();
-
7992 break;
executed: break;
Execution Count:9450
9450
7993 -
7994 case QEvent::Resize: -
7995 resizeEvent((QResizeEvent*)event);
executed (the execution status of this line is deduced): resizeEvent((QResizeEvent*)event);
-
7996 d->updateWidgetTransform();
executed (the execution status of this line is deduced): d->updateWidgetTransform();
-
7997 break;
executed: break;
Execution Count:9859
9859
7998 -
7999 case QEvent::Close: -
8000 closeEvent((QCloseEvent *)event);
executed (the execution status of this line is deduced): closeEvent((QCloseEvent *)event);
-
8001 break;
executed: break;
Execution Count:115
115
8002 -
8003#ifndef QT_NO_CONTEXTMENU -
8004 case QEvent::ContextMenu: -
8005 switch (data->context_menu_policy) { -
8006 case Qt::PreventContextMenu: -
8007 break;
never executed: break;
0
8008 case Qt::DefaultContextMenu: -
8009 contextMenuEvent(static_cast<QContextMenuEvent *>(event));
executed (the execution status of this line is deduced): contextMenuEvent(static_cast<QContextMenuEvent *>(event));
-
8010 break;
executed: break;
Execution Count:1
1
8011 case Qt::CustomContextMenu: -
8012 emit customContextMenuRequested(static_cast<QContextMenuEvent *>(event)->pos());
never executed (the execution status of this line is deduced): customContextMenuRequested(static_cast<QContextMenuEvent *>(event)->pos());
-
8013 break;
never executed: break;
0
8014#ifndef QT_NO_MENU -
8015 case Qt::ActionsContextMenu: -
8016 if (d->actions.count()) {
never evaluated: d->actions.count()
0
8017 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(),
-
8018 0, this);
never executed (the execution status of this line is deduced): 0, this);
-
8019 break;
never executed: break;
0
8020 } -
8021 // fall through -
8022#endif -
8023 default:
code before this statement never executed: default:
0
8024 event->ignore();
never executed (the execution status of this line is deduced): event->ignore();
-
8025 break;
never executed: break;
0
8026 } -
8027 break;
executed: break;
Execution Count:1
1
8028#endif // QT_NO_CONTEXTMENU -
8029 -
8030#ifndef QT_NO_DRAGANDDROP -
8031 case QEvent::Drop: -
8032 dropEvent((QDropEvent*) event);
executed (the execution status of this line is deduced): dropEvent((QDropEvent*) event);
-
8033 break;
executed: break;
Execution Count:2
2
8034 -
8035 case QEvent::DragEnter: -
8036 dragEnterEvent((QDragEnterEvent*) event);
executed (the execution status of this line is deduced): dragEnterEvent((QDragEnterEvent*) event);
-
8037 break;
executed: break;
Execution Count:3
3
8038 -
8039 case QEvent::DragMove: -
8040 dragMoveEvent((QDragMoveEvent*) event);
executed (the execution status of this line is deduced): dragMoveEvent((QDragMoveEvent*) event);
-
8041 break;
executed: break;
Execution Count:5
5
8042 -
8043 case QEvent::DragLeave: -
8044 dragLeaveEvent((QDragLeaveEvent*) event);
executed (the execution status of this line is deduced): dragLeaveEvent((QDragLeaveEvent*) event);
-
8045 break;
executed: break;
Execution Count:1
1
8046#endif -
8047 -
8048 case QEvent::Show: -
8049 showEvent((QShowEvent*) event);
executed (the execution status of this line is deduced): showEvent((QShowEvent*) event);
-
8050 break;
executed: break;
Execution Count:10789
10789
8051 -
8052 case QEvent::Hide: -
8053 hideEvent((QHideEvent*) event);
executed (the execution status of this line is deduced): hideEvent((QHideEvent*) event);
-
8054 break;
executed: break;
Execution Count:10570
10570
8055 -
8056 case QEvent::ShowWindowRequest: -
8057 if (!isHidden())
never evaluated: !isHidden()
0
8058 d->show_sys();
never executed: d->show_sys();
0
8059 break;
never executed: break;
0
8060 -
8061 case QEvent::ApplicationFontChange: -
8062 d->resolveFont();
executed (the execution status of this line is deduced): d->resolveFont();
-
8063 break;
executed: break;
Execution Count:8
8
8064 case QEvent::ApplicationPaletteChange: -
8065 if (!(windowType() == Qt::Desktop))
partially evaluated: !(windowType() == Qt::Desktop)
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
8066 d->resolvePalette();
executed: d->resolvePalette();
Execution Count:1
1
8067 break;
executed: break;
Execution Count:1
1
8068 -
8069 case QEvent::ToolBarChange: -
8070 case QEvent::ActivationChange: -
8071 case QEvent::EnabledChange: -
8072 case QEvent::FontChange: -
8073 case QEvent::StyleChange: -
8074 case QEvent::PaletteChange: -
8075 case QEvent::WindowTitleChange: -
8076 case QEvent::IconTextChange: -
8077 case QEvent::ModifiedChange: -
8078 case QEvent::MouseTrackingChange: -
8079 case QEvent::ParentChange: -
8080 case QEvent::WindowStateChange: -
8081 case QEvent::LocaleChange: -
8082 case QEvent::MacSizeChange: -
8083 case QEvent::ContentsRectChange: -
8084 case QEvent::ThemeChange: -
8085 changeEvent(event);
executed (the execution status of this line is deduced): changeEvent(event);
-
8086 break;
executed: break;
Execution Count:67993
67993
8087 -
8088 case QEvent::WindowActivate: -
8089 case QEvent::WindowDeactivate: { -
8090 if (isVisible() && !palette().isEqual(QPalette::Active, QPalette::Inactive))
evaluated: isVisible()
TRUEFALSE
yes
Evaluation Count:7273
yes
Evaluation Count:12
partially evaluated: !palette().isEqual(QPalette::Active, QPalette::Inactive)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7273
0-7273
8091 update();
never executed: update();
0
8092 QList<QObject*> childList = d->children;
executed (the execution status of this line is deduced): QList<QObject*> childList = d->children;
-
8093 for (int i = 0; i < childList.size(); ++i) {
evaluated: i < childList.size()
TRUEFALSE
yes
Evaluation Count:12447
yes
Evaluation Count:7285
7285-12447
8094 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));
-
8095 if (w && w->isVisible() && !w->isWindow())
evaluated: w
TRUEFALSE
yes
Evaluation Count:8259
yes
Evaluation Count:4188
evaluated: w->isVisible()
TRUEFALSE
yes
Evaluation Count:5630
yes
Evaluation Count:2629
evaluated: !w->isWindow()
TRUEFALSE
yes
Evaluation Count:5612
yes
Evaluation Count:18
18-8259
8096 QApplication::sendEvent(w, event);
executed: QApplication::sendEvent(w, event);
Execution Count:5612
5612
8097 }
executed: }
Execution Count:12447
12447
8098 break; }
executed: break;
Execution Count:7285
7285
8099 -
8100 case QEvent::LanguageChange: -
8101 changeEvent(event);
executed (the execution status of this line is deduced): changeEvent(event);
-
8102 { -
8103 QList<QObject*> childList = d->children;
executed (the execution status of this line is deduced): QList<QObject*> childList = d->children;
-
8104 for (int i = 0; i < childList.size(); ++i) {
evaluated: i < childList.size()
TRUEFALSE
yes
Evaluation Count:19
yes
Evaluation Count:14
14-19
8105 QObject *o = childList.at(i);
executed (the execution status of this line is deduced): QObject *o = childList.at(i);
-
8106 if (o)
partially evaluated: o
TRUEFALSE
yes
Evaluation Count:19
no
Evaluation Count:0
0-19
8107 QApplication::sendEvent(o, event);
executed: QApplication::sendEvent(o, event);
Execution Count:19
19
8108 }
executed: }
Execution Count:19
19
8109 } -
8110 update();
executed (the execution status of this line is deduced): update();
-
8111 break;
executed: break;
Execution Count:14
14
8112 -
8113 case QEvent::ApplicationLayoutDirectionChange: -
8114 d->resolveLayoutDirection();
executed (the execution status of this line is deduced): d->resolveLayoutDirection();
-
8115 break;
executed: break;
Execution Count:154
154
8116 -
8117 case QEvent::LayoutDirectionChange: -
8118 if (d->layout)
evaluated: d->layout
TRUEFALSE
yes
Evaluation Count:61
yes
Evaluation Count:317
61-317
8119 d->layout->invalidate();
executed: d->layout->invalidate();
Execution Count:61
61
8120 update();
executed (the execution status of this line is deduced): update();
-
8121 changeEvent(event);
executed (the execution status of this line is deduced): changeEvent(event);
-
8122 break;
executed: break;
Execution Count:378
378
8123 case QEvent::UpdateRequest: -
8124 d->syncBackingStore();
executed (the execution status of this line is deduced): d->syncBackingStore();
-
8125 break;
executed: break;
Execution Count:3263
3263
8126 case QEvent::UpdateLater: -
8127 update(static_cast<QUpdateLaterEvent*>(event)->region());
executed (the execution status of this line is deduced): update(static_cast<QUpdateLaterEvent*>(event)->region());
-
8128 break;
executed: break;
Execution Count:5523
5523
8129 case QEvent::StyleAnimationUpdate: -
8130 update();
executed (the execution status of this line is deduced): update();
-
8131 break;
executed: break;
Execution Count:15
15
8132 -
8133 case QEvent::WindowBlocked: -
8134 case QEvent::WindowUnblocked: -
8135 if (!d->children.isEmpty()) {
evaluated: !d->children.isEmpty()
TRUEFALSE
yes
Evaluation Count:110
yes
Evaluation Count:450
110-450
8136 QWidget *modalWidget = QApplication::activeModalWidget();
executed (the execution status of this line is deduced): QWidget *modalWidget = QApplication::activeModalWidget();
-
8137 for (int i = 0; i < d->children.size(); ++i) {
evaluated: i < d->children.size()
TRUEFALSE
yes
Evaluation Count:188
yes
Evaluation Count:110
110-188
8138 QObject *o = d->children.at(i);
executed (the execution status of this line is deduced): QObject *o = d->children.at(i);
-
8139 if (o && o != modalWidget && o->isWidgetType()) {
partially evaluated: o
TRUEFALSE
yes
Evaluation Count:188
no
Evaluation Count:0
evaluated: o != modalWidget
TRUEFALSE
yes
Evaluation Count:150
yes
Evaluation Count:38
evaluated: o->isWidgetType()
TRUEFALSE
yes
Evaluation Count:110
yes
Evaluation Count:40
0-188
8140 QWidget *w = static_cast<QWidget *>(o);
executed (the execution status of this line is deduced): QWidget *w = static_cast<QWidget *>(o);
-
8141 // do not forward the event to child windows; QApplication does this for us -
8142 if (!w->isWindow())
evaluated: !w->isWindow()
TRUEFALSE
yes
Evaluation Count:72
yes
Evaluation Count:38
38-72
8143 QApplication::sendEvent(w, event);
executed: QApplication::sendEvent(w, event);
Execution Count:72
72
8144 }
executed: }
Execution Count:110
110
8145 }
executed: }
Execution Count:188
188
8146 }
executed: }
Execution Count:110
110
8147#if defined(Q_WS_WIN) -
8148 setDisabledStyle(this, (event->type() == QEvent::WindowBlocked)); -
8149#endif -
8150 break;
executed: break;
Execution Count:560
560
8151#ifndef QT_NO_TOOLTIP -
8152 case QEvent::ToolTip: -
8153 if (!d->toolTip.isEmpty())
partially evaluated: !d->toolTip.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
8154 QToolTip::showText(static_cast<QHelpEvent*>(event)->globalPos(), d->toolTip, this);
never executed: QToolTip::showText(static_cast<QHelpEvent*>(event)->globalPos(), d->toolTip, this);
0
8155 else -
8156 event->ignore();
executed: event->ignore();
Execution Count:1
1
8157 break;
executed: break;
Execution Count:1
1
8158#endif -
8159#ifndef QT_NO_WHATSTHIS -
8160 case QEvent::WhatsThis: -
8161 if (d->whatsThis.size())
never evaluated: d->whatsThis.size()
0
8162 QWhatsThis::showText(static_cast<QHelpEvent *>(event)->globalPos(), d->whatsThis, this);
never executed: QWhatsThis::showText(static_cast<QHelpEvent *>(event)->globalPos(), d->whatsThis, this);
0
8163 else -
8164 event->ignore();
never executed: event->ignore();
0
8165 break;
never executed: break;
0
8166 case QEvent::QueryWhatsThis: -
8167 if (d->whatsThis.isEmpty())
never evaluated: d->whatsThis.isEmpty()
0
8168 event->ignore();
never executed: event->ignore();
0
8169 break;
never executed: break;
0
8170#endif -
8171 case QEvent::EmbeddingControl: -
8172 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);
-
8173 data->fstrut_dirty = false;
never executed (the execution status of this line is deduced): data->fstrut_dirty = false;
-
8174#if defined(Q_WS_WIN) || defined(Q_WS_X11) -
8175 d->topData()->embedded = 1; -
8176#endif -
8177 break;
never executed: break;
0
8178#ifndef QT_NO_ACTION -
8179 case QEvent::ActionAdded: -
8180 case QEvent::ActionRemoved: -
8181 case QEvent::ActionChanged: -
8182 actionEvent((QActionEvent*)event);
executed (the execution status of this line is deduced): actionEvent((QActionEvent*)event);
-
8183 break;
executed: break;
Execution Count:13445
13445
8184#endif -
8185 -
8186 case QEvent::KeyboardLayoutChange: -
8187 { -
8188 changeEvent(event);
never executed (the execution status of this line is deduced): changeEvent(event);
-
8189 -
8190 // inform children of the change -
8191 QList<QObject*> childList = d->children;
never executed (the execution status of this line is deduced): QList<QObject*> childList = d->children;
-
8192 for (int i = 0; i < childList.size(); ++i) {
never evaluated: i < childList.size()
0
8193 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));
-
8194 if (w && w->isVisible() && !w->isWindow())
never evaluated: w
never evaluated: w->isVisible()
never evaluated: !w->isWindow()
0
8195 QApplication::sendEvent(w, event);
never executed: QApplication::sendEvent(w, event);
0
8196 }
never executed: }
0
8197 break;
never executed: break;
0
8198 } -
8199#ifdef Q_WS_MAC -
8200 case QEvent::MacGLWindowChange: -
8201 d->needWindowChange = false; -
8202 break; -
8203#endif -
8204 case QEvent::TouchBegin: -
8205 case QEvent::TouchUpdate: -
8206 case QEvent::TouchEnd: -
8207 case QEvent::TouchCancel: -
8208 { -
8209 event->ignore();
executed (the execution status of this line is deduced): event->ignore();
-
8210 break;
executed: break;
Execution Count:1
1
8211 } -
8212#ifndef QT_NO_GESTURES -
8213 case QEvent::Gesture: -
8214 event->ignore();
never executed (the execution status of this line is deduced): event->ignore();
-
8215 break;
never executed: break;
0
8216#endif -
8217#ifndef QT_NO_PROPERTIES -
8218 case QEvent::DynamicPropertyChange: { -
8219 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();
-
8220 if (!qstrncmp(propName, "_q_customDpi", 12) && propName.length() == 13) {
partially evaluated: !qstrncmp(propName, "_q_customDpi", 12)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
never evaluated: propName.length() == 13
0-4
8221 uint value = property(propName.constData()).toUInt();
never executed (the execution status of this line is deduced): uint value = property(propName.constData()).toUInt();
-
8222 if (!d->extra)
never evaluated: !d->extra
0
8223 d->createExtra();
never executed: d->createExtra();
0
8224 const char axis = propName.at(12);
never executed (the execution status of this line is deduced): const char axis = propName.at(12);
-
8225 if (axis == 'X')
never evaluated: axis == 'X'
0
8226 d->extra->customDpiX = value;
never executed: d->extra->customDpiX = value;
0
8227 else if (axis == 'Y')
never evaluated: axis == 'Y'
0
8228 d->extra->customDpiY = value;
never executed: d->extra->customDpiY = value;
0
8229 d->updateFont(d->data.fnt);
never executed (the execution status of this line is deduced): d->updateFont(d->data.fnt);
-
8230 }
never executed: }
0
8231 // fall through -
8232 } -
8233#endif -
8234 default: -
8235 return QObject::event(event);
executed: return QObject::event(event);
Execution Count:200355
200355
8236 } -
8237 return true;
executed: return true;
Execution Count:217677
217677
8238} -
8239 -
8240/*! -
8241 This event handler can be reimplemented to handle state changes. -
8242 -
8243 The state being changed in this event can be retrieved through the \a event -
8244 supplied. -
8245 -
8246 Change events include: QEvent::ToolBarChange, -
8247 QEvent::ActivationChange, QEvent::EnabledChange, QEvent::FontChange, -
8248 QEvent::StyleChange, QEvent::PaletteChange, -
8249 QEvent::WindowTitleChange, QEvent::IconTextChange, -
8250 QEvent::ModifiedChange, QEvent::MouseTrackingChange, -
8251 QEvent::ParentChange, QEvent::WindowStateChange, -
8252 QEvent::LanguageChange, QEvent::LocaleChange, -
8253 QEvent::LayoutDirectionChange. -
8254 -
8255*/ -
8256void QWidget::changeEvent(QEvent * event) -
8257{ -
8258 switch(event->type()) { -
8259 case QEvent::EnabledChange: { -
8260 update();
executed (the execution status of this line is deduced): update();
-
8261#ifndef QT_NO_ACCESSIBILITY -
8262 QAccessible::State s;
executed (the execution status of this line is deduced): QAccessible::State s;
-
8263 s.disabled = true;
executed (the execution status of this line is deduced): s.disabled = true;
-
8264 QAccessibleStateChangeEvent event(this, s);
executed (the execution status of this line is deduced): QAccessibleStateChangeEvent event(this, s);
-
8265 QAccessible::updateAccessibility(&event);
executed (the execution status of this line is deduced): QAccessible::updateAccessibility(&event);
-
8266#endif -
8267 break;
executed: break;
Execution Count:2355
2355
8268 } -
8269 -
8270 case QEvent::FontChange: -
8271 case QEvent::StyleChange: { -
8272 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
8273 update();
executed (the execution status of this line is deduced): update();
-
8274 updateGeometry();
executed (the execution status of this line is deduced): updateGeometry();
-
8275 if (d->layout)
evaluated: d->layout
TRUEFALSE
yes
Evaluation Count:690
yes
Evaluation Count:2890
690-2890
8276 d->layout->invalidate();
executed: d->layout->invalidate();
Execution Count:690
690
8277 break;
executed: break;
Execution Count:3580
3580
8278 } -
8279 -
8280 case QEvent::PaletteChange: -
8281 update();
executed (the execution status of this line is deduced): update();
-
8282 break;
executed: break;
Execution Count:16616
16616
8283 -
8284 case QEvent::ThemeChange: -
8285 if (QApplication::desktopSettingsAware() && windowType() != Qt::Desktop
never evaluated: QApplication::desktopSettingsAware()
never evaluated: windowType() != Qt::Desktop
0
8286 && qApp && !QApplication::closingDown()) {
never evaluated: (static_cast<QApplication *>(QCoreApplication::instance()))
never evaluated: !QApplication::closingDown()
0
8287 if (testAttribute(Qt::WA_WState_Polished))
never evaluated: testAttribute(Qt::WA_WState_Polished)
0
8288 QApplication::style()->unpolish(this);
never executed: QApplication::style()->unpolish(this);
0
8289 if (testAttribute(Qt::WA_WState_Polished))
never evaluated: testAttribute(Qt::WA_WState_Polished)
0
8290 QApplication::style()->polish(this);
never executed: QApplication::style()->polish(this);
0
8291 QEvent styleChangedEvent(QEvent::StyleChange);
never executed (the execution status of this line is deduced): QEvent styleChangedEvent(QEvent::StyleChange);
-
8292 QCoreApplication::sendEvent(this, &styleChangedEvent);
never executed (the execution status of this line is deduced): QCoreApplication::sendEvent(this, &styleChangedEvent);
-
8293 if (isVisible())
never evaluated: isVisible()
0
8294 update();
never executed: update();
0
8295 }
never executed: }
0
8296 break;
never executed: break;
0
8297 -
8298#ifdef Q_OS_MAC -
8299 case QEvent::MacSizeChange: -
8300 updateGeometry(); -
8301 break; -
8302#elif defined Q_WS_MAC -
8303 case QEvent::ToolTipChange: -
8304 case QEvent::MouseTrackingChange: -
8305 qt_mac_update_mouseTracking(this); -
8306 break; -
8307#endif -
8308 -
8309 default: -
8310 break;
executed: break;
Execution Count:44679
44679
8311 } -
8312}
executed: }
Execution Count:67230
67230
8313 -
8314/*! -
8315 This event handler, for event \a event, can be reimplemented in a -
8316 subclass to receive mouse move events for the widget. -
8317 -
8318 If mouse tracking is switched off, mouse move events only occur if -
8319 a mouse button is pressed while the mouse is being moved. If mouse -
8320 tracking is switched on, mouse move events occur even if no mouse -
8321 button is pressed. -
8322 -
8323 QMouseEvent::pos() reports the position of the mouse cursor, -
8324 relative to this widget. For press and release events, the -
8325 position is usually the same as the position of the last mouse -
8326 move event, but it might be different if the user's hand shakes. -
8327 This is a feature of the underlying window system, not Qt. -
8328 -
8329 If you want to show a tooltip immediately, while the mouse is -
8330 moving (e.g., to get the mouse coordinates with QMouseEvent::pos() -
8331 and show them as a tooltip), you must first enable mouse tracking -
8332 as described above. Then, to ensure that the tooltip is updated -
8333 immediately, you must call QToolTip::showText() instead of -
8334 setToolTip() in your implementation of mouseMoveEvent(). -
8335 -
8336 \sa setMouseTracking(), mousePressEvent(), mouseReleaseEvent(), -
8337 mouseDoubleClickEvent(), event(), QMouseEvent, {Scribble Example} -
8338*/ -
8339 -
8340void QWidget::mouseMoveEvent(QMouseEvent *event) -
8341{ -
8342 event->ignore();
never executed (the execution status of this line is deduced): event->ignore();
-
8343}
never executed: }
0
8344 -
8345/*! -
8346 This event handler, for event \a event, can be reimplemented in a -
8347 subclass to receive mouse press events for the widget. -
8348 -
8349 If you create new widgets in the mousePressEvent() the -
8350 mouseReleaseEvent() may not end up where you expect, depending on -
8351 the underlying window system (or X11 window manager), the widgets' -
8352 location and maybe more. -
8353 -
8354 The default implementation implements the closing of popup widgets -
8355 when you click outside the window. For other widget types it does -
8356 nothing. -
8357 -
8358 \sa mouseReleaseEvent(), mouseDoubleClickEvent(), -
8359 mouseMoveEvent(), event(), QMouseEvent, {Scribble Example} -
8360*/ -
8361 -
8362void QWidget::mousePressEvent(QMouseEvent *event) -
8363{ -
8364 event->ignore();
executed (the execution status of this line is deduced): event->ignore();
-
8365 if ((windowType() == Qt::Popup)) {
partially evaluated: (windowType() == Qt::Popup)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:11
0-11
8366 event->accept();
never executed (the execution status of this line is deduced): event->accept();
-
8367 QWidget* w;
never executed (the execution status of this line is deduced): QWidget* w;
-
8368 while ((w = QApplication::activePopupWidget()) && w != this){
never evaluated: (w = QApplication::activePopupWidget())
never evaluated: w != this
0
8369 w->close();
never executed (the execution status of this line is deduced): w->close();
-
8370 if (QApplication::activePopupWidget() == w) // widget does not want to disappear
never evaluated: QApplication::activePopupWidget() == w
0
8371 w->hide(); // hide at least
never executed: w->hide();
0
8372 }
never executed: }
0
8373 if (!rect().contains(event->pos())){
never evaluated: !rect().contains(event->pos())
0
8374 close();
never executed (the execution status of this line is deduced): close();
-
8375 }
never executed: }
0
8376 }
never executed: }
0
8377}
executed: }
Execution Count:11
11
8378 -
8379/*! -
8380 This event handler, for event \a event, can be reimplemented in a -
8381 subclass to receive mouse release events for the widget. -
8382 -
8383 \sa mousePressEvent(), mouseDoubleClickEvent(), -
8384 mouseMoveEvent(), event(), QMouseEvent, {Scribble Example} -
8385*/ -
8386 -
8387void QWidget::mouseReleaseEvent(QMouseEvent *event) -
8388{ -
8389 event->ignore();
executed (the execution status of this line is deduced): event->ignore();
-
8390}
executed: }
Execution Count:3
3
8391 -
8392/*! -
8393 This event handler, for event \a event, can be reimplemented in a -
8394 subclass to receive mouse double click events for the widget. -
8395 -
8396 The default implementation generates a normal mouse press event. -
8397 -
8398 \note The widget will also receive mouse press and mouse release -
8399 events in addition to the double click event. It is up to the -
8400 developer to ensure that the application interprets these events -
8401 correctly. -
8402 -
8403 \sa mousePressEvent(), mouseReleaseEvent(), mouseMoveEvent(), -
8404 event(), QMouseEvent -
8405*/ -
8406 -
8407void QWidget::mouseDoubleClickEvent(QMouseEvent *event) -
8408{ -
8409 Q_UNUSED(event);
executed (the execution status of this line is deduced): (void)event;;
-
8410}
executed: }
Execution Count:10
10
8411 -
8412#ifndef QT_NO_WHEELEVENT -
8413/*! -
8414 This event handler, for event \a event, can be reimplemented in a -
8415 subclass to receive wheel events for the widget. -
8416 -
8417 If you reimplement this handler, it is very important that you -
8418 \l{QWheelEvent}{ignore()} the event if you do not handle -
8419 it, so that the widget's parent can interpret it. -
8420 -
8421 The default implementation ignores the event. -
8422 -
8423 \sa QWheelEvent::ignore(), QWheelEvent::accept(), event(), -
8424 QWheelEvent -
8425*/ -
8426 -
8427void QWidget::wheelEvent(QWheelEvent *event) -
8428{ -
8429 event->ignore();
never executed (the execution status of this line is deduced): event->ignore();
-
8430}
never executed: }
0
8431#endif // QT_NO_WHEELEVENT -
8432 -
8433#ifndef QT_NO_TABLETEVENT -
8434/*! -
8435 This event handler, for event \a event, can be reimplemented in a -
8436 subclass to receive tablet events for the widget. -
8437 -
8438 If you reimplement this handler, it is very important that you -
8439 \l{QTabletEvent}{ignore()} the event if you do not handle -
8440 it, so that the widget's parent can interpret it. -
8441 -
8442 The default implementation ignores the event. -
8443 -
8444 \sa QTabletEvent::ignore(), QTabletEvent::accept(), event(), -
8445 QTabletEvent -
8446*/ -
8447 -
8448void QWidget::tabletEvent(QTabletEvent *event) -
8449{ -
8450 event->ignore();
never executed (the execution status of this line is deduced): event->ignore();
-
8451}
never executed: }
0
8452#endif // QT_NO_TABLETEVENT -
8453 -
8454/*! -
8455 This event handler, for event \a event, can be reimplemented in a -
8456 subclass to receive key press events for the widget. -
8457 -
8458 A widget must call setFocusPolicy() to accept focus initially and -
8459 have focus in order to receive a key press event. -
8460 -
8461 If you reimplement this handler, it is very important that you -
8462 call the base class implementation if you do not act upon the key. -
8463 -
8464 The default implementation closes popup widgets if the user -
8465 presses Esc. Otherwise the event is ignored, so that the widget's -
8466 parent can interpret it. -
8467 -
8468 Note that QKeyEvent starts with isAccepted() == true, so you do not -
8469 need to call QKeyEvent::accept() - just do not call the base class -
8470 implementation if you act upon the key. -
8471 -
8472 \sa keyReleaseEvent(), setFocusPolicy(), -
8473 focusInEvent(), focusOutEvent(), event(), QKeyEvent, {Tetrix Example} -
8474*/ -
8475 -
8476void QWidget::keyPressEvent(QKeyEvent *event) -
8477{ -
8478 if ((windowType() == Qt::Popup) && event->key() == Qt::Key_Escape) {
partially evaluated: (windowType() == Qt::Popup)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:284
never evaluated: event->key() == Qt::Key_Escape
0-284
8479 event->accept();
never executed (the execution status of this line is deduced): event->accept();
-
8480 close();
never executed (the execution status of this line is deduced): close();
-
8481 } else {
never executed: }
0
8482 event->ignore();
executed (the execution status of this line is deduced): event->ignore();
-
8483 }
executed: }
Execution Count:284
284
8484} -
8485 -
8486/*! -
8487 This event handler, for event \a event, can be reimplemented in a -
8488 subclass to receive key release events for the widget. -
8489 -
8490 A widget must \l{setFocusPolicy()}{accept focus} -
8491 initially and \l{hasFocus()}{have focus} in order to -
8492 receive a key release event. -
8493 -
8494 If you reimplement this handler, it is very important that you -
8495 call the base class implementation if you do not act upon the key. -
8496 -
8497 The default implementation ignores the event, so that the widget's -
8498 parent can interpret it. -
8499 -
8500 Note that QKeyEvent starts with isAccepted() == true, so you do not -
8501 need to call QKeyEvent::accept() - just do not call the base class -
8502 implementation if you act upon the key. -
8503 -
8504 \sa keyPressEvent(), QKeyEvent::ignore(), setFocusPolicy(), -
8505 focusInEvent(), focusOutEvent(), event(), QKeyEvent -
8506*/ -
8507 -
8508void QWidget::keyReleaseEvent(QKeyEvent *event) -
8509{ -
8510 event->ignore();
executed (the execution status of this line is deduced): event->ignore();
-
8511}
executed: }
Execution Count:4458
4458
8512 -
8513/*! -
8514 \fn void QWidget::focusInEvent(QFocusEvent *event) -
8515 -
8516 This event handler can be reimplemented in a subclass to receive -
8517 keyboard focus events (focus received) for the widget. The event -
8518 is passed in the \a event parameter -
8519 -
8520 A widget normally must setFocusPolicy() to something other than -
8521 Qt::NoFocus in order to receive focus events. (Note that the -
8522 application programmer can call setFocus() on any widget, even -
8523 those that do not normally accept focus.) -
8524 -
8525 The default implementation updates the widget (except for windows -
8526 that do not specify a focusPolicy()). -
8527 -
8528 \sa focusOutEvent(), setFocusPolicy(), keyPressEvent(), -
8529 keyReleaseEvent(), event(), QFocusEvent -
8530*/ -
8531 -
8532void QWidget::focusInEvent(QFocusEvent *) -
8533{ -
8534 if (focusPolicy() != Qt::NoFocus || !isWindow()) {
evaluated: focusPolicy() != Qt::NoFocus
TRUEFALSE
yes
Evaluation Count:673
yes
Evaluation Count:90
evaluated: !isWindow()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:87
3-673
8535 update();
executed (the execution status of this line is deduced): update();
-
8536 }
executed: }
Execution Count:676
676
8537}
executed: }
Execution Count:763
763
8538 -
8539/*! -
8540 \fn void QWidget::focusOutEvent(QFocusEvent *event) -
8541 -
8542 This event handler can be reimplemented in a subclass to receive -
8543 keyboard focus events (focus lost) for the widget. The events is -
8544 passed in the \a event parameter. -
8545 -
8546 A widget normally must setFocusPolicy() to something other than -
8547 Qt::NoFocus in order to receive focus events. (Note that the -
8548 application programmer can call setFocus() on any widget, even -
8549 those that do not normally accept focus.) -
8550 -
8551 The default implementation updates the widget (except for windows -
8552 that do not specify a focusPolicy()). -
8553 -
8554 \sa focusInEvent(), setFocusPolicy(), keyPressEvent(), -
8555 keyReleaseEvent(), event(), QFocusEvent -
8556*/ -
8557 -
8558void QWidget::focusOutEvent(QFocusEvent *) -
8559{ -
8560 if (focusPolicy() != Qt::NoFocus || !isWindow())
evaluated: focusPolicy() != Qt::NoFocus
TRUEFALSE
yes
Evaluation Count:572
yes
Evaluation Count:22
evaluated: !isWindow()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:17
5-572
8561 update();
executed: update();
Execution Count:577
577
8562}
executed: }
Execution Count:594
594
8563 -
8564/*! -
8565 \fn void QWidget::enterEvent(QEvent *event) -
8566 -
8567 This event handler can be reimplemented in a subclass to receive -
8568 widget enter events which are passed in the \a event parameter. -
8569 -
8570 An event is sent to the widget when the mouse cursor enters the -
8571 widget. -
8572 -
8573 \sa leaveEvent(), mouseMoveEvent(), event() -
8574*/ -
8575 -
8576void QWidget::enterEvent(QEvent *) -
8577{ -
8578} -
8579 -
8580// ### Qt 6: void QWidget::enterEvent(QEnterEvent *). -
8581 -
8582/*! -
8583 \fn void QWidget::leaveEvent(QEvent *event) -
8584 -
8585 This event handler can be reimplemented in a subclass to receive -
8586 widget leave events which are passed in the \a event parameter. -
8587 -
8588 A leave event is sent to the widget when the mouse cursor leaves -
8589 the widget. -
8590 -
8591 \sa enterEvent(), mouseMoveEvent(), event() -
8592*/ -
8593 -
8594void QWidget::leaveEvent(QEvent *) -
8595{ -
8596} -
8597 -
8598/*! -
8599 \fn void QWidget::paintEvent(QPaintEvent *event) -
8600 -
8601 This event handler can be reimplemented in a subclass to receive paint -
8602 events passed in \a event. -
8603 -
8604 A paint event is a request to repaint all or part of a widget. It can -
8605 happen for one of the following reasons: -
8606 -
8607 \list -
8608 \li repaint() or update() was invoked, -
8609 \li the widget was obscured and has now been uncovered, or -
8610 \li many other reasons. -
8611 \endlist -
8612 -
8613 Many widgets can simply repaint their entire surface when asked to, but -
8614 some slow widgets need to optimize by painting only the requested region: -
8615 QPaintEvent::region(). This speed optimization does not change the result, -
8616 as painting is clipped to that region during event processing. QListView -
8617 and QTableView do this, for example. -
8618 -
8619 Qt also tries to speed up painting by merging multiple paint events into -
8620 one. When update() is called several times or the window system sends -
8621 several paint events, Qt merges these events into one event with a larger -
8622 region (see QRegion::united()). The repaint() function does not permit this -
8623 optimization, so we suggest using update() whenever possible. -
8624 -
8625 When the paint event occurs, the update region has normally been erased, so -
8626 you are painting on the widget's background. -
8627 -
8628 The background can be set using setBackgroundRole() and setPalette(). -
8629 -
8630 Since Qt 4.0, QWidget automatically double-buffers its painting, so there -
8631 is no need to write double-buffering code in paintEvent() to avoid flicker. -
8632 -
8633 \b{Note for the X11 platform}: It is possible to toggle global double -
8634 buffering by calling \c qt_x11_set_global_double_buffer(). For example, -
8635 -
8636 \snippet code/src_gui_kernel_qwidget.cpp 14 -
8637 -
8638 \note Generally, you should refrain from calling update() or repaint() -
8639 \b{inside} a paintEvent(). For example, calling update() or repaint() on -
8640 children inside a paintevent() results in undefined behavior; the child may -
8641 or may not get a paint event. -
8642 -
8643 \warning If you are using a custom paint engine without Qt's backingstore, -
8644 Qt::WA_PaintOnScreen must be set. Otherwise, QWidget::paintEngine() will -
8645 never be called; the backingstore will be used instead. -
8646 -
8647 \sa event(), repaint(), update(), QPainter, QPixmap, QPaintEvent, -
8648 {Analog Clock Example} -
8649*/ -
8650 -
8651void QWidget::paintEvent(QPaintEvent *) -
8652{ -
8653} -
8654 -
8655 -
8656/*! -
8657 \fn void QWidget::moveEvent(QMoveEvent *event) -
8658 -
8659 This event handler can be reimplemented in a subclass to receive -
8660 widget move events which are passed in the \a event parameter. -
8661 When the widget receives this event, it is already at the new -
8662 position. -
8663 -
8664 The old position is accessible through QMoveEvent::oldPos(). -
8665 -
8666 \sa resizeEvent(), event(), move(), QMoveEvent -
8667*/ -
8668 -
8669void QWidget::moveEvent(QMoveEvent *) -
8670{ -
8671} -
8672 -
8673 -
8674/*! -
8675 This event handler can be reimplemented in a subclass to receive -
8676 widget resize events which are passed in the \a event parameter. -
8677 When resizeEvent() is called, the widget already has its new -
8678 geometry. The old size is accessible through -
8679 QResizeEvent::oldSize(). -
8680 -
8681 The widget will be erased and receive a paint event immediately -
8682 after processing the resize event. No drawing need be (or should -
8683 be) done inside this handler. -
8684 -
8685 -
8686 \sa moveEvent(), event(), resize(), QResizeEvent, paintEvent(), -
8687 {Scribble Example} -
8688*/ -
8689 -
8690void QWidget::resizeEvent(QResizeEvent * /* event */) -
8691{ -
8692} -
8693 -
8694#ifndef QT_NO_ACTION -
8695/*! -
8696 \fn void QWidget::actionEvent(QActionEvent *event) -
8697 -
8698 This event handler is called with the given \a event whenever the -
8699 widget's actions are changed. -
8700 -
8701 \sa addAction(), insertAction(), removeAction(), actions(), QActionEvent -
8702*/ -
8703void QWidget::actionEvent(QActionEvent *) -
8704{ -
8705 -
8706} -
8707#endif -
8708 -
8709/*! -
8710 This event handler is called with the given \a event when Qt receives a window -
8711 close request for a top-level widget from the window system. -
8712 -
8713 By default, the event is accepted and the widget is closed. You can reimplement -
8714 this function to change the way the widget responds to window close requests. -
8715 For example, you can prevent the window from closing by calling \l{QEvent::}{ignore()} -
8716 on all events. -
8717 -
8718 Main window applications typically use reimplementations of this function to check -
8719 whether the user's work has been saved and ask for permission before closing. -
8720 For example, the \l{Application Example} uses a helper function to determine whether -
8721 or not to close the window: -
8722 -
8723 \snippet mainwindows/application/mainwindow.cpp 3 -
8724 \snippet mainwindows/application/mainwindow.cpp 4 -
8725 -
8726 \sa event(), hide(), close(), QCloseEvent, {Application Example} -
8727*/ -
8728 -
8729void QWidget::closeEvent(QCloseEvent *event) -
8730{ -
8731 event->accept();
executed (the execution status of this line is deduced): event->accept();
-
8732}
executed: }
Execution Count:68
68
8733 -
8734#ifndef QT_NO_CONTEXTMENU -
8735/*! -
8736 This event handler, for event \a event, can be reimplemented in a -
8737 subclass to receive widget context menu events. -
8738 -
8739 The handler is called when the widget's \l contextMenuPolicy is -
8740 Qt::DefaultContextMenu. -
8741 -
8742 The default implementation ignores the context event. -
8743 See the \l QContextMenuEvent documentation for more details. -
8744 -
8745 \sa event(), QContextMenuEvent, customContextMenuRequested() -
8746*/ -
8747 -
8748void QWidget::contextMenuEvent(QContextMenuEvent *event) -
8749{ -
8750 event->ignore();
never executed (the execution status of this line is deduced): event->ignore();
-
8751}
never executed: }
0
8752#endif // QT_NO_CONTEXTMENU -
8753 -
8754 -
8755/*! -
8756 This event handler, for event \a event, can be reimplemented in a -
8757 subclass to receive Input Method composition events. This handler -
8758 is called when the state of the input method changes. -
8759 -
8760 Note that when creating custom text editing widgets, the -
8761 Qt::WA_InputMethodEnabled window attribute must be set explicitly -
8762 (using the setAttribute() function) in order to receive input -
8763 method events. -
8764 -
8765 The default implementation calls event->ignore(), which rejects the -
8766 Input Method event. See the \l QInputMethodEvent documentation for more -
8767 details. -
8768 -
8769 \sa event(), QInputMethodEvent -
8770*/ -
8771void QWidget::inputMethodEvent(QInputMethodEvent *event) -
8772{ -
8773 event->ignore();
never executed (the execution status of this line is deduced): event->ignore();
-
8774}
never executed: }
0
8775 -
8776/*! -
8777 This method is only relevant for input widgets. It is used by the -
8778 input method to query a set of properties of the widget to be -
8779 able to support complex input method operations as support for -
8780 surrounding text and reconversions. -
8781 -
8782 \a query specifies which property is queried. -
8783 -
8784 \sa inputMethodEvent(), QInputMethodEven, inputMethodHints -
8785*/ -
8786QVariant QWidget::inputMethodQuery(Qt::InputMethodQuery query) const -
8787{ -
8788 switch(query) { -
8789 case Qt::ImCursorRectangle: -
8790 return QRect(width()/2, 0, 1, height());
executed: return QRect(width()/2, 0, 1, height());
Execution Count:1
1
8791 case Qt::ImFont: -
8792 return font();
never executed: return font();
0
8793 case Qt::ImAnchorPosition: -
8794 // Fallback. -
8795 return inputMethodQuery(Qt::ImCursorPosition);
never executed: return inputMethodQuery(Qt::ImCursorPosition);
0
8796 case Qt::ImHints: -
8797 return (int)inputMethodHints();
never executed: return (int)inputMethodHints();
0
8798 default: -
8799 return QVariant();
executed: return QVariant();
Execution Count:691
691
8800 } -
8801}
never executed: }
0
8802 -
8803/*! -
8804 \property QWidget::inputMethodHints -
8805 \brief What input method specific hints the widget has. -
8806 -
8807 This is only relevant for input widgets. It is used by -
8808 the input method to retrieve hints as to how the input method -
8809 should operate. For example, if the Qt::ImhFormattedNumbersOnly flag -
8810 is set, the input method may change its visual components to reflect -
8811 that only numbers can be entered. -
8812 -
8813 \note The flags are only hints, so the particular input method -
8814 implementation is free to ignore them. If you want to be -
8815 sure that a certain type of characters are entered, -
8816 you should also set a QValidator on the widget. -
8817 -
8818 The default value is Qt::ImhNone. -
8819 -
8820 \since 4.6 -
8821 -
8822 \sa inputMethodQuery() -
8823*/ -
8824Qt::InputMethodHints QWidget::inputMethodHints() const -
8825{ -
8826#ifndef QT_NO_IM -
8827 const QWidgetPrivate *priv = d_func();
executed (the execution status of this line is deduced): const QWidgetPrivate *priv = d_func();
-
8828 while (priv->inheritsInputMethodHints) {
evaluated: priv->inheritsInputMethodHints
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:6
4-6
8829 priv = priv->q_func()->parentWidget()->d_func();
executed (the execution status of this line is deduced): priv = priv->q_func()->parentWidget()->d_func();
-
8830 Q_ASSERT(priv);
executed (the execution status of this line is deduced): qt_noop();
-
8831 }
executed: }
Execution Count:4
4
8832 return priv->imHints;
executed: return priv->imHints;
Execution Count:6
6
8833#else //QT_NO_IM -
8834 return 0; -
8835#endif //QT_NO_IM -
8836} -
8837 -
8838void QWidget::setInputMethodHints(Qt::InputMethodHints hints) -
8839{ -
8840#ifndef QT_NO_IM -
8841 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
8842 d->imHints = hints;
executed (the execution status of this line is deduced): d->imHints = hints;
-
8843 qApp->inputMethod()->update(Qt::ImHints);
executed (the execution status of this line is deduced): (static_cast<QApplication *>(QCoreApplication::instance()))->inputMethod()->update(Qt::ImHints);
-
8844#endif //QT_NO_IM -
8845}
executed: }
Execution Count:1575
1575
8846 -
8847 -
8848#ifndef QT_NO_DRAGANDDROP -
8849 -
8850/*! -
8851 \fn void QWidget::dragEnterEvent(QDragEnterEvent *event) -
8852 -
8853 This event handler is called when a drag is in progress and the -
8854 mouse enters this widget. The event is passed in the \a event parameter. -
8855 -
8856 If the event is ignored, the widget won't receive any \l{dragMoveEvent()}{drag -
8857 move events}. -
8858 -
8859 See the \l{dnd.html}{Drag-and-drop documentation} for an -
8860 overview of how to provide drag-and-drop in your application. -
8861 -
8862 \sa QDrag, QDragEnterEvent -
8863*/ -
8864void QWidget::dragEnterEvent(QDragEnterEvent *) -
8865{ -
8866} -
8867 -
8868/*! -
8869 \fn void QWidget::dragMoveEvent(QDragMoveEvent *event) -
8870 -
8871 This event handler is called if a drag is in progress, and when -
8872 any of the following conditions occur: the cursor enters this widget, -
8873 the cursor moves within this widget, or a modifier key is pressed on -
8874 the keyboard while this widget has the focus. The event is passed -
8875 in the \a event parameter. -
8876 -
8877 See the \l{dnd.html}{Drag-and-drop documentation} for an -
8878 overview of how to provide drag-and-drop in your application. -
8879 -
8880 \sa QDrag, QDragMoveEvent -
8881*/ -
8882void QWidget::dragMoveEvent(QDragMoveEvent *) -
8883{ -
8884} -
8885 -
8886/*! -
8887 \fn void QWidget::dragLeaveEvent(QDragLeaveEvent *event) -
8888 -
8889 This event handler is called when a drag is in progress and the -
8890 mouse leaves this widget. The event is passed in the \a event -
8891 parameter. -
8892 -
8893 See the \l{dnd.html}{Drag-and-drop documentation} for an -
8894 overview of how to provide drag-and-drop in your application. -
8895 -
8896 \sa QDrag, QDragLeaveEvent -
8897*/ -
8898void QWidget::dragLeaveEvent(QDragLeaveEvent *) -
8899{ -
8900} -
8901 -
8902/*! -
8903 \fn void QWidget::dropEvent(QDropEvent *event) -
8904 -
8905 This event handler is called when the drag is dropped on this -
8906 widget. The event is passed in the \a event parameter. -
8907 -
8908 See the \l{dnd.html}{Drag-and-drop documentation} for an -
8909 overview of how to provide drag-and-drop in your application. -
8910 -
8911 \sa QDrag, QDropEvent -
8912*/ -
8913void QWidget::dropEvent(QDropEvent *) -
8914{ -
8915} -
8916 -
8917#endif // QT_NO_DRAGANDDROP -
8918 -
8919/*! -
8920 \fn void QWidget::showEvent(QShowEvent *event) -
8921 -
8922 This event handler can be reimplemented in a subclass to receive -
8923 widget show events which are passed in the \a event parameter. -
8924 -
8925 Non-spontaneous show events are sent to widgets immediately -
8926 before they are shown. The spontaneous show events of windows are -
8927 delivered afterwards. -
8928 -
8929 Note: A widget receives spontaneous show and hide events when its -
8930 mapping status is changed by the window system, e.g. a spontaneous -
8931 hide event when the user minimizes the window, and a spontaneous -
8932 show event when the window is restored again. After receiving a -
8933 spontaneous hide event, a widget is still considered visible in -
8934 the sense of isVisible(). -
8935 -
8936 \sa visible, event(), QShowEvent -
8937*/ -
8938void QWidget::showEvent(QShowEvent *) -
8939{ -
8940} -
8941 -
8942/*! -
8943 \fn void QWidget::hideEvent(QHideEvent *event) -
8944 -
8945 This event handler can be reimplemented in a subclass to receive -
8946 widget hide events. The event is passed in the \a event parameter. -
8947 -
8948 Hide events are sent to widgets immediately after they have been -
8949 hidden. -
8950 -
8951 Note: A widget receives spontaneous show and hide events when its -
8952 mapping status is changed by the window system, e.g. a spontaneous -
8953 hide event when the user minimizes the window, and a spontaneous -
8954 show event when the window is restored again. After receiving a -
8955 spontaneous hide event, a widget is still considered visible in -
8956 the sense of isVisible(). -
8957 -
8958 \sa visible, event(), QHideEvent -
8959*/ -
8960void QWidget::hideEvent(QHideEvent *) -
8961{ -
8962} -
8963 -
8964/*! -
8965 This special event handler can be reimplemented in a subclass to -
8966 receive native platform events identified by \a eventType -
8967 which are passed in the \a message parameter. -
8968 -
8969 In your reimplementation of this function, if you want to stop the -
8970 event being handled by Qt, return true and set \a result. -
8971 If you return false, this native event is passed back to Qt, -
8972 which translates the event into a Qt event and sends it to the widget. -
8973 -
8974 \note Events are only delivered to this event handler if the widget is -
8975 has a native Window handle. -
8976 -
8977 \note This function superseedes the event filter functions -
8978 x11Event(), winEvent() and macEvent() of Qt 4. -
8979 -
8980 \table -
8981 \header \li Platform \li Event Type Identifier \li Message Type \li Result Type -
8982 \row \li Windows \li "windows_generic_MSG" \li MSG * \li LRESULT -
8983 \endtable -
8984*/ -
8985 -
8986bool QWidget::nativeEvent(const QByteArray &eventType, void *message, long *result) -
8987{ -
8988 Q_UNUSED(eventType);
executed (the execution status of this line is deduced): (void)eventType;;
-
8989 Q_UNUSED(message);
executed (the execution status of this line is deduced): (void)message;;
-
8990 Q_UNUSED(result);
executed (the execution status of this line is deduced): (void)result;;
-
8991 return false;
executed: return false;
Execution Count:38625
38625
8992} -
8993 -
8994/*! -
8995 Ensures that the widget has been polished by QStyle (i.e., has a -
8996 proper font and palette). -
8997 -
8998 QWidget calls this function after it has been fully constructed -
8999 but before it is shown the very first time. You can call this -
9000 function if you want to ensure that the widget is polished before -
9001 doing an operation, e.g., the correct font size might be needed in -
9002 the widget's sizeHint() reimplementation. Note that this function -
9003 \e is called from the default implementation of sizeHint(). -
9004 -
9005 Polishing is useful for final initialization that must happen after -
9006 all constructors (from base classes as well as from subclasses) -
9007 have been called. -
9008 -
9009 If you need to change some settings when a widget is polished, -
9010 reimplement event() and handle the QEvent::Polish event type. -
9011 -
9012 \b{Note:} The function is declared const so that it can be called from -
9013 other const functions (e.g., sizeHint()). -
9014 -
9015 \sa event() -
9016*/ -
9017void QWidget::ensurePolished() const -
9018{ -
9019 Q_D(const QWidget);
executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
9020 -
9021 const QMetaObject *m = metaObject();
executed (the execution status of this line is deduced): const QMetaObject *m = metaObject();
-
9022 if (m == d->polished)
evaluated: m == d->polished
TRUEFALSE
yes
Evaluation Count:129742
yes
Evaluation Count:26642
26642-129742
9023 return;
executed: return;
Execution Count:129742
129742
9024 d->polished = m;
executed (the execution status of this line is deduced): d->polished = m;
-
9025 -
9026 QEvent e(QEvent::Polish);
executed (the execution status of this line is deduced): QEvent e(QEvent::Polish);
-
9027 QCoreApplication::sendEvent(const_cast<QWidget *>(this), &e);
executed (the execution status of this line is deduced): QCoreApplication::sendEvent(const_cast<QWidget *>(this), &e);
-
9028 -
9029 // polish children after 'this' -
9030 QList<QObject*> children = d->children;
executed (the execution status of this line is deduced): QList<QObject*> children = d->children;
-
9031 for (int i = 0; i < children.size(); ++i) {
evaluated: i < children.size()
TRUEFALSE
yes
Evaluation Count:34670
yes
Evaluation Count:26642
26642-34670
9032 QObject *o = children.at(i);
executed (the execution status of this line is deduced): QObject *o = children.at(i);
-
9033 if(!o->isWidgetType())
evaluated: !o->isWidgetType()
TRUEFALSE
yes
Evaluation Count:14464
yes
Evaluation Count:20206
14464-20206
9034 continue;
executed: continue;
Execution Count:14464
14464
9035 if (QWidget *w = qobject_cast<QWidget *>(o))
partially evaluated: QWidget *w = qobject_cast<QWidget *>(o)
TRUEFALSE
yes
Evaluation Count:20206
no
Evaluation Count:0
0-20206
9036 w->ensurePolished();
executed: w->ensurePolished();
Execution Count:20206
20206
9037 }
executed: }
Execution Count:20206
20206
9038 -
9039 if (d->parent && d->sendChildEvents) {
evaluated: d->parent
TRUEFALSE
yes
Evaluation Count:24421
yes
Evaluation Count:2221
evaluated: d->sendChildEvents
TRUEFALSE
yes
Evaluation Count:24420
yes
Evaluation Count:1
1-24421
9040 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));
-
9041 QCoreApplication::sendEvent(d->parent, &e);
executed (the execution status of this line is deduced): QCoreApplication::sendEvent(d->parent, &e);
-
9042 }
executed: }
Execution Count:24420
24420
9043}
executed: }
Execution Count:26642
26642
9044 -
9045/*! -
9046 Returns the mask currently set on a widget. If no mask is set the -
9047 return value will be an empty region. -
9048 -
9049 \sa setMask(), clearMask(), QRegion::isEmpty(), {Shaped Clock Example} -
9050*/ -
9051QRegion QWidget::mask() const -
9052{ -
9053 Q_D(const QWidget);
executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
9054 return d->extra ? d->extra->mask : QRegion();
executed: return d->extra ? d->extra->mask : QRegion();
Execution Count:725
725
9055} -
9056 -
9057/*! -
9058 Returns the layout manager that is installed on this widget, or 0 -
9059 if no layout manager is installed. -
9060 -
9061 The layout manager sets the geometry of the widget's children -
9062 that have been added to the layout. -
9063 -
9064 \sa setLayout(), sizePolicy(), {Layout Management} -
9065*/ -
9066QLayout *QWidget::layout() const -
9067{ -
9068 return d_func()->layout;
executed: return d_func()->layout;
Execution Count:45843
45843
9069} -
9070 -
9071 -
9072/*! -
9073 \fn void QWidget::setLayout(QLayout *layout) -
9074 -
9075 Sets the layout manager for this widget to \a layout. -
9076 -
9077 If there already is a layout manager installed on this widget, -
9078 QWidget won't let you install another. You must first delete the -
9079 existing layout manager (returned by layout()) before you can -
9080 call setLayout() with the new layout. -
9081 -
9082 If \a layout is the layout manger on a different widget, setLayout() -
9083 will reparent the layout and make it the layout manager for this widget. -
9084 -
9085 Example: -
9086 -
9087 \snippet layouts/layouts.cpp 24 -
9088 -
9089 An alternative to calling this function is to pass this widget to -
9090 the layout's constructor. -
9091 -
9092 The QWidget will take ownership of \a layout. -
9093 -
9094 \sa layout(), {Layout Management} -
9095*/ -
9096 -
9097void QWidget::setLayout(QLayout *l) -
9098{ -
9099 if (!l) {
evaluated: !l
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:7844
1-7844
9100 qWarning("QWidget::setLayout: Cannot set layout to 0");
executed (the execution status of this line is deduced): QMessageLogger("kernel/qwidget.cpp", 9100, __PRETTY_FUNCTION__).warning("QWidget::setLayout: Cannot set layout to 0");
-
9101 return;
executed: return;
Execution Count:1
1
9102 } -
9103 if (layout()) {
evaluated: layout()
TRUEFALSE
yes
Evaluation Count:24
yes
Evaluation Count:7820
24-7820
9104 if (layout() != l)
partially evaluated: layout() != l
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:24
0-24
9105 qWarning("QWidget::setLayout: Attempting to set QLayout \"%s\" on %s \"%s\", which already has a"
never executed: QMessageLogger("kernel/qwidget.cpp", 9105, __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
9106 " layout", l->objectName().toLocal8Bit().data(), metaObject()->className(),
never executed: QMessageLogger("kernel/qwidget.cpp", 9105, __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
9107 objectName().toLocal8Bit().data());
never executed: QMessageLogger("kernel/qwidget.cpp", 9105, __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
9108 return;
executed: return;
Execution Count:24
24
9109 } -
9110 -
9111 QObject *oldParent = l->parent();
executed (the execution status of this line is deduced): QObject *oldParent = l->parent();
-
9112 if (oldParent && oldParent != this) {
evaluated: oldParent
TRUEFALSE
yes
Evaluation Count:83
yes
Evaluation Count:7737
evaluated: oldParent != this
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:82
1-7737
9113 if (oldParent->isWidgetType()) {
partially evaluated: oldParent->isWidgetType()
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
9114 // Steal the layout off a widget parent. Takes effect when -
9115 // morphing laid-out container widgets in Designer. -
9116 QWidget *oldParentWidget = static_cast<QWidget *>(oldParent);
executed (the execution status of this line is deduced): QWidget *oldParentWidget = static_cast<QWidget *>(oldParent);
-
9117 oldParentWidget->takeLayout();
executed (the execution status of this line is deduced): oldParentWidget->takeLayout();
-
9118 } else {
executed: }
Execution Count:1
1
9119 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", 9119, __PRETTY_FUNCTION__).warning("QWidget::setLayout: Attempting to set QLayout \"%s\" on %s \"%s\", when the QLayout already has a parent",
-
9120 l->objectName().toLocal8Bit().data(), metaObject()->className(),
never executed (the execution status of this line is deduced): l->objectName().toLocal8Bit().data(), metaObject()->className(),
-
9121 objectName().toLocal8Bit().data());
never executed (the execution status of this line is deduced): objectName().toLocal8Bit().data());
-
9122 return;
never executed: return;
0
9123 } -
9124 } -
9125 -
9126 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
9127 l->d_func()->topLevel = true;
executed (the execution status of this line is deduced): l->d_func()->topLevel = true;
-
9128 d->layout = l;
executed (the execution status of this line is deduced): d->layout = l;
-
9129 if (oldParent != this) {
evaluated: oldParent != this
TRUEFALSE
yes
Evaluation Count:7738
yes
Evaluation Count:82
82-7738
9130 l->setParent(this);
executed (the execution status of this line is deduced): l->setParent(this);
-
9131 l->d_func()->reparentChildWidgets(this);
executed (the execution status of this line is deduced): l->d_func()->reparentChildWidgets(this);
-
9132 l->invalidate();
executed (the execution status of this line is deduced): l->invalidate();
-
9133 }
executed: }
Execution Count:7738
7738
9134 -
9135 if (isWindow() && d->maybeTopData())
evaluated: isWindow()
TRUEFALSE
yes
Evaluation Count:238
yes
Evaluation Count:7582
evaluated: d->maybeTopData()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:237
1-7582
9136 d->topData()->sizeAdjusted = false;
executed: d->topData()->sizeAdjusted = false;
Execution Count:1
1
9137}
executed: }
Execution Count:7820
7820
9138 -
9139/*! -
9140 \fn QLayout *QWidget::takeLayout() -
9141 -
9142 Remove the layout from the widget. -
9143 \since 4.5 -
9144*/ -
9145 -
9146QLayout *QWidget::takeLayout() -
9147{ -
9148 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
9149 QLayout *l = layout();
executed (the execution status of this line is deduced): QLayout *l = layout();
-
9150 if (!l)
partially evaluated: !l
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
9151 return 0;
never executed: return 0;
0
9152 d->layout = 0;
executed (the execution status of this line is deduced): d->layout = 0;
-
9153 l->setParent(0);
executed (the execution status of this line is deduced): l->setParent(0);
-
9154 return l;
executed: return l;
Execution Count:1
1
9155} -
9156 -
9157/*! -
9158 \property QWidget::sizePolicy -
9159 \brief the default layout behavior of the widget -
9160 -
9161 If there is a QLayout that manages this widget's children, the -
9162 size policy specified by that layout is used. If there is no such -
9163 QLayout, the result of this function is used. -
9164 -
9165 The default policy is Preferred/Preferred, which means that the -
9166 widget can be freely resized, but prefers to be the size -
9167 sizeHint() returns. Button-like widgets set the size policy to -
9168 specify that they may stretch horizontally, but are fixed -
9169 vertically. The same applies to lineedit controls (such as -
9170 QLineEdit, QSpinBox or an editable QComboBox) and other -
9171 horizontally orientated widgets (such as QProgressBar). -
9172 QToolButton's are normally square, so they allow growth in both -
9173 directions. Widgets that support different directions (such as -
9174 QSlider, QScrollBar or QHeader) specify stretching in the -
9175 respective direction only. Widgets that can provide scroll bars -
9176 (usually subclasses of QScrollArea) tend to specify that they can -
9177 use additional space, and that they can make do with less than -
9178 sizeHint(). -
9179 -
9180 \sa sizeHint(), QLayout, QSizePolicy, updateGeometry() -
9181*/ -
9182QSizePolicy QWidget::sizePolicy() const -
9183{ -
9184 Q_D(const QWidget);
executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
9185 return d->size_policy;
executed: return d->size_policy;
Execution Count:86947
86947
9186} -
9187 -
9188void QWidget::setSizePolicy(QSizePolicy policy) -
9189{ -
9190 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
9191 setAttribute(Qt::WA_WState_OwnSizePolicy);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_WState_OwnSizePolicy);
-
9192 if (policy == d->size_policy)
evaluated: policy == d->size_policy
TRUEFALSE
yes
Evaluation Count:425
yes
Evaluation Count:24603
425-24603
9193 return;
executed: return;
Execution Count:425
425
9194 d->size_policy = policy;
executed (the execution status of this line is deduced): d->size_policy = policy;
-
9195 -
9196#ifndef QT_NO_GRAPHICSVIEW -
9197 if (QWExtra *extra = d->extra) {
evaluated: QWExtra *extra = d->extra
TRUEFALSE
yes
Evaluation Count:1151
yes
Evaluation Count:23452
1151-23452
9198 if (extra->proxyWidget)
partially evaluated: extra->proxyWidget
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1151
0-1151
9199 extra->proxyWidget->setSizePolicy(policy);
never executed: extra->proxyWidget->setSizePolicy(policy);
0
9200 }
executed: }
Execution Count:1151
1151
9201#endif -
9202 -
9203 updateGeometry();
executed (the execution status of this line is deduced): updateGeometry();
-
9204 -
9205 if (isWindow() && d->maybeTopData())
evaluated: isWindow()
TRUEFALSE
yes
Evaluation Count:5201
yes
Evaluation Count:19402
partially evaluated: d->maybeTopData()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5201
0-19402
9206 d->topData()->sizeAdjusted = false;
never executed: d->topData()->sizeAdjusted = false;
0
9207}
executed: }
Execution Count:24603
24603
9208 -
9209/*! -
9210 \fn void QWidget::setSizePolicy(QSizePolicy::Policy horizontal, QSizePolicy::Policy vertical) -
9211 \overload -
9212 -
9213 Sets the size policy of the widget to \a horizontal and \a -
9214 vertical, with standard stretch and no height-for-width. -
9215 -
9216 \sa QSizePolicy::QSizePolicy() -
9217*/ -
9218 -
9219/*! -
9220 Returns the preferred height for this widget, given the width \a w. -
9221 -
9222 If this widget has a layout, the default implementation returns -
9223 the layout's preferred height. if there is no layout, the default -
9224 implementation returns -1 indicating that the preferred height -
9225 does not depend on the width. -
9226*/ -
9227 -
9228int QWidget::heightForWidth(int w) const -
9229{ -
9230 if (layout() && layout()->hasHeightForWidth())
partially evaluated: layout()
TRUEFALSE
yes
Evaluation Count:68
no
Evaluation Count:0
partially evaluated: layout()->hasHeightForWidth()
TRUEFALSE
yes
Evaluation Count:68
no
Evaluation Count:0
0-68
9231 return layout()->totalHeightForWidth(w);
executed: return layout()->totalHeightForWidth(w);
Execution Count:68
68
9232 return -1;
never executed: return -1;
0
9233} -
9234 -
9235 -
9236/*! -
9237 \since 5.0 -
9238 -
9239 Returns true if the widget's preferred height depends on its width; otherwise returns false. -
9240*/ -
9241bool QWidget::hasHeightForWidth() const -
9242{ -
9243 Q_D(const QWidget);
executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
9244 return d->layout ? d->layout->hasHeightForWidth() : d->size_policy.hasHeightForWidth();
executed: return d->layout ? d->layout->hasHeightForWidth() : d->size_policy.hasHeightForWidth();
Execution Count:14380
14380
9245} -
9246 -
9247/*! -
9248 \fn QWidget *QWidget::childAt(int x, int y) const -
9249 -
9250 Returns the visible child widget at the position (\a{x}, \a{y}) -
9251 in the widget's coordinate system. If there is no visible child -
9252 widget at the specified position, the function returns 0. -
9253*/ -
9254 -
9255/*! -
9256 \overload -
9257 -
9258 Returns the visible child widget at point \a p in the widget's own -
9259 coordinate system. -
9260*/ -
9261 -
9262QWidget *QWidget::childAt(const QPoint &p) const -
9263{ -
9264 return d_func()->childAt_helper(p, false);
executed: return d_func()->childAt_helper(p, false);
Execution Count:869
869
9265} -
9266 -
9267QWidget *QWidgetPrivate::childAt_helper(const QPoint &p, bool ignoreChildrenInDestructor) const -
9268{ -
9269 if (children.isEmpty())
evaluated: children.isEmpty()
TRUEFALSE
yes
Evaluation Count:263
yes
Evaluation Count:954
263-954
9270 return 0;
executed: return 0;
Execution Count:263
263
9271 -
9272#ifdef Q_WS_MAC -
9273 Q_Q(const QWidget); -
9274 // Unified tool bars on the Mac require special handling since they live outside -
9275 // QMainWindow's geometry(). See commit: 35667fd45ada49269a5987c235fdedfc43e92bb8 -
9276 bool includeFrame = q->isWindow() && qobject_cast<const QMainWindow *>(q) -
9277 && static_cast<const QMainWindow *>(q)->unifiedTitleAndToolBarOnMac(); -
9278 if (includeFrame) -
9279 return childAtRecursiveHelper(p, ignoreChildrenInDestructor, includeFrame); -
9280#endif -
9281 -
9282 if (!pointInsideRectAndMask(p))
evaluated: !pointInsideRectAndMask(p)
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:949
5-949
9283 return 0;
executed: return 0;
Execution Count:5
5
9284 return childAtRecursiveHelper(p, ignoreChildrenInDestructor);
executed: return childAtRecursiveHelper(p, ignoreChildrenInDestructor);
Execution Count:949
949
9285} -
9286 -
9287QWidget *QWidgetPrivate::childAtRecursiveHelper(const QPoint &p, bool ignoreChildrenInDestructor, bool includeFrame) const -
9288{ -
9289#ifndef Q_WS_MAC -
9290 Q_UNUSED(includeFrame);
executed (the execution status of this line is deduced): (void)includeFrame;;
-
9291#endif -
9292 for (int i = children.size() - 1; i >= 0; --i) {
evaluated: i >= 0
TRUEFALSE
yes
Evaluation Count:5420
yes
Evaluation Count:949
949-5420
9293 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));
-
9294 if (!child || child->isWindow() || child->isHidden() || child->testAttribute(Qt::WA_TransparentForMouseEvents)
evaluated: !child
TRUEFALSE
yes
Evaluation Count:1712
yes
Evaluation Count:3708
evaluated: child->isWindow()
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:3700
evaluated: child->isHidden()
TRUEFALSE
yes
Evaluation Count:761
yes
Evaluation Count:2939
partially evaluated: child->testAttribute(Qt::WA_TransparentForMouseEvents)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2939
0-3708
9295 || (ignoreChildrenInDestructor && child->data->in_destructor)) {
evaluated: ignoreChildrenInDestructor
TRUEFALSE
yes
Evaluation Count:56
yes
Evaluation Count:2883
evaluated: child->data->in_destructor
TRUEFALSE
yes
Evaluation Count:50
yes
Evaluation Count:6
6-2883
9296 continue;
executed: continue;
Execution Count:2531
2531
9297 } -
9298 -
9299 // Map the point 'p' from parent coordinates to child coordinates. -
9300 QPoint childPoint = p;
executed (the execution status of this line is deduced): QPoint childPoint = p;
-
9301#ifdef Q_WS_MAC -
9302 // 'includeFrame' is true if the child's parent is a top-level QMainWindow with an unified tool bar. -
9303 // An unified tool bar on the Mac lives outside QMainWindow's geometry(), so a normal -
9304 // QWidget::mapFromParent won't do the trick. -
9305 if (includeFrame && qobject_cast<QToolBar *>(child)) -
9306 childPoint = qt_mac_nativeMapFromParent(child, p); -
9307 else -
9308#endif -
9309 childPoint -= child->data->crect.topLeft();
executed (the execution status of this line is deduced): childPoint -= child->data->crect.topLeft();
-
9310 -
9311 // Check if the point hits the child. -
9312 if (!child->d_func()->pointInsideRectAndMask(childPoint))
evaluated: !child->d_func()->pointInsideRectAndMask(childPoint)
TRUEFALSE
yes
Evaluation Count:1699
yes
Evaluation Count:1190
1190-1699
9313 continue;
executed: continue;
Execution Count:1699
1699
9314 -
9315 // Do the same for the child's descendants. -
9316 if (QWidget *w = child->d_func()->childAtRecursiveHelper(childPoint, ignoreChildrenInDestructor))
evaluated: QWidget *w = child->d_func()->childAtRecursiveHelper(childPoint, ignoreChildrenInDestructor)
TRUEFALSE
yes
Evaluation Count:431
yes
Evaluation Count:759
431-759
9317 return w;
executed: return w;
Execution Count:431
431
9318 -
9319 // We have found our target; namely the child at position 'p'. -
9320 return child;
executed: return child;
Execution Count:759
759
9321 } -
9322 return 0;
executed: return 0;
Execution Count:949
949
9323} -
9324 -
9325void QWidgetPrivate::updateGeometry_helper(bool forceUpdate) -
9326{ -
9327 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
9328 if (widgetItem)
evaluated: widgetItem
TRUEFALSE
yes
Evaluation Count:11822
yes
Evaluation Count:44357
11822-44357
9329 widgetItem->invalidateSizeCache();
executed: widgetItem->invalidateSizeCache();
Execution Count:11822
11822
9330 QWidget *parent;
executed (the execution status of this line is deduced): QWidget *parent;
-
9331 if (forceUpdate || !extra || extra->minw != extra->maxw || extra->minh != extra->maxh) {
evaluated: forceUpdate
TRUEFALSE
yes
Evaluation Count:4154
yes
Evaluation Count:52025
evaluated: !extra
TRUEFALSE
yes
Evaluation Count:41505
yes
Evaluation Count:10520
evaluated: extra->minw != extra->maxw
TRUEFALSE
yes
Evaluation Count:10337
yes
Evaluation Count:183
evaluated: extra->minh != extra->maxh
TRUEFALSE
yes
Evaluation Count:18
yes
Evaluation Count:165
18-52025
9332 if (!q->isWindow() && !q->isHidden() && (parent = q->parentWidget())) {
evaluated: !q->isWindow()
TRUEFALSE
yes
Evaluation Count:43945
yes
Evaluation Count:12069
evaluated: !q->isHidden()
TRUEFALSE
yes
Evaluation Count:42917
yes
Evaluation Count:1028
partially evaluated: (parent = q->parentWidget())
TRUEFALSE
yes
Evaluation Count:42917
no
Evaluation Count:0
0-43945
9333 if (parent->d_func()->layout)
evaluated: parent->d_func()->layout
TRUEFALSE
yes
Evaluation Count:19002
yes
Evaluation Count:23915
19002-23915
9334 parent->d_func()->layout->invalidate();
executed: parent->d_func()->layout->invalidate();
Execution Count:19002
19002
9335 else if (parent->isVisible())
evaluated: parent->isVisible()
TRUEFALSE
yes
Evaluation Count:2810
yes
Evaluation Count:21105
2810-21105
9336 QApplication::postEvent(parent, new QEvent(QEvent::LayoutRequest));
executed: QApplication::postEvent(parent, new QEvent(QEvent::LayoutRequest));
Execution Count:2810
2810
9337 } -
9338 }
executed: }
Execution Count:56014
56014
9339}
executed: }
Execution Count:56179
56179
9340 -
9341/*! -
9342 Notifies the layout system that this widget has changed and may -
9343 need to change geometry. -
9344 -
9345 Call this function if the sizeHint() or sizePolicy() have changed. -
9346 -
9347 For explicitly hidden widgets, updateGeometry() is a no-op. The -
9348 layout system will be notified as soon as the widget is shown. -
9349*/ -
9350 -
9351void QWidget::updateGeometry() -
9352{ -
9353 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
9354 d->updateGeometry_helper(false);
executed (the execution status of this line is deduced): d->updateGeometry_helper(false);
-
9355}
executed: }
Execution Count:48334
48334
9356 -
9357/*! \property QWidget::windowFlags -
9358 -
9359 Window flags are a combination of a type (e.g. Qt::Dialog) and -
9360 zero or more hints to the window system (e.g. -
9361 Qt::FramelessWindowHint). -
9362 -
9363 If the widget had type Qt::Widget or Qt::SubWindow and becomes a -
9364 window (Qt::Window, Qt::Dialog, etc.), it is put at position (0, -
9365 0) on the desktop. If the widget is a window and becomes a -
9366 Qt::Widget or Qt::SubWindow, it is put at position (0, 0) -
9367 relative to its parent widget. -
9368 -
9369 \note This function calls setParent() when changing the flags for -
9370 a window, causing the widget to be hidden. You must call show() to make -
9371 the widget visible again.. -
9372 -
9373 \sa windowType(), {Window Flags Example} -
9374*/ -
9375void QWidget::setWindowFlags(Qt::WindowFlags flags) -
9376{ -
9377 if (data->window_flags == flags)
evaluated: data->window_flags == flags
TRUEFALSE
yes
Evaluation Count:18
yes
Evaluation Count:474
18-474
9378 return;
executed: return;
Execution Count:18
18
9379 -
9380 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
9381 -
9382 if ((data->window_flags | flags) & Qt::Window) {
evaluated: (data->window_flags | flags) & Qt::Window
TRUEFALSE
yes
Evaluation Count:343
yes
Evaluation Count:131
131-343
9383 // the old type was a window and/or the new type is a window -
9384 QPoint oldPos = pos();
executed (the execution status of this line is deduced): QPoint oldPos = pos();
-
9385 bool visible = isVisible();
executed (the execution status of this line is deduced): bool visible = isVisible();
-
9386 setParent(parentWidget(), flags);
executed (the execution status of this line is deduced): setParent(parentWidget(), flags);
-
9387 -
9388 // if both types are windows or neither of them are, we restore -
9389 // the old position -
9390 if (!((data->window_flags ^ flags) & Qt::Window)
evaluated: !((data->window_flags ^ flags) & Qt::Window)
TRUEFALSE
yes
Evaluation Count:298
yes
Evaluation Count:45
45-298
9391 && (visible || testAttribute(Qt::WA_Moved))) {
evaluated: visible
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:289
evaluated: testAttribute(Qt::WA_Moved)
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:285
4-289
9392 move(oldPos);
executed (the execution status of this line is deduced): move(oldPos);
-
9393 }
executed: }
Execution Count:13
13
9394 // for backward-compatibility we change Qt::WA_QuitOnClose attribute value only when the window was recreated. -
9395 d->adjustQuitOnCloseAttribute();
executed (the execution status of this line is deduced): d->adjustQuitOnCloseAttribute();
-
9396 } else {
executed: }
Execution Count:343
343
9397 data->window_flags = flags;
executed (the execution status of this line is deduced): data->window_flags = flags;
-
9398 }
executed: }
Execution Count:131
131
9399} -
9400 -
9401/*! -
9402 Sets the window flags for the widget to \a flags, -
9403 \e without telling the window system. -
9404 -
9405 \warning Do not call this function unless you really know what -
9406 you're doing. -
9407 -
9408 \sa setWindowFlags() -
9409*/ -
9410void QWidget::overrideWindowFlags(Qt::WindowFlags flags) -
9411{ -
9412 data->window_flags = flags;
never executed (the execution status of this line is deduced): data->window_flags = flags;
-
9413}
never executed: }
0
9414 -
9415/*! -
9416 \fn Qt::WindowType QWidget::windowType() const -
9417 -
9418 Returns the window type of this widget. This is identical to -
9419 windowFlags() & Qt::WindowType_Mask. -
9420 -
9421 \sa windowFlags -
9422*/ -
9423 -
9424/*! -
9425 Sets the parent of the widget to \a parent, and resets the window -
9426 flags. The widget is moved to position (0, 0) in its new parent. -
9427 -
9428 If the new parent widget is in a different window, the -
9429 reparented widget and its children are appended to the end of the -
9430 \l{setFocusPolicy()}{tab chain} of the new parent -
9431 widget, in the same internal order as before. If one of the moved -
9432 widgets had keyboard focus, setParent() calls clearFocus() for that -
9433 widget. -
9434 -
9435 If the new parent widget is in the same window as the -
9436 old parent, setting the parent doesn't change the tab order or -
9437 keyboard focus. -
9438 -
9439 If the "new" parent widget is the old parent widget, this function -
9440 does nothing. -
9441 -
9442 \note The widget becomes invisible as part of changing its parent, -
9443 even if it was previously visible. You must call show() to make the -
9444 widget visible again. -
9445 -
9446 \warning It is very unlikely that you will ever need this -
9447 function. If you have a widget that changes its content -
9448 dynamically, it is far easier to use \l QStackedWidget. -
9449 -
9450 \sa setWindowFlags() -
9451*/ -
9452void QWidget::setParent(QWidget *parent) -
9453{ -
9454 if (parent == parentWidget())
evaluated: parent == parentWidget()
TRUEFALSE
yes
Evaluation Count:1826
yes
Evaluation Count:2559
1826-2559
9455 return;
executed: return;
Execution Count:1826
1826
9456 setParent((QWidget*)parent, windowFlags() & ~Qt::WindowType_Mask);
executed (the execution status of this line is deduced): setParent((QWidget*)parent, windowFlags() & ~Qt::WindowType_Mask);
-
9457}
executed: }
Execution Count:2559
2559
9458 -
9459/*! -
9460 \overload -
9461 -
9462 This function also takes widget flags, \a f as an argument. -
9463*/ -
9464 -
9465void QWidget::setParent(QWidget *parent, Qt::WindowFlags f) -
9466{ -
9467 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
9468 bool resized = testAttribute(Qt::WA_Resized);
executed (the execution status of this line is deduced): bool resized = testAttribute(Qt::WA_Resized);
-
9469 bool wasCreated = testAttribute(Qt::WA_WState_Created);
executed (the execution status of this line is deduced): bool wasCreated = testAttribute(Qt::WA_WState_Created);
-
9470 QWidget *oldtlw = window();
executed (the execution status of this line is deduced): QWidget *oldtlw = window();
-
9471 -
9472 QWidget *desktopWidget = 0;
executed (the execution status of this line is deduced): QWidget *desktopWidget = 0;
-
9473 if (parent && parent->windowType() == Qt::Desktop)
evaluated: parent
TRUEFALSE
yes
Evaluation Count:30397
yes
Evaluation Count:428
partially evaluated: parent->windowType() == Qt::Desktop
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:30397
0-30397
9474 desktopWidget = parent;
never executed: desktopWidget = parent;
0
9475 bool newParent = (parent != parentWidget()) || !wasCreated || desktopWidget;
evaluated: (parent != parentWidget())
TRUEFALSE
yes
Evaluation Count:30468
yes
Evaluation Count:357
evaluated: !wasCreated
TRUEFALSE
yes
Evaluation Count:339
yes
Evaluation Count:18
partially evaluated: desktopWidget
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:18
0-30468
9476 -
9477 if (newParent && parent && !desktopWidget) {
evaluated: newParent
TRUEFALSE
yes
Evaluation Count:30807
yes
Evaluation Count:18
evaluated: parent
TRUEFALSE
yes
Evaluation Count:30380
yes
Evaluation Count:427
partially evaluated: !desktopWidget
TRUEFALSE
yes
Evaluation Count:30380
no
Evaluation Count:0
0-30807
9478 if (testAttribute(Qt::WA_NativeWindow) && !qApp->testAttribute(Qt::AA_DontCreateNativeWidgetSiblings)
partially evaluated: testAttribute(Qt::WA_NativeWindow)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:30380
never evaluated: !(static_cast<QApplication *>(QCoreApplication::instance()))->testAttribute(Qt::AA_DontCreateNativeWidgetSiblings)
0-30380
9479#ifdef Q_WS_MAC -
9480 // On Mac, toolbars inside the unified title bar will never overlap with -
9481 // siblings in the content view. So we skip enforce native siblings in that case -
9482 && !d->isInUnifiedToolbar && parentWidget() && parentWidget()->isWindow() -
9483#endif // Q_WS_MAC -
9484 ) -
9485 parent->d_func()->enforceNativeChildren();
never executed: parent->d_func()->enforceNativeChildren();
0
9486 else if (parent->d_func()->nativeChildrenForced() || parent->testAttribute(Qt::WA_PaintOnScreen))
evaluated: parent->d_func()->nativeChildrenForced()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:30379
partially evaluated: parent->testAttribute(Qt::WA_PaintOnScreen)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:30379
0-30379
9487 setAttribute(Qt::WA_NativeWindow);
executed: setAttribute(Qt::WA_NativeWindow);
Execution Count:1
1
9488 } -
9489 -
9490 if (wasCreated) {
evaluated: wasCreated
TRUEFALSE
yes
Evaluation Count:103
yes
Evaluation Count:30722
103-30722
9491 if (!testAttribute(Qt::WA_WState_Hidden)) {
evaluated: !testAttribute(Qt::WA_WState_Hidden)
TRUEFALSE
yes
Evaluation Count:26
yes
Evaluation Count:77
26-77
9492 hide();
executed (the execution status of this line is deduced): hide();
-
9493 setAttribute(Qt::WA_WState_ExplicitShowHide, false);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_WState_ExplicitShowHide, false);
-
9494 }
executed: }
Execution Count:26
26
9495 if (newParent) {
evaluated: newParent
TRUEFALSE
yes
Evaluation Count:85
yes
Evaluation Count:18
18-85
9496 QEvent e(QEvent::ParentAboutToChange);
executed (the execution status of this line is deduced): QEvent e(QEvent::ParentAboutToChange);
-
9497 QApplication::sendEvent(this, &e);
executed (the execution status of this line is deduced): QApplication::sendEvent(this, &e);
-
9498 }
executed: }
Execution Count:85
85
9499 }
executed: }
Execution Count:103
103
9500 if (newParent && isAncestorOf(focusWidget()))
evaluated: newParent
TRUEFALSE
yes
Evaluation Count:30807
yes
Evaluation Count:18
evaluated: isAncestorOf(focusWidget())
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:30803
4-30807
9501 focusWidget()->clearFocus();
executed: focusWidget()->clearFocus();
Execution Count:4
4
9502 -
9503 QTLWExtra *oldTopExtra = window()->d_func()->maybeTopData();
executed (the execution status of this line is deduced): QTLWExtra *oldTopExtra = window()->d_func()->maybeTopData();
-
9504 QWidgetBackingStoreTracker *oldBsTracker = oldTopExtra ? &oldTopExtra->backingStoreTracker : 0;
evaluated: oldTopExtra
TRUEFALSE
yes
Evaluation Count:181
yes
Evaluation Count:30644
181-30644
9505 -
9506 d->setParent_sys(parent, f);
executed (the execution status of this line is deduced): d->setParent_sys(parent, f);
-
9507 -
9508 QTLWExtra *topExtra = window()->d_func()->maybeTopData();
executed (the execution status of this line is deduced): QTLWExtra *topExtra = window()->d_func()->maybeTopData();
-
9509 QWidgetBackingStoreTracker *bsTracker = topExtra ? &topExtra->backingStoreTracker : 0;
evaluated: topExtra
TRUEFALSE
yes
Evaluation Count:2080
yes
Evaluation Count:28745
2080-28745
9510 if (oldBsTracker && oldBsTracker != bsTracker)
evaluated: oldBsTracker
TRUEFALSE
yes
Evaluation Count:181
yes
Evaluation Count:30644
evaluated: oldBsTracker != bsTracker
TRUEFALSE
yes
Evaluation Count:149
yes
Evaluation Count:32
32-30644
9511 oldBsTracker->unregisterWidgetSubtree(this);
executed: oldBsTracker->unregisterWidgetSubtree(this);
Execution Count:149
149
9512 -
9513 if (desktopWidget)
partially evaluated: desktopWidget
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:30825
0-30825
9514 parent = 0;
never executed: parent = 0;
0
9515 -
9516 if (QWidgetBackingStore *oldBs = oldtlw->d_func()->maybeBackingStore()) {
evaluated: QWidgetBackingStore *oldBs = oldtlw->d_func()->maybeBackingStore()
TRUEFALSE
yes
Evaluation Count:730
yes
Evaluation Count:30095
730-30095
9517 if (newParent)
evaluated: newParent
TRUEFALSE
yes
Evaluation Count:712
yes
Evaluation Count:18
18-712
9518 oldBs->removeDirtyWidget(this);
executed: oldBs->removeDirtyWidget(this);
Execution Count:712
712
9519 // Move the widget and all its static children from -
9520 // the old backing store to the new one. -
9521 oldBs->moveStaticWidgets(this);
executed (the execution status of this line is deduced): oldBs->moveStaticWidgets(this);
-
9522 }
executed: }
Execution Count:730
730
9523 -
9524 if (QApplicationPrivate::testAttribute(Qt::AA_ImmediateWidgetCreation) && !testAttribute(Qt::WA_WState_Created))
partially evaluated: QApplicationPrivate::testAttribute(Qt::AA_ImmediateWidgetCreation)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:30825
never evaluated: !testAttribute(Qt::WA_WState_Created)
0-30825
9525 create();
never executed: create();
0
9526 -
9527 d->reparentFocusWidgets(oldtlw);
executed (the execution status of this line is deduced): d->reparentFocusWidgets(oldtlw);
-
9528 setAttribute(Qt::WA_Resized, resized);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_Resized, resized);
-
9529 if (!testAttribute(Qt::WA_StyleSheet)
partially evaluated: !testAttribute(Qt::WA_StyleSheet)
TRUEFALSE
yes
Evaluation Count:30825
no
Evaluation Count:0
0-30825
9530 && (!parent || !parent->testAttribute(Qt::WA_StyleSheet))) {
evaluated: !parent
TRUEFALSE
yes
Evaluation Count:428
yes
Evaluation Count:30397
evaluated: !parent->testAttribute(Qt::WA_StyleSheet)
TRUEFALSE
yes
Evaluation Count:30394
yes
Evaluation Count:3
3-30397
9531 d->resolveFont();
executed (the execution status of this line is deduced): d->resolveFont();
-
9532 d->resolvePalette();
executed (the execution status of this line is deduced): d->resolvePalette();
-
9533 }
executed: }
Execution Count:30822
30822
9534 d->resolveLayoutDirection();
executed (the execution status of this line is deduced): d->resolveLayoutDirection();
-
9535 d->resolveLocale();
executed (the execution status of this line is deduced): d->resolveLocale();
-
9536 -
9537 // Note: GL widgets under WGL or EGL will always need a ParentChange -
9538 // event to handle recreation/rebinding of the GL context, hence the -
9539 // (f & Qt::MSWindowsOwnDC) clause (which is set on QGLWidgets on all -
9540 // platforms). -
9541 if (newParent
evaluated: newParent
TRUEFALSE
yes
Evaluation Count:30807
yes
Evaluation Count:18
18-30807
9542#if defined(Q_WS_WIN) || defined(QT_OPENGL_ES) -
9543 || (f & Qt::MSWindowsOwnDC) -
9544#endif -
9545 ) { -
9546 // propagate enabled updates enabled state to non-windows -
9547 if (!isWindow()) {
evaluated: !isWindow()
TRUEFALSE
yes
Evaluation Count:29805
yes
Evaluation Count:1002
1002-29805
9548 if (!testAttribute(Qt::WA_ForceDisabled))
partially evaluated: !testAttribute(Qt::WA_ForceDisabled)
TRUEFALSE
yes
Evaluation Count:29805
no
Evaluation Count:0
0-29805
9549 d->setEnabled_helper(parent ? parent->isEnabled() : true);
executed: d->setEnabled_helper(parent ? parent->isEnabled() : true);
Execution Count:29805
29805
9550 if (!testAttribute(Qt::WA_ForceUpdatesDisabled))
partially evaluated: !testAttribute(Qt::WA_ForceUpdatesDisabled)
TRUEFALSE
yes
Evaluation Count:29805
no
Evaluation Count:0
0-29805
9551 d->setUpdatesEnabled_helper(parent ? parent->updatesEnabled() : true);
executed: d->setUpdatesEnabled_helper(parent ? parent->updatesEnabled() : true);
Execution Count:29805
29805
9552 }
executed: }
Execution Count:29805
29805
9553 d->inheritStyle();
executed (the execution status of this line is deduced): d->inheritStyle();
-
9554 -
9555 // send and post remaining QObject events -
9556 if (parent && d->sendChildEvents) {
evaluated: parent
TRUEFALSE
yes
Evaluation Count:30380
yes
Evaluation Count:427
evaluated: d->sendChildEvents
TRUEFALSE
yes
Evaluation Count:30379
yes
Evaluation Count:1
1-30380
9557 QChildEvent e(QEvent::ChildAdded, this);
executed (the execution status of this line is deduced): QChildEvent e(QEvent::ChildAdded, this);
-
9558 QApplication::sendEvent(parent, &e);
executed (the execution status of this line is deduced): QApplication::sendEvent(parent, &e);
-
9559 }
executed: }
Execution Count:30379
30379
9560 -
9561//### already hidden above ---> must probably do something smart on the mac -
9562// #ifdef Q_WS_MAC -
9563// extern bool qt_mac_is_macdrawer(const QWidget *); //qwidget_mac.cpp -
9564// if(!qt_mac_is_macdrawer(q)) //special case -
9565// q->setAttribute(Qt::WA_WState_Hidden); -
9566// #else -
9567// q->setAttribute(Qt::WA_WState_Hidden); -
9568//#endif -
9569 -
9570 if (parent && d->sendChildEvents && d->polished) {
evaluated: parent
TRUEFALSE
yes
Evaluation Count:30380
yes
Evaluation Count:427
evaluated: d->sendChildEvents
TRUEFALSE
yes
Evaluation Count:30379
yes
Evaluation Count:1
evaluated: d->polished
TRUEFALSE
yes
Evaluation Count:112
yes
Evaluation Count:30267
1-30380
9571 QChildEvent e(QEvent::ChildPolished, this);
executed (the execution status of this line is deduced): QChildEvent e(QEvent::ChildPolished, this);
-
9572 QCoreApplication::sendEvent(parent, &e);
executed (the execution status of this line is deduced): QCoreApplication::sendEvent(parent, &e);
-
9573 }
executed: }
Execution Count:112
112
9574 -
9575 QEvent e(QEvent::ParentChange);
executed (the execution status of this line is deduced): QEvent e(QEvent::ParentChange);
-
9576 QApplication::sendEvent(this, &e);
executed (the execution status of this line is deduced): QApplication::sendEvent(this, &e);
-
9577 }
executed: }
Execution Count:30807
30807
9578 -
9579 if (!wasCreated) {
evaluated: !wasCreated
TRUEFALSE
yes
Evaluation Count:30722
yes
Evaluation Count:103
103-30722
9580 if (isWindow() || parentWidget()->isVisible())
evaluated: isWindow()
TRUEFALSE
yes
Evaluation Count:907
yes
Evaluation Count:29815
evaluated: parentWidget()->isVisible()
TRUEFALSE
yes
Evaluation Count:402
yes
Evaluation Count:29413
402-29815
9581 setAttribute(Qt::WA_WState_Hidden, true);
executed: setAttribute(Qt::WA_WState_Hidden, true);
Execution Count:1309
1309
9582 else if (!testAttribute(Qt::WA_WState_ExplicitShowHide))
evaluated: !testAttribute(Qt::WA_WState_ExplicitShowHide)
TRUEFALSE
yes
Evaluation Count:29401
yes
Evaluation Count:12
12-29401
9583 setAttribute(Qt::WA_WState_Hidden, false);
executed: setAttribute(Qt::WA_WState_Hidden, false);
Execution Count:29401
29401
9584 } -
9585 -
9586 d->updateIsOpaque();
executed (the execution status of this line is deduced): d->updateIsOpaque();
-
9587 -
9588#ifndef QT_NO_GRAPHICSVIEW -
9589 // Embed the widget into a proxy if the parent is embedded. -
9590 // ### Doesn't handle reparenting out of an embedded widget. -
9591 if (oldtlw->graphicsProxyWidget()) {
partially evaluated: oldtlw->graphicsProxyWidget()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:30825
0-30825
9592 if (QGraphicsProxyWidget *ancestorProxy = d->nearestGraphicsProxyWidget(oldtlw))
never evaluated: QGraphicsProxyWidget *ancestorProxy = d->nearestGraphicsProxyWidget(oldtlw)
0
9593 ancestorProxy->d_func()->unembedSubWindow(this);
never executed: ancestorProxy->d_func()->unembedSubWindow(this);
0
9594 }
never executed: }
0
9595 if (isWindow() && parent && !graphicsProxyWidget() && !bypassGraphicsProxyWidget(this)) {
evaluated: isWindow()
TRUEFALSE
yes
Evaluation Count:1002
yes
Evaluation Count:29823
evaluated: parent
TRUEFALSE
yes
Evaluation Count:574
yes
Evaluation Count:428
partially evaluated: !graphicsProxyWidget()
TRUEFALSE
yes
Evaluation Count:574
no
Evaluation Count:0
evaluated: !bypassGraphicsProxyWidget(this)
TRUEFALSE
yes
Evaluation Count:569
yes
Evaluation Count:5
0-29823
9596 if (QGraphicsProxyWidget *ancestorProxy = d->nearestGraphicsProxyWidget(parent))
partially evaluated: QGraphicsProxyWidget *ancestorProxy = d->nearestGraphicsProxyWidget(parent)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:569
0-569
9597 ancestorProxy->d_func()->embedSubWindow(this);
never executed: ancestorProxy->d_func()->embedSubWindow(this);
0
9598 }
executed: }
Execution Count:569
569
9599#endif -
9600}
executed: }
Execution Count:30825
30825
9601 -
9602/*! -
9603 Scrolls the widget including its children \a dx pixels to the -
9604 right and \a dy downward. Both \a dx and \a dy may be negative. -
9605 -
9606 After scrolling, the widgets will receive paint events for -
9607 the areas that need to be repainted. For widgets that Qt knows to -
9608 be opaque, this is only the newly exposed parts. -
9609 For example, if an opaque widget is scrolled 8 pixels to the left, -
9610 only an 8-pixel wide stripe at the right edge needs updating. -
9611 -
9612 Since widgets propagate the contents of their parents by default, -
9613 you need to set the \l autoFillBackground property, or use -
9614 setAttribute() to set the Qt::WA_OpaquePaintEvent attribute, to make -
9615 a widget opaque. -
9616 -
9617 For widgets that use contents propagation, a scroll will cause an -
9618 update of the entire scroll area. -
9619 -
9620 \sa {Transparency and Double Buffering} -
9621*/ -
9622 -
9623void QWidget::scroll(int dx, int dy) -
9624{ -
9625 if ((!updatesEnabled() && children().size() == 0) || !isVisible())
evaluated: !updatesEnabled()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1143
partially evaluated: children().size() == 0
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
evaluated: !isVisible()
TRUEFALSE
yes
Evaluation Count:32
yes
Evaluation Count:1111
0-1143
9626 return;
executed: return;
Execution Count:34
34
9627 if (dx == 0 && dy == 0)
evaluated: dx == 0
TRUEFALSE
yes
Evaluation Count:443
yes
Evaluation Count:668
partially evaluated: dy == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:443
0-668
9628 return;
never executed: return;
0
9629 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
9630#ifndef QT_NO_GRAPHICSVIEW -
9631 if (QGraphicsProxyWidget *proxy = QWidgetPrivate::nearestGraphicsProxyWidget(this)) {
partially evaluated: QGraphicsProxyWidget *proxy = QWidgetPrivate::nearestGraphicsProxyWidget(this)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1111
0-1111
9632 // Graphics View maintains its own dirty region as a list of rects; -
9633 // until we can connect item updates directly to the view, we must -
9634 // separately add a translated dirty region. -
9635 if (!d->dirty.isEmpty()) {
never evaluated: !d->dirty.isEmpty()
0
9636 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;}))
-
9637 proxy->update(rect);
never executed: proxy->update(rect);
0
9638 }
never executed: }
0
9639 proxy->scroll(dx, dy, proxy->subWidgetRect(this));
never executed (the execution status of this line is deduced): proxy->scroll(dx, dy, proxy->subWidgetRect(this));
-
9640 return;
never executed: return;
0
9641 } -
9642#endif -
9643 d->setDirtyOpaqueRegion();
executed (the execution status of this line is deduced): d->setDirtyOpaqueRegion();
-
9644 d->scroll_sys(dx, dy);
executed (the execution status of this line is deduced): d->scroll_sys(dx, dy);
-
9645}
executed: }
Execution Count:1111
1111
9646 -
9647/*! -
9648 \overload -
9649 -
9650 This version only scrolls \a r and does not move the children of -
9651 the widget. -
9652 -
9653 If \a r is empty or invalid, the result is undefined. -
9654 -
9655 \sa QScrollArea -
9656*/ -
9657void QWidget::scroll(int dx, int dy, const QRect &r) -
9658{ -
9659 -
9660 if ((!updatesEnabled() && children().size() == 0) || !isVisible())
never evaluated: !updatesEnabled()
never evaluated: children().size() == 0
never evaluated: !isVisible()
0
9661 return;
never executed: return;
0
9662 if (dx == 0 && dy == 0)
never evaluated: dx == 0
never evaluated: dy == 0
0
9663 return;
never executed: return;
0
9664 Q_D(QWidget);
never executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
9665#ifndef QT_NO_GRAPHICSVIEW -
9666 if (QGraphicsProxyWidget *proxy = QWidgetPrivate::nearestGraphicsProxyWidget(this)) {
never evaluated: QGraphicsProxyWidget *proxy = QWidgetPrivate::nearestGraphicsProxyWidget(this)
0
9667 // Graphics View maintains its own dirty region as a list of rects; -
9668 // until we can connect item updates directly to the view, we must -
9669 // separately add a translated dirty region. -
9670 if (!d->dirty.isEmpty()) {
never evaluated: !d->dirty.isEmpty()
0
9671 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;}))
-
9672 proxy->update(rect);
never executed: proxy->update(rect);
0
9673 }
never executed: }
0
9674 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()));
-
9675 return;
never executed: return;
0
9676 } -
9677#endif -
9678 d->scroll_sys(dx, dy, r);
never executed (the execution status of this line is deduced): d->scroll_sys(dx, dy, r);
-
9679}
never executed: }
0
9680 -
9681/*! -
9682 Repaints the widget directly by calling paintEvent() immediately, -
9683 unless updates are disabled or the widget is hidden. -
9684 -
9685 We suggest only using repaint() if you need an immediate repaint, -
9686 for example during animation. In almost all circumstances update() -
9687 is better, as it permits Qt to optimize for speed and minimize -
9688 flicker. -
9689 -
9690 \warning If you call repaint() in a function which may itself be -
9691 called from paintEvent(), you may get infinite recursion. The -
9692 update() function never causes recursion. -
9693 -
9694 \sa update(), paintEvent(), setUpdatesEnabled() -
9695*/ -
9696 -
9697void QWidget::repaint() -
9698{ -
9699 repaint(rect());
executed (the execution status of this line is deduced): repaint(rect());
-
9700}
executed: }
Execution Count:355
355
9701 -
9702/*! \overload -
9703 -
9704 This version repaints a rectangle (\a x, \a y, \a w, \a h) inside -
9705 the widget. -
9706 -
9707 If \a w is negative, it is replaced with \c{width() - x}, and if -
9708 \a h is negative, it is replaced width \c{height() - y}. -
9709*/ -
9710void QWidget::repaint(int x, int y, int w, int h) -
9711{ -
9712 if (x > data->crect.width() || y > data->crect.height())
never evaluated: x > data->crect.width()
never evaluated: y > data->crect.height()
0
9713 return;
never executed: return;
0
9714 -
9715 if (w < 0)
never evaluated: w < 0
0
9716 w = data->crect.width() - x;
never executed: w = data->crect.width() - x;
0
9717 if (h < 0)
never evaluated: h < 0
0
9718 h = data->crect.height() - y;
never executed: h = data->crect.height() - y;
0
9719 -
9720 repaint(QRect(x, y, w, h));
never executed (the execution status of this line is deduced): repaint(QRect(x, y, w, h));
-
9721}
never executed: }
0
9722 -
9723/*! \overload -
9724 -
9725 This version repaints a rectangle \a rect inside the widget. -
9726*/ -
9727void QWidget::repaint(const QRect &rect) -
9728{ -
9729 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
9730 -
9731 if (testAttribute(Qt::WA_WState_ConfigPending)) {
partially evaluated: testAttribute(Qt::WA_WState_ConfigPending)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:384
0-384
9732 update(rect);
never executed (the execution status of this line is deduced): update(rect);
-
9733 return;
never executed: return;
0
9734 } -
9735 -
9736 if (!isVisible() || !updatesEnabled() || rect.isEmpty())
evaluated: !isVisible()
TRUEFALSE
yes
Evaluation Count:143
yes
Evaluation Count:241
partially evaluated: !updatesEnabled()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:241
evaluated: rect.isEmpty()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:238
0-241
9737 return;
executed: return;
Execution Count:146
146
9738 -
9739 if (hasBackingStoreSupport()) {
partially evaluated: hasBackingStoreSupport()
TRUEFALSE
yes
Evaluation Count:238
no
Evaluation Count:0
0-238
9740#ifdef Q_WS_MAC -
9741 if (qt_widget_private(this)->isInUnifiedToolbar) { -
9742 qt_widget_private(this)->unifiedSurface->renderToolbar(this, true); -
9743 return; -
9744 } -
9745#endif // Q_WS_MAC -
9746 QTLWExtra *tlwExtra = window()->d_func()->maybeTopData();
executed (the execution status of this line is deduced): QTLWExtra *tlwExtra = window()->d_func()->maybeTopData();
-
9747 if (tlwExtra && !tlwExtra->inTopLevelResize && tlwExtra->backingStore) {
partially evaluated: tlwExtra
TRUEFALSE
yes
Evaluation Count:238
no
Evaluation Count:0
partially evaluated: !tlwExtra->inTopLevelResize
TRUEFALSE
yes
Evaluation Count:238
no
Evaluation Count:0
partially evaluated: tlwExtra->backingStore
TRUEFALSE
yes
Evaluation Count:238
no
Evaluation Count:0
0-238
9748 tlwExtra->inRepaint = true;
executed (the execution status of this line is deduced): tlwExtra->inRepaint = true;
-
9749 tlwExtra->backingStoreTracker->markDirty(rect, this, true);
executed (the execution status of this line is deduced): tlwExtra->backingStoreTracker->markDirty(rect, this, true);
-
9750 tlwExtra->inRepaint = false;
executed (the execution status of this line is deduced): tlwExtra->inRepaint = false;
-
9751 }
executed: }
Execution Count:238
238
9752 } else {
executed: }
Execution Count:238
238
9753 d->repaint_sys(rect);
never executed (the execution status of this line is deduced): d->repaint_sys(rect);
-
9754 }
never executed: }
0
9755} -
9756 -
9757/*! -
9758 \overload -
9759 -
9760 This version repaints a region \a rgn inside the widget. -
9761*/ -
9762void QWidget::repaint(const QRegion &rgn) -
9763{ -
9764 Q_D(QWidget);
never executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
9765 -
9766 if (testAttribute(Qt::WA_WState_ConfigPending)) {
never evaluated: testAttribute(Qt::WA_WState_ConfigPending)
0
9767 update(rgn);
never executed (the execution status of this line is deduced): update(rgn);
-
9768 return;
never executed: return;
0
9769 } -
9770 -
9771 if (!isVisible() || !updatesEnabled() || rgn.isEmpty())
never evaluated: !isVisible()
never evaluated: !updatesEnabled()
never evaluated: rgn.isEmpty()
0
9772 return;
never executed: return;
0
9773 -
9774 if (hasBackingStoreSupport()) {
never evaluated: hasBackingStoreSupport()
0
9775#ifdef Q_WS_MAC -
9776 if (qt_widget_private(this)->isInUnifiedToolbar) { -
9777 qt_widget_private(this)->unifiedSurface->renderToolbar(this, true); -
9778 return; -
9779 } -
9780#endif // Q_WS_MAC -
9781 QTLWExtra *tlwExtra = window()->d_func()->maybeTopData();
never executed (the execution status of this line is deduced): QTLWExtra *tlwExtra = window()->d_func()->maybeTopData();
-
9782 if (tlwExtra && !tlwExtra->inTopLevelResize && tlwExtra->backingStore) {
never evaluated: tlwExtra
never evaluated: !tlwExtra->inTopLevelResize
never evaluated: tlwExtra->backingStore
0
9783 tlwExtra->inRepaint = true;
never executed (the execution status of this line is deduced): tlwExtra->inRepaint = true;
-
9784 tlwExtra->backingStoreTracker->markDirty(rgn, this, true);
never executed (the execution status of this line is deduced): tlwExtra->backingStoreTracker->markDirty(rgn, this, true);
-
9785 tlwExtra->inRepaint = false;
never executed (the execution status of this line is deduced): tlwExtra->inRepaint = false;
-
9786 }
never executed: }
0
9787 } else {
never executed: }
0
9788 d->repaint_sys(rgn);
never executed (the execution status of this line is deduced): d->repaint_sys(rgn);
-
9789 }
never executed: }
0
9790} -
9791 -
9792/*! -
9793 Updates the widget unless updates are disabled or the widget is -
9794 hidden. -
9795 -
9796 This function does not cause an immediate repaint; instead it -
9797 schedules a paint event for processing when Qt returns to the main -
9798 event loop. This permits Qt to optimize for more speed and less -
9799 flicker than a call to repaint() does. -
9800 -
9801 Calling update() several times normally results in just one -
9802 paintEvent() call. -
9803 -
9804 Qt normally erases the widget's area before the paintEvent() call. -
9805 If the Qt::WA_OpaquePaintEvent widget attribute is set, the widget is -
9806 responsible for painting all its pixels with an opaque color. -
9807 -
9808 \sa repaint(), paintEvent(), setUpdatesEnabled(), {Analog Clock Example} -
9809*/ -
9810void QWidget::update() -
9811{ -
9812 update(rect());
executed (the execution status of this line is deduced): update(rect());
-
9813}
executed: }
Execution Count:144411
144411
9814 -
9815/*! \fn void QWidget::update(int x, int y, int w, int h) -
9816 \overload -
9817 -
9818 This version updates a rectangle (\a x, \a y, \a w, \a h) inside -
9819 the widget. -
9820*/ -
9821 -
9822/*! -
9823 \overload -
9824 -
9825 This version updates a rectangle \a rect inside the widget. -
9826*/ -
9827void QWidget::update(const QRect &rect) -
9828{ -
9829 if (!isVisible() || !updatesEnabled() || rect.isEmpty())
evaluated: !isVisible()
TRUEFALSE
yes
Evaluation Count:116518
yes
Evaluation Count:47516
evaluated: !updatesEnabled()
TRUEFALSE
yes
Evaluation Count:346
yes
Evaluation Count:47170
evaluated: rect.isEmpty()
TRUEFALSE
yes
Evaluation Count:1081
yes
Evaluation Count:46089
346-116518
9830 return;
executed: return;
Execution Count:117945
117945
9831 -
9832 if (testAttribute(Qt::WA_WState_InPaintEvent)) {
evaluated: testAttribute(Qt::WA_WState_InPaintEvent)
TRUEFALSE
yes
Evaluation Count:167
yes
Evaluation Count:45922
167-45922
9833 QApplication::postEvent(this, new QUpdateLaterEvent(rect));
executed (the execution status of this line is deduced): QApplication::postEvent(this, new QUpdateLaterEvent(rect));
-
9834 return;
executed: return;
Execution Count:167
167
9835 } -
9836 -
9837 if (hasBackingStoreSupport()) {
partially evaluated: hasBackingStoreSupport()
TRUEFALSE
yes
Evaluation Count:45922
no
Evaluation Count:0
0-45922
9838#ifdef Q_WS_MAC -
9839 if (qt_widget_private(this)->isInUnifiedToolbar) { -
9840 qt_widget_private(this)->unifiedSurface->renderToolbar(this, true); -
9841 return; -
9842 } -
9843#endif // Q_WS_MAC -
9844 QTLWExtra *tlwExtra = window()->d_func()->maybeTopData();
executed (the execution status of this line is deduced): QTLWExtra *tlwExtra = window()->d_func()->maybeTopData();
-
9845 if (tlwExtra && !tlwExtra->inTopLevelResize && tlwExtra->backingStore)
partially evaluated: tlwExtra
TRUEFALSE
yes
Evaluation Count:45922
no
Evaluation Count:0
partially evaluated: !tlwExtra->inTopLevelResize
TRUEFALSE
yes
Evaluation Count:45922
no
Evaluation Count:0
partially evaluated: tlwExtra->backingStore
TRUEFALSE
yes
Evaluation Count:45922
no
Evaluation Count:0
0-45922
9846 tlwExtra->backingStoreTracker->markDirty(rect, this);
executed: tlwExtra->backingStoreTracker->markDirty(rect, this);
Execution Count:45922
45922
9847 } else {
executed: }
Execution Count:45922
45922
9848 d_func()->repaint_sys(rect);
never executed (the execution status of this line is deduced): d_func()->repaint_sys(rect);
-
9849 }
never executed: }
0
9850} -
9851 -
9852/*! -
9853 \overload -
9854 -
9855 This version repaints a region \a rgn inside the widget. -
9856*/ -
9857void QWidget::update(const QRegion &rgn) -
9858{ -
9859 if (!isVisible() || !updatesEnabled() || rgn.isEmpty())
evaluated: !isVisible()
TRUEFALSE
yes
Evaluation Count:517
yes
Evaluation Count:10162
evaluated: !updatesEnabled()
TRUEFALSE
yes
Evaluation Count:181
yes
Evaluation Count:9981
evaluated: rgn.isEmpty()
TRUEFALSE
yes
Evaluation Count:1229
yes
Evaluation Count:8752
181-10162
9860 return;
executed: return;
Execution Count:1927
1927
9861 -
9862 if (testAttribute(Qt::WA_WState_InPaintEvent)) {
partially evaluated: testAttribute(Qt::WA_WState_InPaintEvent)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8752
0-8752
9863 QApplication::postEvent(this, new QUpdateLaterEvent(rgn));
never executed (the execution status of this line is deduced): QApplication::postEvent(this, new QUpdateLaterEvent(rgn));
-
9864 return;
never executed: return;
0
9865 } -
9866 -
9867 if (hasBackingStoreSupport()) {
partially evaluated: hasBackingStoreSupport()
TRUEFALSE
yes
Evaluation Count:8752
no
Evaluation Count:0
0-8752
9868#ifdef Q_WS_MAC -
9869 if (qt_widget_private(this)->isInUnifiedToolbar) { -
9870 qt_widget_private(this)->unifiedSurface->renderToolbar(this, true); -
9871 return; -
9872 } -
9873#endif // Q_WS_MAC -
9874 QTLWExtra *tlwExtra = window()->d_func()->maybeTopData();
executed (the execution status of this line is deduced): QTLWExtra *tlwExtra = window()->d_func()->maybeTopData();
-
9875 if (tlwExtra && !tlwExtra->inTopLevelResize && tlwExtra->backingStore)
partially evaluated: tlwExtra
TRUEFALSE
yes
Evaluation Count:8752
no
Evaluation Count:0
partially evaluated: !tlwExtra->inTopLevelResize
TRUEFALSE
yes
Evaluation Count:8752
no
Evaluation Count:0
partially evaluated: tlwExtra->backingStore
TRUEFALSE
yes
Evaluation Count:8752
no
Evaluation Count:0
0-8752
9876 tlwExtra->backingStoreTracker->markDirty(rgn, this);
executed: tlwExtra->backingStoreTracker->markDirty(rgn, this);
Execution Count:8752
8752
9877 } else {
executed: }
Execution Count:8752
8752
9878 d_func()->repaint_sys(rgn);
never executed (the execution status of this line is deduced): d_func()->repaint_sys(rgn);
-
9879 }
never executed: }
0
9880} -
9881 -
9882 -
9883 /*! -
9884 \internal -
9885 -
9886 This just sets the corresponding attribute bit to 1 or 0 -
9887 */ -
9888static void setAttribute_internal(Qt::WidgetAttribute attribute, bool on, QWidgetData *data, -
9889 QWidgetPrivate *d) -
9890{ -
9891 if (attribute < int(8*sizeof(uint))) {
evaluated: attribute < int(8*sizeof(uint))
TRUEFALSE
yes
Evaluation Count:168894
yes
Evaluation Count:290354
168894-290354
9892 if (on)
evaluated: on
TRUEFALSE
yes
Evaluation Count:106423
yes
Evaluation Count:62471
62471-106423
9893 data->widget_attributes |= (1<<attribute);
executed: data->widget_attributes |= (1<<attribute);
Execution Count:106423
106423
9894 else -
9895 data->widget_attributes &= ~(1<<attribute);
executed: data->widget_attributes &= ~(1<<attribute);
Execution Count:62471
62471
9896 } else { -
9897 const int x = attribute - 8*sizeof(uint);
executed (the execution status of this line is deduced): const int x = attribute - 8*sizeof(uint);
-
9898 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));
-
9899 if (on)
evaluated: on
TRUEFALSE
yes
Evaluation Count:235831
yes
Evaluation Count:54523
54523-235831
9900 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:235831
235831
9901 else -
9902 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:54523
54523
9903 } -
9904} -
9905 -
9906#ifdef Q_OS_MAC -
9907void QWidgetPrivate::macUpdateSizeAttribute() -
9908{ -
9909 Q_Q(QWidget); -
9910 QEvent event(QEvent::MacSizeChange); -
9911 QApplication::sendEvent(q, &event); -
9912 for (int i = 0; i < children.size(); ++i) { -
9913 QWidget *w = qobject_cast<QWidget *>(children.at(i)); -
9914 if (w && (!w->isWindow() || w->testAttribute(Qt::WA_WindowPropagation)) -
9915 && !q->testAttribute(Qt::WA_MacMiniSize) // no attribute set? inherit from parent -
9916 && !w->testAttribute(Qt::WA_MacSmallSize) -
9917 && !w->testAttribute(Qt::WA_MacNormalSize)) -
9918 w->d_func()->macUpdateSizeAttribute(); -
9919 } -
9920 resolveFont(); -
9921} -
9922#endif -
9923 -
9924/*! -
9925 Sets the attribute \a attribute on this widget if \a on is true; -
9926 otherwise clears the attribute. -
9927 -
9928 \sa testAttribute() -
9929*/ -
9930void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on) -
9931{ -
9932 if (testAttribute(attribute) == on)
evaluated: testAttribute(attribute) == on
TRUEFALSE
yes
Evaluation Count:393693
yes
Evaluation Count:459248
393693-459248
9933 return;
executed: return;
Execution Count:393693
393693
9934 -
9935 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
9936 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();
-
9937 "QWidget::setAttribute(WidgetAttribute, bool)", -
9938 "QWidgetPrivate::high_attributes[] too small to contain all attributes in WidgetAttribute"); -
9939#ifdef Q_OS_WIN -
9940 // ### Don't use PaintOnScreen+paintEngine() to do native painting in some future release -
9941 if (attribute == Qt::WA_PaintOnScreen && on && windowType() != Qt::Desktop && !inherits("QGLWidget")) { -
9942 // see qwidget_qpa.cpp, ::paintEngine for details -
9943 paintEngine(); -
9944 if (d->noPaintOnScreen) -
9945 return; -
9946 } -
9947#endif -
9948 -
9949 setAttribute_internal(attribute, on, data, d);
executed (the execution status of this line is deduced): setAttribute_internal(attribute, on, data, d);
-
9950 -
9951 switch (attribute) { -
9952 -
9953#ifndef QT_NO_DRAGANDDROP -
9954 case Qt::WA_AcceptDrops: { -
9955 if (on && !testAttribute(Qt::WA_DropSiteRegistered))
evaluated: on
TRUEFALSE
yes
Evaluation Count:2134
yes
Evaluation Count:362
evaluated: !testAttribute(Qt::WA_DropSiteRegistered)
TRUEFALSE
yes
Evaluation Count:1479
yes
Evaluation Count:655
362-2134
9956 setAttribute(Qt::WA_DropSiteRegistered, true);
executed: setAttribute(Qt::WA_DropSiteRegistered, true);
Execution Count:1479
1479
9957 else if (!on && (isWindow() || !parentWidget() || !parentWidget()->testAttribute(Qt::WA_DropSiteRegistered)))
evaluated: !on
TRUEFALSE
yes
Evaluation Count:362
yes
Evaluation Count:655
evaluated: isWindow()
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:356
partially evaluated: !parentWidget()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:356
evaluated: !parentWidget()->testAttribute(Qt::WA_DropSiteRegistered)
TRUEFALSE
yes
Evaluation Count:355
yes
Evaluation Count:1
0-655
9958 setAttribute(Qt::WA_DropSiteRegistered, false);
executed: setAttribute(Qt::WA_DropSiteRegistered, false);
Execution Count:361
361
9959 QEvent e(QEvent::AcceptDropsChange);
executed (the execution status of this line is deduced): QEvent e(QEvent::AcceptDropsChange);
-
9960 QApplication::sendEvent(this, &e);
executed (the execution status of this line is deduced): QApplication::sendEvent(this, &e);
-
9961 break;
executed: break;
Execution Count:2496
2496
9962 } -
9963 case Qt::WA_DropSiteRegistered: { -
9964 d->registerDropSite(on);
executed (the execution status of this line is deduced): d->registerDropSite(on);
-
9965 for (int i = 0; i < d->children.size(); ++i) {
evaluated: i < d->children.size()
TRUEFALSE
yes
Evaluation Count:7774
yes
Evaluation Count:6025
6025-7774
9966 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));
-
9967 if (w && !w->isWindow() && !w->testAttribute(Qt::WA_AcceptDrops) && w->testAttribute(Qt::WA_DropSiteRegistered) != on)
evaluated: w
TRUEFALSE
yes
Evaluation Count:4188
yes
Evaluation Count:3586
partially evaluated: !w->isWindow()
TRUEFALSE
yes
Evaluation Count:4188
no
Evaluation Count:0
evaluated: !w->testAttribute(Qt::WA_AcceptDrops)
TRUEFALSE
yes
Evaluation Count:4181
yes
Evaluation Count:7
partially evaluated: w->testAttribute(Qt::WA_DropSiteRegistered) != on
TRUEFALSE
yes
Evaluation Count:4181
no
Evaluation Count:0
0-4188
9968 w->setAttribute(Qt::WA_DropSiteRegistered, on);
executed: w->setAttribute(Qt::WA_DropSiteRegistered, on);
Execution Count:4181
4181
9969 }
executed: }
Execution Count:7774
7774
9970 break;
executed: break;
Execution Count:6025
6025
9971 } -
9972#endif -
9973 -
9974 case Qt::WA_NoChildEventsForParent: -
9975 d->sendChildEvents = !on;
executed (the execution status of this line is deduced): d->sendChildEvents = !on;
-
9976 break;
executed: break;
Execution Count:1
1
9977 case Qt::WA_NoChildEventsFromChildren: -
9978 d->receiveChildEvents = !on;
never executed (the execution status of this line is deduced): d->receiveChildEvents = !on;
-
9979 break;
never executed: break;
0
9980 case Qt::WA_MacBrushedMetal: -
9981#ifdef Q_WS_MAC -
9982 d->setStyle_helper(style(), false, true); // Make sure things get unpolished/polished correctly. -
9983 // fall through since changing the metal attribute affects the opaque size grip. -
9984 case Qt::WA_MacOpaqueSizeGrip: -
9985 d->macUpdateOpaqueSizeGrip(); -
9986 break; -
9987 case Qt::WA_MacShowFocusRect: -
9988 if (hasFocus()) { -
9989 clearFocus(); -
9990 setFocus(); -
9991 } -
9992 break; -
9993 case Qt::WA_Hover: -
9994 qt_mac_update_mouseTracking(this); -
9995 break; -
9996#endif -
9997 case Qt::WA_MacAlwaysShowToolWindow: -
9998#ifdef Q_WS_MAC -
9999 d->macUpdateHideOnSuspend(); -
10000#endif -
10001 break;
never executed: break;
0
10002 case Qt::WA_MacNormalSize: -
10003 case Qt::WA_MacSmallSize: -
10004 case Qt::WA_MacMiniSize: -
10005#ifdef Q_OS_MAC -
10006 { -
10007 // We can only have one of these set at a time -
10008 const Qt::WidgetAttribute MacSizes[] = { Qt::WA_MacNormalSize, Qt::WA_MacSmallSize, -
10009 Qt::WA_MacMiniSize }; -
10010 for (int i = 0; i < 3; ++i) { -
10011 if (MacSizes[i] != attribute) -
10012 setAttribute_internal(MacSizes[i], false, data, d); -
10013 } -
10014 d->macUpdateSizeAttribute(); -
10015 } -
10016#endif -
10017 break;
never executed: break;
0
10018 case Qt::WA_ShowModal: -
10019 if (!on) {
evaluated: !on
TRUEFALSE
yes
Evaluation Count:45
yes
Evaluation Count:87
45-87
10020 // reset modality type to NonModal when clearing WA_ShowModal -
10021 data->window_modality = Qt::NonModal;
executed (the execution status of this line is deduced): data->window_modality = Qt::NonModal;
-
10022 } else if (data->window_modality == Qt::NonModal) {
executed: }
Execution Count:45
partially evaluated: data->window_modality == Qt::NonModal
TRUEFALSE
yes
Evaluation Count:87
no
Evaluation Count:0
0-87
10023 // determine the modality type if it hasn't been set prior -
10024 // to setting WA_ShowModal. set the default to WindowModal -
10025 // if we are the child of a group leader; otherwise use -
10026 // ApplicationModal. -
10027 QWidget *w = parentWidget();
executed (the execution status of this line is deduced): QWidget *w = parentWidget();
-
10028 if (w)
evaluated: w
TRUEFALSE
yes
Evaluation Count:35
yes
Evaluation Count:52
35-52
10029 w = w->window();
executed: w = w->window();
Execution Count:35
35
10030 while (w && !w->testAttribute(Qt::WA_GroupLeader)) {
evaluated: w
TRUEFALSE
yes
Evaluation Count:35
yes
Evaluation Count:87
partially evaluated: !w->testAttribute(Qt::WA_GroupLeader)
TRUEFALSE
yes
Evaluation Count:35
no
Evaluation Count:0
0-87
10031 w = w->parentWidget();
executed (the execution status of this line is deduced): w = w->parentWidget();
-
10032 if (w)
partially evaluated: w
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:35
0-35
10033 w = w->window();
never executed: w = w->window();
0
10034 }
executed: }
Execution Count:35
35
10035 data->window_modality = (w && w->testAttribute(Qt::WA_GroupLeader))
partially evaluated: w
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:87
never evaluated: w->testAttribute(Qt::WA_GroupLeader)
0-87
10036 ? Qt::WindowModal
executed (the execution status of this line is deduced): ? Qt::WindowModal
-
10037 : Qt::ApplicationModal;
executed (the execution status of this line is deduced): : Qt::ApplicationModal;
-
10038 // Some window managers do not allow us to enter modality after the -
10039 // window is visible.The window must be hidden before changing the -
10040 // windowModality property and then reshown. -
10041 }
executed: }
Execution Count:87
87
10042 if (testAttribute(Qt::WA_WState_Created)) {
evaluated: testAttribute(Qt::WA_WState_Created)
TRUEFALSE
yes
Evaluation Count:45
yes
Evaluation Count:87
45-87
10043 // don't call setModal_sys() before create_sys() -
10044 d->setModal_sys();
executed (the execution status of this line is deduced): d->setModal_sys();
-
10045 }
executed: }
Execution Count:45
45
10046 break;
executed: break;
Execution Count:132
132
10047 case Qt::WA_MouseTracking: { -
10048 QEvent e(QEvent::MouseTrackingChange);
executed (the execution status of this line is deduced): QEvent e(QEvent::MouseTrackingChange);
-
10049 QApplication::sendEvent(this, &e);
executed (the execution status of this line is deduced): QApplication::sendEvent(this, &e);
-
10050 break; }
executed: break;
Execution Count:3798
3798
10051 case Qt::WA_NativeWindow: { -
10052 d->createTLExtra();
executed (the execution status of this line is deduced): d->createTLExtra();
-
10053#ifndef QT_NO_IM -
10054 QWidget *focusWidget = d->effectiveFocusWidget();
executed (the execution status of this line is deduced): QWidget *focusWidget = d->effectiveFocusWidget();
-
10055 if (on && !internalWinId() && hasFocus()
partially evaluated: on
TRUEFALSE
yes
Evaluation Count:5
no
Evaluation Count:0
partially evaluated: !internalWinId()
TRUEFALSE
yes
Evaluation Count:5
no
Evaluation Count:0
partially evaluated: hasFocus()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-5
10056 && focusWidget->testAttribute(Qt::WA_InputMethodEnabled)) {
never evaluated: focusWidget->testAttribute(Qt::WA_InputMethodEnabled)
0
10057 qApp->inputMethod()->commit();
never executed (the execution status of this line is deduced): (static_cast<QApplication *>(QCoreApplication::instance()))->inputMethod()->commit();
-
10058 qApp->inputMethod()->update(Qt::ImEnabled);
never executed (the execution status of this line is deduced): (static_cast<QApplication *>(QCoreApplication::instance()))->inputMethod()->update(Qt::ImEnabled);
-
10059 }
never executed: }
0
10060 if (!qApp->testAttribute(Qt::AA_DontCreateNativeWidgetSiblings) && parentWidget()
partially evaluated: !(static_cast<QApplication *>(QCoreApplication::instance()))->testAttribute(Qt::AA_DontCreateNativeWidgetSiblings)
TRUEFALSE
yes
Evaluation Count:5
no
Evaluation Count:0
evaluated: parentWidget()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:2
0-5
10061#ifdef Q_WS_MAC -
10062 // On Mac, toolbars inside the unified title bar will never overlap with -
10063 // siblings in the content view. So we skip enforce native siblings in that case -
10064 && !d->isInUnifiedToolbar && parentWidget()->isWindow() -
10065#endif // Q_WS_MAC -
10066 ) -
10067 parentWidget()->d_func()->enforceNativeChildren();
executed: parentWidget()->d_func()->enforceNativeChildren();
Execution Count:3
3
10068 if (on && !internalWinId() && testAttribute(Qt::WA_WState_Created))
partially evaluated: on
TRUEFALSE
yes
Evaluation Count:5
no
Evaluation Count:0
partially evaluated: !internalWinId()
TRUEFALSE
yes
Evaluation Count:5
no
Evaluation Count:0
partially evaluated: testAttribute(Qt::WA_WState_Created)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-5
10069 d->createWinId();
never executed: d->createWinId();
0
10070 if (isEnabled() && focusWidget->isEnabled()
partially evaluated: isEnabled()
TRUEFALSE
yes
Evaluation Count:5
no
Evaluation Count:0
partially evaluated: focusWidget->isEnabled()
TRUEFALSE
yes
Evaluation Count:5
no
Evaluation Count:0
0-5
10071 && focusWidget->testAttribute(Qt::WA_InputMethodEnabled)) {
partially evaluated: focusWidget->testAttribute(Qt::WA_InputMethodEnabled)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-5
10072 qApp->inputMethod()->update(Qt::ImEnabled);
never executed (the execution status of this line is deduced): (static_cast<QApplication *>(QCoreApplication::instance()))->inputMethod()->update(Qt::ImEnabled);
-
10073 }
never executed: }
0
10074#endif //QT_NO_IM -
10075 break;
executed: break;
Execution Count:5
5
10076 } -
10077 case Qt::WA_PaintOnScreen: -
10078 d->updateIsOpaque();
executed (the execution status of this line is deduced): d->updateIsOpaque();
-
10079#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined(Q_WS_MAC) -
10080 // Recreate the widget if it's already created as an alien widget and -
10081 // WA_PaintOnScreen is enabled. Paint on screen widgets must have win id. -
10082 // So must their children. -
10083 if (on) { -
10084 setAttribute(Qt::WA_NativeWindow); -
10085 d->enforceNativeChildren(); -
10086 } -
10087#endif -
10088 // fall through -
10089 case Qt::WA_OpaquePaintEvent:
code before this statement executed: case Qt::WA_OpaquePaintEvent:
Execution Count:107
107
10090 d->updateIsOpaque();
executed (the execution status of this line is deduced): d->updateIsOpaque();
-
10091 break;
executed: break;
Execution Count:7719
7719
10092 case Qt::WA_NoSystemBackground: -
10093 d->updateIsOpaque();
executed (the execution status of this line is deduced): d->updateIsOpaque();
-
10094 // fall through... -
10095 case Qt::WA_UpdatesDisabled:
code before this statement executed: case Qt::WA_UpdatesDisabled:
Execution Count:51
51
10096 d->updateSystemBackground();
executed (the execution status of this line is deduced): d->updateSystemBackground();
-
10097 break;
executed: break;
Execution Count:28322
28322
10098 case Qt::WA_TransparentForMouseEvents: -
10099#ifdef Q_WS_MAC -
10100 d->macUpdateIgnoreMouseEvents(); -
10101#endif -
10102 break;
executed: break;
Execution Count:45
45
10103 case Qt::WA_InputMethodEnabled: { -
10104#ifndef QT_NO_IM -
10105 if (qApp->focusObject() == this) {
evaluated: (static_cast<QApplication *>(QCoreApplication::instance()))->focusObject() == this
TRUEFALSE
yes
Evaluation Count:178
yes
Evaluation Count:5575
178-5575
10106 if (!on)
partially evaluated: !on
TRUEFALSE
yes
Evaluation Count:178
no
Evaluation Count:0
0-178
10107 qApp->inputMethod()->commit();
executed: (static_cast<QApplication *>(QCoreApplication::instance()))->inputMethod()->commit();
Execution Count:178
178
10108 qApp->inputMethod()->update(Qt::ImEnabled);
executed (the execution status of this line is deduced): (static_cast<QApplication *>(QCoreApplication::instance()))->inputMethod()->update(Qt::ImEnabled);
-
10109 }
executed: }
Execution Count:178
178
10110#endif //QT_NO_IM -
10111 break;
executed: break;
Execution Count:5753
5753
10112 } -
10113 case Qt::WA_WindowPropagation: -
10114 d->resolvePalette();
executed (the execution status of this line is deduced): d->resolvePalette();
-
10115 d->resolveFont();
executed (the execution status of this line is deduced): d->resolveFont();
-
10116 d->resolveLocale();
executed (the execution status of this line is deduced): d->resolveLocale();
-
10117 break;
executed: break;
Execution Count:270
270
10118#ifdef Q_WS_X11 -
10119 case Qt::WA_NoX11EventCompression: -
10120 if (!d->extra) -
10121 d->createExtra(); -
10122 d->extra->compress_events = on; -
10123 break; -
10124 case Qt::WA_X11OpenGLOverlay: -
10125 d->updateIsOpaque(); -
10126 break; -
10127 case Qt::WA_X11DoNotAcceptFocus: -
10128 if (testAttribute(Qt::WA_WState_Created)) -
10129 d->updateX11AcceptFocus(); -
10130 break; -
10131#endif -
10132 case Qt::WA_DontShowOnScreen: { -
10133 if (on && isVisible()) {
partially evaluated: on
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
partially evaluated: isVisible()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
10134 // Make sure we keep the current state and only hide the widget -
10135 // from the desktop. show_sys will only update platform specific -
10136 // attributes at this point. -
10137 d->hide_sys();
never executed (the execution status of this line is deduced): d->hide_sys();
-
10138 d->show_sys();
never executed (the execution status of this line is deduced): d->show_sys();
-
10139 }
never executed: }
0
10140 break;
executed: break;
Execution Count:3
3
10141 } -
10142 -
10143#ifdef Q_WS_X11 -
10144 case Qt::WA_X11NetWmWindowTypeDesktop: -
10145 case Qt::WA_X11NetWmWindowTypeDock: -
10146 case Qt::WA_X11NetWmWindowTypeToolBar: -
10147 case Qt::WA_X11NetWmWindowTypeMenu: -
10148 case Qt::WA_X11NetWmWindowTypeUtility: -
10149 case Qt::WA_X11NetWmWindowTypeSplash: -
10150 case Qt::WA_X11NetWmWindowTypeDialog: -
10151 case Qt::WA_X11NetWmWindowTypeDropDownMenu: -
10152 case Qt::WA_X11NetWmWindowTypePopupMenu: -
10153 case Qt::WA_X11NetWmWindowTypeToolTip: -
10154 case Qt::WA_X11NetWmWindowTypeNotification: -
10155 case Qt::WA_X11NetWmWindowTypeCombo: -
10156 case Qt::WA_X11NetWmWindowTypeDND: -
10157 if (testAttribute(Qt::WA_WState_Created)) -
10158 d->setNetWmWindowTypes(); -
10159 break; -
10160#endif -
10161 -
10162 case Qt::WA_StaticContents: -
10163 if (QWidgetBackingStore *bs = d->maybeBackingStore()) {
never evaluated: QWidgetBackingStore *bs = d->maybeBackingStore()
0
10164 if (on)
never evaluated: on
0
10165 bs->addStaticWidget(this);
never executed: bs->addStaticWidget(this);
0
10166 else -
10167 bs->removeStaticWidget(this);
never executed: bs->removeStaticWidget(this);
0
10168 } -
10169 break;
never executed: break;
0
10170 case Qt::WA_TranslucentBackground: -
10171 if (on) {
partially evaluated: on
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
10172 setAttribute(Qt::WA_NoSystemBackground);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_NoSystemBackground);
-
10173 d->updateIsTranslucent();
executed (the execution status of this line is deduced): d->updateIsTranslucent();
-
10174 }
executed: }
Execution Count:3
3
10175 -
10176 break;
executed: break;
Execution Count:3
3
10177 case Qt::WA_AcceptTouchEvents: -
10178#if defined(Q_WS_WIN) || defined(Q_WS_MAC) -
10179 if (on) -
10180 d->registerTouchWindow(); -
10181#endif -
10182 break;
executed: break;
Execution Count:3713
3713
10183 default: -
10184 break;
executed: break;
Execution Count:400963
400963
10185 } -
10186}
executed: }
Execution Count:459248
459248
10187 -
10188/*! \fn bool QWidget::testAttribute(Qt::WidgetAttribute attribute) const -
10189 -
10190 Returns true if attribute \a attribute is set on this widget; -
10191 otherwise returns false. -
10192 -
10193 \sa setAttribute() -
10194 */ -
10195bool QWidget::testAttribute_helper(Qt::WidgetAttribute attribute) const -
10196{ -
10197 Q_D(const QWidget);
executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
10198 const int x = attribute - 8*sizeof(uint);
executed (the execution status of this line is deduced): const int x = attribute - 8*sizeof(uint);
-
10199 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));
-
10200 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:2415052
2415052
10201} -
10202 -
10203/*! -
10204 \property QWidget::windowOpacity -
10205 -
10206 \brief The level of opacity for the window. -
10207 -
10208 The valid range of opacity is from 1.0 (completely opaque) to -
10209 0.0 (completely transparent). -
10210 -
10211 By default the value of this property is 1.0. -
10212 -
10213 This feature is available on Embedded Linux, Mac OS X, Windows, -
10214 and X11 platforms that support the Composite extension. -
10215 -
10216 This feature is not available on Windows CE. -
10217 -
10218 Note that under X11 you need to have a composite manager running, -
10219 and the X11 specific _NET_WM_WINDOW_OPACITY atom needs to be -
10220 supported by the window manager you are using. -
10221 -
10222 \warning Changing this property from opaque to transparent might issue a -
10223 paint event that needs to be processed before the window is displayed -
10224 correctly. This affects mainly the use of QPixmap::grabWindow(). Also note -
10225 that semi-transparent windows update and resize significantly slower than -
10226 opaque windows. -
10227 -
10228 \sa setMask() -
10229*/ -
10230qreal QWidget::windowOpacity() const -
10231{ -
10232 Q_D(const QWidget);
executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
10233 return (isWindow() && d->maybeTopData()) ? d->maybeTopData()->opacity / 255. : 1.0;
executed: return (isWindow() && d->maybeTopData()) ? d->maybeTopData()->opacity / 255. : 1.0;
Execution Count:3
3
10234} -
10235 -
10236void QWidget::setWindowOpacity(qreal opacity) -
10237{ -
10238 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
10239 if (!isWindow())
partially evaluated: !isWindow()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:274
0-274
10240 return;
never executed: return;
0
10241 -
10242 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));
-
10243 QTLWExtra *extra = d->topData();
executed (the execution status of this line is deduced): QTLWExtra *extra = d->topData();
-
10244 extra->opacity = uint(opacity * 255);
executed (the execution status of this line is deduced): extra->opacity = uint(opacity * 255);
-
10245 setAttribute(Qt::WA_WState_WindowOpacitySet);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_WState_WindowOpacitySet);
-
10246 d->setWindowOpacity_sys(opacity);
executed (the execution status of this line is deduced): d->setWindowOpacity_sys(opacity);
-
10247 -
10248 if (!testAttribute(Qt::WA_WState_Created))
partially evaluated: !testAttribute(Qt::WA_WState_Created)
TRUEFALSE
yes
Evaluation Count:274
no
Evaluation Count:0
0-274
10249 return;
executed: return;
Execution Count:274
274
10250 -
10251#ifndef QT_NO_GRAPHICSVIEW -
10252 if (QGraphicsProxyWidget *proxy = graphicsProxyWidget()) {
never evaluated: QGraphicsProxyWidget *proxy = graphicsProxyWidget()
0
10253 // Avoid invalidating the cache if set. -
10254 if (proxy->cacheMode() == QGraphicsItem::NoCache)
never evaluated: proxy->cacheMode() == QGraphicsItem::NoCache
0
10255 proxy->update();
never executed: proxy->update();
0
10256 else if (QGraphicsScene *scene = proxy->scene())
never evaluated: QGraphicsScene *scene = proxy->scene()
0
10257 scene->update(proxy->sceneBoundingRect());
never executed: scene->update(proxy->sceneBoundingRect());
0
10258 return;
never executed: return;
0
10259 } -
10260#endif -
10261}
never executed: }
0
10262 -
10263/*! -
10264 \property QWidget::windowModified -
10265 \brief whether the document shown in the window has unsaved changes -
10266 -
10267 A modified window is a window whose content has changed but has -
10268 not been saved to disk. This flag will have different effects -
10269 varied by the platform. On Mac OS X the close button will have a -
10270 modified look; on other platforms, the window title will have an -
10271 '*' (asterisk). -
10272 -
10273 The window title must contain a "[*]" placeholder, which -
10274 indicates where the '*' should appear. Normally, it should appear -
10275 right after the file name (e.g., "document1.txt[*] - Text -
10276 Editor"). If the window isn't modified, the placeholder is simply -
10277 removed. -
10278 -
10279 Note that if a widget is set as modified, all its ancestors will -
10280 also be set as modified. However, if you call \c -
10281 {setWindowModified(false)} on a widget, this will not propagate to -
10282 its parent because other children of the parent might have been -
10283 modified. -
10284 -
10285 \sa windowTitle, {Application Example}, {SDI Example}, {MDI Example} -
10286*/ -
10287bool QWidget::isWindowModified() const -
10288{ -
10289 return testAttribute(Qt::WA_WindowModified);
executed: return testAttribute(Qt::WA_WindowModified);
Execution Count:485
485
10290} -
10291 -
10292void QWidget::setWindowModified(bool mod) -
10293{ -
10294 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
10295 setAttribute(Qt::WA_WindowModified, mod);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_WindowModified, mod);
-
10296 -
10297 d->setWindowModified_helper();
executed (the execution status of this line is deduced): d->setWindowModified_helper();
-
10298 -
10299 QEvent e(QEvent::ModifiedChange);
executed (the execution status of this line is deduced): QEvent e(QEvent::ModifiedChange);
-
10300 QApplication::sendEvent(this, &e);
executed (the execution status of this line is deduced): QApplication::sendEvent(this, &e);
-
10301}
executed: }
Execution Count:199
199
10302 -
10303void QWidgetPrivate::setWindowModified_helper() -
10304{ -
10305 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
10306 QWindow *window = q->windowHandle();
executed (the execution status of this line is deduced): QWindow *window = q->windowHandle();
-
10307 if (!window)
evaluated: !window
TRUEFALSE
yes
Evaluation Count:16
yes
Evaluation Count:1777
16-1777
10308 return;
executed: return;
Execution Count:16
16
10309 QPlatformWindow *platformWindow = window->handle();
executed (the execution status of this line is deduced): QPlatformWindow *platformWindow = window->handle();
-
10310 if (!platformWindow)
evaluated: !platformWindow
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1776
1-1776
10311 return;
executed: return;
Execution Count:1
1
10312 bool on = q->testAttribute(Qt::WA_WindowModified);
executed (the execution status of this line is deduced): bool on = q->testAttribute(Qt::WA_WindowModified);
-
10313 if (!platformWindow->setWindowModified(on)) {
partially evaluated: !platformWindow->setWindowModified(on)
TRUEFALSE
yes
Evaluation Count:1776
no
Evaluation Count:0
0-1776
10314 if (!q->windowTitle().contains(QLatin1String("[*]")) && on)
evaluated: !q->windowTitle().contains(QLatin1String("[*]"))
TRUEFALSE
yes
Evaluation Count:1771
yes
Evaluation Count:5
partially evaluated: on
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1771
0-1771
10315 qWarning("QWidget::setWindowModified: The window title does not contain a '[*]' placeholder");
never executed: QMessageLogger("kernel/qwidget.cpp", 10315, __PRETTY_FUNCTION__).warning("QWidget::setWindowModified: The window title does not contain a '[*]' placeholder");
0
10316 setWindowTitle_helper(q->windowTitle());
executed (the execution status of this line is deduced): setWindowTitle_helper(q->windowTitle());
-
10317 setWindowIconText_helper(q->windowIconText());
executed (the execution status of this line is deduced): setWindowIconText_helper(q->windowIconText());
-
10318 }
executed: }
Execution Count:1776
1776
10319}
executed: }
Execution Count:1776
1776
10320 -
10321#ifndef QT_NO_TOOLTIP -
10322/*! -
10323 \property QWidget::toolTip -
10324 -
10325 \brief the widget's tooltip -
10326 -
10327 Note that by default tooltips are only shown for widgets that are -
10328 children of the active window. You can change this behavior by -
10329 setting the attribute Qt::WA_AlwaysShowToolTips on the \e window, -
10330 not on the widget with the tooltip. -
10331 -
10332 If you want to control a tooltip's behavior, you can intercept the -
10333 event() function and catch the QEvent::ToolTip event (e.g., if you -
10334 want to customize the area for which the tooltip should be shown). -
10335 -
10336 By default, this property contains an empty string. -
10337 -
10338 \sa QToolTip, statusTip, whatsThis -
10339*/ -
10340void QWidget::setToolTip(const QString &s) -
10341{ -
10342 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
10343 d->toolTip = s;
executed (the execution status of this line is deduced): d->toolTip = s;
-
10344 -
10345 QEvent event(QEvent::ToolTipChange);
executed (the execution status of this line is deduced): QEvent event(QEvent::ToolTipChange);
-
10346 QApplication::sendEvent(this, &event);
executed (the execution status of this line is deduced): QApplication::sendEvent(this, &event);
-
10347}
executed: }
Execution Count:1450
1450
10348 -
10349QString QWidget::toolTip() const -
10350{ -
10351 Q_D(const QWidget);
never executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
10352 return d->toolTip;
never executed: return d->toolTip;
0
10353} -
10354#endif // QT_NO_TOOLTIP -
10355 -
10356 -
10357#ifndef QT_NO_STATUSTIP -
10358/*! -
10359 \property QWidget::statusTip -
10360 \brief the widget's status tip -
10361 -
10362 By default, this property contains an empty string. -
10363 -
10364 \sa toolTip, whatsThis -
10365*/ -
10366void QWidget::setStatusTip(const QString &s) -
10367{ -
10368 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
10369 d->statusTip = s;
executed (the execution status of this line is deduced): d->statusTip = s;
-
10370}
executed: }
Execution Count:18
18
10371 -
10372QString QWidget::statusTip() const -
10373{ -
10374 Q_D(const QWidget);
never executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
10375 return d->statusTip;
never executed: return d->statusTip;
0
10376} -
10377#endif // QT_NO_STATUSTIP -
10378 -
10379#ifndef QT_NO_WHATSTHIS -
10380/*! -
10381 \property QWidget::whatsThis -
10382 -
10383 \brief the widget's What's This help text. -
10384 -
10385 By default, this property contains an empty string. -
10386 -
10387 \sa QWhatsThis, QWidget::toolTip, QWidget::statusTip -
10388*/ -
10389void QWidget::setWhatsThis(const QString &s) -
10390{ -
10391 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
10392 d->whatsThis = s;
executed (the execution status of this line is deduced): d->whatsThis = s;
-
10393}
executed: }
Execution Count:18
18
10394 -
10395QString QWidget::whatsThis() const -
10396{ -
10397 Q_D(const QWidget);
never executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
10398 return d->whatsThis;
never executed: return d->whatsThis;
0
10399} -
10400#endif // QT_NO_WHATSTHIS -
10401 -
10402#ifndef QT_NO_ACCESSIBILITY -
10403/*! -
10404 \property QWidget::accessibleName -
10405 -
10406 \brief the widget's name as seen by assistive technologies -
10407 -
10408 This property is used by accessible clients to identify, find, or announce -
10409 the widget for accessible clients. -
10410 -
10411 By default, this property contains an empty string. -
10412 -
10413 \sa QAccessibleInterface::text() -
10414*/ -
10415void QWidget::setAccessibleName(const QString &name) -
10416{ -
10417 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
10418 d->accessibleName = name;
executed (the execution status of this line is deduced): d->accessibleName = name;
-
10419 QAccessibleEvent event(this, QAccessible::NameChanged);
executed (the execution status of this line is deduced): QAccessibleEvent event(this, QAccessible::NameChanged);
-
10420 QAccessible::updateAccessibility(&event);
executed (the execution status of this line is deduced): QAccessible::updateAccessibility(&event);
-
10421}
executed: }
Execution Count:2369
2369
10422 -
10423QString QWidget::accessibleName() const -
10424{ -
10425 Q_D(const QWidget);
executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
10426 return d->accessibleName;
executed: return d->accessibleName;
Execution Count:772
772
10427} -
10428 -
10429/*! -
10430 \property QWidget::accessibleDescription -
10431 -
10432 \brief the widget's description as seen by assistive technologies -
10433 -
10434 By default, this property contains an empty string. -
10435 -
10436 \sa QAccessibleInterface::text() -
10437*/ -
10438void QWidget::setAccessibleDescription(const QString &description) -
10439{ -
10440 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
10441 d->accessibleDescription = description;
executed (the execution status of this line is deduced): d->accessibleDescription = description;
-
10442 QAccessibleEvent event(this, QAccessible::DescriptionChanged);
executed (the execution status of this line is deduced): QAccessibleEvent event(this, QAccessible::DescriptionChanged);
-
10443 QAccessible::updateAccessibility(&event);
executed (the execution status of this line is deduced): QAccessible::updateAccessibility(&event);
-
10444}
executed: }
Execution Count:1667
1667
10445 -
10446QString QWidget::accessibleDescription() const -
10447{ -
10448 Q_D(const QWidget);
never executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
10449 return d->accessibleDescription;
never executed: return d->accessibleDescription;
0
10450} -
10451#endif // QT_NO_ACCESSIBILITY -
10452 -
10453#ifndef QT_NO_SHORTCUT -
10454/*! -
10455 Adds a shortcut to Qt's shortcut system that watches for the given -
10456 \a key sequence in the given \a context. If the \a context is -
10457 Qt::ApplicationShortcut, the shortcut applies to the application as a -
10458 whole. Otherwise, it is either local to this widget, Qt::WidgetShortcut, -
10459 or to the window itself, Qt::WindowShortcut. -
10460 -
10461 If the same \a key sequence has been grabbed by several widgets, -
10462 when the \a key sequence occurs a QEvent::Shortcut event is sent -
10463 to all the widgets to which it applies in a non-deterministic -
10464 order, but with the ``ambiguous'' flag set to true. -
10465 -
10466 \warning You should not normally need to use this function; -
10467 instead create \l{QAction}s with the shortcut key sequences you -
10468 require (if you also want equivalent menu options and toolbar -
10469 buttons), or create \l{QShortcut}s if you just need key sequences. -
10470 Both QAction and QShortcut handle all the event filtering for you, -
10471 and provide signals which are triggered when the user triggers the -
10472 key sequence, so are much easier to use than this low-level -
10473 function. -
10474 -
10475 \sa releaseShortcut(), setShortcutEnabled() -
10476*/ -
10477int QWidget::grabShortcut(const QKeySequence &key, Qt::ShortcutContext context) -
10478{ -
10479 Q_ASSERT(qApp);
executed (the execution status of this line is deduced): qt_noop();
-
10480 if (key.isEmpty())
evaluated: key.isEmpty()
TRUEFALSE
yes
Evaluation Count:1912
yes
Evaluation Count:1192
1192-1912
10481 return 0;
executed: return 0;
Execution Count:1912
1912
10482 setAttribute(Qt::WA_GrabbedShortcut);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_GrabbedShortcut);
-
10483 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:1192
1192
10484} -
10485 -
10486/*! -
10487 Removes the shortcut with the given \a id from Qt's shortcut -
10488 system. The widget will no longer receive QEvent::Shortcut events -
10489 for the shortcut's key sequence (unless it has other shortcuts -
10490 with the same key sequence). -
10491 -
10492 \warning You should not normally need to use this function since -
10493 Qt's shortcut system removes shortcuts automatically when their -
10494 parent widget is destroyed. It is best to use QAction or -
10495 QShortcut to handle shortcuts, since they are easier to use than -
10496 this low-level function. Note also that this is an expensive -
10497 operation. -
10498 -
10499 \sa grabShortcut(), setShortcutEnabled() -
10500*/ -
10501void QWidget::releaseShortcut(int id) -
10502{ -
10503 Q_ASSERT(qApp);
executed (the execution status of this line is deduced): qt_noop();
-
10504 if (id)
evaluated: id
TRUEFALSE
yes
Evaluation Count:279
yes
Evaluation Count:372
279-372
10505 qApp->d_func()->shortcutMap.removeShortcut(id, this, 0);
executed: (static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->shortcutMap.removeShortcut(id, this, 0);
Execution Count:279
279
10506}
executed: }
Execution Count:651
651
10507 -
10508/*! -
10509 If \a enable is true, the shortcut with the given \a id is -
10510 enabled; otherwise the shortcut is disabled. -
10511 -
10512 \warning You should not normally need to use this function since -
10513 Qt's shortcut system enables/disables shortcuts automatically as -
10514 widgets become hidden/visible and gain or lose focus. It is best -
10515 to use QAction or QShortcut to handle shortcuts, since they are -
10516 easier to use than this low-level function. -
10517 -
10518 \sa grabShortcut(), releaseShortcut() -
10519*/ -
10520void QWidget::setShortcutEnabled(int id, bool enable) -
10521{ -
10522 Q_ASSERT(qApp);
executed (the execution status of this line is deduced): qt_noop();
-
10523 if (id)
partially evaluated: id
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:16
0-16
10524 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
10525}
executed: }
Execution Count:16
16
10526 -
10527/*! -
10528 \since 4.2 -
10529 -
10530 If \a enable is true, auto repeat of the shortcut with the -
10531 given \a id is enabled; otherwise it is disabled. -
10532 -
10533 \sa grabShortcut(), releaseShortcut() -
10534*/ -
10535void QWidget::setShortcutAutoRepeat(int id, bool enable) -
10536{ -
10537 Q_ASSERT(qApp);
never executed (the execution status of this line is deduced): qt_noop();
-
10538 if (id)
never evaluated: id
0
10539 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
10540}
never executed: }
0
10541#endif // QT_NO_SHORTCUT -
10542 -
10543/*! -
10544 Updates the widget's micro focus. -
10545*/ -
10546void QWidget::updateMicroFocus() -
10547{ -
10548 // updating everything since this is currently called for any kind of state change -
10549 qApp->inputMethod()->update(Qt::ImQueryAll);
executed (the execution status of this line is deduced): (static_cast<QApplication *>(QCoreApplication::instance()))->inputMethod()->update(Qt::ImQueryAll);
-
10550}
executed: }
Execution Count:14021
14021
10551 -
10552/*! -
10553 Raises this widget to the top of the parent widget's stack. -
10554 -
10555 After this call the widget will be visually in front of any -
10556 overlapping sibling widgets. -
10557 -
10558 \note When using activateWindow(), you can call this function to -
10559 ensure that the window is stacked on top. -
10560 -
10561 \sa lower(), stackUnder() -
10562*/ -
10563 -
10564void QWidget::raise() -
10565{ -
10566 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
10567 if (!isWindow()) {
evaluated: !isWindow()
TRUEFALSE
yes
Evaluation Count:4364
yes
Evaluation Count:93
93-4364
10568 QWidget *p = parentWidget();
executed (the execution status of this line is deduced): QWidget *p = parentWidget();
-
10569 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();
-
10570 if (parentChildCount < 2)
evaluated: parentChildCount < 2
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:4357
7-4357
10571 return;
executed: return;
Execution Count:7
7
10572 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);
-
10573 Q_ASSERT(from >= 0);
executed (the execution status of this line is deduced): qt_noop();
-
10574 // Do nothing if the widget is already in correct stacking order _and_ created. -
10575 if (from != parentChildCount -1)
evaluated: from != parentChildCount -1
TRUEFALSE
yes
Evaluation Count:2250
yes
Evaluation Count:2107
2107-2250
10576 p->d_func()->children.move(from, parentChildCount - 1);
executed: p->d_func()->children.move(from, parentChildCount - 1);
Execution Count:2250
2250
10577 if (!testAttribute(Qt::WA_WState_Created) && p->testAttribute(Qt::WA_WState_Created))
evaluated: !testAttribute(Qt::WA_WState_Created)
TRUEFALSE
yes
Evaluation Count:1746
yes
Evaluation Count:2611
evaluated: p->testAttribute(Qt::WA_WState_Created)
TRUEFALSE
yes
Evaluation Count:549
yes
Evaluation Count:1197
549-2611
10578 create();
executed: create();
Execution Count:549
549
10579 else if (from == parentChildCount - 1)
evaluated: from == parentChildCount - 1
TRUEFALSE
yes
Evaluation Count:2056
yes
Evaluation Count:1752
1752-2056
10580 return;
executed: return;
Execution Count:2056
2056
10581 -
10582 QRegion region(rect());
executed (the execution status of this line is deduced): QRegion region(rect());
-
10583 d->subtractOpaqueSiblings(region);
executed (the execution status of this line is deduced): d->subtractOpaqueSiblings(region);
-
10584 d->invalidateBuffer(region);
executed (the execution status of this line is deduced): d->invalidateBuffer(region);
-
10585 }
executed: }
Execution Count:2301
2301
10586 if (testAttribute(Qt::WA_WState_Created))
evaluated: testAttribute(Qt::WA_WState_Created)
TRUEFALSE
yes
Evaluation Count:1956
yes
Evaluation Count:438
438-1956
10587 d->raise_sys();
executed: d->raise_sys();
Execution Count:1956
1956
10588 -
10589 QEvent e(QEvent::ZOrderChange);
executed (the execution status of this line is deduced): QEvent e(QEvent::ZOrderChange);
-
10590 QApplication::sendEvent(this, &e);
executed (the execution status of this line is deduced): QApplication::sendEvent(this, &e);
-
10591}
executed: }
Execution Count:2394
2394
10592 -
10593/*! -
10594 Lowers the widget to the bottom of the parent widget's stack. -
10595 -
10596 After this call the widget will be visually behind (and therefore -
10597 obscured by) any overlapping sibling widgets. -
10598 -
10599 \sa raise(), stackUnder() -
10600*/ -
10601 -
10602void QWidget::lower() -
10603{ -
10604 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
10605 if (!isWindow()) {
partially evaluated: !isWindow()
TRUEFALSE
yes
Evaluation Count:883
no
Evaluation Count:0
0-883
10606 QWidget *p = parentWidget();
executed (the execution status of this line is deduced): QWidget *p = parentWidget();
-
10607 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();
-
10608 if (parentChildCount < 2)
partially evaluated: parentChildCount < 2
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:883
0-883
10609 return;
never executed: return;
0
10610 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);
-
10611 Q_ASSERT(from >= 0);
executed (the execution status of this line is deduced): qt_noop();
-
10612 // Do nothing if the widget is already in correct stacking order _and_ created. -
10613 if (from != 0)
evaluated: from != 0
TRUEFALSE
yes
Evaluation Count:716
yes
Evaluation Count:167
167-716
10614 p->d_func()->children.move(from, 0);
executed: p->d_func()->children.move(from, 0);
Execution Count:716
716
10615 if (!testAttribute(Qt::WA_WState_Created) && p->testAttribute(Qt::WA_WState_Created))
evaluated: !testAttribute(Qt::WA_WState_Created)
TRUEFALSE
yes
Evaluation Count:863
yes
Evaluation Count:20
evaluated: p->testAttribute(Qt::WA_WState_Created)
TRUEFALSE
yes
Evaluation Count:25
yes
Evaluation Count:838
20-863
10616 create();
executed: create();
Execution Count:25
25
10617 else if (from == 0)
evaluated: from == 0
TRUEFALSE
yes
Evaluation Count:157
yes
Evaluation Count:701
157-701
10618 return;
executed: return;
Execution Count:157
157
10619 } -
10620 if (testAttribute(Qt::WA_WState_Created))
evaluated: testAttribute(Qt::WA_WState_Created)
TRUEFALSE
yes
Evaluation Count:37
yes
Evaluation Count:689
37-689
10621 d->lower_sys();
executed: d->lower_sys();
Execution Count:37
37
10622 -
10623 QEvent e(QEvent::ZOrderChange);
executed (the execution status of this line is deduced): QEvent e(QEvent::ZOrderChange);
-
10624 QApplication::sendEvent(this, &e);
executed (the execution status of this line is deduced): QApplication::sendEvent(this, &e);
-
10625}
executed: }
Execution Count:726
726
10626 -
10627 -
10628/*! -
10629 Places the widget under \a w in the parent widget's stack. -
10630 -
10631 To make this work, the widget itself and \a w must be siblings. -
10632 -
10633 \sa raise(), lower() -
10634*/ -
10635void QWidget::stackUnder(QWidget* w) -
10636{ -
10637 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
10638 QWidget *p = parentWidget();
executed (the execution status of this line is deduced): QWidget *p = parentWidget();
-
10639 if (!w || isWindow() || p != w->parentWidget() || this == w)
partially evaluated: !w
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:10
partially evaluated: isWindow()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:10
partially evaluated: p != w->parentWidget()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:10
partially evaluated: this == w
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:10
0-10
10640 return;
never executed: return;
0
10641 if (p) {
partially evaluated: p
TRUEFALSE
yes
Evaluation Count:10
no
Evaluation Count:0
0-10
10642 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);
-
10643 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);
-
10644 Q_ASSERT(from >= 0);
executed (the execution status of this line is deduced): qt_noop();
-
10645 Q_ASSERT(to >= 0);
executed (the execution status of this line is deduced): qt_noop();
-
10646 if (from < to)
evaluated: from < to
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:1
1-9
10647 --to;
executed: --to;
Execution Count:9
9
10648 // Do nothing if the widget is already in correct stacking order _and_ created. -
10649 if (from != to)
evaluated: from != to
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:8
2-8
10650 p->d_func()->children.move(from, to);
executed: p->d_func()->children.move(from, to);
Execution Count:2
2
10651 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:9
partially evaluated: p->testAttribute(Qt::WA_WState_Created)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-9
10652 create();
never executed: create();
0
10653 else if (from == to)
evaluated: from == to
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:2
2-8
10654 return;
executed: return;
Execution Count:8
8
10655 } -
10656 if (testAttribute(Qt::WA_WState_Created))
evaluated: testAttribute(Qt::WA_WState_Created)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
1
10657 d->stackUnder_sys(w);
executed: d->stackUnder_sys(w);
Execution Count:1
1
10658 -
10659 QEvent e(QEvent::ZOrderChange);
executed (the execution status of this line is deduced): QEvent e(QEvent::ZOrderChange);
-
10660 QApplication::sendEvent(this, &e);
executed (the execution status of this line is deduced): QApplication::sendEvent(this, &e);
-
10661}
executed: }
Execution Count:2
2
10662 -
10663 -
10664/*! -
10665 \fn bool QWidget::isTopLevel() const -
10666 \obsolete -
10667 -
10668 Use isWindow() instead. -
10669*/ -
10670 -
10671/*! -
10672 \fn bool QWidget::isRightToLeft() const -
10673 \internal -
10674*/ -
10675 -
10676/*! -
10677 \fn bool QWidget::isLeftToRight() const -
10678 \internal -
10679*/ -
10680 -
10681/*! -
10682 \macro QWIDGETSIZE_MAX -
10683 \relates QWidget -
10684 -
10685 Defines the maximum size for a QWidget object. -
10686 -
10687 The largest allowed size for a widget is QSize(QWIDGETSIZE_MAX, -
10688 QWIDGETSIZE_MAX), i.e. QSize (16777215,16777215). -
10689 -
10690 \sa QWidget::setMaximumSize() -
10691*/ -
10692 -
10693/*! -
10694 \fn QWidget::setupUi(QWidget *widget) -
10695 -
10696 Sets up the user interface for the specified \a widget. -
10697 -
10698 \note This function is available with widgets that derive from user -
10699 interface descriptions created using \l{uic}. -
10700 -
10701 \sa {Using a Designer UI File in Your Application} -
10702*/ -
10703 -
10704QRect QWidgetPrivate::frameStrut() const -
10705{ -
10706 Q_Q(const QWidget);
executed (the execution status of this line is deduced): const QWidget * const q = q_func();
-
10707 if (!q->isWindow() || (q->windowType() == Qt::Desktop) || q->testAttribute(Qt::WA_DontShowOnScreen)) {
partially evaluated: !q->isWindow()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5173
evaluated: (q->windowType() == Qt::Desktop)
TRUEFALSE
yes
Evaluation Count:106
yes
Evaluation Count:5067
evaluated: q->testAttribute(Qt::WA_DontShowOnScreen)
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:5061
0-5173
10708 // x2 = x1 + w - 1, so w/h = 1 -
10709 return QRect(0, 0, 1, 1);
executed: return QRect(0, 0, 1, 1);
Execution Count:112
112
10710 } -
10711 -
10712 if (data.fstrut_dirty
evaluated: data.fstrut_dirty
TRUEFALSE
yes
Evaluation Count:4725
yes
Evaluation Count:336
336-4725
10713#ifndef Q_WS_WIN
executed (the execution status of this line is deduced):
-
10714 // ### Fix properly for 4.3
executed (the execution status of this line is deduced):
-
10715 && q->isVisible()
evaluated: q->isVisible()
TRUEFALSE
yes
Evaluation Count:1907
yes
Evaluation Count:2818
1907-2818
10716#endif
executed (the execution status of this line is deduced):
-
10717 && q->testAttribute(Qt::WA_WState_Created))
partially evaluated: q->testAttribute(Qt::WA_WState_Created)
TRUEFALSE
yes
Evaluation Count:1907
no
Evaluation Count:0
0-1907
10718 const_cast<QWidgetPrivate *>(this)->updateFrameStrut();
executed: const_cast<QWidgetPrivate *>(this)->updateFrameStrut();
Execution Count:1907
1907
10719 -
10720 return maybeTopData() ? maybeTopData()->frameStrut : QRect();
executed: return maybeTopData() ? maybeTopData()->frameStrut : QRect();
Execution Count:5061
5061
10721} -
10722 -
10723#ifdef QT_KEYPAD_NAVIGATION -
10724/*! -
10725 \internal -
10726 -
10727 Changes the focus from the current focusWidget to a widget in -
10728 the \a direction. -
10729 -
10730 Returns true, if there was a widget in that direction -
10731*/ -
10732bool QWidgetPrivate::navigateToDirection(Direction direction) -
10733{ -
10734 QWidget *targetWidget = widgetInNavigationDirection(direction); -
10735 if (targetWidget) -
10736 targetWidget->setFocus(); -
10737 return (targetWidget != 0); -
10738} -
10739 -
10740/*! -
10741 \internal -
10742 -
10743 Searches for a widget that is positioned in the \a direction, starting -
10744 from the current focusWidget. -
10745 -
10746 Returns the pointer to a found widget or 0, if there was no widget in -
10747 that direction. -
10748*/ -
10749QWidget *QWidgetPrivate::widgetInNavigationDirection(Direction direction) -
10750{ -
10751 const QWidget *sourceWidget = QApplication::focusWidget(); -
10752 if (!sourceWidget) -
10753 return 0; -
10754 const QRect sourceRect = sourceWidget->rect().translated(sourceWidget->mapToGlobal(QPoint())); -
10755 const int sourceX = -
10756 (direction == DirectionNorth || direction == DirectionSouth) ? -
10757 (sourceRect.left() + (sourceRect.right() - sourceRect.left()) / 2) -
10758 :(direction == DirectionEast ? sourceRect.right() : sourceRect.left()); -
10759 const int sourceY = -
10760 (direction == DirectionEast || direction == DirectionWest) ? -
10761 (sourceRect.top() + (sourceRect.bottom() - sourceRect.top()) / 2) -
10762 :(direction == DirectionSouth ? sourceRect.bottom() : sourceRect.top()); -
10763 const QPoint sourcePoint(sourceX, sourceY); -
10764 const QPoint sourceCenter = sourceRect.center(); -
10765 const QWidget *sourceWindow = sourceWidget->window(); -
10766 -
10767 QWidget *targetWidget = 0; -
10768 int shortestDistance = INT_MAX; -
10769 foreach(QWidget *targetCandidate, QApplication::allWidgets()) { -
10770 -
10771 const QRect targetCandidateRect = targetCandidate->rect().translated(targetCandidate->mapToGlobal(QPoint())); -
10772 -
10773 // For focus proxies, the child widget handling the focus can have keypad navigation focus, -
10774 // but the owner of the proxy cannot. -
10775 // Additionally, empty widgets should be ignored. -
10776 if (targetCandidate->focusProxy() || targetCandidateRect.isEmpty()) -
10777 continue; -
10778 -
10779 // Only navigate to a target widget that... -
10780 if ( targetCandidate != sourceWidget -
10781 // ...takes the focus, -
10782 && targetCandidate->focusPolicy() & Qt::TabFocus -
10783 // ...is above if DirectionNorth, -
10784 && !(direction == DirectionNorth && targetCandidateRect.bottom() > sourceRect.top()) -
10785 // ...is on the right if DirectionEast, -
10786 && !(direction == DirectionEast && targetCandidateRect.left() < sourceRect.right()) -
10787 // ...is below if DirectionSouth, -
10788 && !(direction == DirectionSouth && targetCandidateRect.top() < sourceRect.bottom()) -
10789 // ...is on the left if DirectionWest, -
10790 && !(direction == DirectionWest && targetCandidateRect.right() > sourceRect.left()) -
10791 // ...is enabled, -
10792 && targetCandidate->isEnabled() -
10793 // ...is visible, -
10794 && targetCandidate->isVisible() -
10795 // ...is in the same window, -
10796 && targetCandidate->window() == sourceWindow) { -
10797 const int targetCandidateDistance = pointToRect(sourcePoint, targetCandidateRect); -
10798 if (targetCandidateDistance < shortestDistance) { -
10799 shortestDistance = targetCandidateDistance; -
10800 targetWidget = targetCandidate; -
10801 } -
10802 } -
10803 } -
10804 return targetWidget; -
10805} -
10806 -
10807/*! -
10808 \internal -
10809 -
10810 Tells us if it there is currently a reachable widget by keypad navigation in -
10811 a certain \a orientation. -
10812 If no navigation is possible, occurring key events in that \a orientation may -
10813 be used to interact with the value in the focused widget, even though it -
10814 currently has not the editFocus. -
10815 -
10816 \sa QWidgetPrivate::widgetInNavigationDirection(), QWidget::hasEditFocus() -
10817*/ -
10818bool QWidgetPrivate::canKeypadNavigate(Qt::Orientation orientation) -
10819{ -
10820 return orientation == Qt::Horizontal? -
10821 (QWidgetPrivate::widgetInNavigationDirection(QWidgetPrivate::DirectionEast) -
10822 || QWidgetPrivate::widgetInNavigationDirection(QWidgetPrivate::DirectionWest)) -
10823 :(QWidgetPrivate::widgetInNavigationDirection(QWidgetPrivate::DirectionNorth) -
10824 || QWidgetPrivate::widgetInNavigationDirection(QWidgetPrivate::DirectionSouth)); -
10825} -
10826/*! -
10827 \internal -
10828 -
10829 Checks, if the \a widget is inside a QTabWidget. If is is inside -
10830 one, left/right key events will be used to switch between tabs in keypad -
10831 navigation. If there is no QTabWidget, the horizontal key events can be used -
10832to -
10833 interact with the value in the focused widget, even though it currently has -
10834 not the editFocus. -
10835 -
10836 \sa QWidget::hasEditFocus() -
10837*/ -
10838bool QWidgetPrivate::inTabWidget(QWidget *widget) -
10839{ -
10840 for (QWidget *tabWidget = widget; tabWidget; tabWidget = tabWidget->parentWidget()) -
10841 if (qobject_cast<const QTabWidget*>(tabWidget)) -
10842 return true; -
10843 return false; -
10844} -
10845#endif -
10846 -
10847/*! -
10848 \since 5.0 -
10849 \internal -
10850 -
10851 Sets the backing store to be the \a store specified. -
10852 The QWidget will take ownership of the \a store. -
10853*/ -
10854void QWidget::setBackingStore(QBackingStore *store) -
10855{ -
10856 // ### createWinId() ?? -
10857 -
10858 if (!isTopLevel())
partially evaluated: !isTopLevel()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1482
0-1482
10859 return;
never executed: return;
0
10860 -
10861 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
10862 -
10863 QTLWExtra *topData = d->topData();
executed (the execution status of this line is deduced): QTLWExtra *topData = d->topData();
-
10864 if (topData->backingStore == store)
partially evaluated: topData->backingStore == store
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1482
0-1482
10865 return;
never executed: return;
0
10866 -
10867 QBackingStore *oldStore = topData->backingStore;
executed (the execution status of this line is deduced): QBackingStore *oldStore = topData->backingStore;
-
10868 delete topData->backingStore;
executed (the execution status of this line is deduced): delete topData->backingStore;
-
10869 topData->backingStore = store;
executed (the execution status of this line is deduced): topData->backingStore = store;
-
10870 -
10871 QWidgetBackingStore *bs = d->maybeBackingStore();
executed (the execution status of this line is deduced): QWidgetBackingStore *bs = d->maybeBackingStore();
-
10872 if (!bs)
partially evaluated: !bs
TRUEFALSE
yes
Evaluation Count:1482
no
Evaluation Count:0
0-1482
10873 return;
executed: return;
Execution Count:1482
1482
10874 -
10875 if (isTopLevel()) {
never evaluated: isTopLevel()
0
10876 if (bs->store != oldStore && bs->store != store)
never evaluated: bs->store != oldStore
never evaluated: bs->store != store
0
10877 delete bs->store;
never executed: delete bs->store;
0
10878 bs->store = store;
never executed (the execution status of this line is deduced): bs->store = store;
-
10879 }
never executed: }
0
10880}
never executed: }
0
10881 -
10882/*! -
10883 \since 5.0 -
10884 -
10885 Returns the QBackingStore this widget will be drawn into. -
10886*/ -
10887QBackingStore *QWidget::backingStore() const -
10888{ -
10889 Q_D(const QWidget);
executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
10890 QTLWExtra *extra = d->maybeTopData();
executed (the execution status of this line is deduced): QTLWExtra *extra = d->maybeTopData();
-
10891 if (extra && extra->backingStore)
partially evaluated: extra
TRUEFALSE
yes
Evaluation Count:4630
no
Evaluation Count:0
evaluated: extra->backingStore
TRUEFALSE
yes
Evaluation Count:3035
yes
Evaluation Count:1595
0-4630
10892 return extra->backingStore;
executed: return extra->backingStore;
Execution Count:3035
3035
10893 -
10894 QWidgetBackingStore *bs = d->maybeBackingStore();
executed (the execution status of this line is deduced): QWidgetBackingStore *bs = d->maybeBackingStore();
-
10895 -
10896 return bs ? bs->store : 0;
executed: return bs ? bs->store : 0;
Execution Count:1595
1595
10897} -
10898 -
10899void QWidgetPrivate::getLayoutItemMargins(int *left, int *top, int *right, int *bottom) const -
10900{ -
10901 if (left)
partially evaluated: left
TRUEFALSE
yes
Evaluation Count:441
no
Evaluation Count:0
0-441
10902 *left = (int)leftLayoutItemMargin;
executed: *left = (int)leftLayoutItemMargin;
Execution Count:441
441
10903 if (top)
partially evaluated: top
TRUEFALSE
yes
Evaluation Count:441
no
Evaluation Count:0
0-441
10904 *top = (int)topLayoutItemMargin;
executed: *top = (int)topLayoutItemMargin;
Execution Count:441
441
10905 if (right)
partially evaluated: right
TRUEFALSE
yes
Evaluation Count:441
no
Evaluation Count:0
0-441
10906 *right = (int)rightLayoutItemMargin;
executed: *right = (int)rightLayoutItemMargin;
Execution Count:441
441
10907 if (bottom)
partially evaluated: bottom
TRUEFALSE
yes
Evaluation Count:441
no
Evaluation Count:0
0-441
10908 *bottom = (int)bottomLayoutItemMargin;
executed: *bottom = (int)bottomLayoutItemMargin;
Execution Count:441
441
10909}
executed: }
Execution Count:441
441
10910 -
10911void QWidgetPrivate::setLayoutItemMargins(int left, int top, int right, int bottom) -
10912{ -
10913 if (leftLayoutItemMargin == left
never evaluated: leftLayoutItemMargin == left
0
10914 && topLayoutItemMargin == top
never evaluated: topLayoutItemMargin == top
0
10915 && rightLayoutItemMargin == right
never evaluated: rightLayoutItemMargin == right
0
10916 && bottomLayoutItemMargin == bottom)
never evaluated: bottomLayoutItemMargin == bottom
0
10917 return;
never executed: return;
0
10918 -
10919 Q_Q(QWidget);
never executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
10920 leftLayoutItemMargin = (signed char)left;
never executed (the execution status of this line is deduced): leftLayoutItemMargin = (signed char)left;
-
10921 topLayoutItemMargin = (signed char)top;
never executed (the execution status of this line is deduced): topLayoutItemMargin = (signed char)top;
-
10922 rightLayoutItemMargin = (signed char)right;
never executed (the execution status of this line is deduced): rightLayoutItemMargin = (signed char)right;
-
10923 bottomLayoutItemMargin = (signed char)bottom;
never executed (the execution status of this line is deduced): bottomLayoutItemMargin = (signed char)bottom;
-
10924 q->updateGeometry();
never executed (the execution status of this line is deduced): q->updateGeometry();
-
10925}
never executed: }
0
10926 -
10927void QWidgetPrivate::setLayoutItemMargins(QStyle::SubElement element, const QStyleOption *opt) -
10928{ -
10929 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
10930 QStyleOption myOpt;
executed (the execution status of this line is deduced): QStyleOption myOpt;
-
10931 if (!opt) {
evaluated: !opt
TRUEFALSE
yes
Evaluation Count:19965
yes
Evaluation Count:3959
3959-19965
10932 myOpt.initFrom(q);
executed (the execution status of this line is deduced): myOpt.initFrom(q);
-
10933 myOpt.rect.setRect(0, 0, 32768, 32768); // arbitrary
executed (the execution status of this line is deduced): myOpt.rect.setRect(0, 0, 32768, 32768);
-
10934 opt = &myOpt;
executed (the execution status of this line is deduced): opt = &myOpt;
-
10935 }
executed: }
Execution Count:19965
19965
10936 -
10937 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);
-
10938 if (liRect.isValid()) {
evaluated: liRect.isValid()
TRUEFALSE
yes
Evaluation Count:30
yes
Evaluation Count:23894
30-23894
10939 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());
-
10940 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());
-
10941 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());
-
10942 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());
-
10943 } else {
executed: }
Execution Count:30
30
10944 leftLayoutItemMargin = 0;
executed (the execution status of this line is deduced): leftLayoutItemMargin = 0;
-
10945 topLayoutItemMargin = 0;
executed (the execution status of this line is deduced): topLayoutItemMargin = 0;
-
10946 rightLayoutItemMargin = 0;
executed (the execution status of this line is deduced): rightLayoutItemMargin = 0;
-
10947 bottomLayoutItemMargin = 0;
executed (the execution status of this line is deduced): bottomLayoutItemMargin = 0;
-
10948 }
executed: }
Execution Count:23894
23894
10949} -
10950// resets the Qt::WA_QuitOnClose attribute to the default value for transient widgets. -
10951void QWidgetPrivate::adjustQuitOnCloseAttribute() -
10952{ -
10953 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
10954 -
10955 if (!q->parentWidget()) {
evaluated: !q->parentWidget()
TRUEFALSE
yes
Evaluation Count:33939
yes
Evaluation Count:35
35-33939
10956 Qt::WindowType type = q->windowType();
executed (the execution status of this line is deduced): Qt::WindowType type = q->windowType();
-
10957 if (type == Qt::Widget || type == Qt::SubWindow)
evaluated: type == Qt::Widget
TRUEFALSE
yes
Evaluation Count:32614
yes
Evaluation Count:1325
partially evaluated: type == Qt::SubWindow
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1325
0-32614
10958 type = Qt::Window;
executed: type = Qt::Window;
Execution Count:32614
32614
10959 if (type != Qt::Widget && type != Qt::Window && type != Qt::Dialog)
partially evaluated: type != Qt::Widget
TRUEFALSE
yes
Evaluation Count:33939
no
Evaluation Count:0
evaluated: type != Qt::Window
TRUEFALSE
yes
Evaluation Count:1079
yes
Evaluation Count:32860
evaluated: type != Qt::Dialog
TRUEFALSE
yes
Evaluation Count:773
yes
Evaluation Count:306
0-33939
10960 q->setAttribute(Qt::WA_QuitOnClose, false);
executed: q->setAttribute(Qt::WA_QuitOnClose, false);
Execution Count:773
773
10961 }
executed: }
Execution Count:33939
33939
10962}
executed: }
Execution Count:33974
33974
10963 -
10964 -
10965 -
10966Q_WIDGETS_EXPORT QWidgetData *qt_qwidget_data(QWidget *widget) -
10967{ -
10968 return widget->data;
never executed: return widget->data;
0
10969} -
10970 -
10971Q_WIDGETS_EXPORT QWidgetPrivate *qt_widget_private(QWidget *widget) -
10972{ -
10973 return widget->d_func();
executed: return widget->d_func();
Execution Count:787
787
10974} -
10975 -
10976 -
10977#ifndef QT_NO_GRAPHICSVIEW -
10978/*! -
10979 \since 4.5 -
10980 -
10981 Returns the proxy widget for the corresponding embedded widget in a graphics -
10982 view; otherwise returns 0. -
10983 -
10984 \sa QGraphicsProxyWidget::createProxyForChildWidget(), -
10985 QGraphicsScene::addWidget() -
10986 */ -
10987QGraphicsProxyWidget *QWidget::graphicsProxyWidget() const -
10988{ -
10989 Q_D(const QWidget);
executed (the execution status of this line is deduced): const QWidgetPrivate * const d = d_func();
-
10990 if (d->extra) {
evaluated: d->extra
TRUEFALSE
yes
Evaluation Count:4015
yes
Evaluation Count:31062
4015-31062
10991 return d->extra->proxyWidget;
executed: return d->extra->proxyWidget;
Execution Count:4015
4015
10992 } -
10993 return 0;
executed: return 0;
Execution Count:31062
31062
10994} -
10995#endif -
10996 -
10997#ifndef QT_NO_GESTURES -
10998/*! -
10999 Subscribes the widget to a given \a gesture with specific \a flags. -
11000 -
11001 \sa ungrabGesture(), QGestureEvent -
11002 \since 4.6 -
11003*/ -
11004void QWidget::grabGesture(Qt::GestureType gesture, Qt::GestureFlags flags) -
11005{ -
11006 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
11007 d->gestureContext.insert(gesture, flags);
executed (the execution status of this line is deduced): d->gestureContext.insert(gesture, flags);
-
11008 (void)QGestureManager::instance(); // create a gesture manager
executed (the execution status of this line is deduced): (void)QGestureManager::instance();
-
11009}
executed: }
Execution Count:4092
4092
11010 -
11011/*! -
11012 Unsubscribes the widget from a given \a gesture type -
11013 -
11014 \sa grabGesture(), QGestureEvent -
11015 \since 4.6 -
11016*/ -
11017void QWidget::ungrabGesture(Qt::GestureType gesture) -
11018{ -
11019 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
11020 if (d->gestureContext.remove(gesture)) {
partially evaluated: d->gestureContext.remove(gesture)
TRUEFALSE
yes
Evaluation Count:3422
no
Evaluation Count:0
0-3422
11021 if (QGestureManager *manager = QGestureManager::instance())
partially evaluated: QGestureManager *manager = QGestureManager::instance()
TRUEFALSE
yes
Evaluation Count:3422
no
Evaluation Count:0
0-3422
11022 manager->cleanupCachedGestures(this, gesture);
executed: manager->cleanupCachedGestures(this, gesture);
Execution Count:3422
3422
11023 }
executed: }
Execution Count:3422
3422
11024}
executed: }
Execution Count:3422
3422
11025#endif // QT_NO_GESTURES -
11026 -
11027/*! -
11028 \fn void QWidget::destroy(bool destroyWindow, bool destroySubWindows) -
11029 -
11030 Frees up window system resources. Destroys the widget window if \a -
11031 destroyWindow is true. -
11032 -
11033 destroy() calls itself recursively for all the child widgets, -
11034 passing \a destroySubWindows for the \a destroyWindow parameter. -
11035 To have more control over destruction of subwidgets, destroy -
11036 subwidgets selectively first. -
11037 -
11038 This function is usually called from the QWidget destructor. -
11039*/ -
11040 -
11041/*! -
11042 \fn QPaintEngine *QWidget::paintEngine() const -
11043 -
11044 Returns the widget's paint engine. -
11045 -
11046 Note that this function should not be called explicitly by the -
11047 user, since it's meant for reimplementation purposes only. The -
11048 function is called by Qt internally, and the default -
11049 implementation may not always return a valid pointer. -
11050*/ -
11051 -
11052/*! -
11053 \fn QPoint QWidget::mapToGlobal(const QPoint &pos) const -
11054 -
11055 Translates the widget coordinate \a pos to global screen -
11056 coordinates. For example, \c{mapToGlobal(QPoint(0,0))} would give -
11057 the global coordinates of the top-left pixel of the widget. -
11058 -
11059 \sa mapFromGlobal(), mapTo(), mapToParent() -
11060*/ -
11061 -
11062/*! -
11063 \fn QPoint QWidget::mapFromGlobal(const QPoint &pos) const -
11064 -
11065 Translates the global screen coordinate \a pos to widget -
11066 coordinates. -
11067 -
11068 \sa mapToGlobal(), mapFrom(), mapFromParent() -
11069*/ -
11070 -
11071/*! -
11072 \fn void QWidget::grabMouse() -
11073 -
11074 Grabs the mouse input. -
11075 -
11076 This widget receives all mouse events until releaseMouse() is -
11077 called; other widgets get no mouse events at all. Keyboard -
11078 events are not affected. Use grabKeyboard() if you want to grab -
11079 that. -
11080 -
11081 \warning Bugs in mouse-grabbing applications very often lock the -
11082 terminal. Use this function with extreme caution, and consider -
11083 using the \c -nograb command line option while debugging. -
11084 -
11085 It is almost never necessary to grab the mouse when using Qt, as -
11086 Qt grabs and releases it sensibly. In particular, Qt grabs the -
11087 mouse when a mouse button is pressed and keeps it until the last -
11088 button is released. -
11089 -
11090 \note Only visible widgets can grab mouse input. If isVisible() -
11091 returns false for a widget, that widget cannot call grabMouse(). -
11092 -
11093 \note \b{(Mac OS X developers)} For \e Cocoa, calling -
11094 grabMouse() on a widget only works when the mouse is inside the -
11095 frame of that widget. For \e Carbon, it works outside the widget's -
11096 frame as well, like for Windows and X11. -
11097 -
11098 \sa releaseMouse(), grabKeyboard(), releaseKeyboard() -
11099*/ -
11100 -
11101/*! -
11102 \fn void QWidget::grabMouse(const QCursor &cursor) -
11103 \overload grabMouse() -
11104 -
11105 Grabs the mouse input and changes the cursor shape. -
11106 -
11107 The cursor will assume shape \a cursor (for as long as the mouse -
11108 focus is grabbed) and this widget will be the only one to receive -
11109 mouse events until releaseMouse() is called(). -
11110 -
11111 \warning Grabbing the mouse might lock the terminal. -
11112 -
11113 \note \b{(Mac OS X developers)} See the note in QWidget::grabMouse(). -
11114 -
11115 \sa releaseMouse(), grabKeyboard(), releaseKeyboard(), setCursor() -
11116*/ -
11117 -
11118/*! -
11119 \fn void QWidget::releaseMouse() -
11120 -
11121 Releases the mouse grab. -
11122 -
11123 \sa grabMouse(), grabKeyboard(), releaseKeyboard() -
11124*/ -
11125 -
11126/*! -
11127 \fn void QWidget::grabKeyboard() -
11128 -
11129 Grabs the keyboard input. -
11130 -
11131 This widget receives all keyboard events until releaseKeyboard() -
11132 is called; other widgets get no keyboard events at all. Mouse -
11133 events are not affected. Use grabMouse() if you want to grab that. -
11134 -
11135 The focus widget is not affected, except that it doesn't receive -
11136 any keyboard events. setFocus() moves the focus as usual, but the -
11137 new focus widget receives keyboard events only after -
11138 releaseKeyboard() is called. -
11139 -
11140 If a different widget is currently grabbing keyboard input, that -
11141 widget's grab is released first. -
11142 -
11143 \sa releaseKeyboard(), grabMouse(), releaseMouse(), focusWidget() -
11144*/ -
11145 -
11146/*! -
11147 \fn void QWidget::releaseKeyboard() -
11148 -
11149 Releases the keyboard grab. -
11150 -
11151 \sa grabKeyboard(), grabMouse(), releaseMouse() -
11152*/ -
11153 -
11154/*! -
11155 \fn QWidget *QWidget::mouseGrabber() -
11156 -
11157 Returns the widget that is currently grabbing the mouse input. -
11158 -
11159 If no widget in this application is currently grabbing the mouse, -
11160 0 is returned. -
11161 -
11162 \sa grabMouse(), keyboardGrabber() -
11163*/ -
11164 -
11165/*! -
11166 \fn QWidget *QWidget::keyboardGrabber() -
11167 -
11168 Returns the widget that is currently grabbing the keyboard input. -
11169 -
11170 If no widget in this application is currently grabbing the -
11171 keyboard, 0 is returned. -
11172 -
11173 \sa grabMouse(), mouseGrabber() -
11174*/ -
11175 -
11176/*! -
11177 \fn void QWidget::activateWindow() -
11178 -
11179 Sets the top-level widget containing this widget to be the active -
11180 window. -
11181 -
11182 An active window is a visible top-level window that has the -
11183 keyboard input focus. -
11184 -
11185 This function performs the same operation as clicking the mouse on -
11186 the title bar of a top-level window. On X11, the result depends on -
11187 the Window Manager. If you want to ensure that the window is -
11188 stacked on top as well you should also call raise(). Note that the -
11189 window must be visible, otherwise activateWindow() has no effect. -
11190 -
11191 On Windows, if you are calling this when the application is not -
11192 currently the active one then it will not make it the active -
11193 window. It will change the color of the taskbar entry to indicate -
11194 that the window has changed in some way. This is because Microsoft -
11195 does not allow an application to interrupt what the user is currently -
11196 doing in another application. -
11197 -
11198 \sa isActiveWindow(), window(), show() -
11199*/ -
11200 -
11201/*! -
11202 \fn int QWidget::metric(PaintDeviceMetric m) const -
11203 -
11204 Internal implementation of the virtual QPaintDevice::metric() -
11205 function. -
11206 -
11207 \a m is the metric to get. -
11208*/ -
11209 -
11210/*! -
11211 Initializes the \a painter pen, background and font to the same as -
11212 the given widget's. This function is called automatically when the -
11213 painter is opened on a QWidget. -
11214*/ -
11215void QWidget::initPainter(QPainter *painter) const -
11216{ -
11217 const QPalette &pal = palette();
executed (the execution status of this line is deduced): const QPalette &pal = palette();
-
11218 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);
-
11219 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());
-
11220 QFont f(font(), const_cast<QWidget *>(this));
executed (the execution status of this line is deduced): QFont f(font(), const_cast<QWidget *>(this));
-
11221 painter->d_func()->state->deviceFont = f;
executed (the execution status of this line is deduced): painter->d_func()->state->deviceFont = f;
-
11222 painter->d_func()->state->font = f;
executed (the execution status of this line is deduced): painter->d_func()->state->font = f;
-
11223}
executed: }
Execution Count:11729
11729
11224 -
11225QPaintDevice *QWidget::redirected(QPoint *offset) const -
11226{ -
11227 return d_func()->redirected(offset);
executed: return d_func()->redirected(offset);
Execution Count:11728
11728
11228} -
11229 -
11230QPainter *QWidget::sharedPainter() const -
11231{ -
11232 // Someone sent a paint event directly to the widget -
11233 if (!d_func()->redirectDev)
partially evaluated: !d_func()->redirectDev
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:21788
0-21788
11234 return 0;
never executed: return 0;
0
11235 -
11236 QPainter *sp = d_func()->sharedPainter();
executed (the execution status of this line is deduced): QPainter *sp = d_func()->sharedPainter();
-
11237 if (!sp || !sp->isActive())
evaluated: !sp
TRUEFALSE
yes
Evaluation Count:21786
yes
Evaluation Count:2
partially evaluated: !sp->isActive()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-21786
11238 return 0;
executed: return 0;
Execution Count:21786
21786
11239 -
11240 if (sp->paintEngine()->paintDevice() != d_func()->redirectDev)
partially evaluated: sp->paintEngine()->paintDevice() != d_func()->redirectDev
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
11241 return 0;
never executed: return 0;
0
11242 -
11243 return sp;
executed: return sp;
Execution Count:2
2
11244} -
11245 -
11246/*! -
11247 \fn void QWidget::setMask(const QRegion &region) -
11248 \overload -
11249 -
11250 Causes only the parts of the widget which overlap \a region to be -
11251 visible. If the region includes pixels outside the rect() of the -
11252 widget, window system controls in that area may or may not be -
11253 visible, depending on the platform. -
11254 -
11255 Note that this effect can be slow if the region is particularly -
11256 complex. -
11257 -
11258 \sa windowOpacity -
11259*/ -
11260void QWidget::setMask(const QRegion &newMask) -
11261{ -
11262 Q_D(QWidget);
executed (the execution status of this line is deduced): QWidgetPrivate * const d = d_func();
-
11263 -
11264 d->createExtra();
executed (the execution status of this line is deduced): d->createExtra();
-
11265 if (newMask == d->extra->mask)
evaluated: newMask == d->extra->mask
TRUEFALSE
yes
Evaluation Count:22
yes
Evaluation Count:26
22-26
11266 return;
executed: return;
Execution Count:22
22
11267 -
11268#ifndef QT_NO_BACKINGSTORE -
11269 const QRegion oldMask(d->extra->mask);
executed (the execution status of this line is deduced): const QRegion oldMask(d->extra->mask);
-
11270#endif -
11271 -
11272 d->extra->mask = newMask;
executed (the execution status of this line is deduced): d->extra->mask = newMask;
-
11273 d->extra->hasMask = !newMask.isEmpty();
executed (the execution status of this line is deduced): d->extra->hasMask = !newMask.isEmpty();
-
11274 -
11275#ifndef Q_WS_MAC -
11276 if (!testAttribute(Qt::WA_WState_Created))
evaluated: !testAttribute(Qt::WA_WState_Created)
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:21
5-21
11277 return;
executed: return;
Execution Count:5
5
11278#endif -
11279 -
11280 d->setMask_sys(newMask);
executed (the execution status of this line is deduced): d->setMask_sys(newMask);
-
11281 -
11282#ifndef QT_NO_BACKINGSTORE -
11283 if (!isVisible())
evaluated: !isVisible()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:20
1-20
11284 return;
executed: return;
Execution Count:1
1
11285 -
11286 if (!d->extra->hasMask) {
partially evaluated: !d->extra->hasMask
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:20
0-20
11287 // Mask was cleared; update newly exposed area. -
11288 QRegion expose(rect());
never executed (the execution status of this line is deduced): QRegion expose(rect());
-
11289 expose -= oldMask;
never executed (the execution status of this line is deduced): expose -= oldMask;
-
11290 if (!expose.isEmpty()) {
never evaluated: !expose.isEmpty()
0
11291 d->setDirtyOpaqueRegion();
never executed (the execution status of this line is deduced): d->setDirtyOpaqueRegion();
-
11292 update(expose);
never executed (the execution status of this line is deduced): update(expose);
-
11293 }
never executed: }
0
11294 return;
never executed: return;
0
11295 } -
11296 -
11297 if (!isWindow()) {
partially evaluated: !isWindow()
TRUEFALSE
yes
Evaluation Count:20
no
Evaluation Count:0
0-20
11298 // Update newly exposed area on the parent widget. -
11299 QRegion parentExpose(rect());
executed (the execution status of this line is deduced): QRegion parentExpose(rect());
-
11300 parentExpose -= newMask;
executed (the execution status of this line is deduced): parentExpose -= newMask;
-
11301 if (!parentExpose.isEmpty()) {
partially evaluated: !parentExpose.isEmpty()
TRUEFALSE
yes
Evaluation Count:20
no
Evaluation Count:0
0-20
11302 d->setDirtyOpaqueRegion();
executed (the execution status of this line is deduced): d->setDirtyOpaqueRegion();
-
11303 parentExpose.translate(data->crect.topLeft());
executed (the execution status of this line is deduced): parentExpose.translate(data->crect.topLeft());
-
11304 parentWidget()->update(parentExpose);
executed (the execution status of this line is deduced): parentWidget()->update(parentExpose);
-
11305 }
executed: }
Execution Count:20
20
11306 -
11307 // Update newly exposed area on this widget -
11308 if (!oldMask.isEmpty())
partially evaluated: !oldMask.isEmpty()
TRUEFALSE
yes
Evaluation Count:20
no
Evaluation Count:0
0-20
11309 update(newMask - oldMask);
executed: update(newMask - oldMask);
Execution Count:20
20
11310 }
executed: }
Execution Count:20
20
11311#endif -
11312}
executed: }
Execution Count:20
20
11313 -
11314/*! -
11315 \fn void QWidget::setMask(const QBitmap &bitmap) -
11316 -
11317 Causes only the pixels of the widget for which \a bitmap has a -
11318 corresponding 1 bit to be visible. If the region includes pixels -
11319 outside the rect() of the widget, window system controls in that -
11320 area may or may not be visible, depending on the platform. -
11321 -
11322 Note that this effect can be slow if the region is particularly -
11323 complex. -
11324 -
11325 The following code shows how an image with an alpha channel can be -
11326 used to generate a mask for a widget: -
11327 -
11328 \snippet widget-mask/main.cpp 0 -
11329 -
11330 The label shown by this code is masked using the image it contains, -
11331 giving the appearance that an irregularly-shaped image is being drawn -
11332 directly onto the screen. -
11333 -
11334 Masked widgets receive mouse events only on their visible -
11335 portions. -
11336 -
11337 \sa clearMask(), windowOpacity(), {Shaped Clock Example} -
11338*/ -
11339void QWidget::setMask(const QBitmap &bitmap) -
11340{ -
11341 setMask(QRegion(bitmap));
executed (the execution status of this line is deduced): setMask(QRegion(bitmap));
-
11342}
executed: }
Execution Count:4
4
11343 -
11344/*! -
11345 \fn void QWidget::clearMask() -
11346 -
11347 Removes any mask set by setMask(). -
11348 -
11349 \sa setMask() -
11350*/ -
11351void QWidget::clearMask() -
11352{ -
11353 setMask(QRegion());
never executed (the execution status of this line is deduced): setMask(QRegion());
-
11354}
never executed: }
0
11355 -
11356#ifdef Q_WS_MAC -
11357void QWidgetPrivate::syncUnifiedMode() { -
11358 // The whole purpose of this method is to keep the unifiedToolbar in sync. -
11359 // That means making sure we either exchange the drawing methods or we let -
11360 // the toolbar know that it does not require to draw the baseline. -
11361 Q_Q(QWidget); -
11362 // This function makes sense only if this is a top level -
11363 if(!q->isWindow()) -
11364 return; -
11365 OSWindowRef window = qt_mac_window_for(q); -
11366 if(changeMethods) { -
11367 // Ok, we are in documentMode. -
11368 if(originalDrawMethod) -
11369 qt_mac_replaceDrawRect(window, this); -
11370 } else { -
11371 if(!originalDrawMethod) -
11372 qt_mac_replaceDrawRectOriginal(window, this); -
11373 } -
11374} -
11375 -
11376#endif // Q_WS_MAC -
11377 -
11378QT_END_NAMESPACE -
11379 -
11380#include "moc_qwidget.cpp" -
11381 -
11382 -
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial