Line | Source Code | Coverage |
---|
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | | - |
7 | | - |
8 | | - |
9 | | - |
10 | void QGraphicsWidgetPrivate::init(QGraphicsItem *parentItem, Qt::WindowFlags wFlags) | - |
11 | { | - |
12 | QGraphicsWidget * const q = q_func(); | - |
13 | | - |
14 | attributes = 0; | - |
15 | isWidget = 1; | - |
16 | focusNext = focusPrev = q; | - |
17 | focusPolicy = Qt::NoFocus; | - |
18 | | - |
19 | adjustWindowFlags(&wFlags); | - |
20 | windowFlags = wFlags; | - |
21 | | - |
22 | if (parentItem) evaluated: parentItem yes Evaluation Count:310 | yes Evaluation Count:1134 |
| 310-1134 |
23 | setParentItemHelper(parentItem, 0, 0); executed: setParentItemHelper(parentItem, 0, 0); Execution Count:310 | 310 |
24 | | - |
25 | q->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred, QSizePolicy::DefaultType)); | - |
26 | q->setGraphicsItem(q); | - |
27 | | - |
28 | resolveLayoutDirection(); | - |
29 | q->unsetWindowFrameMargins(); | - |
30 | flags |= QGraphicsItem::ItemUsesExtendedStyleOption; | - |
31 | flags |= QGraphicsItem::ItemSendsGeometryChanges; | - |
32 | if (windowFlags & Qt::Window) evaluated: windowFlags & Qt::Window yes Evaluation Count:184 | yes Evaluation Count:1260 |
| 184-1260 |
33 | flags |= QGraphicsItem::ItemIsPanel; executed: flags |= QGraphicsItem::ItemIsPanel; Execution Count:184 | 184 |
34 | } executed: } Execution Count:1444 | 1444 |
35 | | - |
36 | qreal QGraphicsWidgetPrivate::titleBarHeight(const QStyleOptionTitleBar &options) const | - |
37 | { | - |
38 | const QGraphicsWidget * const q = q_func(); | - |
39 | int height = q->style()->pixelMetric(QStyle::PM_TitleBarHeight, &options); | - |
40 | | - |
41 | | - |
42 | | - |
43 | | - |
44 | | - |
45 | return (qreal)height; executed: return (qreal)height; Execution Count:426 | 426 |
46 | } | - |
47 | | - |
48 | | - |
49 | | - |
50 | | - |
51 | QGraphicsWidgetPrivate::~QGraphicsWidgetPrivate() | - |
52 | { | - |
53 | | - |
54 | delete[] margins; | - |
55 | delete[] windowFrameMargins; | - |
56 | delete windowData; | - |
57 | } executed: } Execution Count:936 | 936 |
58 | | - |
59 | | - |
60 | | - |
61 | | - |
62 | | - |
63 | | - |
64 | | - |
65 | void QGraphicsWidgetPrivate::ensureMargins() const | - |
66 | { | - |
67 | if (!margins) { evaluated: !margins yes Evaluation Count:195 | yes Evaluation Count:174 |
| 174-195 |
68 | margins = new qreal[4]; | - |
69 | for (int i = 0; i < 4; ++i) evaluated: i < 4 yes Evaluation Count:780 | yes Evaluation Count:195 |
| 195-780 |
70 | margins[i] = 0; executed: margins[i] = 0; Execution Count:780 | 780 |
71 | } executed: } Execution Count:195 | 195 |
72 | } executed: } Execution Count:369 | 369 |
73 | | - |
74 | | - |
75 | | - |
76 | | - |
77 | | - |
78 | | - |
79 | | - |
80 | void QGraphicsWidgetPrivate::ensureWindowFrameMargins() const | - |
81 | { | - |
82 | if (!windowFrameMargins) { partially evaluated: !windowFrameMargins yes Evaluation Count:185 | no Evaluation Count:0 |
| 0-185 |
83 | windowFrameMargins = new qreal[4]; | - |
84 | for (int i = 0; i < 4; ++i) evaluated: i < 4 yes Evaluation Count:740 | yes Evaluation Count:185 |
| 185-740 |
85 | windowFrameMargins[i] = 0; executed: windowFrameMargins[i] = 0; Execution Count:740 | 740 |
86 | } executed: } Execution Count:185 | 185 |
87 | } executed: } Execution Count:185 | 185 |
88 | | - |
89 | | - |
90 | | - |
91 | | - |
92 | | - |
93 | | - |
94 | | - |
95 | void QGraphicsWidgetPrivate::ensureWindowData() | - |
96 | { | - |
97 | if (!windowData) evaluated: !windowData yes Evaluation Count:194 | yes Evaluation Count:57 |
| 57-194 |
98 | windowData = new WindowData; executed: windowData = new WindowData; Execution Count:194 | 194 |
99 | } executed: } Execution Count:251 | 251 |
100 | | - |
101 | void QGraphicsWidgetPrivate::setPalette_helper(const QPalette &palette) | - |
102 | { | - |
103 | if (this->palette == palette && this->palette.resolve() == palette.resolve()) never evaluated: this->palette == palette never evaluated: this->palette.resolve() == palette.resolve() | 0 |
104 | return; | 0 |
105 | updatePalette(palette); | - |
106 | } | 0 |
107 | | - |
108 | void QGraphicsWidgetPrivate::resolvePalette(uint inheritedMask) | - |
109 | { | - |
110 | inheritedPaletteResolveMask = inheritedMask; | - |
111 | QPalette naturalPalette = naturalWidgetPalette(); | - |
112 | QPalette resolvedPalette = palette.resolve(naturalPalette); | - |
113 | updatePalette(resolvedPalette); | - |
114 | } executed: } Execution Count:1434 | 1434 |
115 | | - |
116 | void QGraphicsWidgetPrivate::updatePalette(const QPalette &palette) | - |
117 | { | - |
118 | QGraphicsWidget * const q = q_func(); | - |
119 | | - |
120 | this->palette = palette; | - |
121 | | - |
122 | | - |
123 | 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 |
124 | inheritedPaletteResolveMask = 0; executed: inheritedPaletteResolveMask = 0; Execution Count:174 | 174 |
125 | int mask = palette.resolve() | inheritedPaletteResolveMask; | - |
126 | | - |
127 | | - |
128 | for (int i = 0; i < children.size(); ++i) { evaluated: i < children.size() yes Evaluation Count:22 | yes Evaluation Count:1434 |
| 22-1434 |
129 | QGraphicsItem *item = children.at(i); | - |
130 | if (item->isWidget()) { partially evaluated: item->isWidget() yes Evaluation Count:22 | no Evaluation Count:0 |
| 0-22 |
131 | QGraphicsWidget *w = static_cast<QGraphicsWidget *>(item); | - |
132 | 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 |
133 | w->d_func()->resolvePalette(mask); executed: w->d_func()->resolvePalette(mask); Execution Count:22 | 22 |
134 | } else { executed: } Execution Count:22 | 22 |
135 | item->d_ptr->resolvePalette(mask); | - |
136 | } | 0 |
137 | } | - |
138 | | - |
139 | | - |
140 | QEvent event(QEvent::PaletteChange); | - |
141 | QApplication::sendEvent(q, &event); | - |
142 | } executed: } Execution Count:1434 | 1434 |
143 | | - |
144 | void QGraphicsWidgetPrivate::setLayoutDirection_helper(Qt::LayoutDirection direction) | - |
145 | { | - |
146 | QGraphicsWidget * const q = q_func(); | - |
147 | 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 |
148 | return; executed: return; Execution Count:1453 | 1453 |
149 | q->setAttribute(Qt::WA_RightToLeft, (direction == Qt::RightToLeft)); | - |
150 | | - |
151 | | - |
152 | for (int i = 0; i < children.size(); ++i) { evaluated: i < children.size() yes Evaluation Count:10 | yes Evaluation Count:13 |
| 10-13 |
153 | QGraphicsItem *item = children.at(i); | - |
154 | if (item->isWidget()) { partially evaluated: item->isWidget() yes Evaluation Count:10 | no Evaluation Count:0 |
| 0-10 |
155 | QGraphicsWidget *widget = static_cast<QGraphicsWidget *>(item); | - |
156 | 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 |
157 | widget->d_func()->setLayoutDirection_helper(direction); executed: widget->d_func()->setLayoutDirection_helper(direction); Execution Count:10 | 10 |
158 | } executed: } Execution Count:10 | 10 |
159 | } executed: } Execution Count:10 | 10 |
160 | | - |
161 | | - |
162 | QEvent e(QEvent::LayoutDirectionChange); | - |
163 | QApplication::sendEvent(q, &e); | - |
164 | } executed: } Execution Count:13 | 13 |
165 | | - |
166 | void QGraphicsWidgetPrivate::resolveLayoutDirection() | - |
167 | { | - |
168 | QGraphicsWidget * const q = q_func(); | - |
169 | if (q->testAttribute(Qt::WA_SetLayoutDirection)) { partially evaluated: q->testAttribute(Qt::WA_SetLayoutDirection) no Evaluation Count:0 | yes Evaluation Count:1444 |
| 0-1444 |
170 | return; | 0 |
171 | } | - |
172 | if (QGraphicsWidget *parentWidget = q->parentWidget()) { evaluated: QGraphicsWidget *parentWidget = q->parentWidget() yes Evaluation Count:310 | yes Evaluation Count:1134 |
| 310-1134 |
173 | setLayoutDirection_helper(parentWidget->layoutDirection()); | - |
174 | } else if (scene) { partially evaluated: scene no Evaluation Count:0 | yes Evaluation Count:1134 |
executed: } Execution Count:310 | 0-1134 |
175 | | - |
176 | | - |
177 | setLayoutDirection_helper(QApplication::layoutDirection()); | - |
178 | } else { | 0 |
179 | setLayoutDirection_helper(QApplication::layoutDirection()); | - |
180 | } executed: } Execution Count:1134 | 1134 |
181 | } | - |
182 | | - |
183 | QPalette QGraphicsWidgetPrivate::naturalWidgetPalette() const | - |
184 | { | - |
185 | const QGraphicsWidget * const q = q_func(); | - |
186 | QPalette palette; | - |
187 | if (QGraphicsWidget *parent = q->parentWidget()) { evaluated: QGraphicsWidget *parent = q->parentWidget() yes Evaluation Count:1221 | yes Evaluation Count:213 |
| 213-1221 |
188 | palette = parent->palette(); | - |
189 | } else if (scene) { evaluated: scene yes Evaluation Count:206 | yes Evaluation Count:7 |
executed: } Execution Count:1221 | 7-1221 |
190 | palette = scene->palette(); | - |
191 | } executed: } Execution Count:206 | 206 |
192 | palette.resolve(0); | - |
193 | return palette; executed: return palette; Execution Count:1434 | 1434 |
194 | } | - |
195 | | - |
196 | void QGraphicsWidgetPrivate::setFont_helper(const QFont &font) | - |
197 | { | - |
198 | if (this->font == font && this->font.resolve() == font.resolve()) never evaluated: this->font == font never evaluated: this->font.resolve() == font.resolve() | 0 |
199 | return; | 0 |
200 | updateFont(font); | - |
201 | } | 0 |
202 | | - |
203 | void QGraphicsWidgetPrivate::resolveFont(uint inheritedMask) | - |
204 | { | - |
205 | QGraphicsWidget * const q = q_func(); | - |
206 | inheritedFontResolveMask = inheritedMask; | - |
207 | if (QGraphicsWidget *p = q->parentWidget()) evaluated: QGraphicsWidget *p = q->parentWidget() yes Evaluation Count:1221 | yes Evaluation Count:215 |
| 215-1221 |
208 | inheritedFontResolveMask |= p->d_func()->inheritedFontResolveMask; executed: inheritedFontResolveMask |= p->d_func()->inheritedFontResolveMask; Execution Count:1221 | 1221 |
209 | QFont naturalFont = naturalWidgetFont(); | - |
210 | QFont resolvedFont = font.resolve(naturalFont); | - |
211 | updateFont(resolvedFont); | - |
212 | } executed: } Execution Count:1436 | 1436 |
213 | | - |
214 | void QGraphicsWidgetPrivate::updateFont(const QFont &font) | - |
215 | { | - |
216 | QGraphicsWidget * const q = q_func(); | - |
217 | | - |
218 | this->font = font; | - |
219 | | - |
220 | | - |
221 | 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 |
222 | inheritedFontResolveMask = 0; executed: inheritedFontResolveMask = 0; Execution Count:174 | 174 |
223 | int mask = font.resolve() | inheritedFontResolveMask; | - |
224 | | - |
225 | | - |
226 | for (int i = 0; i < children.size(); ++i) { evaluated: i < children.size() yes Evaluation Count:22 | yes Evaluation Count:1436 |
| 22-1436 |
227 | QGraphicsItem *item = children.at(i); | - |
228 | if (item->isWidget()) { partially evaluated: item->isWidget() yes Evaluation Count:22 | no Evaluation Count:0 |
| 0-22 |
229 | QGraphicsWidget *w = static_cast<QGraphicsWidget *>(item); | - |
230 | 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 |
231 | w->d_func()->resolveFont(mask); executed: w->d_func()->resolveFont(mask); Execution Count:22 | 22 |
232 | } else { executed: } Execution Count:22 | 22 |
233 | item->d_ptr->resolveFont(mask); | - |
234 | } | 0 |
235 | } | - |
236 | | - |
237 | if (!polished) partially evaluated: !polished yes Evaluation Count:1436 | no Evaluation Count:0 |
| 0-1436 |
238 | return; executed: return; Execution Count:1436 | 1436 |
239 | | - |
240 | QEvent event(QEvent::FontChange); | - |
241 | QApplication::sendEvent(q, &event); | - |
242 | } | 0 |
243 | | - |
244 | QFont QGraphicsWidgetPrivate::naturalWidgetFont() const | - |
245 | { | - |
246 | const QGraphicsWidget * const q = q_func(); | - |
247 | QFont naturalFont; | - |
248 | if (QGraphicsWidget *parent = q->parentWidget()) { evaluated: QGraphicsWidget *parent = q->parentWidget() yes Evaluation Count:1221 | yes Evaluation Count:215 |
| 215-1221 |
249 | naturalFont = parent->font(); | - |
250 | } else if (scene) { evaluated: scene yes Evaluation Count:208 | yes Evaluation Count:7 |
executed: } Execution Count:1221 | 7-1221 |
251 | naturalFont = scene->font(); | - |
252 | } executed: } Execution Count:208 | 208 |
253 | naturalFont.resolve(0); | - |
254 | return naturalFont; executed: return naturalFont; Execution Count:1436 | 1436 |
255 | } | - |
256 | | - |
257 | void QGraphicsWidgetPrivate::initStyleOptionTitleBar(QStyleOptionTitleBar *option) | - |
258 | { | - |
259 | QGraphicsWidget * const q = q_func(); | - |
260 | ensureWindowData(); | - |
261 | q->initStyleOption(option); | - |
262 | option->rect.setHeight(titleBarHeight(*option)); | - |
263 | option->titleBarFlags = windowFlags; | - |
264 | option->subControls = QStyle::SC_TitleBarCloseButton | QStyle::SC_TitleBarLabel | QStyle::SC_TitleBarSysMenu; | - |
265 | option->activeSubControls = windowData->hoveredSubControl; | - |
266 | bool isActive = q->isActiveWindow(); | - |
267 | if (isActive) { evaluated: isActive yes Evaluation Count:16 | yes Evaluation Count:197 |
| 16-197 |
268 | option->state |= QStyle::State_Active; | - |
269 | option->titleBarState = Qt::WindowActive; | - |
270 | option->titleBarState |= QStyle::State_Active; | - |
271 | } else { executed: } Execution Count:16 | 16 |
272 | option->state &= ~QStyle::State_Active; | - |
273 | option->titleBarState = Qt::WindowNoState; | - |
274 | } executed: } Execution Count:197 | 197 |
275 | QFont windowTitleFont = QApplication::font("QMdiSubWindowTitleBar"); | - |
276 | QRect textRect = q->style()->subControlRect(QStyle::CC_TitleBar, option, QStyle::SC_TitleBarLabel, 0); | - |
277 | option->text = QFontMetrics(windowTitleFont).elidedText( | - |
278 | windowData->windowTitle, Qt::ElideRight, textRect.width()); | - |
279 | } executed: } Execution Count:213 | 213 |
280 | | - |
281 | void QGraphicsWidgetPrivate::adjustWindowFlags(Qt::WindowFlags *flags) | - |
282 | { | - |
283 | bool customize = (*flags & (Qt::CustomizeWindowHint | - |
284 | | Qt::FramelessWindowHint | - |
285 | | Qt::WindowTitleHint | - |
286 | | Qt::WindowSystemMenuHint | - |
287 | | Qt::WindowMinimizeButtonHint | - |
288 | | Qt::WindowMaximizeButtonHint | - |
289 | | Qt::WindowContextHelpButtonHint)); | - |
290 | | - |
291 | uint type = (*flags & Qt::WindowType_Mask); | - |
292 | if (customize) evaluated: customize yes Evaluation Count:1 | yes Evaluation Count:1444 |
| 1-1444 |
293 | ; executed: ; Execution Count:1 | 1 |
294 | 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 |
295 | *flags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowContextHelpButtonHint; never executed: *flags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowContextHelpButtonHint; | 0 |
296 | else if (type == Qt::Tool) partially evaluated: type == Qt::Tool no Evaluation Count:0 | yes Evaluation Count:1444 |
| 0-1444 |
297 | *flags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint; never executed: *flags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint; | 0 |
298 | 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 |
299 | *flags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint | 184 |
300 | | Qt::WindowMinimizeButtonHint | Qt::WindowMaximizeButtonHint; executed: *flags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinimizeButtonHint | Qt::WindowMaximizeButtonHint; Execution Count:184 | 184 |
301 | } | - |
302 | | - |
303 | void QGraphicsWidgetPrivate::windowFrameMouseReleaseEvent(QGraphicsSceneMouseEvent *event) | - |
304 | { | - |
305 | QGraphicsWidget * const q = q_func(); | - |
306 | ensureWindowData(); | - |
307 | if (windowData->grabbedSection != Qt::NoSection) { never evaluated: windowData->grabbedSection != Qt::NoSection | 0 |
308 | if (windowData->grabbedSection == Qt::TitleBarArea) { never evaluated: windowData->grabbedSection == Qt::TitleBarArea | 0 |
309 | windowData->buttonSunken = false; | - |
310 | QStyleOptionTitleBar bar; | - |
311 | initStyleOptionTitleBar(&bar); | - |
312 | | - |
313 | bar.rect = q->windowFrameRect().toRect(); | - |
314 | bar.rect.moveTo(0,0); | - |
315 | bar.rect.setHeight(q->style()->pixelMetric(QStyle::PM_TitleBarHeight, &bar)); | - |
316 | QPointF pos = event->pos(); | - |
317 | if (windowFrameMargins) { never evaluated: windowFrameMargins | 0 |
318 | pos.rx() += windowFrameMargins[Left]; | - |
319 | pos.ry() += windowFrameMargins[Top]; | - |
320 | } | 0 |
321 | bar.subControls = QStyle::SC_TitleBarCloseButton; | - |
322 | if (q->style()->subControlRect(QStyle::CC_TitleBar, &bar, | 0 |
323 | QStyle::SC_TitleBarCloseButton, | 0 |
324 | event->widget()).contains(pos.toPoint())) { never evaluated: q->style()->subControlRect(QStyle::CC_TitleBar, &bar, QStyle::SC_TitleBarCloseButton, event->widget()).contains(pos.toPoint()) | 0 |
325 | q->close(); | - |
326 | } | 0 |
327 | } | 0 |
328 | if (!(static_cast<QGraphicsSceneMouseEvent *>(event)->buttons())) never evaluated: !(static_cast<QGraphicsSceneMouseEvent *>(event)->buttons()) | 0 |
329 | windowData->grabbedSection = Qt::NoSection; never executed: windowData->grabbedSection = Qt::NoSection; | 0 |
330 | event->accept(); | - |
331 | } | 0 |
332 | } | 0 |
333 | | - |
334 | void QGraphicsWidgetPrivate::windowFrameMousePressEvent(QGraphicsSceneMouseEvent *event) | - |
335 | { | - |
336 | QGraphicsWidget * const q = q_func(); | - |
337 | if (event->button() != Qt::LeftButton) never evaluated: event->button() != Qt::LeftButton | 0 |
338 | return; | 0 |
339 | | - |
340 | ensureWindowData(); | - |
341 | windowData->startGeometry = q->geometry(); | - |
342 | windowData->grabbedSection = q->windowFrameSectionAt(event->pos()); | - |
343 | ensureWindowData(); | - |
344 | if (windowData->grabbedSection == Qt::TitleBarArea never evaluated: windowData->grabbedSection == Qt::TitleBarArea | 0 |
345 | && windowData->hoveredSubControl == QStyle::SC_TitleBarCloseButton) { never evaluated: windowData->hoveredSubControl == QStyle::SC_TitleBarCloseButton | 0 |
346 | windowData->buttonSunken = true; | - |
347 | q->update(); | - |
348 | } | 0 |
349 | event->setAccepted(windowData->grabbedSection != Qt::NoSection); | - |
350 | } | 0 |
351 | static qreal minimumHeightForWidth(qreal width, qreal minh, qreal maxh, | - |
352 | const QGraphicsWidget *widget, | - |
353 | bool heightForWidth = true) | - |
354 | { | - |
355 | qreal minimumHeightForWidth = -1; | - |
356 | const bool hasHFW = QGraphicsLayoutItemPrivate::get(widget)->hasHeightForWidth(); | - |
357 | if (hasHFW == heightForWidth) { never evaluated: hasHFW == heightForWidth | 0 |
358 | minimumHeightForWidth = hasHFW | 0 |
359 | ? widget->effectiveSizeHint(Qt::MinimumSize, QSizeF(width, -1)).height() | - |
360 | : widget->effectiveSizeHint(Qt::MinimumSize, QSizeF(-1, width)).width(); | - |
361 | } else { | 0 |
362 | | - |
363 | const qreal constraint = width; | - |
364 | while (maxh - minh > 0.1) { never evaluated: maxh - minh > 0.1 | 0 |
365 | qreal middle = minh + (maxh - minh)/2; | - |
366 | | - |
367 | | - |
368 | | - |
369 | qreal hfw = hasHFW | 0 |
370 | ? widget->effectiveSizeHint(Qt::MinimumSize, QSizeF(middle, -1)).height() | - |
371 | : widget->effectiveSizeHint(Qt::MinimumSize, QSizeF(-1, middle)).width(); | - |
372 | if (hfw > constraint) { never evaluated: hfw > constraint | 0 |
373 | minh = middle; | - |
374 | } else if (hfw <= constraint) { never evaluated: hfw <= constraint | 0 |
375 | maxh = middle; | - |
376 | } | 0 |
377 | } | - |
378 | minimumHeightForWidth = maxh; | - |
379 | } | 0 |
380 | return minimumHeightForWidth; never executed: return minimumHeightForWidth; | 0 |
381 | } | - |
382 | | - |
383 | static qreal minimumWidthForHeight(qreal height, qreal minw, qreal maxw, | - |
384 | const QGraphicsWidget *widget) | - |
385 | { | - |
386 | return minimumHeightForWidth(height, minw, maxw, widget, false); never executed: return minimumHeightForWidth(height, minw, maxw, widget, false); | 0 |
387 | } | - |
388 | | - |
389 | static QSizeF closestAcceptableSize(const QSizeF &proposed, | - |
390 | const QGraphicsWidget *widget) | - |
391 | { | - |
392 | const QSizeF current = widget->size(); | - |
393 | | - |
394 | qreal minw = proposed.width(); | - |
395 | qreal maxw = current.width(); | - |
396 | qreal minh = proposed.height(); | - |
397 | qreal maxh = current.height(); | - |
398 | | - |
399 | qreal middlew = maxw; | - |
400 | qreal middleh = maxh; | - |
401 | qreal min_hfw; | - |
402 | min_hfw = minimumHeightForWidth(maxw, minh, maxh, widget); | - |
403 | | - |
404 | do { | - |
405 | if (maxw - minw < 0.1) { never evaluated: maxw - minw < 0.1 | 0 |
406 | | - |
407 | minw = maxw; | - |
408 | minh = maxh; | - |
409 | } | 0 |
410 | middlew = minw + (maxw - minw)/2.0; | - |
411 | middleh = minh + (maxh - minh)/2.0; | - |
412 | | - |
413 | min_hfw = minimumHeightForWidth(middlew, minh, maxh, widget); | - |
414 | | - |
415 | if (min_hfw > middleh) { never evaluated: min_hfw > middleh | 0 |
416 | minw = middlew; | - |
417 | minh = middleh; | - |
418 | } else if (min_hfw <= middleh) { never evaluated: min_hfw <= middleh | 0 |
419 | maxw = middlew; | - |
420 | maxh = middleh; | - |
421 | } | 0 |
422 | } while (maxw != minw); never evaluated: maxw != minw | 0 |
423 | | - |
424 | min_hfw = minimumHeightForWidth(middlew, minh, maxh, widget); | - |
425 | | - |
426 | QSizeF result; | - |
427 | if (min_hfw < maxh) { never evaluated: min_hfw < maxh | 0 |
428 | result = QSizeF(middlew, min_hfw); | - |
429 | } else { | 0 |
430 | | - |
431 | result = QSizeF(minimumWidthForHeight(maxh, proposed.width(), current.width(), widget), maxh); | - |
432 | } | 0 |
433 | return result; never executed: return result; | 0 |
434 | } | - |
435 | | - |
436 | static void _q_boundGeometryToSizeConstraints(const QRectF &startGeometry, | - |
437 | QRectF *rect, Qt::WindowFrameSection section, | - |
438 | const QSizeF &min, const QSizeF &max, | - |
439 | const QGraphicsWidget *widget) | - |
440 | { | - |
441 | const QRectF proposedRect = *rect; | - |
442 | qreal width = qBound(min.width(), proposedRect.width(), max.width()); | - |
443 | qreal height = qBound(min.height(), proposedRect.height(), max.height()); | - |
444 | | - |
445 | const bool hasHFW = QGraphicsLayoutItemPrivate::get(widget)->hasHeightForWidth(); | - |
446 | const bool hasWFH = QGraphicsLayoutItemPrivate::get(widget)->hasWidthForHeight(); | - |
447 | | - |
448 | const bool widthChanged = proposedRect.width() != widget->size().width(); | - |
449 | const bool heightChanged = proposedRect.height() != widget->size().height(); | - |
450 | | - |
451 | if (hasHFW || hasWFH) { | 0 |
452 | if (widthChanged || heightChanged) { never evaluated: widthChanged never evaluated: heightChanged | 0 |
453 | qreal minExtent; | - |
454 | qreal maxExtent; | - |
455 | qreal constraint; | - |
456 | qreal proposed; | - |
457 | if (hasHFW) { | 0 |
458 | minExtent = min.height(); | - |
459 | maxExtent = max.height(); | - |
460 | constraint = width; | - |
461 | proposed = proposedRect.height(); | - |
462 | } else { | 0 |
463 | | - |
464 | minExtent = min.width(); | - |
465 | maxExtent = max.width(); | - |
466 | constraint = height; | - |
467 | proposed = proposedRect.width(); | - |
468 | } | 0 |
469 | if (minimumHeightForWidth(constraint, minExtent, maxExtent, widget, hasHFW) > proposed) { never evaluated: minimumHeightForWidth(constraint, minExtent, maxExtent, widget, hasHFW) > proposed | 0 |
470 | QSizeF effectiveSize = closestAcceptableSize(QSizeF(width, height), widget); | - |
471 | width = effectiveSize.width(); | - |
472 | height = effectiveSize.height(); | - |
473 | } | 0 |
474 | } | 0 |
475 | } | 0 |
476 | | - |
477 | switch (section) { | - |
478 | case Qt::LeftSection: | - |
479 | rect->setRect(startGeometry.right() - qRound(width), startGeometry.top(), | - |
480 | qRound(width), startGeometry.height()); | - |
481 | break; | 0 |
482 | case Qt::TopLeftSection: | - |
483 | rect->setRect(startGeometry.right() - qRound(width), startGeometry.bottom() - qRound(height), | - |
484 | qRound(width), qRound(height)); | - |
485 | break; | 0 |
486 | case Qt::TopSection: | - |
487 | rect->setRect(startGeometry.left(), startGeometry.bottom() - qRound(height), | - |
488 | startGeometry.width(), qRound(height)); | - |
489 | break; | 0 |
490 | case Qt::TopRightSection: | - |
491 | rect->setTop(rect->bottom() - qRound(height)); | - |
492 | rect->setWidth(qRound(width)); | - |
493 | break; | 0 |
494 | case Qt::RightSection: | - |
495 | rect->setWidth(qRound(width)); | - |
496 | break; | 0 |
497 | case Qt::BottomRightSection: | - |
498 | rect->setWidth(qRound(width)); | - |
499 | rect->setHeight(qRound(height)); | - |
500 | break; | 0 |
501 | case Qt::BottomSection: | - |
502 | rect->setHeight(qRound(height)); | - |
503 | break; | 0 |
504 | case Qt::BottomLeftSection: | - |
505 | rect->setRect(startGeometry.right() - qRound(width), startGeometry.top(), | - |
506 | qRound(width), qRound(height)); | - |
507 | break; | 0 |
508 | default: | - |
509 | break; | 0 |
510 | } | - |
511 | } | 0 |
512 | | - |
513 | void QGraphicsWidgetPrivate::windowFrameMouseMoveEvent(QGraphicsSceneMouseEvent *event) | - |
514 | { | - |
515 | QGraphicsWidget * const q = q_func(); | - |
516 | ensureWindowData(); | - |
517 | if (!(event->buttons() & Qt::LeftButton) || windowData->hoveredSubControl != QStyle::SC_TitleBarLabel) never evaluated: !(event->buttons() & Qt::LeftButton) never evaluated: windowData->hoveredSubControl != QStyle::SC_TitleBarLabel | 0 |
518 | return; | 0 |
519 | | - |
520 | QLineF delta(q->mapFromScene(event->buttonDownScenePos(Qt::LeftButton)), event->pos()); | - |
521 | QLineF parentDelta(q->mapToParent(delta.p1()), q->mapToParent(delta.p2())); | - |
522 | QLineF parentXDelta(q->mapToParent(QPointF(delta.p1().x(), 0)), q->mapToParent(QPointF(delta.p2().x(), 0))); | - |
523 | QLineF parentYDelta(q->mapToParent(QPointF(0, delta.p1().y())), q->mapToParent(QPointF(0, delta.p2().y()))); | - |
524 | | - |
525 | QRectF newGeometry; | - |
526 | switch (windowData->grabbedSection) { | - |
527 | case Qt::LeftSection: | - |
528 | newGeometry = QRectF(windowData->startGeometry.topLeft() | - |
529 | + QPointF(parentXDelta.dx(), parentXDelta.dy()), | - |
530 | windowData->startGeometry.size() - QSizeF(delta.dx(), delta.dy())); | - |
531 | break; | 0 |
532 | case Qt::TopLeftSection: | - |
533 | newGeometry = QRectF(windowData->startGeometry.topLeft() | - |
534 | + QPointF(parentDelta.dx(), parentDelta.dy()), | - |
535 | windowData->startGeometry.size() - QSizeF(delta.dx(), delta.dy())); | - |
536 | break; | 0 |
537 | case Qt::TopSection: | - |
538 | newGeometry = QRectF(windowData->startGeometry.topLeft() | - |
539 | + QPointF(parentYDelta.dx(), parentYDelta.dy()), | - |
540 | windowData->startGeometry.size() - QSizeF(0, delta.dy())); | - |
541 | break; | 0 |
542 | case Qt::TopRightSection: | - |
543 | newGeometry = QRectF(windowData->startGeometry.topLeft() | - |
544 | + QPointF(parentYDelta.dx(), parentYDelta.dy()), | - |
545 | windowData->startGeometry.size() - QSizeF(-delta.dx(), delta.dy())); | - |
546 | break; | 0 |
547 | case Qt::RightSection: | - |
548 | newGeometry = QRectF(windowData->startGeometry.topLeft(), | - |
549 | windowData->startGeometry.size() + QSizeF(delta.dx(), 0)); | - |
550 | break; | 0 |
551 | case Qt::BottomRightSection: | - |
552 | newGeometry = QRectF(windowData->startGeometry.topLeft(), | - |
553 | windowData->startGeometry.size() + QSizeF(delta.dx(), delta.dy())); | - |
554 | break; | 0 |
555 | case Qt::BottomSection: | - |
556 | newGeometry = QRectF(windowData->startGeometry.topLeft(), | - |
557 | windowData->startGeometry.size() + QSizeF(0, delta.dy())); | - |
558 | break; | 0 |
559 | case Qt::BottomLeftSection: | - |
560 | newGeometry = QRectF(windowData->startGeometry.topLeft() | - |
561 | + QPointF(parentXDelta.dx(), parentXDelta.dy()), | - |
562 | windowData->startGeometry.size() - QSizeF(delta.dx(), -delta.dy())); | - |
563 | break; | 0 |
564 | case Qt::TitleBarArea: | - |
565 | newGeometry = QRectF(windowData->startGeometry.topLeft() | - |
566 | + QPointF(parentDelta.dx(), parentDelta.dy()), | - |
567 | windowData->startGeometry.size()); | - |
568 | break; | 0 |
569 | case Qt::NoSection: | - |
570 | break; | 0 |
571 | } | - |
572 | | - |
573 | if (windowData->grabbedSection != Qt::NoSection) { never evaluated: windowData->grabbedSection != Qt::NoSection | 0 |
574 | _q_boundGeometryToSizeConstraints(windowData->startGeometry, &newGeometry, | - |
575 | windowData->grabbedSection, | - |
576 | q->effectiveSizeHint(Qt::MinimumSize), | - |
577 | q->effectiveSizeHint(Qt::MaximumSize), | - |
578 | q); | - |
579 | q->setGeometry(newGeometry); | - |
580 | } | 0 |
581 | } | 0 |
582 | | - |
583 | void QGraphicsWidgetPrivate::windowFrameHoverMoveEvent(QGraphicsSceneHoverEvent *event) | - |
584 | { | - |
585 | QGraphicsWidget * const q = q_func(); | - |
586 | if (!hasDecoration()) never evaluated: !hasDecoration() | 0 |
587 | return; | 0 |
588 | | - |
589 | ensureWindowData(); | - |
590 | | - |
591 | if (q->rect().contains(event->pos())) { never evaluated: q->rect().contains(event->pos()) | 0 |
592 | if (windowData->buttonMouseOver || windowData->hoveredSubControl != QStyle::SC_None) never evaluated: windowData->buttonMouseOver never evaluated: windowData->hoveredSubControl != QStyle::SC_None | 0 |
593 | windowFrameHoverLeaveEvent(event); never executed: windowFrameHoverLeaveEvent(event); | 0 |
594 | return; | 0 |
595 | } | - |
596 | | - |
597 | bool wasMouseOver = windowData->buttonMouseOver; | - |
598 | QRect oldButtonRect = windowData->buttonRect; | - |
599 | windowData->buttonRect = QRect(); | - |
600 | windowData->buttonMouseOver = false; | - |
601 | QPointF pos = event->pos(); | - |
602 | QStyleOptionTitleBar bar; | - |
603 | | - |
604 | if (windowFrameMargins) { never evaluated: windowFrameMargins | 0 |
605 | pos.rx() += windowFrameMargins[Left]; | - |
606 | pos.ry() += windowFrameMargins[Top]; | - |
607 | } | 0 |
608 | initStyleOptionTitleBar(&bar); | - |
609 | bar.rect = q->windowFrameRect().toRect(); | - |
610 | bar.rect.moveTo(0,0); | - |
611 | bar.rect.setHeight(int(titleBarHeight(bar))); | - |
612 | | - |
613 | Qt::CursorShape cursorShape = Qt::ArrowCursor; | - |
614 | bool needsSetCursorCall = true; | - |
615 | switch (q->windowFrameSectionAt(event->pos())) { | - |
616 | case Qt::TopLeftSection: | - |
617 | case Qt::BottomRightSection: | - |
618 | cursorShape = Qt::SizeFDiagCursor; | - |
619 | break; | 0 |
620 | case Qt::TopRightSection: | - |
621 | case Qt::BottomLeftSection: | - |
622 | cursorShape = Qt::SizeBDiagCursor; | - |
623 | break; | 0 |
624 | case Qt::LeftSection: | - |
625 | case Qt::RightSection: | - |
626 | cursorShape = Qt::SizeHorCursor; | - |
627 | break; | 0 |
628 | case Qt::TopSection: | - |
629 | case Qt::BottomSection: | - |
630 | cursorShape = Qt::SizeVerCursor; | - |
631 | break; | 0 |
632 | case Qt::TitleBarArea: | - |
633 | windowData->buttonRect = q->style()->subControlRect( | - |
634 | QStyle::CC_TitleBar, &bar, QStyle::SC_TitleBarCloseButton, 0); | - |
635 | | - |
636 | | - |
637 | | - |
638 | | - |
639 | | - |
640 | | - |
641 | | - |
642 | if (windowData->buttonRect.contains(pos.toPoint())) never evaluated: windowData->buttonRect.contains(pos.toPoint()) | 0 |
643 | windowData->buttonMouseOver = true; never executed: windowData->buttonMouseOver = true; | 0 |
644 | event->ignore(); | - |
645 | break; | 0 |
646 | default: | - |
647 | needsSetCursorCall = false; | - |
648 | event->ignore(); | - |
649 | } | 0 |
650 | | - |
651 | if (needsSetCursorCall) never evaluated: needsSetCursorCall | 0 |
652 | q->setCursor(cursorShape); never executed: q->setCursor(cursorShape); | 0 |
653 | | - |
654 | | - |
655 | windowData->hoveredSubControl = q->style()->hitTestComplexControl(QStyle::CC_TitleBar, &bar, pos.toPoint(), 0); | - |
656 | if (windowData->hoveredSubControl != QStyle::SC_TitleBarCloseButton) never evaluated: windowData->hoveredSubControl != QStyle::SC_TitleBarCloseButton | 0 |
657 | windowData->hoveredSubControl = QStyle::SC_TitleBarLabel; never executed: windowData->hoveredSubControl = QStyle::SC_TitleBarLabel; | 0 |
658 | | - |
659 | if (windowData->buttonMouseOver != wasMouseOver) { never evaluated: windowData->buttonMouseOver != wasMouseOver | 0 |
660 | if (!oldButtonRect.isNull()) never evaluated: !oldButtonRect.isNull() | 0 |
661 | q->update(QRectF(oldButtonRect).translated(q->windowFrameRect().topLeft())); never executed: q->update(QRectF(oldButtonRect).translated(q->windowFrameRect().topLeft())); | 0 |
662 | if (!windowData->buttonRect.isNull()) never evaluated: !windowData->buttonRect.isNull() | 0 |
663 | q->update(QRectF(windowData->buttonRect).translated(q->windowFrameRect().topLeft())); never executed: q->update(QRectF(windowData->buttonRect).translated(q->windowFrameRect().topLeft())); | 0 |
664 | } | 0 |
665 | } | 0 |
666 | | - |
667 | void QGraphicsWidgetPrivate::windowFrameHoverLeaveEvent(QGraphicsSceneHoverEvent *event) | - |
668 | { | - |
669 | (void)event;; | - |
670 | QGraphicsWidget * const q = q_func(); | - |
671 | if (hasDecoration()) { never evaluated: hasDecoration() | 0 |
672 | | - |
673 | | - |
674 | q->unsetCursor(); | - |
675 | | - |
676 | | - |
677 | ensureWindowData(); | - |
678 | | - |
679 | bool needsUpdate = false; | - |
680 | if (windowData->hoveredSubControl == QStyle::SC_TitleBarCloseButton never evaluated: windowData->hoveredSubControl == QStyle::SC_TitleBarCloseButton | 0 |
681 | || windowData->buttonMouseOver) never evaluated: windowData->buttonMouseOver | 0 |
682 | needsUpdate = true; never executed: needsUpdate = true; | 0 |
683 | | - |
684 | | - |
685 | windowData->hoveredSubControl = QStyle::SC_None; | - |
686 | windowData->buttonMouseOver = false; | - |
687 | windowData->buttonRect = QRect(); | - |
688 | if (needsUpdate) never evaluated: needsUpdate | 0 |
689 | q->update(windowData->buttonRect); never executed: q->update(windowData->buttonRect); | 0 |
690 | } | 0 |
691 | } | 0 |
692 | | - |
693 | bool QGraphicsWidgetPrivate::hasDecoration() const | - |
694 | { | - |
695 | return (windowFlags & Qt::Window) && (windowFlags & Qt::WindowTitleHint); executed: return (windowFlags & Qt::Window) && (windowFlags & Qt::WindowTitleHint); Execution Count:231 | 231 |
696 | } | - |
697 | | - |
698 | | - |
699 | | - |
700 | | - |
701 | void QGraphicsWidgetPrivate::fixFocusChainBeforeReparenting(QGraphicsWidget *newParent, QGraphicsScene *oldScene, QGraphicsScene *newScene) | - |
702 | { | - |
703 | QGraphicsWidget * const q = q_func(); | - |
704 | | - |
705 | qt_noop(); | - |
706 | | - |
707 | QGraphicsWidget *n = q; | - |
708 | QGraphicsWidget *o = 0; | - |
709 | | - |
710 | QGraphicsWidget *w = focusNext; | - |
711 | | - |
712 | QGraphicsWidget *firstOld = 0; | - |
713 | bool wasPreviousNew = true; | - |
714 | | - |
715 | while (w != q) { evaluated: w != q yes Evaluation Count:17 | yes Evaluation Count:1507 |
| 17-1507 |
716 | bool isCurrentNew = q->isAncestorOf(w); | - |
717 | if (isCurrentNew) { partially evaluated: isCurrentNew no Evaluation Count:0 | yes Evaluation Count:17 |
| 0-17 |
718 | if (!wasPreviousNew) { never evaluated: !wasPreviousNew | 0 |
719 | n->d_func()->focusNext = w; | - |
720 | w->d_func()->focusPrev = n; | - |
721 | } | 0 |
722 | n = w; | - |
723 | } else { | 0 |
724 | if (wasPreviousNew) { evaluated: wasPreviousNew yes Evaluation Count:7 | yes Evaluation Count:10 |
| 7-10 |
725 | if (o) { partially evaluated: o no Evaluation Count:0 | yes Evaluation Count:7 |
| 0-7 |
726 | o->d_func()->focusNext = w; | - |
727 | w->d_func()->focusPrev = o; | - |
728 | } else { | 0 |
729 | firstOld = w; | - |
730 | } executed: } Execution Count:7 | 7 |
731 | } | - |
732 | o = w; | - |
733 | } executed: } Execution Count:17 | 17 |
734 | w = w->d_func()->focusNext; | - |
735 | wasPreviousNew = isCurrentNew; | - |
736 | } executed: } Execution Count:17 | 17 |
737 | | - |
738 | | - |
739 | if (firstOld) { evaluated: firstOld yes Evaluation Count:7 | yes Evaluation Count:1500 |
| 7-1500 |
740 | o->d_func()->focusNext = firstOld; | - |
741 | firstOld->d_func()->focusPrev = o; | - |
742 | } executed: } Execution Count:7 | 7 |
743 | | - |
744 | | - |
745 | if (newParent) evaluated: newParent yes Evaluation Count:776 | yes Evaluation Count:731 |
| 731-776 |
746 | newScene = newParent->scene(); executed: newScene = newParent->scene(); Execution Count:776 | 776 |
747 | | - |
748 | 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 |
749 | 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 |
750 | | - |
751 | QGraphicsItem *topLevelItem = newParent ? newParent->topLevelItem() : 0; evaluated: newParent yes Evaluation Count:776 | yes Evaluation Count:731 |
| 731-776 |
752 | QGraphicsWidget *topLevel = 0; | - |
753 | 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 |
754 | topLevel = static_cast<QGraphicsWidget *>(topLevelItem); executed: topLevel = static_cast<QGraphicsWidget *>(topLevelItem); Execution Count:776 | 776 |
755 | | - |
756 | 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 |
757 | QGraphicsWidget *last = topLevel->d_func()->focusPrev; | - |
758 | | - |
759 | last->d_func()->focusNext = q; | - |
760 | focusPrev = last; | - |
761 | | - |
762 | | - |
763 | topLevel->d_func()->focusPrev = n; | - |
764 | n->d_func()->focusNext = topLevel; | - |
765 | } else { executed: } Execution Count:776 | 776 |
766 | | - |
767 | n->d_func()->focusNext = q; | - |
768 | focusPrev = n; | - |
769 | } executed: } Execution Count:731 | 731 |
770 | | - |
771 | } | - |
772 | | - |
773 | void QGraphicsWidgetPrivate::setLayout_helper(QGraphicsLayout *l) | - |
774 | { | - |
775 | delete (this->layout); | - |
776 | layout = l; | - |
777 | if (!l) { evaluated: !l yes Evaluation Count:7 | yes Evaluation Count:214 |
| 7-214 |
778 | QGraphicsWidget * const q = q_func(); | - |
779 | q->updateGeometry(); | - |
780 | } executed: } Execution Count:7 | 7 |
781 | } executed: } Execution Count:221 | 221 |
782 | | - |
783 | qreal QGraphicsWidgetPrivate::width() const | - |
784 | { | - |
785 | const QGraphicsWidget * const q = q_func(); | - |
786 | return q->geometry().width(); never executed: return q->geometry().width(); | 0 |
787 | } | - |
788 | | - |
789 | void QGraphicsWidgetPrivate::setWidth(qreal w) | - |
790 | { | - |
791 | if (qIsNaN(w)) never evaluated: qIsNaN(w) | 0 |
792 | return; | 0 |
793 | QGraphicsWidget * const q = q_func(); | - |
794 | if (q->geometry().width() == w) never evaluated: q->geometry().width() == w | 0 |
795 | return; | 0 |
796 | | - |
797 | q->setGeometry(QRectF(q->x(), q->y(), w, height())); | - |
798 | } | 0 |
799 | | - |
800 | void QGraphicsWidgetPrivate::resetWidth() | - |
801 | { | - |
802 | QGraphicsWidget * const q = q_func(); | - |
803 | q->setGeometry(QRectF(q->x(), q->y(), 0, height())); | - |
804 | } | 0 |
805 | | - |
806 | qreal QGraphicsWidgetPrivate::height() const | - |
807 | { | - |
808 | const QGraphicsWidget * const q = q_func(); | - |
809 | return q->geometry().height(); never executed: return q->geometry().height(); | 0 |
810 | } | - |
811 | | - |
812 | void QGraphicsWidgetPrivate::setHeight(qreal h) | - |
813 | { | - |
814 | if (qIsNaN(h)) never evaluated: qIsNaN(h) | 0 |
815 | return; | 0 |
816 | QGraphicsWidget * const q = q_func(); | - |
817 | if (q->geometry().height() == h) never evaluated: q->geometry().height() == h | 0 |
818 | return; | 0 |
819 | | - |
820 | q->setGeometry(QRectF(q->x(), q->y(), width(), h)); | - |
821 | } | 0 |
822 | | - |
823 | void QGraphicsWidgetPrivate::resetHeight() | - |
824 | { | - |
825 | QGraphicsWidget * const q = q_func(); | - |
826 | q->setGeometry(QRectF(q->x(), q->y(), width(), 0)); | - |
827 | } | 0 |
828 | | - |
829 | void QGraphicsWidgetPrivate::setGeometryFromSetPos() | - |
830 | { | - |
831 | if (inSetGeometry) evaluated: inSetGeometry yes Evaluation Count:752 | yes Evaluation Count:1 |
| 1-752 |
832 | return; executed: return; Execution Count:752 | 752 |
833 | QGraphicsWidget * const q = q_func(); | - |
834 | inSetPos = 1; | - |
835 | | - |
836 | | - |
837 | q->setGeometry(QRectF(pos, q->size())); | - |
838 | inSetPos = 0 ; | - |
839 | } executed: } Execution Count:1 | 1 |
840 | | - |
841 | | - |
842 | | - |
| | |