Line | Source Code | Coverage |
---|
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | | - |
7 | | - |
8 | | - |
9 | | - |
10 | class QStatusBarPrivate : public QWidgetPrivate | - |
11 | { | - |
12 | inline QStatusBar* q_func() { return static_cast<QStatusBar *>(q_ptr); } inline const QStatusBar* q_func() const { return static_cast<const QStatusBar *>(q_ptr); } friend class QStatusBar; | - |
13 | public: | - |
14 | QStatusBarPrivate() {} | - |
15 | | - |
16 | struct SBItem { | - |
17 | SBItem(QWidget* widget, int stretch, bool permanent) | - |
18 | : s(stretch), w(widget), p(permanent) {} executed: } Execution Count:20 | 20 |
19 | int s; | - |
20 | QWidget * w; | - |
21 | bool p; | - |
22 | }; | - |
23 | | - |
24 | QList<SBItem *> items; | - |
25 | QString tempItem; | - |
26 | | - |
27 | QBoxLayout * box; | - |
28 | QTimer * timer; | - |
29 | | - |
30 | | - |
31 | QSizeGrip * resizer; | - |
32 | bool showSizeGrip; | - |
33 | | - |
34 | | - |
35 | int savedStrut; | - |
36 | | - |
37 | | - |
38 | | - |
39 | | - |
40 | | - |
41 | int indexToLastNonPermanentWidget() const | - |
42 | { | - |
43 | int i = items.size() - 1; | - |
44 | for (; i >= 0; --i) { evaluated: i >= 0 yes Evaluation Count:27 | yes Evaluation Count:20 |
| 20-27 |
45 | SBItem *item = items.at(i); | - |
46 | if (!(item && item->p)) partially evaluated: item yes Evaluation Count:27 | no Evaluation Count:0 |
evaluated: item->p yes Evaluation Count:18 | yes Evaluation Count:9 |
| 0-27 |
47 | break; executed: break; Execution Count:9 | 9 |
48 | } executed: } Execution Count:18 | 18 |
49 | return i; executed: return i; Execution Count:29 | 29 |
50 | } | - |
51 | | - |
52 | | - |
53 | void tryToShowSizeGrip() | - |
54 | { | - |
55 | if (!showSizeGrip) partially evaluated: !showSizeGrip no Evaluation Count:0 | yes Evaluation Count:7 |
| 0-7 |
56 | return; | 0 |
57 | showSizeGrip = false; | - |
58 | if (!resizer || resizer->isVisible()) partially evaluated: !resizer no Evaluation Count:0 | yes Evaluation Count:7 |
partially evaluated: resizer->isVisible() no Evaluation Count:0 | yes Evaluation Count:7 |
| 0-7 |
59 | return; | 0 |
60 | resizer->setAttribute(Qt::WA_WState_ExplicitShowHide, false); | - |
61 | QMetaObject::invokeMethod(resizer, "_q_showIfNotHidden", Qt::DirectConnection); | - |
62 | resizer->setAttribute(Qt::WA_WState_ExplicitShowHide, false); | - |
63 | } executed: } Execution Count:7 | 7 |
64 | | - |
65 | | - |
66 | QRect messageRect() const; | - |
67 | }; | - |
68 | | - |
69 | | - |
70 | QRect QStatusBarPrivate::messageRect() const | - |
71 | { | - |
72 | const QStatusBar * const q = q_func(); | - |
73 | bool rtl = q->layoutDirection() == Qt::RightToLeft; | - |
74 | | - |
75 | int left = 6; | - |
76 | int right = q->width() - 12; | - |
77 | | - |
78 | | - |
79 | if (resizer && resizer->isVisible()) { partially evaluated: resizer yes Evaluation Count:21 | no Evaluation Count:0 |
evaluated: resizer->isVisible() yes Evaluation Count:17 | yes Evaluation Count:4 |
| 0-21 |
80 | if (rtl) partially evaluated: rtl no Evaluation Count:0 | yes Evaluation Count:17 |
| 0-17 |
81 | left = resizer->x() + resizer->width(); never executed: left = resizer->x() + resizer->width(); | 0 |
82 | else | - |
83 | right = resizer->x(); executed: right = resizer->x(); Execution Count:17 | 17 |
84 | } | - |
85 | | - |
86 | | - |
87 | for (int i=0; i<items.size(); ++i) { evaluated: i<items.size() yes Evaluation Count:18 | yes Evaluation Count:21 |
| 18-21 |
88 | QStatusBarPrivate::SBItem* item = items.at(i); | - |
89 | if (!item) partially evaluated: !item no Evaluation Count:0 | yes Evaluation Count:18 |
| 0-18 |
90 | break; | 0 |
91 | if (item->p && item->w->isVisible()) { partially evaluated: item->p no Evaluation Count:0 | yes Evaluation Count:18 |
never evaluated: item->w->isVisible() | 0-18 |
92 | if (item->p) { | 0 |
93 | if (rtl) | 0 |
94 | left = qMax(left, item->w->x() + item->w->width() + 2); never executed: left = qMax(left, item->w->x() + item->w->width() + 2); | 0 |
95 | else | - |
96 | right = qMin(right, item->w->x() - 2); never executed: right = qMin(right, item->w->x() - 2); | 0 |
97 | } | - |
98 | break; | 0 |
99 | } | - |
100 | } executed: } Execution Count:18 | 18 |
101 | return QRect(left, 0, right-left, q->height()); executed: return QRect(left, 0, right-left, q->height()); Execution Count:21 | 21 |
102 | } | - |
103 | QStatusBar::QStatusBar(QWidget * parent) | - |
104 | : QWidget(*new QStatusBarPrivate, parent, 0) | - |
105 | { | - |
106 | QStatusBarPrivate * const d = d_func(); | - |
107 | d->box = 0; | - |
108 | d->timer = 0; | - |
109 | | - |
110 | | - |
111 | d->resizer = 0; | - |
112 | setSizeGripEnabled(true); | - |
113 | | - |
114 | | - |
115 | | - |
116 | } executed: } Execution Count:15 | 15 |
117 | | - |
118 | | - |
119 | | - |
120 | | - |
121 | | - |
122 | QStatusBar::~QStatusBar() | - |
123 | { | - |
124 | QStatusBarPrivate * const d = d_func(); | - |
125 | while (!d->items.isEmpty()) evaluated: !d->items.isEmpty() yes Evaluation Count:20 | yes Evaluation Count:15 |
| 15-20 |
126 | delete d->items.takeFirst(); executed: delete d->items.takeFirst(); Execution Count:20 | 20 |
127 | } executed: } Execution Count:15 | 15 |
128 | void QStatusBar::addWidget(QWidget * widget, int stretch) | - |
129 | { | - |
130 | if (!widget) partially evaluated: !widget no Evaluation Count:0 | yes Evaluation Count:9 |
| 0-9 |
131 | return; | 0 |
132 | insertWidget(d_func()->indexToLastNonPermanentWidget() + 1, widget, stretch); | - |
133 | } executed: } Execution Count:9 | 9 |
134 | int QStatusBar::insertWidget(int index, QWidget *widget, int stretch) | - |
135 | { | - |
136 | if (!widget) partially evaluated: !widget no Evaluation Count:0 | yes Evaluation Count:14 |
| 0-14 |
137 | return -1; never executed: return -1; | 0 |
138 | | - |
139 | QStatusBarPrivate * const d = d_func(); | - |
140 | QStatusBarPrivate::SBItem* item = new QStatusBarPrivate::SBItem(widget, stretch, false); | - |
141 | | - |
142 | int idx = d->indexToLastNonPermanentWidget(); | - |
143 | if (index < 0 || index > d->items.size() || (idx >= 0 && index > idx + 1)) { evaluated: index < 0 yes Evaluation Count:1 | yes Evaluation Count:13 |
partially evaluated: index > d->items.size() no Evaluation Count:0 | yes Evaluation Count:13 |
evaluated: idx >= 0 yes Evaluation Count:4 | yes Evaluation Count:9 |
evaluated: index > idx + 1 yes Evaluation Count:1 | yes Evaluation Count:3 |
| 0-13 |
144 | QMessageLogger("widgets/qstatusbar.cpp", 308, __PRETTY_FUNCTION__).warning("QStatusBar::insertWidget: Index out of range (%d), appending widget", index); | - |
145 | index = idx + 1; | - |
146 | } executed: } Execution Count:2 | 2 |
147 | d->items.insert(index, item); | - |
148 | | - |
149 | if (!d->tempItem.isEmpty()) partially evaluated: !d->tempItem.isEmpty() no Evaluation Count:0 | yes Evaluation Count:14 |
| 0-14 |
150 | widget->hide(); never executed: widget->hide(); | 0 |
151 | | - |
152 | reformat(); | - |
153 | if (!widget->isHidden() || !widget->testAttribute(Qt::WA_WState_ExplicitShowHide)) partially evaluated: !widget->isHidden() yes Evaluation Count:14 | no Evaluation Count:0 |
never evaluated: !widget->testAttribute(Qt::WA_WState_ExplicitShowHide) | 0-14 |
154 | widget->show(); executed: widget->show(); Execution Count:14 | 14 |
155 | | - |
156 | return index; executed: return index; Execution Count:14 | 14 |
157 | } | - |
158 | void QStatusBar::addPermanentWidget(QWidget * widget, int stretch) | - |
159 | { | - |
160 | if (!widget) partially evaluated: !widget no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
161 | return; | 0 |
162 | insertPermanentWidget(d_func()->items.size(), widget, stretch); | - |
163 | } executed: } Execution Count:1 | 1 |
164 | int QStatusBar::insertPermanentWidget(int index, QWidget *widget, int stretch) | - |
165 | { | - |
166 | if (!widget) partially evaluated: !widget no Evaluation Count:0 | yes Evaluation Count:6 |
| 0-6 |
167 | return -1; never executed: return -1; | 0 |
168 | | - |
169 | QStatusBarPrivate * const d = d_func(); | - |
170 | QStatusBarPrivate::SBItem* item = new QStatusBarPrivate::SBItem(widget, stretch, true); | - |
171 | | - |
172 | int idx = d->indexToLastNonPermanentWidget(); | - |
173 | if (index < 0 || index > d->items.size() || (idx >= 0 && index <= idx)) { evaluated: index < 0 yes Evaluation Count:1 | yes Evaluation Count:5 |
evaluated: index > d->items.size() yes Evaluation Count:1 | yes Evaluation Count:4 |
evaluated: idx >= 0 yes Evaluation Count:3 | yes Evaluation Count:1 |
evaluated: index <= idx yes Evaluation Count:2 | yes Evaluation Count:1 |
| 1-5 |
174 | QMessageLogger("widgets/qstatusbar.cpp", 373, __PRETTY_FUNCTION__).warning("QStatusBar::insertPermanentWidget: Index out of range (%d), appending widget", index); | - |
175 | index = d->items.size(); | - |
176 | } executed: } Execution Count:4 | 4 |
177 | d->items.insert(index, item); | - |
178 | | - |
179 | reformat(); | - |
180 | if (!widget->isHidden() || !widget->testAttribute(Qt::WA_WState_ExplicitShowHide)) partially evaluated: !widget->isHidden() yes Evaluation Count:6 | no Evaluation Count:0 |
never evaluated: !widget->testAttribute(Qt::WA_WState_ExplicitShowHide) | 0-6 |
181 | widget->show(); executed: widget->show(); Execution Count:6 | 6 |
182 | | - |
183 | return index; executed: return index; Execution Count:6 | 6 |
184 | } | - |
185 | void QStatusBar::removeWidget(QWidget *widget) | - |
186 | { | - |
187 | if (!widget) | 0 |
188 | return; | 0 |
189 | | - |
190 | QStatusBarPrivate * const d = d_func(); | - |
191 | bool found = false; | - |
192 | QStatusBarPrivate::SBItem* item; | - |
193 | for (int i=0; i<d->items.size(); ++i) { never evaluated: i<d->items.size() | 0 |
194 | item = d->items.at(i); | - |
195 | if (!item) | 0 |
196 | break; | 0 |
197 | if (item->w == widget) { never evaluated: item->w == widget | 0 |
198 | d->items.removeAt(i); | - |
199 | item->w->hide(); | - |
200 | delete item; | - |
201 | found = true; | - |
202 | break; | 0 |
203 | } | - |
204 | } | 0 |
205 | | - |
206 | if (found) | 0 |
207 | reformat(); never executed: reformat(); | 0 |
208 | | - |
209 | | - |
210 | | - |
211 | | - |
212 | } | 0 |
213 | bool QStatusBar::isSizeGripEnabled() const | - |
214 | { | - |
215 | | - |
216 | | - |
217 | | - |
218 | const QStatusBarPrivate * const d = d_func(); | - |
219 | return !!d->resizer; never executed: return !!d->resizer; | 0 |
220 | | - |
221 | } | - |
222 | | - |
223 | void QStatusBar::setSizeGripEnabled(bool enabled) | - |
224 | { | - |
225 | | - |
226 | | - |
227 | | - |
228 | QStatusBarPrivate * const d = d_func(); | - |
229 | if (!enabled != !d->resizer) { evaluated: !enabled != !d->resizer yes Evaluation Count:16 | yes Evaluation Count:3 |
| 3-16 |
230 | if (enabled) { evaluated: enabled yes Evaluation Count:15 | yes Evaluation Count:1 |
| 1-15 |
231 | d->resizer = new QSizeGrip(this); | - |
232 | d->resizer->hide(); | - |
233 | d->resizer->installEventFilter(this); | - |
234 | d->showSizeGrip = true; | - |
235 | } else { executed: } Execution Count:15 | 15 |
236 | delete d->resizer; | - |
237 | d->resizer = 0; | - |
238 | d->showSizeGrip = false; | - |
239 | } executed: } Execution Count:1 | 1 |
240 | reformat(); | - |
241 | if (d->resizer && isVisible()) evaluated: d->resizer yes Evaluation Count:15 | yes Evaluation Count:1 |
partially evaluated: isVisible() no Evaluation Count:0 | yes Evaluation Count:15 |
| 0-15 |
242 | d->tryToShowSizeGrip(); never executed: d->tryToShowSizeGrip(); | 0 |
243 | } executed: } Execution Count:16 | 16 |
244 | | - |
245 | } executed: } Execution Count:19 | 19 |
246 | void QStatusBar::reformat() | - |
247 | { | - |
248 | QStatusBarPrivate * const d = d_func(); | - |
249 | if (d->box) evaluated: d->box yes Evaluation Count:21 | yes Evaluation Count:15 |
| 15-21 |
250 | delete d->box; executed: delete d->box; Execution Count:21 | 21 |
251 | | - |
252 | QBoxLayout *vbox; | - |
253 | | - |
254 | if (d->resizer) { evaluated: d->resizer yes Evaluation Count:35 | yes Evaluation Count:1 |
| 1-35 |
255 | d->box = new QHBoxLayout(this); | - |
256 | d->box->setMargin(0); | - |
257 | vbox = new QVBoxLayout; | - |
258 | d->box->addLayout(vbox); | - |
259 | } else executed: } Execution Count:35 | 35 |
260 | | - |
261 | { | - |
262 | vbox = d->box = new QVBoxLayout(this); | - |
263 | d->box->setMargin(0); | - |
264 | } executed: } Execution Count:1 | 1 |
265 | vbox->addSpacing(3); | - |
266 | QBoxLayout* l = new QHBoxLayout; | - |
267 | vbox->addLayout(l); | - |
268 | l->addSpacing(2); | - |
269 | l->setSpacing(6); | - |
270 | | - |
271 | int maxH = fontMetrics().height(); | - |
272 | | - |
273 | int i; | - |
274 | QStatusBarPrivate::SBItem* item; | - |
275 | for (i=0,item=0; i<d->items.size(); ++i) { evaluated: i<d->items.size() yes Evaluation Count:38 | yes Evaluation Count:25 |
| 25-38 |
276 | item = d->items.at(i); | - |
277 | if (!item || item->p) partially evaluated: !item no Evaluation Count:0 | yes Evaluation Count:38 |
evaluated: item->p yes Evaluation Count:11 | yes Evaluation Count:27 |
| 0-38 |
278 | break; executed: break; Execution Count:11 | 11 |
279 | l->addWidget(item->w, item->s); | - |
280 | int itemH = qMin(qSmartMinSize(item->w).height(), item->w->maximumHeight()); | - |
281 | maxH = qMax(maxH, itemH); | - |
282 | } executed: } Execution Count:27 | 27 |
283 | | - |
284 | l->addStretch(0); | - |
285 | | - |
286 | for (item=0; i<d->items.size(); ++i) { evaluated: i<d->items.size() yes Evaluation Count:24 | yes Evaluation Count:36 |
| 24-36 |
287 | item = d->items.at(i); | - |
288 | if (!item) partially evaluated: !item no Evaluation Count:0 | yes Evaluation Count:24 |
| 0-24 |
289 | break; | 0 |
290 | l->addWidget(item->w, item->s); | - |
291 | int itemH = qMin(qSmartMinSize(item->w).height(), item->w->maximumHeight()); | - |
292 | maxH = qMax(maxH, itemH); | - |
293 | } executed: } Execution Count:24 | 24 |
294 | | - |
295 | if (d->resizer) { evaluated: d->resizer yes Evaluation Count:35 | yes Evaluation Count:1 |
| 1-35 |
296 | maxH = qMax(maxH, d->resizer->sizeHint().height()); | - |
297 | d->box->addSpacing(1); | - |
298 | d->box->addWidget(d->resizer, 0, Qt::AlignBottom); | - |
299 | } executed: } Execution Count:35 | 35 |
300 | | - |
301 | l->addStrut(maxH); | - |
302 | d->savedStrut = maxH; | - |
303 | vbox->addSpacing(2); | - |
304 | d->box->activate(); | - |
305 | update(); | - |
306 | } executed: } Execution Count:36 | 36 |
307 | void QStatusBar::showMessage(const QString &message, int timeout) | - |
308 | { | - |
309 | QStatusBarPrivate * const d = d_func(); | - |
310 | | - |
311 | d->tempItem = message; | - |
312 | | - |
313 | if (timeout > 0) { evaluated: timeout > 0 yes Evaluation Count:4 | yes Evaluation Count:6 |
| 4-6 |
314 | if (!d->timer) { partially evaluated: !d->timer yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
315 | d->timer = new QTimer(this); | - |
316 | connect(d->timer, "2""timeout()", this, "1""clearMessage()"); | - |
317 | } executed: } Execution Count:4 | 4 |
318 | d->timer->start(timeout); | - |
319 | } else if (d->timer) { evaluated: d->timer yes Evaluation Count:1 | yes Evaluation Count:5 |
executed: } Execution Count:4 | 1-5 |
320 | delete d->timer; | - |
321 | d->timer = 0; | - |
322 | } executed: } Execution Count:1 | 1 |
323 | | - |
324 | hideOrShow(); | - |
325 | } executed: } Execution Count:10 | 10 |
326 | | - |
327 | | - |
328 | | - |
329 | | - |
330 | | - |
331 | | - |
332 | | - |
333 | void QStatusBar::clearMessage() | - |
334 | { | - |
335 | QStatusBarPrivate * const d = d_func(); | - |
336 | if (d->tempItem.isEmpty()) partially evaluated: d->tempItem.isEmpty() no Evaluation Count:0 | yes Evaluation Count:5 |
| 0-5 |
337 | return; | 0 |
338 | if (d->timer) { evaluated: d->timer yes Evaluation Count:3 | yes Evaluation Count:2 |
| 2-3 |
339 | qDeleteInEventHandler(d->timer); | - |
340 | d->timer = 0; | - |
341 | } executed: } Execution Count:3 | 3 |
342 | d->tempItem.clear(); | - |
343 | hideOrShow(); | - |
344 | } executed: } Execution Count:5 | 5 |
345 | | - |
346 | | - |
347 | | - |
348 | | - |
349 | | - |
350 | | - |
351 | | - |
352 | QString QStatusBar::currentMessage() const | - |
353 | { | - |
354 | const QStatusBarPrivate * const d = d_func(); | - |
355 | return d->tempItem; executed: return d->tempItem; Execution Count:19 | 19 |
356 | } | - |
357 | void QStatusBar::hideOrShow() | - |
358 | { | - |
359 | QStatusBarPrivate * const d = d_func(); | - |
360 | bool haveMessage = !d->tempItem.isEmpty(); | - |
361 | | - |
362 | QStatusBarPrivate::SBItem* item = 0; | - |
363 | for (int i=0; i<d->items.size(); ++i) { evaluated: i<d->items.size() yes Evaluation Count:13 | yes Evaluation Count:15 |
| 13-15 |
364 | item = d->items.at(i); | - |
365 | if (!item || item->p) partially evaluated: !item no Evaluation Count:0 | yes Evaluation Count:13 |
partially evaluated: item->p no Evaluation Count:0 | yes Evaluation Count:13 |
| 0-13 |
366 | break; | 0 |
367 | if (haveMessage && item->w->isVisible()) { evaluated: haveMessage yes Evaluation Count:8 | yes Evaluation Count:5 |
evaluated: item->w->isVisible() yes Evaluation Count:3 | yes Evaluation Count:5 |
| 3-8 |
368 | item->w->hide(); | - |
369 | item->w->setAttribute(Qt::WA_WState_ExplicitShowHide, false); | - |
370 | } else if (!haveMessage && !item->w->testAttribute(Qt::WA_WState_ExplicitShowHide)) { evaluated: !haveMessage yes Evaluation Count:5 | yes Evaluation Count:5 |
evaluated: !item->w->testAttribute(Qt::WA_WState_ExplicitShowHide) yes Evaluation Count:2 | yes Evaluation Count:3 |
executed: } Execution Count:3 | 2-5 |
371 | item->w->show(); | - |
372 | } executed: } Execution Count:2 | 2 |
373 | } | - |
374 | | - |
375 | messageChanged(d->tempItem); | - |
376 | | - |
377 | | - |
378 | if (QAccessible::isActive()) { partially evaluated: QAccessible::isActive() no Evaluation Count:0 | yes Evaluation Count:15 |
| 0-15 |
379 | QAccessibleEvent event(this, QAccessible::NameChanged); | - |
380 | QAccessible::updateAccessibility(&event); | - |
381 | } | 0 |
382 | | - |
383 | | - |
384 | repaint(d->messageRect()); | - |
385 | } executed: } Execution Count:15 | 15 |
386 | | - |
387 | | - |
388 | | - |
389 | | - |
390 | void QStatusBar::showEvent(QShowEvent *) | - |
391 | { | - |
392 | | - |
393 | QStatusBarPrivate * const d = d_func(); | - |
394 | if (d->resizer && d->showSizeGrip) partially evaluated: d->resizer yes Evaluation Count:11 | no Evaluation Count:0 |
evaluated: d->showSizeGrip yes Evaluation Count:7 | yes Evaluation Count:4 |
| 0-11 |
395 | d->tryToShowSizeGrip(); executed: d->tryToShowSizeGrip(); Execution Count:7 | 7 |
396 | | - |
397 | } executed: } Execution Count:11 | 11 |
398 | void QStatusBar::paintEvent(QPaintEvent *event) | - |
399 | { | - |
400 | QStatusBarPrivate * const d = d_func(); | - |
401 | bool haveMessage = !d->tempItem.isEmpty(); | - |
402 | | - |
403 | QPainter p(this); | - |
404 | QStyleOption opt; | - |
405 | opt.initFrom(this); | - |
406 | style()->drawPrimitive(QStyle::PE_PanelStatusBar, &opt, &p, this); | - |
407 | | - |
408 | for (int i=0; i<d->items.size(); ++i) { evaluated: i<d->items.size() yes Evaluation Count:7 | yes Evaluation Count:19 |
| 7-19 |
409 | QStatusBarPrivate::SBItem* item = d->items.at(i); | - |
410 | if (item && item->w->isVisible() && (!haveMessage || item->p)) { partially evaluated: item yes Evaluation Count:7 | no Evaluation Count:0 |
evaluated: item->w->isVisible() yes Evaluation Count:2 | yes Evaluation Count:5 |
partially evaluated: !haveMessage yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-7 |
411 | QRect ir = item->w->geometry().adjusted(-2, -1, 2, 1); | - |
412 | if (event->rect().intersects(ir)) { evaluated: event->rect().intersects(ir) yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
413 | QStyleOption opt(0); | - |
414 | opt.rect = ir; | - |
415 | opt.palette = palette(); | - |
416 | opt.state = QStyle::State_None; | - |
417 | style()->drawPrimitive(QStyle::PE_FrameStatusBarItem, &opt, &p, item->w); | - |
418 | } executed: } Execution Count:1 | 1 |
419 | } executed: } Execution Count:2 | 2 |
420 | } executed: } Execution Count:7 | 7 |
421 | if (haveMessage) { evaluated: haveMessage yes Evaluation Count:6 | yes Evaluation Count:13 |
| 6-13 |
422 | p.setPen(palette().foreground().color()); | - |
423 | p.drawText(d->messageRect(), Qt::AlignLeading | Qt::AlignVCenter | Qt::TextSingleLine, d->tempItem); | - |
424 | } executed: } Execution Count:6 | 6 |
425 | } executed: } Execution Count:19 | 19 |
426 | | - |
427 | | - |
428 | | - |
429 | | - |
430 | void QStatusBar::resizeEvent(QResizeEvent * e) | - |
431 | { | - |
432 | QWidget::resizeEvent(e); | - |
433 | } executed: } Execution Count:11 | 11 |
434 | | - |
435 | | - |
436 | | - |
437 | | - |
438 | | - |
439 | bool QStatusBar::event(QEvent *e) | - |
440 | { | - |
441 | QStatusBarPrivate * const d = d_func(); | - |
442 | | - |
443 | if (e->type() == QEvent::LayoutRequest evaluated: e->type() == QEvent::LayoutRequest yes Evaluation Count:14 | yes Evaluation Count:273 |
| 14-273 |
444 | ) { | - |
445 | | - |
446 | int maxH = fontMetrics().height(); | - |
447 | | - |
448 | QStatusBarPrivate::SBItem* item = 0; | - |
449 | for (int i=0; i<d->items.size(); ++i) { evaluated: i<d->items.size() yes Evaluation Count:6 | yes Evaluation Count:14 |
| 6-14 |
450 | item = d->items.at(i); | - |
451 | if (!item) partially evaluated: !item no Evaluation Count:0 | yes Evaluation Count:6 |
| 0-6 |
452 | break; | 0 |
453 | int itemH = qMin(qSmartMinSize(item->w).height(), item->w->maximumHeight()); | - |
454 | maxH = qMax(maxH, itemH); | - |
455 | } executed: } Execution Count:6 | 6 |
456 | | - |
457 | | - |
458 | if (d->resizer) evaluated: d->resizer yes Evaluation Count:13 | yes Evaluation Count:1 |
| 1-13 |
459 | maxH = qMax(maxH, d->resizer->sizeHint().height()); executed: maxH = qMax(maxH, d->resizer->sizeHint().height()); Execution Count:13 | 13 |
460 | | - |
461 | | - |
462 | if (maxH != d->savedStrut) partially evaluated: maxH != d->savedStrut no Evaluation Count:0 | yes Evaluation Count:14 |
| 0-14 |
463 | reformat(); never executed: reformat(); | 0 |
464 | else | - |
465 | update(); executed: update(); Execution Count:14 | 14 |
466 | } | - |
467 | if (e->type() == QEvent::ChildRemoved) { evaluated: e->type() == QEvent::ChildRemoved yes Evaluation Count:26 | yes Evaluation Count:261 |
| 26-261 |
468 | QStatusBarPrivate::SBItem* item = 0; | - |
469 | for (int i=0; i<d->items.size(); ++i) { evaluated: i<d->items.size() yes Evaluation Count:55 | yes Evaluation Count:26 |
| 26-55 |
470 | item = d->items.at(i); | - |
471 | if (!item) partially evaluated: !item no Evaluation Count:0 | yes Evaluation Count:55 |
| 0-55 |
472 | break; | 0 |
473 | if (item->w == ((QChildEvent*)e)->child()) { partially evaluated: item->w == ((QChildEvent*)e)->child() no Evaluation Count:0 | yes Evaluation Count:55 |
| 0-55 |
474 | d->items.removeAt(i); | - |
475 | delete item; | - |
476 | } | 0 |
477 | } executed: } Execution Count:55 | 55 |
478 | } executed: } Execution Count:26 | 26 |
479 | | - |
480 | | - |
481 | | - |
482 | | - |
483 | return QWidget::event(e); executed: return QWidget::event(e); Execution Count:287 | 287 |
484 | } | - |
485 | | - |
486 | | - |
487 | | - |
| | |