Line | Source Code | Coverage |
---|
1 | /**************************************************************************** | - |
2 | ** | - |
3 | ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). | - |
4 | ** Contact: http://www.qt-project.org/legal | - |
5 | ** | - |
6 | ** This file is part of the QtGui module of the Qt Toolkit. | - |
7 | ** | - |
8 | ** $QT_BEGIN_LICENSE:LGPL$ | - |
9 | ** Commercial License Usage | - |
10 | ** Licensees holding valid commercial Qt licenses may use this file in | - |
11 | ** accordance with the commercial license agreement provided with the | - |
12 | ** Software or, alternatively, in accordance with the terms contained in | - |
13 | ** a written agreement between you and Digia. For licensing terms and | - |
14 | ** conditions see http://qt.digia.com/licensing. For further information | - |
15 | ** use the contact form at http://qt.digia.com/contact-us. | - |
16 | ** | - |
17 | ** GNU Lesser General Public License Usage | - |
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - |
19 | ** General Public License version 2.1 as published by the Free Software | - |
20 | ** Foundation and appearing in the file LICENSE.LGPL included in the | - |
21 | ** packaging of this file. Please review the following information to | - |
22 | ** ensure the GNU Lesser General Public License version 2.1 requirements | - |
23 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | - |
24 | ** | - |
25 | ** In addition, as a special exception, Digia gives you certain additional | - |
26 | ** rights. These rights are described in the Digia Qt LGPL Exception | - |
27 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | - |
28 | ** | - |
29 | ** GNU General Public License Usage | - |
30 | ** Alternatively, this file may be used under the terms of the GNU | - |
31 | ** General Public License version 3.0 as published by the Free Software | - |
32 | ** Foundation and appearing in the file LICENSE.GPL included in the | - |
33 | ** packaging of this file. Please review the following information to | - |
34 | ** ensure the GNU General Public License version 3.0 requirements will be | - |
35 | ** met: http://www.gnu.org/copyleft/gpl.html. | - |
36 | ** | - |
37 | ** | - |
38 | ** $QT_END_LICENSE$ | - |
39 | ** | - |
40 | ****************************************************************************/ | - |
41 | | - |
42 | #include "qglobal.h" | - |
43 | | - |
44 | #ifndef QT_NO_GRAPHICSVIEW | - |
45 | | - |
46 | #include <QtCore/qdebug.h> | - |
47 | #include <QtCore/qnumeric.h> | - |
48 | #include "qgraphicswidget_p.h" | - |
49 | #include "qgraphicslayoutitem_p.h" | - |
50 | #include "qgraphicslayout.h" | - |
51 | #include "qgraphicsscene_p.h" | - |
52 | #include <QtWidgets/qapplication.h> | - |
53 | #include <QtWidgets/qgraphicsscene.h> | - |
54 | #include <QtWidgets/qstyleoption.h> | - |
55 | #include <QtWidgets/QStyleOptionTitleBar> | - |
56 | #include <QtWidgets/QGraphicsSceneMouseEvent> | - |
57 | #if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC) | - |
58 | # include <private/qmacstyle_mac_p.h> | - |
59 | #endif | - |
60 | | - |
61 | QT_BEGIN_NAMESPACE | - |
62 | | - |
63 | void QGraphicsWidgetPrivate::init(QGraphicsItem *parentItem, Qt::WindowFlags wFlags) | - |
64 | { | - |
65 | Q_Q(QGraphicsWidget); executed (the execution status of this line is deduced): QGraphicsWidget * const q = q_func(); | - |
66 | | - |
67 | attributes = 0; executed (the execution status of this line is deduced): attributes = 0; | - |
68 | isWidget = 1; // QGraphicsItem::isWidget() returns true. executed (the execution status of this line is deduced): isWidget = 1; | - |
69 | focusNext = focusPrev = q; executed (the execution status of this line is deduced): focusNext = focusPrev = q; | - |
70 | focusPolicy = Qt::NoFocus; executed (the execution status of this line is deduced): focusPolicy = Qt::NoFocus; | - |
71 | | - |
72 | adjustWindowFlags(&wFlags); executed (the execution status of this line is deduced): adjustWindowFlags(&wFlags); | - |
73 | windowFlags = wFlags; executed (the execution status of this line is deduced): windowFlags = wFlags; | - |
74 | | - |
75 | if (parentItem) evaluated: parentItem yes Evaluation Count:310 | yes Evaluation Count:1134 |
| 310-1134 |
76 | setParentItemHelper(parentItem, 0, 0); executed: setParentItemHelper(parentItem, 0, 0); Execution Count:310 | 310 |
77 | | - |
78 | q->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred, QSizePolicy::DefaultType)); executed (the execution status of this line is deduced): q->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred, QSizePolicy::DefaultType)); | - |
79 | q->setGraphicsItem(q); executed (the execution status of this line is deduced): q->setGraphicsItem(q); | - |
80 | | - |
81 | resolveLayoutDirection(); executed (the execution status of this line is deduced): resolveLayoutDirection(); | - |
82 | q->unsetWindowFrameMargins(); executed (the execution status of this line is deduced): q->unsetWindowFrameMargins(); | - |
83 | flags |= QGraphicsItem::ItemUsesExtendedStyleOption; executed (the execution status of this line is deduced): flags |= QGraphicsItem::ItemUsesExtendedStyleOption; | - |
84 | flags |= QGraphicsItem::ItemSendsGeometryChanges; executed (the execution status of this line is deduced): flags |= QGraphicsItem::ItemSendsGeometryChanges; | - |
85 | if (windowFlags & Qt::Window) evaluated: windowFlags & Qt::Window yes Evaluation Count:184 | yes Evaluation Count:1260 |
| 184-1260 |
86 | flags |= QGraphicsItem::ItemIsPanel; executed: flags |= QGraphicsItem::ItemIsPanel; Execution Count:184 | 184 |
87 | } executed: } Execution Count:1444 | 1444 |
88 | | - |
89 | qreal QGraphicsWidgetPrivate::titleBarHeight(const QStyleOptionTitleBar &options) const | - |
90 | { | - |
91 | Q_Q(const QGraphicsWidget); executed (the execution status of this line is deduced): const QGraphicsWidget * const q = q_func(); | - |
92 | int height = q->style()->pixelMetric(QStyle::PM_TitleBarHeight, &options); executed (the execution status of this line is deduced): int height = q->style()->pixelMetric(QStyle::PM_TitleBarHeight, &options); | - |
93 | #if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC) | - |
94 | if (qobject_cast<QMacStyle*>(q->style())) { | - |
95 | height -=4; | - |
96 | } | - |
97 | #endif | - |
98 | return (qreal)height; executed: return (qreal)height; Execution Count:426 | 426 |
99 | } | - |
100 | | - |
101 | /*! | - |
102 | \internal | - |
103 | */ | - |
104 | QGraphicsWidgetPrivate::~QGraphicsWidgetPrivate() | - |
105 | { | - |
106 | // Remove any lazily allocated data | - |
107 | delete[] margins; executed (the execution status of this line is deduced): delete[] margins; | - |
108 | delete[] windowFrameMargins; executed (the execution status of this line is deduced): delete[] windowFrameMargins; | - |
109 | delete windowData; executed (the execution status of this line is deduced): delete windowData; | - |
110 | } executed: } Execution Count:936 | 936 |
111 | | - |
112 | /*! | - |
113 | \internal | - |
114 | | - |
115 | Ensures that margins is allocated. | - |
116 | This function must be called before any dereferencing. | - |
117 | */ | - |
118 | void QGraphicsWidgetPrivate::ensureMargins() const | - |
119 | { | - |
120 | if (!margins) { evaluated: !margins yes Evaluation Count:195 | yes Evaluation Count:174 |
| 174-195 |
121 | margins = new qreal[4]; executed (the execution status of this line is deduced): margins = new qreal[4]; | - |
122 | for (int i = 0; i < 4; ++i) evaluated: i < 4 yes Evaluation Count:780 | yes Evaluation Count:195 |
| 195-780 |
123 | margins[i] = 0; executed: margins[i] = 0; Execution Count:780 | 780 |
124 | } executed: } Execution Count:195 | 195 |
125 | } executed: } Execution Count:369 | 369 |
126 | | - |
127 | /*! | - |
128 | \internal | - |
129 | | - |
130 | Ensures that windowFrameMargins is allocated. | - |
131 | This function must be called before any dereferencing. | - |
132 | */ | - |
133 | void QGraphicsWidgetPrivate::ensureWindowFrameMargins() const | - |
134 | { | - |
135 | if (!windowFrameMargins) { partially evaluated: !windowFrameMargins yes Evaluation Count:185 | no Evaluation Count:0 |
| 0-185 |
136 | windowFrameMargins = new qreal[4]; executed (the execution status of this line is deduced): windowFrameMargins = new qreal[4]; | - |
137 | for (int i = 0; i < 4; ++i) evaluated: i < 4 yes Evaluation Count:740 | yes Evaluation Count:185 |
| 185-740 |
138 | windowFrameMargins[i] = 0; executed: windowFrameMargins[i] = 0; Execution Count:740 | 740 |
139 | } executed: } Execution Count:185 | 185 |
140 | } executed: } Execution Count:185 | 185 |
141 | | - |
142 | /*! | - |
143 | \internal | - |
144 | | - |
145 | Ensures that windowData is allocated. | - |
146 | This function must be called before any dereferencing. | - |
147 | */ | - |
148 | void QGraphicsWidgetPrivate::ensureWindowData() | - |
149 | { | - |
150 | if (!windowData) evaluated: !windowData yes Evaluation Count:194 | yes Evaluation Count:57 |
| 57-194 |
151 | windowData = new WindowData; executed: windowData = new WindowData; Execution Count:194 | 194 |
152 | } executed: } Execution Count:251 | 251 |
153 | | - |
154 | void QGraphicsWidgetPrivate::setPalette_helper(const QPalette &palette) | - |
155 | { | - |
156 | if (this->palette == palette && this->palette.resolve() == palette.resolve()) never evaluated: this->palette == palette never evaluated: this->palette.resolve() == palette.resolve() | 0 |
157 | return; | 0 |
158 | updatePalette(palette); never executed (the execution status of this line is deduced): updatePalette(palette); | - |
159 | } | 0 |
160 | | - |
161 | void QGraphicsWidgetPrivate::resolvePalette(uint inheritedMask) | - |
162 | { | - |
163 | inheritedPaletteResolveMask = inheritedMask; executed (the execution status of this line is deduced): inheritedPaletteResolveMask = inheritedMask; | - |
164 | QPalette naturalPalette = naturalWidgetPalette(); executed (the execution status of this line is deduced): QPalette naturalPalette = naturalWidgetPalette(); | - |
165 | QPalette resolvedPalette = palette.resolve(naturalPalette); executed (the execution status of this line is deduced): QPalette resolvedPalette = palette.resolve(naturalPalette); | - |
166 | updatePalette(resolvedPalette); executed (the execution status of this line is deduced): updatePalette(resolvedPalette); | - |
167 | } executed: } Execution Count:1434 | 1434 |
168 | | - |
169 | void QGraphicsWidgetPrivate::updatePalette(const QPalette &palette) | - |
170 | { | - |
171 | Q_Q(QGraphicsWidget); executed (the execution status of this line is deduced): QGraphicsWidget * const q = q_func(); | - |
172 | // Update local palette setting. | - |
173 | this->palette = palette; executed (the execution status of this line is deduced): this->palette = palette; | - |
174 | | - |
175 | // Calculate new mask. | - |
176 | if (q->isWindow() && !q->testAttribute(Qt::WA_WindowPropagation)) evaluated: q->isWindow() yes Evaluation Count:174 | yes Evaluation Count:1260 |
partially evaluated: !q->testAttribute(Qt::WA_WindowPropagation) yes Evaluation Count:174 | no Evaluation Count:0 |
| 0-1260 |
177 | inheritedPaletteResolveMask = 0; executed: inheritedPaletteResolveMask = 0; Execution Count:174 | 174 |
178 | int mask = palette.resolve() | inheritedPaletteResolveMask; executed (the execution status of this line is deduced): int mask = palette.resolve() | inheritedPaletteResolveMask; | - |
179 | | - |
180 | // Propagate to children. | - |
181 | for (int i = 0; i < children.size(); ++i) { evaluated: i < children.size() yes Evaluation Count:22 | yes Evaluation Count:1434 |
| 22-1434 |
182 | QGraphicsItem *item = children.at(i); executed (the execution status of this line is deduced): QGraphicsItem *item = children.at(i); | - |
183 | if (item->isWidget()) { partially evaluated: item->isWidget() yes Evaluation Count:22 | no Evaluation Count:0 |
| 0-22 |
184 | QGraphicsWidget *w = static_cast<QGraphicsWidget *>(item); executed (the execution status of this line is deduced): QGraphicsWidget *w = static_cast<QGraphicsWidget *>(item); | - |
185 | if (!w->isWindow() || w->testAttribute(Qt::WA_WindowPropagation)) partially evaluated: !w->isWindow() yes Evaluation Count:22 | no Evaluation Count:0 |
never evaluated: w->testAttribute(Qt::WA_WindowPropagation) | 0-22 |
186 | w->d_func()->resolvePalette(mask); executed: w->d_func()->resolvePalette(mask); Execution Count:22 | 22 |
187 | } else { executed: } Execution Count:22 | 22 |
188 | item->d_ptr->resolvePalette(mask); never executed (the execution status of this line is deduced): item->d_ptr->resolvePalette(mask); | - |
189 | } | 0 |
190 | } | - |
191 | | - |
192 | // Notify change. | - |
193 | QEvent event(QEvent::PaletteChange); executed (the execution status of this line is deduced): QEvent event(QEvent::PaletteChange); | - |
194 | QApplication::sendEvent(q, &event); executed (the execution status of this line is deduced): QApplication::sendEvent(q, &event); | - |
195 | } executed: } Execution Count:1434 | 1434 |
196 | | - |
197 | void QGraphicsWidgetPrivate::setLayoutDirection_helper(Qt::LayoutDirection direction) | - |
198 | { | - |
199 | Q_Q(QGraphicsWidget); executed (the execution status of this line is deduced): QGraphicsWidget * const q = q_func(); | - |
200 | if ((direction == Qt::RightToLeft) == (testAttribute(Qt::WA_RightToLeft))) evaluated: (direction == Qt::RightToLeft) == (testAttribute(Qt::WA_RightToLeft)) yes Evaluation Count:1453 | yes Evaluation Count:13 |
| 13-1453 |
201 | return; executed: return; Execution Count:1453 | 1453 |
202 | 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)); | - |
203 | | - |
204 | // Propagate this change to all children. | - |
205 | for (int i = 0; i < children.size(); ++i) { evaluated: i < children.size() yes Evaluation Count:10 | yes Evaluation Count:13 |
| 10-13 |
206 | QGraphicsItem *item = children.at(i); executed (the execution status of this line is deduced): QGraphicsItem *item = children.at(i); | - |
207 | if (item->isWidget()) { partially evaluated: item->isWidget() yes Evaluation Count:10 | no Evaluation Count:0 |
| 0-10 |
208 | QGraphicsWidget *widget = static_cast<QGraphicsWidget *>(item); executed (the execution status of this line is deduced): QGraphicsWidget *widget = static_cast<QGraphicsWidget *>(item); | - |
209 | if (widget->parentWidget() && !widget->testAttribute(Qt::WA_SetLayoutDirection)) partially evaluated: widget->parentWidget() yes Evaluation Count:10 | no Evaluation Count:0 |
partially evaluated: !widget->testAttribute(Qt::WA_SetLayoutDirection) yes Evaluation Count:10 | no Evaluation Count:0 |
| 0-10 |
210 | widget->d_func()->setLayoutDirection_helper(direction); executed: widget->d_func()->setLayoutDirection_helper(direction); Execution Count:10 | 10 |
211 | } executed: } Execution Count:10 | 10 |
212 | } executed: } Execution Count:10 | 10 |
213 | | - |
214 | // Send the notification event to this widget item. | - |
215 | QEvent e(QEvent::LayoutDirectionChange); executed (the execution status of this line is deduced): QEvent e(QEvent::LayoutDirectionChange); | - |
216 | QApplication::sendEvent(q, &e); executed (the execution status of this line is deduced): QApplication::sendEvent(q, &e); | - |
217 | } executed: } Execution Count:13 | 13 |
218 | | - |
219 | void QGraphicsWidgetPrivate::resolveLayoutDirection() | - |
220 | { | - |
221 | Q_Q(QGraphicsWidget); executed (the execution status of this line is deduced): QGraphicsWidget * const q = q_func(); | - |
222 | if (q->testAttribute(Qt::WA_SetLayoutDirection)) { partially evaluated: q->testAttribute(Qt::WA_SetLayoutDirection) no Evaluation Count:0 | yes Evaluation Count:1444 |
| 0-1444 |
223 | return; | 0 |
224 | } | - |
225 | if (QGraphicsWidget *parentWidget = q->parentWidget()) { evaluated: QGraphicsWidget *parentWidget = q->parentWidget() yes Evaluation Count:310 | yes Evaluation Count:1134 |
| 310-1134 |
226 | setLayoutDirection_helper(parentWidget->layoutDirection()); executed (the execution status of this line is deduced): setLayoutDirection_helper(parentWidget->layoutDirection()); | - |
227 | } else if (scene) { executed: } Execution Count:310 partially evaluated: scene no Evaluation Count:0 | yes Evaluation Count:1134 |
| 0-1134 |
228 | // ### shouldn't the scene have a layoutdirection really? how does | - |
229 | // ### QGraphicsWidget get changes from QApplication::layoutDirection? | - |
230 | setLayoutDirection_helper(QApplication::layoutDirection()); never executed (the execution status of this line is deduced): setLayoutDirection_helper(QApplication::layoutDirection()); | - |
231 | } else { | 0 |
232 | setLayoutDirection_helper(QApplication::layoutDirection()); executed (the execution status of this line is deduced): setLayoutDirection_helper(QApplication::layoutDirection()); | - |
233 | } executed: } Execution Count:1134 | 1134 |
234 | } | - |
235 | | - |
236 | QPalette QGraphicsWidgetPrivate::naturalWidgetPalette() const | - |
237 | { | - |
238 | Q_Q(const QGraphicsWidget); executed (the execution status of this line is deduced): const QGraphicsWidget * const q = q_func(); | - |
239 | QPalette palette; executed (the execution status of this line is deduced): QPalette palette; | - |
240 | if (QGraphicsWidget *parent = q->parentWidget()) { evaluated: QGraphicsWidget *parent = q->parentWidget() yes Evaluation Count:1221 | yes Evaluation Count:213 |
| 213-1221 |
241 | palette = parent->palette(); executed (the execution status of this line is deduced): palette = parent->palette(); | - |
242 | } else if (scene) { executed: } Execution Count:1221 evaluated: scene yes Evaluation Count:206 | yes Evaluation Count:7 |
| 7-1221 |
243 | palette = scene->palette(); executed (the execution status of this line is deduced): palette = scene->palette(); | - |
244 | } executed: } Execution Count:206 | 206 |
245 | palette.resolve(0); executed (the execution status of this line is deduced): palette.resolve(0); | - |
246 | return palette; executed: return palette; Execution Count:1434 | 1434 |
247 | } | - |
248 | | - |
249 | void QGraphicsWidgetPrivate::setFont_helper(const QFont &font) | - |
250 | { | - |
251 | if (this->font == font && this->font.resolve() == font.resolve()) never evaluated: this->font == font never evaluated: this->font.resolve() == font.resolve() | 0 |
252 | return; | 0 |
253 | updateFont(font); never executed (the execution status of this line is deduced): updateFont(font); | - |
254 | } | 0 |
255 | | - |
256 | void QGraphicsWidgetPrivate::resolveFont(uint inheritedMask) | - |
257 | { | - |
258 | Q_Q(QGraphicsWidget); executed (the execution status of this line is deduced): QGraphicsWidget * const q = q_func(); | - |
259 | inheritedFontResolveMask = inheritedMask; executed (the execution status of this line is deduced): inheritedFontResolveMask = inheritedMask; | - |
260 | if (QGraphicsWidget *p = q->parentWidget()) evaluated: QGraphicsWidget *p = q->parentWidget() yes Evaluation Count:1221 | yes Evaluation Count:215 |
| 215-1221 |
261 | inheritedFontResolveMask |= p->d_func()->inheritedFontResolveMask; executed: inheritedFontResolveMask |= p->d_func()->inheritedFontResolveMask; Execution Count:1221 | 1221 |
262 | QFont naturalFont = naturalWidgetFont(); executed (the execution status of this line is deduced): QFont naturalFont = naturalWidgetFont(); | - |
263 | QFont resolvedFont = font.resolve(naturalFont); executed (the execution status of this line is deduced): QFont resolvedFont = font.resolve(naturalFont); | - |
264 | updateFont(resolvedFont); executed (the execution status of this line is deduced): updateFont(resolvedFont); | - |
265 | } executed: } Execution Count:1436 | 1436 |
266 | | - |
267 | void QGraphicsWidgetPrivate::updateFont(const QFont &font) | - |
268 | { | - |
269 | Q_Q(QGraphicsWidget); executed (the execution status of this line is deduced): QGraphicsWidget * const q = q_func(); | - |
270 | // Update the local font setting. | - |
271 | this->font = font; executed (the execution status of this line is deduced): this->font = font; | - |
272 | | - |
273 | // Calculate new mask. | - |
274 | if (q->isWindow() && !q->testAttribute(Qt::WA_WindowPropagation)) evaluated: q->isWindow() yes Evaluation Count:174 | yes Evaluation Count:1262 |
partially evaluated: !q->testAttribute(Qt::WA_WindowPropagation) yes Evaluation Count:174 | no Evaluation Count:0 |
| 0-1262 |
275 | inheritedFontResolveMask = 0; executed: inheritedFontResolveMask = 0; Execution Count:174 | 174 |
276 | int mask = font.resolve() | inheritedFontResolveMask; executed (the execution status of this line is deduced): int mask = font.resolve() | inheritedFontResolveMask; | - |
277 | | - |
278 | // Propagate to children. | - |
279 | for (int i = 0; i < children.size(); ++i) { evaluated: i < children.size() yes Evaluation Count:22 | yes Evaluation Count:1436 |
| 22-1436 |
280 | QGraphicsItem *item = children.at(i); executed (the execution status of this line is deduced): QGraphicsItem *item = children.at(i); | - |
281 | if (item->isWidget()) { partially evaluated: item->isWidget() yes Evaluation Count:22 | no Evaluation Count:0 |
| 0-22 |
282 | QGraphicsWidget *w = static_cast<QGraphicsWidget *>(item); executed (the execution status of this line is deduced): QGraphicsWidget *w = static_cast<QGraphicsWidget *>(item); | - |
283 | if (!w->isWindow() || w->testAttribute(Qt::WA_WindowPropagation)) partially evaluated: !w->isWindow() yes Evaluation Count:22 | no Evaluation Count:0 |
never evaluated: w->testAttribute(Qt::WA_WindowPropagation) | 0-22 |
284 | w->d_func()->resolveFont(mask); executed: w->d_func()->resolveFont(mask); Execution Count:22 | 22 |
285 | } else { executed: } Execution Count:22 | 22 |
286 | item->d_ptr->resolveFont(mask); never executed (the execution status of this line is deduced): item->d_ptr->resolveFont(mask); | - |
287 | } | 0 |
288 | } | - |
289 | | - |
290 | if (!polished) partially evaluated: !polished yes Evaluation Count:1436 | no Evaluation Count:0 |
| 0-1436 |
291 | return; executed: return; Execution Count:1436 | 1436 |
292 | // Notify change. | - |
293 | QEvent event(QEvent::FontChange); never executed (the execution status of this line is deduced): QEvent event(QEvent::FontChange); | - |
294 | QApplication::sendEvent(q, &event); never executed (the execution status of this line is deduced): QApplication::sendEvent(q, &event); | - |
295 | } | 0 |
296 | | - |
297 | QFont QGraphicsWidgetPrivate::naturalWidgetFont() const | - |
298 | { | - |
299 | Q_Q(const QGraphicsWidget); executed (the execution status of this line is deduced): const QGraphicsWidget * const q = q_func(); | - |
300 | QFont naturalFont; // ### no application font support executed (the execution status of this line is deduced): QFont naturalFont; | - |
301 | if (QGraphicsWidget *parent = q->parentWidget()) { evaluated: QGraphicsWidget *parent = q->parentWidget() yes Evaluation Count:1221 | yes Evaluation Count:215 |
| 215-1221 |
302 | naturalFont = parent->font(); executed (the execution status of this line is deduced): naturalFont = parent->font(); | - |
303 | } else if (scene) { executed: } Execution Count:1221 evaluated: scene yes Evaluation Count:208 | yes Evaluation Count:7 |
| 7-1221 |
304 | naturalFont = scene->font(); executed (the execution status of this line is deduced): naturalFont = scene->font(); | - |
305 | } executed: } Execution Count:208 | 208 |
306 | naturalFont.resolve(0); executed (the execution status of this line is deduced): naturalFont.resolve(0); | - |
307 | return naturalFont; executed: return naturalFont; Execution Count:1436 | 1436 |
308 | } | - |
309 | | - |
310 | void QGraphicsWidgetPrivate::initStyleOptionTitleBar(QStyleOptionTitleBar *option) | - |
311 | { | - |
312 | Q_Q(QGraphicsWidget); executed (the execution status of this line is deduced): QGraphicsWidget * const q = q_func(); | - |
313 | ensureWindowData(); executed (the execution status of this line is deduced): ensureWindowData(); | - |
314 | q->initStyleOption(option); executed (the execution status of this line is deduced): q->initStyleOption(option); | - |
315 | option->rect.setHeight(titleBarHeight(*option)); executed (the execution status of this line is deduced): option->rect.setHeight(titleBarHeight(*option)); | - |
316 | option->titleBarFlags = windowFlags; executed (the execution status of this line is deduced): option->titleBarFlags = windowFlags; | - |
317 | option->subControls = QStyle::SC_TitleBarCloseButton | QStyle::SC_TitleBarLabel | QStyle::SC_TitleBarSysMenu; executed (the execution status of this line is deduced): option->subControls = QStyle::SC_TitleBarCloseButton | QStyle::SC_TitleBarLabel | QStyle::SC_TitleBarSysMenu; | - |
318 | option->activeSubControls = windowData->hoveredSubControl; executed (the execution status of this line is deduced): option->activeSubControls = windowData->hoveredSubControl; | - |
319 | bool isActive = q->isActiveWindow(); executed (the execution status of this line is deduced): bool isActive = q->isActiveWindow(); | - |
320 | if (isActive) { evaluated: isActive yes Evaluation Count:16 | yes Evaluation Count:197 |
| 16-197 |
321 | option->state |= QStyle::State_Active; executed (the execution status of this line is deduced): option->state |= QStyle::State_Active; | - |
322 | option->titleBarState = Qt::WindowActive; executed (the execution status of this line is deduced): option->titleBarState = Qt::WindowActive; | - |
323 | option->titleBarState |= QStyle::State_Active; executed (the execution status of this line is deduced): option->titleBarState |= QStyle::State_Active; | - |
324 | } else { executed: } Execution Count:16 | 16 |
325 | option->state &= ~QStyle::State_Active; executed (the execution status of this line is deduced): option->state &= ~QStyle::State_Active; | - |
326 | option->titleBarState = Qt::WindowNoState; executed (the execution status of this line is deduced): option->titleBarState = Qt::WindowNoState; | - |
327 | } executed: } Execution Count:197 | 197 |
328 | QFont windowTitleFont = QApplication::font("QMdiSubWindowTitleBar"); executed (the execution status of this line is deduced): QFont windowTitleFont = QApplication::font("QMdiSubWindowTitleBar"); | - |
329 | QRect textRect = q->style()->subControlRect(QStyle::CC_TitleBar, option, QStyle::SC_TitleBarLabel, 0); executed (the execution status of this line is deduced): QRect textRect = q->style()->subControlRect(QStyle::CC_TitleBar, option, QStyle::SC_TitleBarLabel, 0); | - |
330 | option->text = QFontMetrics(windowTitleFont).elidedText( executed (the execution status of this line is deduced): option->text = QFontMetrics(windowTitleFont).elidedText( | - |
331 | windowData->windowTitle, Qt::ElideRight, textRect.width()); executed (the execution status of this line is deduced): windowData->windowTitle, Qt::ElideRight, textRect.width()); | - |
332 | } executed: } Execution Count:213 | 213 |
333 | | - |
334 | void QGraphicsWidgetPrivate::adjustWindowFlags(Qt::WindowFlags *flags) | - |
335 | { | - |
336 | bool customize = (*flags & (Qt::CustomizeWindowHint executed (the execution status of this line is deduced): bool customize = (*flags & (Qt::CustomizeWindowHint | - |
337 | | Qt::FramelessWindowHint executed (the execution status of this line is deduced): | Qt::FramelessWindowHint | - |
338 | | Qt::WindowTitleHint executed (the execution status of this line is deduced): | Qt::WindowTitleHint | - |
339 | | Qt::WindowSystemMenuHint executed (the execution status of this line is deduced): | Qt::WindowSystemMenuHint | - |
340 | | Qt::WindowMinimizeButtonHint executed (the execution status of this line is deduced): | Qt::WindowMinimizeButtonHint | - |
341 | | Qt::WindowMaximizeButtonHint executed (the execution status of this line is deduced): | Qt::WindowMaximizeButtonHint | - |
342 | | Qt::WindowContextHelpButtonHint)); executed (the execution status of this line is deduced): | Qt::WindowContextHelpButtonHint)); | - |
343 | | - |
344 | uint type = (*flags & Qt::WindowType_Mask); executed (the execution status of this line is deduced): uint type = (*flags & Qt::WindowType_Mask); | - |
345 | if (customize) evaluated: customize yes Evaluation Count:1 | yes Evaluation Count:1444 |
| 1-1444 |
346 | ; executed: ; Execution Count:1 | 1 |
347 | else if (type == Qt::Dialog || type == Qt::Sheet) partially evaluated: type == Qt::Dialog no Evaluation Count:0 | yes Evaluation Count:1444 |
partially evaluated: type == Qt::Sheet no Evaluation Count:0 | yes Evaluation Count:1444 |
| 0-1444 |
348 | *flags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowContextHelpButtonHint; never executed: *flags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowContextHelpButtonHint; | 0 |
349 | else if (type == Qt::Tool) partially evaluated: type == Qt::Tool no Evaluation Count:0 | yes Evaluation Count:1444 |
| 0-1444 |
350 | *flags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint; never executed: *flags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint; | 0 |
351 | else if (type == Qt::Window || type == Qt::SubWindow) evaluated: type == Qt::Window yes Evaluation Count:184 | yes Evaluation Count:1260 |
partially evaluated: type == Qt::SubWindow no Evaluation Count:0 | yes Evaluation Count:1260 |
| 0-1260 |
352 | *flags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint executed: *flags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinimizeButtonHint | Qt::WindowMaximizeButtonHint; Execution Count:184 | 184 |
353 | | Qt::WindowMinimizeButtonHint | Qt::WindowMaximizeButtonHint; executed: *flags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinimizeButtonHint | Qt::WindowMaximizeButtonHint; Execution Count:184 | 184 |
354 | } | - |
355 | | - |
356 | void QGraphicsWidgetPrivate::windowFrameMouseReleaseEvent(QGraphicsSceneMouseEvent *event) | - |
357 | { | - |
358 | Q_Q(QGraphicsWidget); never executed (the execution status of this line is deduced): QGraphicsWidget * const q = q_func(); | - |
359 | ensureWindowData(); never executed (the execution status of this line is deduced): ensureWindowData(); | - |
360 | if (windowData->grabbedSection != Qt::NoSection) { never evaluated: windowData->grabbedSection != Qt::NoSection | 0 |
361 | if (windowData->grabbedSection == Qt::TitleBarArea) { never evaluated: windowData->grabbedSection == Qt::TitleBarArea | 0 |
362 | windowData->buttonSunken = false; never executed (the execution status of this line is deduced): windowData->buttonSunken = false; | - |
363 | QStyleOptionTitleBar bar; never executed (the execution status of this line is deduced): QStyleOptionTitleBar bar; | - |
364 | initStyleOptionTitleBar(&bar); never executed (the execution status of this line is deduced): initStyleOptionTitleBar(&bar); | - |
365 | // make sure that the coordinates (rect and pos) we send to the style are positive. | - |
366 | bar.rect = q->windowFrameRect().toRect(); never executed (the execution status of this line is deduced): bar.rect = q->windowFrameRect().toRect(); | - |
367 | bar.rect.moveTo(0,0); never executed (the execution status of this line is deduced): bar.rect.moveTo(0,0); | - |
368 | bar.rect.setHeight(q->style()->pixelMetric(QStyle::PM_TitleBarHeight, &bar)); never executed (the execution status of this line is deduced): bar.rect.setHeight(q->style()->pixelMetric(QStyle::PM_TitleBarHeight, &bar)); | - |
369 | QPointF pos = event->pos(); never executed (the execution status of this line is deduced): QPointF pos = event->pos(); | - |
370 | if (windowFrameMargins) { never evaluated: windowFrameMargins | 0 |
371 | pos.rx() += windowFrameMargins[Left]; never executed (the execution status of this line is deduced): pos.rx() += windowFrameMargins[Left]; | - |
372 | pos.ry() += windowFrameMargins[Top]; never executed (the execution status of this line is deduced): pos.ry() += windowFrameMargins[Top]; | - |
373 | } | 0 |
374 | bar.subControls = QStyle::SC_TitleBarCloseButton; never executed (the execution status of this line is deduced): bar.subControls = QStyle::SC_TitleBarCloseButton; | - |
375 | if (q->style()->subControlRect(QStyle::CC_TitleBar, &bar, never evaluated: q->style()->subControlRect(QStyle::CC_TitleBar, &bar, QStyle::SC_TitleBarCloseButton, event->widget()).contains(pos.toPoint()) | 0 |
376 | QStyle::SC_TitleBarCloseButton, never evaluated: q->style()->subControlRect(QStyle::CC_TitleBar, &bar, QStyle::SC_TitleBarCloseButton, event->widget()).contains(pos.toPoint()) | 0 |
377 | event->widget()).contains(pos.toPoint())) { never evaluated: q->style()->subControlRect(QStyle::CC_TitleBar, &bar, QStyle::SC_TitleBarCloseButton, event->widget()).contains(pos.toPoint()) | 0 |
378 | q->close(); never executed (the execution status of this line is deduced): q->close(); | - |
379 | } | 0 |
380 | } | 0 |
381 | if (!(static_cast<QGraphicsSceneMouseEvent *>(event)->buttons())) never evaluated: !(static_cast<QGraphicsSceneMouseEvent *>(event)->buttons()) | 0 |
382 | windowData->grabbedSection = Qt::NoSection; never executed: windowData->grabbedSection = Qt::NoSection; | 0 |
383 | event->accept(); never executed (the execution status of this line is deduced): event->accept(); | - |
384 | } | 0 |
385 | } | 0 |
386 | | - |
387 | void QGraphicsWidgetPrivate::windowFrameMousePressEvent(QGraphicsSceneMouseEvent *event) | - |
388 | { | - |
389 | Q_Q(QGraphicsWidget); never executed (the execution status of this line is deduced): QGraphicsWidget * const q = q_func(); | - |
390 | if (event->button() != Qt::LeftButton) never evaluated: event->button() != Qt::LeftButton | 0 |
391 | return; | 0 |
392 | | - |
393 | ensureWindowData(); never executed (the execution status of this line is deduced): ensureWindowData(); | - |
394 | windowData->startGeometry = q->geometry(); never executed (the execution status of this line is deduced): windowData->startGeometry = q->geometry(); | - |
395 | windowData->grabbedSection = q->windowFrameSectionAt(event->pos()); never executed (the execution status of this line is deduced): windowData->grabbedSection = q->windowFrameSectionAt(event->pos()); | - |
396 | ensureWindowData(); never executed (the execution status of this line is deduced): ensureWindowData(); | - |
397 | if (windowData->grabbedSection == Qt::TitleBarArea never evaluated: windowData->grabbedSection == Qt::TitleBarArea | 0 |
398 | && windowData->hoveredSubControl == QStyle::SC_TitleBarCloseButton) { never evaluated: windowData->hoveredSubControl == QStyle::SC_TitleBarCloseButton | 0 |
399 | windowData->buttonSunken = true; never executed (the execution status of this line is deduced): windowData->buttonSunken = true; | - |
400 | q->update(); never executed (the execution status of this line is deduced): q->update(); | - |
401 | } | 0 |
402 | event->setAccepted(windowData->grabbedSection != Qt::NoSection); never executed (the execution status of this line is deduced): event->setAccepted(windowData->grabbedSection != Qt::NoSection); | - |
403 | } | 0 |
404 | | - |
405 | /*! | - |
406 | Used to calculate the | - |
407 | Precondition: | - |
408 | \a widget should support either hfw or wfh | - |
409 | | - |
410 | If \a heightForWidth is set to false, this function will query the width for height | - |
411 | instead. \a width will then be interpreted as height, \a minh and \a maxh will be interpreted | - |
412 | as minimum width and maximum width. | - |
413 | */ | - |
414 | static qreal minimumHeightForWidth(qreal width, qreal minh, qreal maxh, | - |
415 | const QGraphicsWidget *widget, | - |
416 | bool heightForWidth = true) | - |
417 | { | - |
418 | qreal minimumHeightForWidth = -1; never executed (the execution status of this line is deduced): qreal minimumHeightForWidth = -1; | - |
419 | const bool hasHFW = QGraphicsLayoutItemPrivate::get(widget)->hasHeightForWidth(); never executed (the execution status of this line is deduced): const bool hasHFW = QGraphicsLayoutItemPrivate::get(widget)->hasHeightForWidth(); | - |
420 | if (hasHFW == heightForWidth) { never evaluated: hasHFW == heightForWidth | 0 |
421 | minimumHeightForWidth = hasHFW | 0 |
422 | ? widget->effectiveSizeHint(Qt::MinimumSize, QSizeF(width, -1)).height() never executed (the execution status of this line is deduced): ? widget->effectiveSizeHint(Qt::MinimumSize, QSizeF(width, -1)).height() | - |
423 | : widget->effectiveSizeHint(Qt::MinimumSize, QSizeF(-1, width)).width(); //"width" is here height! never executed (the execution status of this line is deduced): : widget->effectiveSizeHint(Qt::MinimumSize, QSizeF(-1, width)).width(); | - |
424 | } else { | 0 |
425 | // widthForHeight | - |
426 | const qreal constraint = width; never executed (the execution status of this line is deduced): const qreal constraint = width; | - |
427 | while (maxh - minh > 0.1) { never evaluated: maxh - minh > 0.1 | 0 |
428 | qreal middle = minh + (maxh - minh)/2; never executed (the execution status of this line is deduced): qreal middle = minh + (maxh - minh)/2; | - |
429 | // ### really bad, if we are a widget with a layout it will call | - |
430 | // layout->effectiveSizeHint(Qt::MiniumumSize), which again will call | - |
431 | // sizeHint three times because of how the cache works | - |
432 | qreal hfw = hasHFW | 0 |
433 | ? widget->effectiveSizeHint(Qt::MinimumSize, QSizeF(middle, -1)).height() never executed (the execution status of this line is deduced): ? widget->effectiveSizeHint(Qt::MinimumSize, QSizeF(middle, -1)).height() | - |
434 | : widget->effectiveSizeHint(Qt::MinimumSize, QSizeF(-1, middle)).width(); never executed (the execution status of this line is deduced): : widget->effectiveSizeHint(Qt::MinimumSize, QSizeF(-1, middle)).width(); | - |
435 | if (hfw > constraint) { never evaluated: hfw > constraint | 0 |
436 | minh = middle; never executed (the execution status of this line is deduced): minh = middle; | - |
437 | } else if (hfw <= constraint) { never executed: } never evaluated: hfw <= constraint | 0 |
438 | maxh = middle; never executed (the execution status of this line is deduced): maxh = middle; | - |
439 | } | 0 |
440 | } | - |
441 | minimumHeightForWidth = maxh; never executed (the execution status of this line is deduced): minimumHeightForWidth = maxh; | - |
442 | } | 0 |
443 | return minimumHeightForWidth; never executed: return minimumHeightForWidth; | 0 |
444 | } | - |
445 | | - |
446 | static qreal minimumWidthForHeight(qreal height, qreal minw, qreal maxw, | - |
447 | const QGraphicsWidget *widget) | - |
448 | { | - |
449 | return minimumHeightForWidth(height, minw, maxw, widget, false); never executed: return minimumHeightForWidth(height, minw, maxw, widget, false); | 0 |
450 | } | - |
451 | | - |
452 | static QSizeF closestAcceptableSize(const QSizeF &proposed, | - |
453 | const QGraphicsWidget *widget) | - |
454 | { | - |
455 | const QSizeF current = widget->size(); never executed (the execution status of this line is deduced): const QSizeF current = widget->size(); | - |
456 | | - |
457 | qreal minw = proposed.width(); never executed (the execution status of this line is deduced): qreal minw = proposed.width(); | - |
458 | qreal maxw = current.width(); never executed (the execution status of this line is deduced): qreal maxw = current.width(); | - |
459 | qreal minh = proposed.height(); never executed (the execution status of this line is deduced): qreal minh = proposed.height(); | - |
460 | qreal maxh = current.height(); never executed (the execution status of this line is deduced): qreal maxh = current.height(); | - |
461 | | - |
462 | qreal middlew = maxw; never executed (the execution status of this line is deduced): qreal middlew = maxw; | - |
463 | qreal middleh = maxh; never executed (the execution status of this line is deduced): qreal middleh = maxh; | - |
464 | qreal min_hfw; never executed (the execution status of this line is deduced): qreal min_hfw; | - |
465 | min_hfw = minimumHeightForWidth(maxw, minh, maxh, widget); never executed (the execution status of this line is deduced): min_hfw = minimumHeightForWidth(maxw, minh, maxh, widget); | - |
466 | | - |
467 | do { | - |
468 | if (maxw - minw < 0.1) { never evaluated: maxw - minw < 0.1 | 0 |
469 | // we still haven't found anything, cut off binary search | - |
470 | minw = maxw; never executed (the execution status of this line is deduced): minw = maxw; | - |
471 | minh = maxh; never executed (the execution status of this line is deduced): minh = maxh; | - |
472 | } | 0 |
473 | middlew = minw + (maxw - minw)/2.0; never executed (the execution status of this line is deduced): middlew = minw + (maxw - minw)/2.0; | - |
474 | middleh = minh + (maxh - minh)/2.0; never executed (the execution status of this line is deduced): middleh = minh + (maxh - minh)/2.0; | - |
475 | | - |
476 | min_hfw = minimumHeightForWidth(middlew, minh, maxh, widget); never executed (the execution status of this line is deduced): min_hfw = minimumHeightForWidth(middlew, minh, maxh, widget); | - |
477 | | - |
478 | if (min_hfw > middleh) { never evaluated: min_hfw > middleh | 0 |
479 | minw = middlew; never executed (the execution status of this line is deduced): minw = middlew; | - |
480 | minh = middleh; never executed (the execution status of this line is deduced): minh = middleh; | - |
481 | } else if (min_hfw <= middleh) { never executed: } never evaluated: min_hfw <= middleh | 0 |
482 | maxw = middlew; never executed (the execution status of this line is deduced): maxw = middlew; | - |
483 | maxh = middleh; never executed (the execution status of this line is deduced): maxh = middleh; | - |
484 | } | 0 |
485 | } while (maxw != minw); never evaluated: maxw != minw | 0 |
486 | | - |
487 | min_hfw = minimumHeightForWidth(middlew, minh, maxh, widget); never executed (the execution status of this line is deduced): min_hfw = minimumHeightForWidth(middlew, minh, maxh, widget); | - |
488 | | - |
489 | QSizeF result; never executed (the execution status of this line is deduced): QSizeF result; | - |
490 | if (min_hfw < maxh) { never evaluated: min_hfw < maxh | 0 |
491 | result = QSizeF(middlew, min_hfw); never executed (the execution status of this line is deduced): result = QSizeF(middlew, min_hfw); | - |
492 | } else { | 0 |
493 | // Needed because of the cut-off we do above. | - |
494 | result = QSizeF(minimumWidthForHeight(maxh, proposed.width(), current.width(), widget), maxh); never executed (the execution status of this line is deduced): result = QSizeF(minimumWidthForHeight(maxh, proposed.width(), current.width(), widget), maxh); | - |
495 | } | 0 |
496 | return result; never executed: return result; | 0 |
497 | } | - |
498 | | - |
499 | static void _q_boundGeometryToSizeConstraints(const QRectF &startGeometry, | - |
500 | QRectF *rect, Qt::WindowFrameSection section, | - |
501 | const QSizeF &min, const QSizeF &max, | - |
502 | const QGraphicsWidget *widget) | - |
503 | { | - |
504 | const QRectF proposedRect = *rect; never executed (the execution status of this line is deduced): const QRectF proposedRect = *rect; | - |
505 | qreal width = qBound(min.width(), proposedRect.width(), max.width()); never executed (the execution status of this line is deduced): qreal width = qBound(min.width(), proposedRect.width(), max.width()); | - |
506 | qreal height = qBound(min.height(), proposedRect.height(), max.height()); never executed (the execution status of this line is deduced): qreal height = qBound(min.height(), proposedRect.height(), max.height()); | - |
507 | | - |
508 | const bool hasHFW = QGraphicsLayoutItemPrivate::get(widget)->hasHeightForWidth(); never executed (the execution status of this line is deduced): const bool hasHFW = QGraphicsLayoutItemPrivate::get(widget)->hasHeightForWidth(); | - |
509 | const bool hasWFH = QGraphicsLayoutItemPrivate::get(widget)->hasWidthForHeight(); never executed (the execution status of this line is deduced): const bool hasWFH = QGraphicsLayoutItemPrivate::get(widget)->hasWidthForHeight(); | - |
510 | | - |
511 | const bool widthChanged = proposedRect.width() != widget->size().width(); never executed (the execution status of this line is deduced): const bool widthChanged = proposedRect.width() != widget->size().width(); | - |
512 | const bool heightChanged = proposedRect.height() != widget->size().height(); never executed (the execution status of this line is deduced): const bool heightChanged = proposedRect.height() != widget->size().height(); | - |
513 | | - |
514 | if (hasHFW || hasWFH) { never evaluated: hasHFW never evaluated: hasWFH | 0 |
515 | if (widthChanged || heightChanged) { never evaluated: widthChanged never evaluated: heightChanged | 0 |
516 | qreal minExtent; never executed (the execution status of this line is deduced): qreal minExtent; | - |
517 | qreal maxExtent; never executed (the execution status of this line is deduced): qreal maxExtent; | - |
518 | qreal constraint; never executed (the execution status of this line is deduced): qreal constraint; | - |
519 | qreal proposed; never executed (the execution status of this line is deduced): qreal proposed; | - |
520 | if (hasHFW) { | 0 |
521 | minExtent = min.height(); never executed (the execution status of this line is deduced): minExtent = min.height(); | - |
522 | maxExtent = max.height(); never executed (the execution status of this line is deduced): maxExtent = max.height(); | - |
523 | constraint = width; never executed (the execution status of this line is deduced): constraint = width; | - |
524 | proposed = proposedRect.height(); never executed (the execution status of this line is deduced): proposed = proposedRect.height(); | - |
525 | } else { | 0 |
526 | // width for height | - |
527 | minExtent = min.width(); never executed (the execution status of this line is deduced): minExtent = min.width(); | - |
528 | maxExtent = max.width(); never executed (the execution status of this line is deduced): maxExtent = max.width(); | - |
529 | constraint = height; never executed (the execution status of this line is deduced): constraint = height; | - |
530 | proposed = proposedRect.width(); never executed (the execution status of this line is deduced): proposed = proposedRect.width(); | - |
531 | } | 0 |
532 | if (minimumHeightForWidth(constraint, minExtent, maxExtent, widget, hasHFW) > proposed) { never evaluated: minimumHeightForWidth(constraint, minExtent, maxExtent, widget, hasHFW) > proposed | 0 |
533 | QSizeF effectiveSize = closestAcceptableSize(QSizeF(width, height), widget); never executed (the execution status of this line is deduced): QSizeF effectiveSize = closestAcceptableSize(QSizeF(width, height), widget); | - |
534 | width = effectiveSize.width(); never executed (the execution status of this line is deduced): width = effectiveSize.width(); | - |
535 | height = effectiveSize.height(); never executed (the execution status of this line is deduced): height = effectiveSize.height(); | - |
536 | } | 0 |
537 | } | 0 |
538 | } | 0 |
539 | | - |
540 | switch (section) { | - |
541 | case Qt::LeftSection: | - |
542 | rect->setRect(startGeometry.right() - qRound(width), startGeometry.top(), never executed (the execution status of this line is deduced): rect->setRect(startGeometry.right() - qRound(width), startGeometry.top(), | - |
543 | qRound(width), startGeometry.height()); never executed (the execution status of this line is deduced): qRound(width), startGeometry.height()); | - |
544 | break; | 0 |
545 | case Qt::TopLeftSection: | - |
546 | rect->setRect(startGeometry.right() - qRound(width), startGeometry.bottom() - qRound(height), never executed (the execution status of this line is deduced): rect->setRect(startGeometry.right() - qRound(width), startGeometry.bottom() - qRound(height), | - |
547 | qRound(width), qRound(height)); never executed (the execution status of this line is deduced): qRound(width), qRound(height)); | - |
548 | break; | 0 |
549 | case Qt::TopSection: | - |
550 | rect->setRect(startGeometry.left(), startGeometry.bottom() - qRound(height), never executed (the execution status of this line is deduced): rect->setRect(startGeometry.left(), startGeometry.bottom() - qRound(height), | - |
551 | startGeometry.width(), qRound(height)); never executed (the execution status of this line is deduced): startGeometry.width(), qRound(height)); | - |
552 | break; | 0 |
553 | case Qt::TopRightSection: | - |
554 | rect->setTop(rect->bottom() - qRound(height)); never executed (the execution status of this line is deduced): rect->setTop(rect->bottom() - qRound(height)); | - |
555 | rect->setWidth(qRound(width)); never executed (the execution status of this line is deduced): rect->setWidth(qRound(width)); | - |
556 | break; | 0 |
557 | case Qt::RightSection: | - |
558 | rect->setWidth(qRound(width)); never executed (the execution status of this line is deduced): rect->setWidth(qRound(width)); | - |
559 | break; | 0 |
560 | case Qt::BottomRightSection: | - |
561 | rect->setWidth(qRound(width)); never executed (the execution status of this line is deduced): rect->setWidth(qRound(width)); | - |
562 | rect->setHeight(qRound(height)); never executed (the execution status of this line is deduced): rect->setHeight(qRound(height)); | - |
563 | break; | 0 |
564 | case Qt::BottomSection: | - |
565 | rect->setHeight(qRound(height)); never executed (the execution status of this line is deduced): rect->setHeight(qRound(height)); | - |
566 | break; | 0 |
567 | case Qt::BottomLeftSection: | - |
568 | rect->setRect(startGeometry.right() - qRound(width), startGeometry.top(), never executed (the execution status of this line is deduced): rect->setRect(startGeometry.right() - qRound(width), startGeometry.top(), | - |
569 | qRound(width), qRound(height)); never executed (the execution status of this line is deduced): qRound(width), qRound(height)); | - |
570 | break; | 0 |
571 | default: | - |
572 | break; | 0 |
573 | } | - |
574 | } | 0 |
575 | | - |
576 | void QGraphicsWidgetPrivate::windowFrameMouseMoveEvent(QGraphicsSceneMouseEvent *event) | - |
577 | { | - |
578 | Q_Q(QGraphicsWidget); never executed (the execution status of this line is deduced): QGraphicsWidget * const q = q_func(); | - |
579 | ensureWindowData(); never executed (the execution status of this line is deduced): ensureWindowData(); | - |
580 | if (!(event->buttons() & Qt::LeftButton) || windowData->hoveredSubControl != QStyle::SC_TitleBarLabel) never evaluated: !(event->buttons() & Qt::LeftButton) never evaluated: windowData->hoveredSubControl != QStyle::SC_TitleBarLabel | 0 |
581 | return; | 0 |
582 | | - |
583 | QLineF delta(q->mapFromScene(event->buttonDownScenePos(Qt::LeftButton)), event->pos()); never executed (the execution status of this line is deduced): QLineF delta(q->mapFromScene(event->buttonDownScenePos(Qt::LeftButton)), event->pos()); | - |
584 | QLineF parentDelta(q->mapToParent(delta.p1()), q->mapToParent(delta.p2())); never executed (the execution status of this line is deduced): QLineF parentDelta(q->mapToParent(delta.p1()), q->mapToParent(delta.p2())); | - |
585 | QLineF parentXDelta(q->mapToParent(QPointF(delta.p1().x(), 0)), q->mapToParent(QPointF(delta.p2().x(), 0))); never executed (the execution status of this line is deduced): QLineF parentXDelta(q->mapToParent(QPointF(delta.p1().x(), 0)), q->mapToParent(QPointF(delta.p2().x(), 0))); | - |
586 | QLineF parentYDelta(q->mapToParent(QPointF(0, delta.p1().y())), q->mapToParent(QPointF(0, delta.p2().y()))); never executed (the execution status of this line is deduced): QLineF parentYDelta(q->mapToParent(QPointF(0, delta.p1().y())), q->mapToParent(QPointF(0, delta.p2().y()))); | - |
587 | | - |
588 | QRectF newGeometry; never executed (the execution status of this line is deduced): QRectF newGeometry; | - |
589 | switch (windowData->grabbedSection) { | - |
590 | case Qt::LeftSection: | - |
591 | newGeometry = QRectF(windowData->startGeometry.topLeft() never executed (the execution status of this line is deduced): newGeometry = QRectF(windowData->startGeometry.topLeft() | - |
592 | + QPointF(parentXDelta.dx(), parentXDelta.dy()), never executed (the execution status of this line is deduced): + QPointF(parentXDelta.dx(), parentXDelta.dy()), | - |
593 | windowData->startGeometry.size() - QSizeF(delta.dx(), delta.dy())); never executed (the execution status of this line is deduced): windowData->startGeometry.size() - QSizeF(delta.dx(), delta.dy())); | - |
594 | break; | 0 |
595 | case Qt::TopLeftSection: | - |
596 | newGeometry = QRectF(windowData->startGeometry.topLeft() never executed (the execution status of this line is deduced): newGeometry = QRectF(windowData->startGeometry.topLeft() | - |
597 | + QPointF(parentDelta.dx(), parentDelta.dy()), never executed (the execution status of this line is deduced): + QPointF(parentDelta.dx(), parentDelta.dy()), | - |
598 | windowData->startGeometry.size() - QSizeF(delta.dx(), delta.dy())); never executed (the execution status of this line is deduced): windowData->startGeometry.size() - QSizeF(delta.dx(), delta.dy())); | - |
599 | break; | 0 |
600 | case Qt::TopSection: | - |
601 | newGeometry = QRectF(windowData->startGeometry.topLeft() never executed (the execution status of this line is deduced): newGeometry = QRectF(windowData->startGeometry.topLeft() | - |
602 | + QPointF(parentYDelta.dx(), parentYDelta.dy()), never executed (the execution status of this line is deduced): + QPointF(parentYDelta.dx(), parentYDelta.dy()), | - |
603 | windowData->startGeometry.size() - QSizeF(0, delta.dy())); never executed (the execution status of this line is deduced): windowData->startGeometry.size() - QSizeF(0, delta.dy())); | - |
604 | break; | 0 |
605 | case Qt::TopRightSection: | - |
606 | newGeometry = QRectF(windowData->startGeometry.topLeft() never executed (the execution status of this line is deduced): newGeometry = QRectF(windowData->startGeometry.topLeft() | - |
607 | + QPointF(parentYDelta.dx(), parentYDelta.dy()), never executed (the execution status of this line is deduced): + QPointF(parentYDelta.dx(), parentYDelta.dy()), | - |
608 | windowData->startGeometry.size() - QSizeF(-delta.dx(), delta.dy())); never executed (the execution status of this line is deduced): windowData->startGeometry.size() - QSizeF(-delta.dx(), delta.dy())); | - |
609 | break; | 0 |
610 | case Qt::RightSection: | - |
611 | newGeometry = QRectF(windowData->startGeometry.topLeft(), never executed (the execution status of this line is deduced): newGeometry = QRectF(windowData->startGeometry.topLeft(), | - |
612 | windowData->startGeometry.size() + QSizeF(delta.dx(), 0)); never executed (the execution status of this line is deduced): windowData->startGeometry.size() + QSizeF(delta.dx(), 0)); | - |
613 | break; | 0 |
614 | case Qt::BottomRightSection: | - |
615 | newGeometry = QRectF(windowData->startGeometry.topLeft(), never executed (the execution status of this line is deduced): newGeometry = QRectF(windowData->startGeometry.topLeft(), | - |
616 | windowData->startGeometry.size() + QSizeF(delta.dx(), delta.dy())); never executed (the execution status of this line is deduced): windowData->startGeometry.size() + QSizeF(delta.dx(), delta.dy())); | - |
617 | break; | 0 |
618 | case Qt::BottomSection: | - |
619 | newGeometry = QRectF(windowData->startGeometry.topLeft(), never executed (the execution status of this line is deduced): newGeometry = QRectF(windowData->startGeometry.topLeft(), | - |
620 | windowData->startGeometry.size() + QSizeF(0, delta.dy())); never executed (the execution status of this line is deduced): windowData->startGeometry.size() + QSizeF(0, delta.dy())); | - |
621 | break; | 0 |
622 | case Qt::BottomLeftSection: | - |
623 | newGeometry = QRectF(windowData->startGeometry.topLeft() never executed (the execution status of this line is deduced): newGeometry = QRectF(windowData->startGeometry.topLeft() | - |
624 | + QPointF(parentXDelta.dx(), parentXDelta.dy()), never executed (the execution status of this line is deduced): + QPointF(parentXDelta.dx(), parentXDelta.dy()), | - |
625 | windowData->startGeometry.size() - QSizeF(delta.dx(), -delta.dy())); never executed (the execution status of this line is deduced): windowData->startGeometry.size() - QSizeF(delta.dx(), -delta.dy())); | - |
626 | break; | 0 |
627 | case Qt::TitleBarArea: | - |
628 | newGeometry = QRectF(windowData->startGeometry.topLeft() never executed (the execution status of this line is deduced): newGeometry = QRectF(windowData->startGeometry.topLeft() | - |
629 | + QPointF(parentDelta.dx(), parentDelta.dy()), never executed (the execution status of this line is deduced): + QPointF(parentDelta.dx(), parentDelta.dy()), | - |
630 | windowData->startGeometry.size()); never executed (the execution status of this line is deduced): windowData->startGeometry.size()); | - |
631 | break; | 0 |
632 | case Qt::NoSection: | - |
633 | break; | 0 |
634 | } | - |
635 | | - |
636 | if (windowData->grabbedSection != Qt::NoSection) { never evaluated: windowData->grabbedSection != Qt::NoSection | 0 |
637 | _q_boundGeometryToSizeConstraints(windowData->startGeometry, &newGeometry, never executed (the execution status of this line is deduced): _q_boundGeometryToSizeConstraints(windowData->startGeometry, &newGeometry, | - |
638 | windowData->grabbedSection, never executed (the execution status of this line is deduced): windowData->grabbedSection, | - |
639 | q->effectiveSizeHint(Qt::MinimumSize), never executed (the execution status of this line is deduced): q->effectiveSizeHint(Qt::MinimumSize), | - |
640 | q->effectiveSizeHint(Qt::MaximumSize), never executed (the execution status of this line is deduced): q->effectiveSizeHint(Qt::MaximumSize), | - |
641 | q); never executed (the execution status of this line is deduced): q); | - |
642 | q->setGeometry(newGeometry); never executed (the execution status of this line is deduced): q->setGeometry(newGeometry); | - |
643 | } | 0 |
644 | } | 0 |
645 | | - |
646 | void QGraphicsWidgetPrivate::windowFrameHoverMoveEvent(QGraphicsSceneHoverEvent *event) | - |
647 | { | - |
648 | Q_Q(QGraphicsWidget); never executed (the execution status of this line is deduced): QGraphicsWidget * const q = q_func(); | - |
649 | if (!hasDecoration()) never evaluated: !hasDecoration() | 0 |
650 | return; | 0 |
651 | | - |
652 | ensureWindowData(); never executed (the execution status of this line is deduced): ensureWindowData(); | - |
653 | | - |
654 | if (q->rect().contains(event->pos())) { never evaluated: q->rect().contains(event->pos()) | 0 |
655 | if (windowData->buttonMouseOver || windowData->hoveredSubControl != QStyle::SC_None) never evaluated: windowData->buttonMouseOver never evaluated: windowData->hoveredSubControl != QStyle::SC_None | 0 |
656 | windowFrameHoverLeaveEvent(event); never executed: windowFrameHoverLeaveEvent(event); | 0 |
657 | return; | 0 |
658 | } | - |
659 | | - |
660 | bool wasMouseOver = windowData->buttonMouseOver; never executed (the execution status of this line is deduced): bool wasMouseOver = windowData->buttonMouseOver; | - |
661 | QRect oldButtonRect = windowData->buttonRect; never executed (the execution status of this line is deduced): QRect oldButtonRect = windowData->buttonRect; | - |
662 | windowData->buttonRect = QRect(); never executed (the execution status of this line is deduced): windowData->buttonRect = QRect(); | - |
663 | windowData->buttonMouseOver = false; never executed (the execution status of this line is deduced): windowData->buttonMouseOver = false; | - |
664 | QPointF pos = event->pos(); never executed (the execution status of this line is deduced): QPointF pos = event->pos(); | - |
665 | QStyleOptionTitleBar bar; never executed (the execution status of this line is deduced): QStyleOptionTitleBar bar; | - |
666 | // make sure that the coordinates (rect and pos) we send to the style are positive. | - |
667 | if (windowFrameMargins) { never evaluated: windowFrameMargins | 0 |
668 | pos.rx() += windowFrameMargins[Left]; never executed (the execution status of this line is deduced): pos.rx() += windowFrameMargins[Left]; | - |
669 | pos.ry() += windowFrameMargins[Top]; never executed (the execution status of this line is deduced): pos.ry() += windowFrameMargins[Top]; | - |
670 | } | 0 |
671 | initStyleOptionTitleBar(&bar); never executed (the execution status of this line is deduced): initStyleOptionTitleBar(&bar); | - |
672 | bar.rect = q->windowFrameRect().toRect(); never executed (the execution status of this line is deduced): bar.rect = q->windowFrameRect().toRect(); | - |
673 | bar.rect.moveTo(0,0); never executed (the execution status of this line is deduced): bar.rect.moveTo(0,0); | - |
674 | bar.rect.setHeight(int(titleBarHeight(bar))); never executed (the execution status of this line is deduced): bar.rect.setHeight(int(titleBarHeight(bar))); | - |
675 | | - |
676 | Qt::CursorShape cursorShape = Qt::ArrowCursor; never executed (the execution status of this line is deduced): Qt::CursorShape cursorShape = Qt::ArrowCursor; | - |
677 | bool needsSetCursorCall = true; never executed (the execution status of this line is deduced): bool needsSetCursorCall = true; | - |
678 | switch (q->windowFrameSectionAt(event->pos())) { | - |
679 | case Qt::TopLeftSection: | - |
680 | case Qt::BottomRightSection: | - |
681 | cursorShape = Qt::SizeFDiagCursor; never executed (the execution status of this line is deduced): cursorShape = Qt::SizeFDiagCursor; | - |
682 | break; | 0 |
683 | case Qt::TopRightSection: | - |
684 | case Qt::BottomLeftSection: | - |
685 | cursorShape = Qt::SizeBDiagCursor; never executed (the execution status of this line is deduced): cursorShape = Qt::SizeBDiagCursor; | - |
686 | break; | 0 |
687 | case Qt::LeftSection: | - |
688 | case Qt::RightSection: | - |
689 | cursorShape = Qt::SizeHorCursor; never executed (the execution status of this line is deduced): cursorShape = Qt::SizeHorCursor; | - |
690 | break; | 0 |
691 | case Qt::TopSection: | - |
692 | case Qt::BottomSection: | - |
693 | cursorShape = Qt::SizeVerCursor; never executed (the execution status of this line is deduced): cursorShape = Qt::SizeVerCursor; | - |
694 | break; | 0 |
695 | case Qt::TitleBarArea: | - |
696 | windowData->buttonRect = q->style()->subControlRect( never executed (the execution status of this line is deduced): windowData->buttonRect = q->style()->subControlRect( | - |
697 | QStyle::CC_TitleBar, &bar, QStyle::SC_TitleBarCloseButton, 0); never executed (the execution status of this line is deduced): QStyle::CC_TitleBar, &bar, QStyle::SC_TitleBarCloseButton, 0); | - |
698 | #ifdef Q_WS_MAC | - |
699 | // On mac we should hover if we are in the 'area' of the buttons | - |
700 | windowData->buttonRect |= q->style()->subControlRect( | - |
701 | QStyle::CC_TitleBar, &bar, QStyle::SC_TitleBarMinButton, 0); | - |
702 | windowData->buttonRect |= q->style()->subControlRect( | - |
703 | QStyle::CC_TitleBar, &bar, QStyle::SC_TitleBarMaxButton, 0); | - |
704 | #endif | - |
705 | if (windowData->buttonRect.contains(pos.toPoint())) never evaluated: windowData->buttonRect.contains(pos.toPoint()) | 0 |
706 | windowData->buttonMouseOver = true; never executed: windowData->buttonMouseOver = true; | 0 |
707 | event->ignore(); never executed (the execution status of this line is deduced): event->ignore(); | - |
708 | break; | 0 |
709 | default: | - |
710 | needsSetCursorCall = false; never executed (the execution status of this line is deduced): needsSetCursorCall = false; | - |
711 | event->ignore(); never executed (the execution status of this line is deduced): event->ignore(); | - |
712 | } | 0 |
713 | #ifndef QT_NO_CURSOR | - |
714 | if (needsSetCursorCall) never evaluated: needsSetCursorCall | 0 |
715 | q->setCursor(cursorShape); never executed: q->setCursor(cursorShape); | 0 |
716 | #endif | - |
717 | // update buttons if we hover over them | - |
718 | windowData->hoveredSubControl = q->style()->hitTestComplexControl(QStyle::CC_TitleBar, &bar, pos.toPoint(), 0); never executed (the execution status of this line is deduced): windowData->hoveredSubControl = q->style()->hitTestComplexControl(QStyle::CC_TitleBar, &bar, pos.toPoint(), 0); | - |
719 | if (windowData->hoveredSubControl != QStyle::SC_TitleBarCloseButton) never evaluated: windowData->hoveredSubControl != QStyle::SC_TitleBarCloseButton | 0 |
720 | windowData->hoveredSubControl = QStyle::SC_TitleBarLabel; never executed: windowData->hoveredSubControl = QStyle::SC_TitleBarLabel; | 0 |
721 | | - |
722 | if (windowData->buttonMouseOver != wasMouseOver) { never evaluated: windowData->buttonMouseOver != wasMouseOver | 0 |
723 | if (!oldButtonRect.isNull()) never evaluated: !oldButtonRect.isNull() | 0 |
724 | q->update(QRectF(oldButtonRect).translated(q->windowFrameRect().topLeft())); never executed: q->update(QRectF(oldButtonRect).translated(q->windowFrameRect().topLeft())); | 0 |
725 | if (!windowData->buttonRect.isNull()) never evaluated: !windowData->buttonRect.isNull() | 0 |
726 | q->update(QRectF(windowData->buttonRect).translated(q->windowFrameRect().topLeft())); never executed: q->update(QRectF(windowData->buttonRect).translated(q->windowFrameRect().topLeft())); | 0 |
727 | } | 0 |
728 | } | 0 |
729 | | - |
730 | void QGraphicsWidgetPrivate::windowFrameHoverLeaveEvent(QGraphicsSceneHoverEvent *event) | - |
731 | { | - |
732 | Q_UNUSED(event); never executed (the execution status of this line is deduced): (void)event;; | - |
733 | Q_Q(QGraphicsWidget); never executed (the execution status of this line is deduced): QGraphicsWidget * const q = q_func(); | - |
734 | if (hasDecoration()) { never evaluated: hasDecoration() | 0 |
735 | // ### restore the cursor, don't override it | - |
736 | #ifndef QT_NO_CURSOR | - |
737 | q->unsetCursor(); never executed (the execution status of this line is deduced): q->unsetCursor(); | - |
738 | #endif | - |
739 | | - |
740 | ensureWindowData(); never executed (the execution status of this line is deduced): ensureWindowData(); | - |
741 | | - |
742 | bool needsUpdate = false; never executed (the execution status of this line is deduced): bool needsUpdate = false; | - |
743 | if (windowData->hoveredSubControl == QStyle::SC_TitleBarCloseButton never evaluated: windowData->hoveredSubControl == QStyle::SC_TitleBarCloseButton | 0 |
744 | || windowData->buttonMouseOver) never evaluated: windowData->buttonMouseOver | 0 |
745 | needsUpdate = true; never executed: needsUpdate = true; | 0 |
746 | | - |
747 | // update the hover state (of buttons etc...) | - |
748 | windowData->hoveredSubControl = QStyle::SC_None; never executed (the execution status of this line is deduced): windowData->hoveredSubControl = QStyle::SC_None; | - |
749 | windowData->buttonMouseOver = false; never executed (the execution status of this line is deduced): windowData->buttonMouseOver = false; | - |
750 | windowData->buttonRect = QRect(); never executed (the execution status of this line is deduced): windowData->buttonRect = QRect(); | - |
751 | if (needsUpdate) never evaluated: needsUpdate | 0 |
752 | q->update(windowData->buttonRect); never executed: q->update(windowData->buttonRect); | 0 |
753 | } | 0 |
754 | } | 0 |
755 | | - |
756 | bool QGraphicsWidgetPrivate::hasDecoration() const | - |
757 | { | - |
758 | return (windowFlags & Qt::Window) && (windowFlags & Qt::WindowTitleHint); executed: return (windowFlags & Qt::Window) && (windowFlags & Qt::WindowTitleHint); Execution Count:231 | 231 |
759 | } | - |
760 | | - |
761 | /** | - |
762 | * is called after a reparent has taken place to fix up the focus chain(s) | - |
763 | */ | - |
764 | void QGraphicsWidgetPrivate::fixFocusChainBeforeReparenting(QGraphicsWidget *newParent, QGraphicsScene *oldScene, QGraphicsScene *newScene) | - |
765 | { | - |
766 | Q_Q(QGraphicsWidget); executed (the execution status of this line is deduced): QGraphicsWidget * const q = q_func(); | - |
767 | | - |
768 | Q_ASSERT(focusNext && focusPrev); executed (the execution status of this line is deduced): qt_noop(); | - |
769 | | - |
770 | QGraphicsWidget *n = q; //last one in 'new' list executed (the execution status of this line is deduced): QGraphicsWidget *n = q; | - |
771 | QGraphicsWidget *o = 0; //last one in 'old' list executed (the execution status of this line is deduced): QGraphicsWidget *o = 0; | - |
772 | | - |
773 | QGraphicsWidget *w = focusNext; executed (the execution status of this line is deduced): QGraphicsWidget *w = focusNext; | - |
774 | | - |
775 | QGraphicsWidget *firstOld = 0; executed (the execution status of this line is deduced): QGraphicsWidget *firstOld = 0; | - |
776 | bool wasPreviousNew = true; executed (the execution status of this line is deduced): bool wasPreviousNew = true; | - |
777 | | - |
778 | while (w != q) { evaluated: w != q yes Evaluation Count:17 | yes Evaluation Count:1507 |
| 17-1507 |
779 | bool isCurrentNew = q->isAncestorOf(w); executed (the execution status of this line is deduced): bool isCurrentNew = q->isAncestorOf(w); | - |
780 | if (isCurrentNew) { partially evaluated: isCurrentNew no Evaluation Count:0 | yes Evaluation Count:17 |
| 0-17 |
781 | if (!wasPreviousNew) { never evaluated: !wasPreviousNew | 0 |
782 | n->d_func()->focusNext = w; never executed (the execution status of this line is deduced): n->d_func()->focusNext = w; | - |
783 | w->d_func()->focusPrev = n; never executed (the execution status of this line is deduced): w->d_func()->focusPrev = n; | - |
784 | } | 0 |
785 | n = w; never executed (the execution status of this line is deduced): n = w; | - |
786 | } else /*if (!isCurrentNew)*/ { | 0 |
787 | if (wasPreviousNew) { evaluated: wasPreviousNew yes Evaluation Count:7 | yes Evaluation Count:10 |
| 7-10 |
788 | if (o) { partially evaluated: o no Evaluation Count:0 | yes Evaluation Count:7 |
| 0-7 |
789 | o->d_func()->focusNext = w; never executed (the execution status of this line is deduced): o->d_func()->focusNext = w; | - |
790 | w->d_func()->focusPrev = o; never executed (the execution status of this line is deduced): w->d_func()->focusPrev = o; | - |
791 | } else { | 0 |
792 | firstOld = w; executed (the execution status of this line is deduced): firstOld = w; | - |
793 | } executed: } Execution Count:7 | 7 |
794 | } | - |
795 | o = w; executed (the execution status of this line is deduced): o = w; | - |
796 | } executed: } Execution Count:17 | 17 |
797 | w = w->d_func()->focusNext; executed (the execution status of this line is deduced): w = w->d_func()->focusNext; | - |
798 | wasPreviousNew = isCurrentNew; executed (the execution status of this line is deduced): wasPreviousNew = isCurrentNew; | - |
799 | } executed: } Execution Count:17 | 17 |
800 | | - |
801 | // repair the 'old' chain | - |
802 | if (firstOld) { evaluated: firstOld yes Evaluation Count:7 | yes Evaluation Count:1500 |
| 7-1500 |
803 | o->d_func()->focusNext = firstOld; executed (the execution status of this line is deduced): o->d_func()->focusNext = firstOld; | - |
804 | firstOld->d_func()->focusPrev = o; executed (the execution status of this line is deduced): firstOld->d_func()->focusPrev = o; | - |
805 | } executed: } Execution Count:7 | 7 |
806 | | - |
807 | // update tabFocusFirst for oldScene if the item is going to be removed from oldScene | - |
808 | if (newParent) evaluated: newParent yes Evaluation Count:776 | yes Evaluation Count:731 |
| 731-776 |
809 | newScene = newParent->scene(); executed: newScene = newParent->scene(); Execution Count:776 | 776 |
810 | | - |
811 | if (oldScene && newScene != oldScene) evaluated: oldScene yes Evaluation Count:10 | yes Evaluation Count:1497 |
evaluated: newScene != oldScene yes Evaluation Count:7 | yes Evaluation Count:3 |
| 3-1497 |
812 | oldScene->d_func()->tabFocusFirst = (firstOld && firstOld->scene() == oldScene) ? firstOld : 0; executed: oldScene->d_func()->tabFocusFirst = (firstOld && firstOld->scene() == oldScene) ? firstOld : 0; Execution Count:7 evaluated: firstOld yes Evaluation Count:4 | yes Evaluation Count:3 |
partially evaluated: firstOld->scene() == oldScene yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-7 |
813 | | - |
814 | QGraphicsItem *topLevelItem = newParent ? newParent->topLevelItem() : 0; evaluated: newParent yes Evaluation Count:776 | yes Evaluation Count:731 |
| 731-776 |
815 | QGraphicsWidget *topLevel = 0; executed (the execution status of this line is deduced): QGraphicsWidget *topLevel = 0; | - |
816 | if (topLevelItem && topLevelItem->isWidget()) evaluated: topLevelItem yes Evaluation Count:776 | yes Evaluation Count:731 |
partially evaluated: topLevelItem->isWidget() yes Evaluation Count:776 | no Evaluation Count:0 |
| 0-776 |
817 | topLevel = static_cast<QGraphicsWidget *>(topLevelItem); executed: topLevel = static_cast<QGraphicsWidget *>(topLevelItem); Execution Count:776 | 776 |
818 | | - |
819 | if (topLevel && newParent) { evaluated: topLevel yes Evaluation Count:776 | yes Evaluation Count:731 |
partially evaluated: newParent yes Evaluation Count:776 | no Evaluation Count:0 |
| 0-776 |
820 | QGraphicsWidget *last = topLevel->d_func()->focusPrev; executed (the execution status of this line is deduced): QGraphicsWidget *last = topLevel->d_func()->focusPrev; | - |
821 | // link last with new chain | - |
822 | last->d_func()->focusNext = q; executed (the execution status of this line is deduced): last->d_func()->focusNext = q; | - |
823 | focusPrev = last; executed (the execution status of this line is deduced): focusPrev = last; | - |
824 | | - |
825 | // link last in chain with | - |
826 | topLevel->d_func()->focusPrev = n; executed (the execution status of this line is deduced): topLevel->d_func()->focusPrev = n; | - |
827 | n->d_func()->focusNext = topLevel; executed (the execution status of this line is deduced): n->d_func()->focusNext = topLevel; | - |
828 | } else { executed: } Execution Count:776 | 776 |
829 | // q is the start of the focus chain | - |
830 | n->d_func()->focusNext = q; executed (the execution status of this line is deduced): n->d_func()->focusNext = q; | - |
831 | focusPrev = n; executed (the execution status of this line is deduced): focusPrev = n; | - |
832 | } executed: } Execution Count:731 | 731 |
833 | | - |
834 | } | - |
835 | | - |
836 | void QGraphicsWidgetPrivate::setLayout_helper(QGraphicsLayout *l) | - |
837 | { | - |
838 | delete (this->layout); executed (the execution status of this line is deduced): delete (this->layout); | - |
839 | layout = l; executed (the execution status of this line is deduced): layout = l; | - |
840 | if (!l) { evaluated: !l yes Evaluation Count:7 | yes Evaluation Count:214 |
| 7-214 |
841 | Q_Q(QGraphicsWidget); executed (the execution status of this line is deduced): QGraphicsWidget * const q = q_func(); | - |
842 | q->updateGeometry(); executed (the execution status of this line is deduced): q->updateGeometry(); | - |
843 | } executed: } Execution Count:7 | 7 |
844 | } executed: } Execution Count:221 | 221 |
845 | | - |
846 | qreal QGraphicsWidgetPrivate::width() const | - |
847 | { | - |
848 | Q_Q(const QGraphicsWidget); never executed (the execution status of this line is deduced): const QGraphicsWidget * const q = q_func(); | - |
849 | return q->geometry().width(); never executed: return q->geometry().width(); | 0 |
850 | } | - |
851 | | - |
852 | void QGraphicsWidgetPrivate::setWidth(qreal w) | - |
853 | { | - |
854 | if (qIsNaN(w)) never evaluated: qIsNaN(w) | 0 |
855 | return; | 0 |
856 | Q_Q(QGraphicsWidget); never executed (the execution status of this line is deduced): QGraphicsWidget * const q = q_func(); | - |
857 | if (q->geometry().width() == w) never evaluated: q->geometry().width() == w | 0 |
858 | return; | 0 |
859 | | - |
860 | q->setGeometry(QRectF(q->x(), q->y(), w, height())); never executed (the execution status of this line is deduced): q->setGeometry(QRectF(q->x(), q->y(), w, height())); | - |
861 | } | 0 |
862 | | - |
863 | void QGraphicsWidgetPrivate::resetWidth() | - |
864 | { | - |
865 | Q_Q(QGraphicsWidget); never executed (the execution status of this line is deduced): QGraphicsWidget * const q = q_func(); | - |
866 | q->setGeometry(QRectF(q->x(), q->y(), 0, height())); never executed (the execution status of this line is deduced): q->setGeometry(QRectF(q->x(), q->y(), 0, height())); | - |
867 | } | 0 |
868 | | - |
869 | qreal QGraphicsWidgetPrivate::height() const | - |
870 | { | - |
871 | Q_Q(const QGraphicsWidget); never executed (the execution status of this line is deduced): const QGraphicsWidget * const q = q_func(); | - |
872 | return q->geometry().height(); never executed: return q->geometry().height(); | 0 |
873 | } | - |
874 | | - |
875 | void QGraphicsWidgetPrivate::setHeight(qreal h) | - |
876 | { | - |
877 | if (qIsNaN(h)) never evaluated: qIsNaN(h) | 0 |
878 | return; | 0 |
879 | Q_Q(QGraphicsWidget); never executed (the execution status of this line is deduced): QGraphicsWidget * const q = q_func(); | - |
880 | if (q->geometry().height() == h) never evaluated: q->geometry().height() == h | 0 |
881 | return; | 0 |
882 | | - |
883 | q->setGeometry(QRectF(q->x(), q->y(), width(), h)); never executed (the execution status of this line is deduced): q->setGeometry(QRectF(q->x(), q->y(), width(), h)); | - |
884 | } | 0 |
885 | | - |
886 | void QGraphicsWidgetPrivate::resetHeight() | - |
887 | { | - |
888 | Q_Q(QGraphicsWidget); never executed (the execution status of this line is deduced): QGraphicsWidget * const q = q_func(); | - |
889 | q->setGeometry(QRectF(q->x(), q->y(), width(), 0)); never executed (the execution status of this line is deduced): q->setGeometry(QRectF(q->x(), q->y(), width(), 0)); | - |
890 | } | 0 |
891 | | - |
892 | void QGraphicsWidgetPrivate::setGeometryFromSetPos() | - |
893 | { | - |
894 | if (inSetGeometry) evaluated: inSetGeometry yes Evaluation Count:752 | yes Evaluation Count:1 |
| 1-752 |
895 | return; executed: return; Execution Count:752 | 752 |
896 | Q_Q(QGraphicsWidget); executed (the execution status of this line is deduced): QGraphicsWidget * const q = q_func(); | - |
897 | inSetPos = 1; executed (the execution status of this line is deduced): inSetPos = 1; | - |
898 | // Ensure setGeometry is called (avoid recursion when setPos is | - |
899 | // called from within setGeometry). | - |
900 | q->setGeometry(QRectF(pos, q->size())); executed (the execution status of this line is deduced): q->setGeometry(QRectF(pos, q->size())); | - |
901 | inSetPos = 0 ; executed (the execution status of this line is deduced): inSetPos = 0 ; | - |
902 | } executed: } Execution Count:1 | 1 |
903 | | - |
904 | QT_END_NAMESPACE | - |
905 | | - |
906 | #endif //QT_NO_GRAPHICSVIEW | - |
907 | | - |
| | |