widgets/qmainwindowlayout.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3 -
4 -
5 -
6 -
7 -
8 -
9 -
10QMainWindowLayoutState::QMainWindowLayoutState(QMainWindow *win) -
11 : -
12 -
13 toolBarAreaLayout(win), -
14 -
15 -
16 dockAreaLayout(win) -
17 -
18 -
19 -
20 -
21{ -
22 mainWindow = win; -
23}
executed: }
Execution Count:88
88
24 -
25QSize QMainWindowLayoutState::sizeHint() const -
26{ -
27 -
28 QSize result(0, 0); -
29 -
30 -
31 result = dockAreaLayout.sizeHint(); -
32 -
33 -
34 -
35 -
36 -
37 -
38 result = toolBarAreaLayout.sizeHint(result); -
39 -
40 -
41 return result;
executed: return result;
Execution Count:30
30
42} -
43 -
44QSize QMainWindowLayoutState::minimumSize() const -
45{ -
46 QSize result(0, 0); -
47 -
48 -
49 result = dockAreaLayout.minimumSize(); -
50 -
51 -
52 -
53 -
54 -
55 -
56 result = toolBarAreaLayout.minimumSize(result); -
57 -
58 -
59 return result;
executed: return result;
Execution Count:167
167
60} -
61 -
62void QMainWindowLayoutState::apply(bool animated) -
63{ -
64 -
65 toolBarAreaLayout.apply(animated); -
66 -
67 -
68 -
69 -
70 dockAreaLayout.apply(animated); -
71 -
72 -
73 -
74 -
75 -
76 -
77 -
78}
executed: }
Execution Count:237
237
79 -
80void QMainWindowLayoutState::fitLayout() -
81{ -
82 QRect r; -
83 -
84 -
85 -
86 toolBarAreaLayout.rect = rect; -
87 r = toolBarAreaLayout.fitLayout(); -
88 -
89 -
90 -
91 dockAreaLayout.rect = r; -
92 dockAreaLayout.fitLayout(); -
93 -
94 -
95 -
96}
executed: }
Execution Count:237
237
97 -
98void QMainWindowLayoutState::deleteAllLayoutItems() -
99{ -
100 -
101 toolBarAreaLayout.deleteAllLayoutItems(); -
102 -
103 -
104 -
105 dockAreaLayout.deleteAllLayoutItems(); -
106 -
107}
executed: }
Execution Count:45
45
108 -
109void QMainWindowLayoutState::deleteCentralWidgetItem() -
110{ -
111 -
112 delete dockAreaLayout.centralWidgetItem; -
113 dockAreaLayout.centralWidgetItem = 0; -
114 -
115 -
116 -
117 -
118}
executed: }
Execution Count:61
61
119 -
120QLayoutItem *QMainWindowLayoutState::itemAt(int index, int *x) const -
121{ -
122 -
123 if (QLayoutItem *ret = toolBarAreaLayout.itemAt(x, index))
evaluated: QLayoutItem *ret = toolBarAreaLayout.itemAt(x, index)
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:410
7-410
124 return ret;
executed: return ret;
Execution Count:7
7
125 -
126 -
127 -
128 if (QLayoutItem *ret = dockAreaLayout.itemAt(x, index))
evaluated: QLayoutItem *ret = dockAreaLayout.itemAt(x, index)
TRUEFALSE
yes
Evaluation Count:178
yes
Evaluation Count:232
178-232
129 return ret;
executed: return ret;
Execution Count:178
178
130 -
131 -
132 -
133 -
134 -
135 return 0;
executed: return 0;
Execution Count:232
232
136} -
137 -
138QLayoutItem *QMainWindowLayoutState::takeAt(int index, int *x) -
139{ -
140 -
141 if (QLayoutItem *ret = toolBarAreaLayout.takeAt(x, index))
evaluated: QLayoutItem *ret = toolBarAreaLayout.takeAt(x, index)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:22
1-22
142 return ret;
executed: return ret;
Execution Count:1
1
143 -
144 -
145 -
146 if (QLayoutItem *ret = dockAreaLayout.takeAt(x, index))
evaluated: QLayoutItem *ret = dockAreaLayout.takeAt(x, index)
TRUEFALSE
yes
Evaluation Count:21
yes
Evaluation Count:1
1-21
147 return ret;
executed: return ret;
Execution Count:21
21
148 return 0;
executed: return 0;
Execution Count:1
1
149} -
150 -
151QList<int> QMainWindowLayoutState::indexOf(QWidget *widget) const -
152{ -
153 QList<int> result; -
154 -
155 -
156 -
157 if (QToolBar *toolBar = qobject_cast<QToolBar*>(widget)) {
never evaluated: QToolBar *toolBar = qobject_cast<QToolBar*>(widget)
0
158 result = toolBarAreaLayout.indexOf(toolBar); -
159 if (!result.isEmpty())
never evaluated: !result.isEmpty()
0
160 result.prepend(0);
never executed: result.prepend(0);
0
161 return result;
never executed: return result;
0
162 } -
163 -
164 -
165 -
166 -
167 if (QDockWidget *dockWidget = qobject_cast<QDockWidget *>(widget)) {
never evaluated: QDockWidget *dockWidget = qobject_cast<QDockWidget *>(widget)
0
168 result = dockAreaLayout.indexOf(dockWidget); -
169 if (!result.isEmpty())
never evaluated: !result.isEmpty()
0
170 result.prepend(1);
never executed: result.prepend(1);
0
171 return result;
never executed: return result;
0
172 } -
173 -
174 -
175 return result;
never executed: return result;
0
176} -
177 -
178bool QMainWindowLayoutState::contains(QWidget *widget) const -
179{ -
180 -
181 if (dockAreaLayout.centralWidgetItem != 0 && dockAreaLayout.centralWidgetItem->widget() == widget)
never evaluated: dockAreaLayout.centralWidgetItem != 0
never evaluated: dockAreaLayout.centralWidgetItem->widget() == widget
0
182 return true;
never executed: return true;
0
183 if (!dockAreaLayout.indexOf(widget).isEmpty())
never evaluated: !dockAreaLayout.indexOf(widget).isEmpty()
0
184 return true;
never executed: return true;
0
185 -
186 -
187 -
188 -
189 -
190 -
191 if (!toolBarAreaLayout.indexOf(widget).isEmpty())
never evaluated: !toolBarAreaLayout.indexOf(widget).isEmpty()
0
192 return true;
never executed: return true;
0
193 -
194 return false;
never executed: return false;
0
195} -
196 -
197void QMainWindowLayoutState::setCentralWidget(QWidget *widget) -
198{ -
199 QLayoutItem *item = 0; -
200 -
201 deleteCentralWidgetItem(); -
202 -
203 if (widget != 0)
partially evaluated: widget != 0
TRUEFALSE
yes
Evaluation Count:18
no
Evaluation Count:0
0-18
204 item = new QWidgetItemV2(widget);
executed: item = new QWidgetItemV2(widget);
Execution Count:18
18
205 -
206 -
207 dockAreaLayout.centralWidgetItem = item; -
208 -
209 -
210 -
211}
executed: }
Execution Count:18
18
212 -
213QWidget *QMainWindowLayoutState::centralWidget() const -
214{ -
215 QLayoutItem *item = 0; -
216 -
217 -
218 item = dockAreaLayout.centralWidgetItem; -
219 -
220 -
221 -
222 -
223 if (item != 0)
partially evaluated: item != 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:24
0-24
224 return item->widget();
never executed: return item->widget();
0
225 return 0;
executed: return 0;
Execution Count:24
24
226} -
227 -
228QList<int> QMainWindowLayoutState::gapIndex(QWidget *widget, -
229 const QPoint &pos) const -
230{ -
231 QList<int> result; -
232 -
233 -
234 -
235 if (qobject_cast<QToolBar*>(widget) != 0) {
never evaluated: qobject_cast<QToolBar*>(widget) != 0
0
236 result = toolBarAreaLayout.gapIndex(pos); -
237 if (!result.isEmpty())
never evaluated: !result.isEmpty()
0
238 result.prepend(0);
never executed: result.prepend(0);
0
239 return result;
never executed: return result;
0
240 } -
241 -
242 -
243 -
244 -
245 if (qobject_cast<QDockWidget *>(widget) != 0) {
never evaluated: qobject_cast<QDockWidget *>(widget) != 0
0
246 result = dockAreaLayout.gapIndex(pos); -
247 if (!result.isEmpty())
never evaluated: !result.isEmpty()
0
248 result.prepend(1);
never executed: result.prepend(1);
0
249 return result;
never executed: return result;
0
250 } -
251 -
252 -
253 return result;
never executed: return result;
0
254} -
255 -
256bool QMainWindowLayoutState::insertGap(const QList<int> &path, QLayoutItem *item) -
257{ -
258 if (path.isEmpty())
never evaluated: path.isEmpty()
0
259 return false;
never executed: return false;
0
260 -
261 int i = path.first(); -
262 -
263 -
264 if (i == 0) {
never evaluated: i == 0
0
265 qt_noop(); -
266 return toolBarAreaLayout.insertGap(path.mid(1), item);
never executed: return toolBarAreaLayout.insertGap(path.mid(1), item);
0
267 } -
268 -
269 -
270 -
271 if (i == 1) {
never evaluated: i == 1
0
272 qt_noop(); -
273 return dockAreaLayout.insertGap(path.mid(1), item);
never executed: return dockAreaLayout.insertGap(path.mid(1), item);
0
274 } -
275 -
276 -
277 return false;
never executed: return false;
0
278} -
279 -
280void QMainWindowLayoutState::remove(const QList<int> &path) -
281{ -
282 int i = path.first(); -
283 -
284 -
285 if (i == 0)
never evaluated: i == 0
0
286 toolBarAreaLayout.remove(path.mid(1));
never executed: toolBarAreaLayout.remove(path.mid(1));
0
287 -
288 -
289 -
290 if (i == 1)
never evaluated: i == 1
0
291 dockAreaLayout.remove(path.mid(1));
never executed: dockAreaLayout.remove(path.mid(1));
0
292 -
293}
never executed: }
0
294 -
295void QMainWindowLayoutState::remove(QLayoutItem *item) -
296{ -
297 -
298 toolBarAreaLayout.remove(item); -
299 -
300 -
301 -
302 -
303 if (QDockWidget *dockWidget = qobject_cast<QDockWidget *>(item->widget())) {
never evaluated: QDockWidget *dockWidget = qobject_cast<QDockWidget *>(item->widget())
0
304 QList<int> path = dockAreaLayout.indexOf(dockWidget); -
305 if (!path.isEmpty())
never evaluated: !path.isEmpty()
0
306 dockAreaLayout.remove(path);
never executed: dockAreaLayout.remove(path);
0
307 }
never executed: }
0
308 -
309}
never executed: }
0
310 -
311void QMainWindowLayoutState::clear() -
312{ -
313 -
314 toolBarAreaLayout.clear(); -
315 -
316 -
317 -
318 dockAreaLayout.clear(); -
319 -
320 -
321 -
322 -
323 rect = QRect(); -
324}
executed: }
Execution Count:4
4
325 -
326bool QMainWindowLayoutState::isValid() const -
327{ -
328 return rect.isValid();
executed: return rect.isValid();
Execution Count:279
279
329} -
330 -
331QLayoutItem *QMainWindowLayoutState::item(const QList<int> &path) -
332{ -
333 int i = path.first(); -
334 -
335 -
336 if (i == 0)
never evaluated: i == 0
0
337 return toolBarAreaLayout.item(path.mid(1)).widgetItem;
never executed: return toolBarAreaLayout.item(path.mid(1)).widgetItem;
0
338 -
339 -
340 -
341 if (i == 1)
never evaluated: i == 1
0
342 return dockAreaLayout.item(path.mid(1)).widgetItem;
never executed: return dockAreaLayout.item(path.mid(1)).widgetItem;
0
343 -
344 -
345 return 0;
never executed: return 0;
0
346} -
347 -
348QRect QMainWindowLayoutState::itemRect(const QList<int> &path) const -
349{ -
350 int i = path.first(); -
351 -
352 -
353 if (i == 0)
never evaluated: i == 0
0
354 return toolBarAreaLayout.itemRect(path.mid(1));
never executed: return toolBarAreaLayout.itemRect(path.mid(1));
0
355 -
356 -
357 -
358 if (i == 1)
never evaluated: i == 1
0
359 return dockAreaLayout.itemRect(path.mid(1));
never executed: return dockAreaLayout.itemRect(path.mid(1));
0
360 -
361 -
362 return QRect();
never executed: return QRect();
0
363} -
364 -
365QRect QMainWindowLayoutState::gapRect(const QList<int> &path) const -
366{ -
367 int i = path.first(); -
368 -
369 -
370 if (i == 0)
never evaluated: i == 0
0
371 return toolBarAreaLayout.itemRect(path.mid(1));
never executed: return toolBarAreaLayout.itemRect(path.mid(1));
0
372 -
373 -
374 -
375 if (i == 1)
never evaluated: i == 1
0
376 return dockAreaLayout.gapRect(path.mid(1));
never executed: return dockAreaLayout.gapRect(path.mid(1));
0
377 -
378 -
379 return QRect();
never executed: return QRect();
0
380} -
381 -
382QLayoutItem *QMainWindowLayoutState::plug(const QList<int> &path) -
383{ -
384 int i = path.first(); -
385 -
386 -
387 if (i == 0)
never evaluated: i == 0
0
388 return toolBarAreaLayout.plug(path.mid(1));
never executed: return toolBarAreaLayout.plug(path.mid(1));
0
389 -
390 -
391 -
392 if (i == 1)
never evaluated: i == 1
0
393 return dockAreaLayout.plug(path.mid(1));
never executed: return dockAreaLayout.plug(path.mid(1));
0
394 -
395 -
396 return 0;
never executed: return 0;
0
397} -
398 -
399QLayoutItem *QMainWindowLayoutState::unplug(const QList<int> &path, QMainWindowLayoutState *other) -
400{ -
401 int i = path.first(); -
402 -
403 -
404 -
405 -
406 if (i == 0)
never evaluated: i == 0
0
407 return toolBarAreaLayout.unplug(path.mid(1), other ? &other->toolBarAreaLayout : 0);
never executed: return toolBarAreaLayout.unplug(path.mid(1), other ? &other->toolBarAreaLayout : 0);
0
408 -
409 -
410 -
411 if (i == 1)
never evaluated: i == 1
0
412 return dockAreaLayout.unplug(path.mid(1));
never executed: return dockAreaLayout.unplug(path.mid(1));
0
413 -
414 -
415 return 0;
never executed: return 0;
0
416} -
417 -
418void QMainWindowLayoutState::saveState(QDataStream &stream) const -
419{ -
420 -
421 dockAreaLayout.saveState(stream); -
422 -
423 -
424 toolBarAreaLayout.saveState(stream); -
425 -
426}
executed: }
Execution Count:2
2
427 -
428template <typename T> -
429static QList<T> findChildrenHelper(const QObject *o) -
430{ -
431 const QObjectList &list = o->children(); -
432 QList<T> result; -
433 -
434 for (int i=0; i < list.size(); ++i) {
evaluated: i < list.size()
TRUEFALSE
yes
Evaluation Count:33
yes
Evaluation Count:8
8-33
435 if (T t = qobject_cast<T>(list[i])) {
evaluated: T t = qobject_cast<T>(list[i])
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:27
6-27
436 result.append(t); -
437 }
executed: }
Execution Count:6
6
438 }
executed: }
Execution Count:33
33
439 -
440 return result;
executed: return result;
Execution Count:8
8
441} -
442 -
443 -
444bool QMainWindowLayoutState::checkFormat(QDataStream &stream, bool pre43) -
445{ -
446 -
447 -
448 -
449 while (!stream.atEnd()) {
evaluated: !stream.atEnd()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:2
2-4
450 uchar marker; -
451 stream >> marker; -
452 switch(marker) -
453 { -
454 -
455 case QToolBarAreaLayout::ToolBarStateMarker: -
456 case QToolBarAreaLayout::ToolBarStateMarkerEx: -
457 { -
458 QList<QToolBar *> toolBars = findChildrenHelper<QToolBar*>(mainWindow); -
459 if (!toolBarAreaLayout.restoreState(stream, toolBars, marker, 0-2
460 pre43 , true )) {
partially evaluated: !toolBarAreaLayout.restoreState(stream, toolBars, marker, pre43 , true )
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
461 return false;
never executed: return false;
0
462 } -
463 } -
464 break;
executed: break;
Execution Count:2
2
465 -
466 -
467 -
468 case QDockAreaLayout::DockWidgetStateMarker: -
469 { -
470 QList<QDockWidget *> dockWidgets = findChildrenHelper<QDockWidget*>(mainWindow); -
471 if (!dockAreaLayout.restoreState(stream, dockWidgets, true )) {
partially evaluated: !dockAreaLayout.restoreState(stream, dockWidgets, true )
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
472 return false;
never executed: return false;
0
473 } -
474 } -
475 break;
executed: break;
Execution Count:2
2
476 -
477 default: -
478 -
479 return false;
never executed: return false;
0
480 } -
481 }
executed: }
Execution Count:4
4
482 -
483 -
484 return true;
executed: return true;
Execution Count:2
2
485} -
486 -
487bool QMainWindowLayoutState::restoreState(QDataStream &_stream, -
488 const QMainWindowLayoutState &oldState) -
489{ -
490 -
491 QByteArray copy; -
492 while(!_stream.atEnd()) {
evaluated: !_stream.atEnd()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2
2
493 int length = 1024; -
494 QByteArray ba(length, '\0'); -
495 length = _stream.readRawData(ba.data(), ba.size()); -
496 ba.resize(length); -
497 copy += ba; -
498 }
executed: }
Execution Count:2
2
499 -
500 QDataStream ds(copy); -
501 const bool oldFormat = !checkFormat(ds, false); -
502 if (oldFormat) {
partially evaluated: oldFormat
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
503 -
504 QDataStream ds2(copy); -
505 if (!checkFormat(ds2, true)) {
never evaluated: !checkFormat(ds2, true)
0
506 return false;
never executed: return false;
0
507 } -
508 }
never executed: }
0
509 -
510 QDataStream stream(copy); -
511 -
512 while (!stream.atEnd()) {
evaluated: !stream.atEnd()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:2
2-4
513 uchar marker; -
514 stream >> marker; -
515 switch(marker) -
516 { -
517 -
518 case QDockAreaLayout::DockWidgetStateMarker: -
519 { -
520 QList<QDockWidget *> dockWidgets = findChildrenHelper<QDockWidget*>(mainWindow); -
521 if (!dockAreaLayout.restoreState(stream, dockWidgets))
partially evaluated: !dockAreaLayout.restoreState(stream, dockWidgets)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
522 return false;
never executed: return false;
0
523 -
524 for (int i = 0; i < dockWidgets.size(); ++i) {
evaluated: i < dockWidgets.size()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:2
2-3
525 QDockWidget *w = dockWidgets.at(i); -
526 QList<int> path = dockAreaLayout.indexOf(w); -
527 if (path.isEmpty()) {
partially evaluated: path.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
528 QList<int> oldPath = oldState.dockAreaLayout.indexOf(w); -
529 if (oldPath.isEmpty()) {
never evaluated: oldPath.isEmpty()
0
530 continue;
never executed: continue;
0
531 } -
532 QDockAreaLayoutInfo *info = dockAreaLayout.info(oldPath); -
533 if (info == 0) {
never evaluated: info == 0
0
534 continue;
never executed: continue;
0
535 } -
536 info->item_list.append(QDockAreaLayoutItem(new QDockWidgetItem(w))); -
537 }
never executed: }
0
538 }
executed: }
Execution Count:3
3
539 } -
540 break;
executed: break;
Execution Count:2
2
541 -
542 -
543 -
544 case QToolBarAreaLayout::ToolBarStateMarker: -
545 case QToolBarAreaLayout::ToolBarStateMarkerEx: -
546 { -
547 QList<QToolBar *> toolBars = findChildrenHelper<QToolBar*>(mainWindow); -
548 if (!toolBarAreaLayout.restoreState(stream, toolBars, marker, oldFormat))
partially evaluated: !toolBarAreaLayout.restoreState(stream, toolBars, marker, oldFormat)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
549 return false;
never executed: return false;
0
550 -
551 for (int i = 0; i < toolBars.size(); ++i) {
partially evaluated: i < toolBars.size()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
552 QToolBar *w = toolBars.at(i); -
553 QList<int> path = toolBarAreaLayout.indexOf(w); -
554 if (path.isEmpty()) {
never evaluated: path.isEmpty()
0
555 QList<int> oldPath = oldState.toolBarAreaLayout.indexOf(w); -
556 if (oldPath.isEmpty()) {
never evaluated: oldPath.isEmpty()
0
557 continue;
never executed: continue;
0
558 } -
559 toolBarAreaLayout.docks[oldPath.at(0)].insertToolBar(0, w); -
560 }
never executed: }
0
561 }
never executed: }
0
562 } -
563 break;
executed: break;
Execution Count:2
2
564 -
565 default: -
566 return false;
never executed: return false;
0
567 } -
568 }
executed: }
Execution Count:4
4
569 -
570 -
571 return true;
executed: return true;
Execution Count:2
2
572} -
573 -
574 -
575 -
576 -
577 -
578 -
579 -
580static inline void validateToolBarArea(Qt::ToolBarArea &area) -
581{ -
582 switch (area) { -
583 case Qt::LeftToolBarArea: -
584 case Qt::RightToolBarArea: -
585 case Qt::TopToolBarArea: -
586 case Qt::BottomToolBarArea: -
587 break;
executed: break;
Execution Count:2
2
588 default: -
589 area = Qt::TopToolBarArea; -
590 }
never executed: }
0
591}
executed: }
Execution Count:2
2
592 -
593static QInternal::DockPosition toDockPos(Qt::ToolBarArea area) -
594{ -
595 switch (area) { -
596 case Qt::LeftToolBarArea: return QInternal::LeftDock;
never executed: return QInternal::LeftDock;
0
597 case Qt::RightToolBarArea: return QInternal::RightDock;
never executed: return QInternal::RightDock;
0
598 case Qt::TopToolBarArea: return QInternal::TopDock;
executed: return QInternal::TopDock;
Execution Count:2
2
599 case Qt::BottomToolBarArea: return QInternal::BottomDock;
never executed: return QInternal::BottomDock;
0
600 default: -
601 break;
never executed: break;
0
602 } -
603 -
604 return QInternal::DockCount;
never executed: return QInternal::DockCount;
0
605} -
606 -
607static Qt::ToolBarArea toToolBarArea(QInternal::DockPosition pos) -
608{ -
609 switch (pos) { -
610 case QInternal::LeftDock: return Qt::LeftToolBarArea;
never executed: return Qt::LeftToolBarArea;
0
611 case QInternal::RightDock: return Qt::RightToolBarArea;
never executed: return Qt::RightToolBarArea;
0
612 case QInternal::TopDock: return Qt::TopToolBarArea;
never executed: return Qt::TopToolBarArea;
0
613 case QInternal::BottomDock: return Qt::BottomToolBarArea;
never executed: return Qt::BottomToolBarArea;
0
614 default: break;
never executed: break;
0
615 } -
616 return Qt::NoToolBarArea;
never executed: return Qt::NoToolBarArea;
0
617} -
618 -
619static inline Qt::ToolBarArea toToolBarArea(int pos) -
620{ -
621 return toToolBarArea(static_cast<QInternal::DockPosition>(pos));
never executed: return toToolBarArea(static_cast<QInternal::DockPosition>(pos));
0
622} -
623 -
624void QMainWindowLayout::addToolBarBreak(Qt::ToolBarArea area) -
625{ -
626 validateToolBarArea(area); -
627 -
628 layoutState.toolBarAreaLayout.addToolBarBreak(toDockPos(area)); -
629 if (savedState.isValid())
never evaluated: savedState.isValid()
0
630 savedState.toolBarAreaLayout.addToolBarBreak(toDockPos(area));
never executed: savedState.toolBarAreaLayout.addToolBarBreak(toDockPos(area));
0
631 -
632 invalidate(); -
633}
never executed: }
0
634 -
635void QMainWindowLayout::insertToolBarBreak(QToolBar *before) -
636{ -
637 layoutState.toolBarAreaLayout.insertToolBarBreak(before); -
638 if (savedState.isValid())
never evaluated: savedState.isValid()
0
639 savedState.toolBarAreaLayout.insertToolBarBreak(before);
never executed: savedState.toolBarAreaLayout.insertToolBarBreak(before);
0
640 invalidate(); -
641}
never executed: }
0
642 -
643void QMainWindowLayout::removeToolBarBreak(QToolBar *before) -
644{ -
645 layoutState.toolBarAreaLayout.removeToolBarBreak(before); -
646 if (savedState.isValid())
never evaluated: savedState.isValid()
0
647 savedState.toolBarAreaLayout.removeToolBarBreak(before);
never executed: savedState.toolBarAreaLayout.removeToolBarBreak(before);
0
648 invalidate(); -
649}
never executed: }
0
650 -
651void QMainWindowLayout::moveToolBar(QToolBar *toolbar, int pos) -
652{ -
653 layoutState.toolBarAreaLayout.moveToolBar(toolbar, pos); -
654 if (savedState.isValid())
never evaluated: savedState.isValid()
0
655 savedState.toolBarAreaLayout.moveToolBar(toolbar, pos);
never executed: savedState.toolBarAreaLayout.moveToolBar(toolbar, pos);
0
656 invalidate(); -
657}
never executed: }
0
658 -
659 -
660 -
661void QMainWindowLayout::removeToolBar(QToolBar *toolbar) -
662{ -
663 if (toolbar) {
never evaluated: toolbar
0
664 QObject::disconnect(parentWidget(), "2""iconSizeChanged(QSize)", -
665 toolbar, "1""_q_updateIconSize(QSize)"); -
666 QObject::disconnect(parentWidget(), "2""toolButtonStyleChanged(Qt::ToolButtonStyle)", -
667 toolbar, "1""_q_updateToolButtonStyle(Qt::ToolButtonStyle)"); -
668 -
669 -
670 -
671 -
672 -
673 -
674 { -
675 removeWidget(toolbar); -
676 } -
677 }
never executed: }
0
678}
never executed: }
0
679 -
680 -
681 -
682 -
683void QMainWindowLayout::addToolBar(Qt::ToolBarArea area, -
684 QToolBar *toolbar, -
685 bool) -
686{ -
687 validateToolBarArea(area); -
688 -
689 -
690 -
691 -
692 -
693 -
694 { -
695 -
696 addChildWidget(toolbar); -
697 QLayoutItem * item = layoutState.toolBarAreaLayout.addToolBar(toDockPos(area), toolbar); -
698 if (savedState.isValid() && item) {
partially evaluated: savedState.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
never evaluated: item
0-2
699 -
700 savedState.toolBarAreaLayout.insertItem(toDockPos(area), item); -
701 }
never executed: }
0
702 invalidate(); -
703 -
704 -
705 toolbar->d_func()->updateWindowFlags(false ); -
706 } -
707}
executed: }
Execution Count:2
2
708 -
709 -
710 -
711 -
712void QMainWindowLayout::insertToolBar(QToolBar *before, QToolBar *toolbar) -
713{ -
714 -
715 -
716 -
717 -
718 -
719 { -
720 addChildWidget(toolbar); -
721 QLayoutItem * item = layoutState.toolBarAreaLayout.insertToolBar(before, toolbar); -
722 if (savedState.isValid() && item) {
never evaluated: savedState.isValid()
never evaluated: item
0
723 -
724 savedState.toolBarAreaLayout.insertItem(before, item); -
725 }
never executed: }
0
726 if (!currentGapPos.isEmpty() && currentGapPos.first() == 0) {
never evaluated: !currentGapPos.isEmpty()
never evaluated: currentGapPos.first() == 0
0
727 currentGapPos = layoutState.toolBarAreaLayout.currentGapIndex(); -
728 if (!currentGapPos.isEmpty()) {
never evaluated: !currentGapPos.isEmpty()
0
729 currentGapPos.prepend(0); -
730 currentGapRect = layoutState.itemRect(currentGapPos); -
731 }
never executed: }
0
732 }
never executed: }
0
733 invalidate(); -
734 } -
735}
never executed: }
0
736 -
737Qt::ToolBarArea QMainWindowLayout::toolBarArea(QToolBar *toolbar) const -
738{ -
739 QInternal::DockPosition pos = layoutState.toolBarAreaLayout.findToolBar(toolbar); -
740 switch (pos) { -
741 case QInternal::LeftDock: return Qt::LeftToolBarArea;
never executed: return Qt::LeftToolBarArea;
0
742 case QInternal::RightDock: return Qt::RightToolBarArea;
never executed: return Qt::RightToolBarArea;
0
743 case QInternal::TopDock: return Qt::TopToolBarArea;
executed: return Qt::TopToolBarArea;
Execution Count:30
30
744 case QInternal::BottomDock: return Qt::BottomToolBarArea;
never executed: return Qt::BottomToolBarArea;
0
745 default: break;
executed: break;
Execution Count:3
3
746 } -
747 -
748 -
749 -
750 -
751 -
752 -
753 return Qt::NoToolBarArea;
executed: return Qt::NoToolBarArea;
Execution Count:3
3
754} -
755 -
756bool QMainWindowLayout::toolBarBreak(QToolBar *toolBar) const -
757{ -
758 return layoutState.toolBarAreaLayout.toolBarBreak(toolBar);
never executed: return layoutState.toolBarAreaLayout.toolBarBreak(toolBar);
0
759} -
760 -
761void QMainWindowLayout::getStyleOptionInfo(QStyleOptionToolBar *option, QToolBar *toolBar) const -
762{ -
763 option->toolBarArea = toolBarArea(toolBar); -
764 layoutState.toolBarAreaLayout.getStyleOptionInfo(option, toolBar); -
765}
executed: }
Execution Count:33
33
766 -
767void QMainWindowLayout::toggleToolBarsVisible() -
768{ -
769 bool updateNonUnifiedParts = true; -
770 if (updateNonUnifiedParts) {
never evaluated: updateNonUnifiedParts
0
771 layoutState.toolBarAreaLayout.visible = !layoutState.toolBarAreaLayout.visible; -
772 if (!layoutState.mainWindow->isMaximized()) {
never evaluated: !layoutState.mainWindow->isMaximized()
0
773 QPoint topLeft = parentWidget()->geometry().topLeft(); -
774 QRect r = parentWidget()->geometry(); -
775 r = layoutState.toolBarAreaLayout.rectHint(r); -
776 r.moveTo(topLeft); -
777 parentWidget()->setGeometry(r); -
778 } else {
never executed: }
0
779 update(); -
780 }
never executed: }
0
781 } -
782}
never executed: }
0
783static inline void validateDockWidgetArea(Qt::DockWidgetArea &area) -
784{ -
785 switch (area) { -
786 case Qt::LeftDockWidgetArea: -
787 case Qt::RightDockWidgetArea: -
788 case Qt::TopDockWidgetArea: -
789 case Qt::BottomDockWidgetArea: -
790 break;
never executed: break;
0
791 default: -
792 area = Qt::LeftDockWidgetArea; -
793 }
never executed: }
0
794}
never executed: }
0
795 -
796static QInternal::DockPosition toDockPos(Qt::DockWidgetArea area) -
797{ -
798 switch (area) { -
799 case Qt::LeftDockWidgetArea: return QInternal::LeftDock;
executed: return QInternal::LeftDock;
Execution Count:9
9
800 case Qt::RightDockWidgetArea: return QInternal::RightDock;
executed: return QInternal::RightDock;
Execution Count:5
5
801 case Qt::TopDockWidgetArea: return QInternal::TopDock;
executed: return QInternal::TopDock;
Execution Count:3
3
802 case Qt::BottomDockWidgetArea: return QInternal::BottomDock;
executed: return QInternal::BottomDock;
Execution Count:1
1
803 default: -
804 break;
never executed: break;
0
805 } -
806 -
807 return QInternal::DockCount;
never executed: return QInternal::DockCount;
0
808} -
809 -
810static Qt::DockWidgetArea toDockWidgetArea(QInternal::DockPosition pos) -
811{ -
812 switch (pos) { -
813 case QInternal::LeftDock : return Qt::LeftDockWidgetArea;
executed: return Qt::LeftDockWidgetArea;
Execution Count:6
6
814 case QInternal::RightDock : return Qt::RightDockWidgetArea;
executed: return Qt::RightDockWidgetArea;
Execution Count:2
2
815 case QInternal::TopDock : return Qt::TopDockWidgetArea;
executed: return Qt::TopDockWidgetArea;
Execution Count:11
11
816 case QInternal::BottomDock : return Qt::BottomDockWidgetArea;
never executed: return Qt::BottomDockWidgetArea;
0
817 default: -
818 break;
never executed: break;
0
819 } -
820 -
821 return Qt::NoDockWidgetArea;
never executed: return Qt::NoDockWidgetArea;
0
822} -
823 -
824inline static Qt::DockWidgetArea toDockWidgetArea(int pos) -
825{ -
826 return toDockWidgetArea(static_cast<QInternal::DockPosition>(pos));
executed: return toDockWidgetArea(static_cast<QInternal::DockPosition>(pos));
Execution Count:19
19
827} -
828 -
829void QMainWindowLayout::setCorner(Qt::Corner corner, Qt::DockWidgetArea area) -
830{ -
831 if (layoutState.dockAreaLayout.corners[corner] == area)
never evaluated: layoutState.dockAreaLayout.corners[corner] == area
0
832 return;
never executed: return;
0
833 layoutState.dockAreaLayout.corners[corner] = area; -
834 if (savedState.isValid())
never evaluated: savedState.isValid()
0
835 savedState.dockAreaLayout.corners[corner] = area;
never executed: savedState.dockAreaLayout.corners[corner] = area;
0
836 invalidate(); -
837}
never executed: }
0
838 -
839Qt::DockWidgetArea QMainWindowLayout::corner(Qt::Corner corner) const -
840{ -
841 return layoutState.dockAreaLayout.corners[corner];
never executed: return layoutState.dockAreaLayout.corners[corner];
0
842} -
843 -
844void QMainWindowLayout::addDockWidget(Qt::DockWidgetArea area, -
845 QDockWidget *dockwidget, -
846 Qt::Orientation orientation) -
847{ -
848 addChildWidget(dockwidget); -
849 -
850 -
851 -
852 if (!movingSeparator.isEmpty())
partially evaluated: !movingSeparator.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:18
0-18
853 endSeparatorMove(movingSeparatorPos);
never executed: endSeparatorMove(movingSeparatorPos);
0
854 -
855 layoutState.dockAreaLayout.addDockWidget(toDockPos(area), dockwidget, orientation); -
856 dockwidget->dockLocationChanged(area); -
857 invalidate(); -
858}
executed: }
Execution Count:18
18
859 -
860void QMainWindowLayout::tabifyDockWidget(QDockWidget *first, QDockWidget *second) -
861{ -
862 addChildWidget(second); -
863 layoutState.dockAreaLayout.tabifyDockWidget(first, second); -
864 second->dockLocationChanged(dockWidgetArea(first)); -
865 invalidate(); -
866}
executed: }
Execution Count:4
4
867 -
868bool QMainWindowLayout::restoreDockWidget(QDockWidget *dockwidget) -
869{ -
870 addChildWidget(dockwidget); -
871 if (!layoutState.dockAreaLayout.restoreDockWidget(dockwidget))
never evaluated: !layoutState.dockAreaLayout.restoreDockWidget(dockwidget)
0
872 return false;
never executed: return false;
0
873 dockwidget->dockLocationChanged(dockWidgetArea(dockwidget)); -
874 invalidate(); -
875 return true;
never executed: return true;
0
876} -
877 -
878 -
879bool QMainWindowLayout::documentMode() const -
880{ -
881 return _documentMode;
never executed: return _documentMode;
0
882} -
883 -
884void QMainWindowLayout::setDocumentMode(bool enabled) -
885{ -
886 if (_documentMode == enabled)
never evaluated: _documentMode == enabled
0
887 return;
never executed: return;
0
888 -
889 _documentMode = enabled; -
890 -
891 -
892 for (QForeachContainer<__typeof__(usedTabBars)> _container_(usedTabBars); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QTabBar *bar = *_container_.i;; __extension__ ({--_container_.brk; break;})) -
893 bar->setDocumentMode(_documentMode);
never executed: bar->setDocumentMode(_documentMode);
0
894 for (QForeachContainer<__typeof__(unusedTabBars)> _container_(unusedTabBars); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QTabBar *bar = *_container_.i;; __extension__ ({--_container_.brk; break;})) -
895 bar->setDocumentMode(_documentMode);
never executed: bar->setDocumentMode(_documentMode);
0
896}
never executed: }
0
897 -
898 -
899void QMainWindowLayout::setVerticalTabsEnabled(bool enabled) -
900{ -
901 -
902 -
903 -
904 if (verticalTabsEnabled == enabled)
never evaluated: verticalTabsEnabled == enabled
0
905 return;
never executed: return;
0
906 -
907 verticalTabsEnabled = enabled; -
908 -
909 updateTabBarShapes(); -
910 -
911}
never executed: }
0
912 -
913 -
914QTabWidget::TabShape QMainWindowLayout::tabShape() const -
915{ -
916 return _tabShape;
never executed: return _tabShape;
0
917} -
918 -
919void QMainWindowLayout::setTabShape(QTabWidget::TabShape tabShape) -
920{ -
921 if (_tabShape == tabShape)
never evaluated: _tabShape == tabShape
0
922 return;
never executed: return;
0
923 -
924 _tabShape = tabShape; -
925 -
926 updateTabBarShapes(); -
927}
never executed: }
0
928 -
929QTabWidget::TabPosition QMainWindowLayout::tabPosition(Qt::DockWidgetArea area) const -
930{ -
931 return tabPositions[toDockPos(area)];
never executed: return tabPositions[toDockPos(area)];
0
932} -
933 -
934void QMainWindowLayout::setTabPosition(Qt::DockWidgetAreas areas, QTabWidget::TabPosition tabPosition) -
935{ -
936 const Qt::DockWidgetArea dockWidgetAreas[] = { -
937 Qt::TopDockWidgetArea, -
938 Qt::LeftDockWidgetArea, -
939 Qt::BottomDockWidgetArea, -
940 Qt::RightDockWidgetArea -
941 }; -
942 const QInternal::DockPosition dockPositions[] = { -
943 QInternal::TopDock, -
944 QInternal::LeftDock, -
945 QInternal::BottomDock, -
946 QInternal::RightDock -
947 }; -
948 -
949 for (int i = 0; i < QInternal::DockCount; ++i)
never evaluated: i < QInternal::DockCount
0
950 if (areas & dockWidgetAreas[i])
never evaluated: areas & dockWidgetAreas[i]
0
951 tabPositions[dockPositions[i]] = tabPosition;
never executed: tabPositions[dockPositions[i]] = tabPosition;
0
952 -
953 updateTabBarShapes(); -
954}
never executed: }
0
955 -
956static inline QTabBar::Shape tabBarShapeFrom(QTabWidget::TabShape shape, QTabWidget::TabPosition position) -
957{ -
958 const bool rounded = (shape == QTabWidget::Rounded); -
959 if (position == QTabWidget::North)
never evaluated: position == QTabWidget::North
0
960 return rounded ? QTabBar::RoundedNorth : QTabBar::TriangularNorth;
never executed: return rounded ? QTabBar::RoundedNorth : QTabBar::TriangularNorth;
0
961 if (position == QTabWidget::South)
never evaluated: position == QTabWidget::South
0
962 return rounded ? QTabBar::RoundedSouth : QTabBar::TriangularSouth;
never executed: return rounded ? QTabBar::RoundedSouth : QTabBar::TriangularSouth;
0
963 if (position == QTabWidget::East)
never evaluated: position == QTabWidget::East
0
964 return rounded ? QTabBar::RoundedEast : QTabBar::TriangularEast;
never executed: return rounded ? QTabBar::RoundedEast : QTabBar::TriangularEast;
0
965 if (position == QTabWidget::West)
never evaluated: position == QTabWidget::West
0
966 return rounded ? QTabBar::RoundedWest : QTabBar::TriangularWest;
never executed: return rounded ? QTabBar::RoundedWest : QTabBar::TriangularWest;
0
967 return QTabBar::RoundedNorth;
never executed: return QTabBar::RoundedNorth;
0
968} -
969 -
970 -
971 -
972void QMainWindowLayout::updateTabBarShapes() -
973{ -
974 -
975 const QTabWidget::TabPosition vertical[] = { -
976 QTabWidget::West, -
977 QTabWidget::East, -
978 QTabWidget::North, -
979 QTabWidget::South -
980 }; -
981 QDockAreaLayout &layout = layoutState.dockAreaLayout; -
982 -
983 for (int i = 0; i < QInternal::DockCount; ++i) {
never evaluated: i < QInternal::DockCount
0
984 -
985 QTabWidget::TabPosition pos = verticalTabsEnabled ? vertical[i] : tabPositions[i];
never evaluated: verticalTabsEnabled
0
986 QTabBar::Shape shape = tabBarShapeFrom(_tabShape, pos); -
987 -
988 -
989 -
990 layout.docks[i].setTabBarShape(shape); -
991 }
never executed: }
0
992}
never executed: }
0
993 -
994 -
995void QMainWindowLayout::splitDockWidget(QDockWidget *after, -
996 QDockWidget *dockwidget, -
997 Qt::Orientation orientation) -
998{ -
999 addChildWidget(dockwidget); -
1000 layoutState.dockAreaLayout.splitDockWidget(after, dockwidget, orientation); -
1001 dockwidget->dockLocationChanged(dockWidgetArea(after)); -
1002 invalidate(); -
1003}
executed: }
Execution Count:1
1
1004 -
1005Qt::DockWidgetArea QMainWindowLayout::dockWidgetArea(QDockWidget *widget) const -
1006{ -
1007 QList<int> pathToWidget = layoutState.dockAreaLayout.indexOf(widget); -
1008 if (pathToWidget.isEmpty())
evaluated: pathToWidget.isEmpty()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:19
2-19
1009 return Qt::NoDockWidgetArea;
executed: return Qt::NoDockWidgetArea;
Execution Count:2
2
1010 return toDockWidgetArea(pathToWidget.first());
executed: return toDockWidgetArea(pathToWidget.first());
Execution Count:19
19
1011} -
1012 -
1013void QMainWindowLayout::keepSize(QDockWidget *w) -
1014{ -
1015 layoutState.dockAreaLayout.keepSize(w); -
1016}
executed: }
Execution Count:15
15
1017 -
1018 -
1019 -
1020class QMainWindowTabBar : public QTabBar -
1021{ -
1022public: -
1023 QMainWindowTabBar(QWidget *parent); -
1024protected: -
1025 bool event(QEvent *e); -
1026}; -
1027 -
1028QMainWindowTabBar::QMainWindowTabBar(QWidget *parent) -
1029 : QTabBar(parent) -
1030{ -
1031 setExpanding(false); -
1032}
executed: }
Execution Count:5
5
1033 -
1034bool QMainWindowTabBar::event(QEvent *e) -
1035{ -
1036 -
1037 -
1038 if (e->type() != QEvent::ToolTip)
partially evaluated: e->type() != QEvent::ToolTip
TRUEFALSE
yes
Evaluation Count:92
no
Evaluation Count:0
0-92
1039 return QTabBar::event(e);
executed: return QTabBar::event(e);
Execution Count:92
92
1040 QSize size = this->size(); -
1041 QSize hint = sizeHint(); -
1042 if (shape() == QTabBar::RoundedWest || shape() == QTabBar::RoundedEast) {
never evaluated: shape() == QTabBar::RoundedWest
never evaluated: shape() == QTabBar::RoundedEast
0
1043 size.transpose(); -
1044 hint.transpose(); -
1045 }
never executed: }
0
1046 if (size.width() < hint.width())
never evaluated: size.width() < hint.width()
0
1047 return QTabBar::event(e);
never executed: return QTabBar::event(e);
0
1048 e->accept(); -
1049 return true;
never executed: return true;
0
1050} -
1051 -
1052QTabBar *QMainWindowLayout::getTabBar() -
1053{ -
1054 QTabBar *result = 0; -
1055 if (!unusedTabBars.isEmpty()) {
partially evaluated: !unusedTabBars.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-5
1056 result = unusedTabBars.takeLast(); -
1057 } else {
never executed: }
0
1058 result = new QMainWindowTabBar(parentWidget()); -
1059 result->setDrawBase(true); -
1060 result->setElideMode(Qt::ElideRight); -
1061 result->setDocumentMode(_documentMode); -
1062 connect(result, "2""currentChanged(int)", this, "1""tabChanged()"); -
1063 }
executed: }
Execution Count:5
5
1064 -
1065 usedTabBars.insert(result); -
1066 return result;
executed: return result;
Execution Count:5
5
1067} -
1068 -
1069 -
1070QWidget *QMainWindowLayout::getSeparatorWidget() -
1071{ -
1072 QWidget *result = 0; -
1073 if (!unusedSeparatorWidgets.isEmpty()) {
never evaluated: !unusedSeparatorWidgets.isEmpty()
0
1074 result = unusedSeparatorWidgets.takeLast(); -
1075 } else {
never executed: }
0
1076 result = new QWidget(parentWidget()); -
1077 result->setAttribute(Qt::WA_MouseNoMask, true); -
1078 result->setAutoFillBackground(false); -
1079 result->setObjectName(QLatin1String("qt_qmainwindow_extended_splitter")); -
1080 }
never executed: }
0
1081 usedSeparatorWidgets.insert(result); -
1082 return result;
never executed: return result;
0
1083} -
1084 -
1085void QMainWindowLayout::tabChanged() -
1086{ -
1087 QTabBar *tb = qobject_cast<QTabBar*>(sender()); -
1088 if (tb == 0)
partially evaluated: tb == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
1089 return;
never executed: return;
0
1090 QDockAreaLayoutInfo *info = layoutState.dockAreaLayout.info(tb); -
1091 if (info == 0)
evaluated: info == 0
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:6
2-6
1092 return;
executed: return;
Execution Count:2
2
1093 info->apply(false); -
1094 -
1095 if (QWidget *w = centralWidget())
partially evaluated: QWidget *w = centralWidget()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6
0-6
1096 w->raise();
never executed: w->raise();
0
1097}
executed: }
Execution Count:6
6
1098 -
1099 -
1100bool QMainWindowLayout::startSeparatorMove(const QPoint &pos) -
1101{ -
1102 movingSeparator = layoutState.dockAreaLayout.findSeparator(pos); -
1103 -
1104 if (movingSeparator.isEmpty())
never evaluated: movingSeparator.isEmpty()
0
1105 return false;
never executed: return false;
0
1106 -
1107 layoutState.dockAreaLayout.fallbackToSizeHints = false; -
1108 -
1109 savedState = layoutState; -
1110 movingSeparatorPos = movingSeparatorOrigin = pos; -
1111 -
1112 return true;
never executed: return true;
0
1113} -
1114 -
1115bool QMainWindowLayout::separatorMove(const QPoint &pos) -
1116{ -
1117 if (movingSeparator.isEmpty())
never evaluated: movingSeparator.isEmpty()
0
1118 return false;
never executed: return false;
0
1119 movingSeparatorPos = pos; -
1120 separatorMoveTimer.start(0, this); -
1121 return true;
never executed: return true;
0
1122} -
1123 -
1124bool QMainWindowLayout::endSeparatorMove(const QPoint&) -
1125{ -
1126 if (movingSeparator.isEmpty())
never evaluated: movingSeparator.isEmpty()
0
1127 return false;
never executed: return false;
0
1128 movingSeparator.clear(); -
1129 savedState.clear(); -
1130 return true;
never executed: return true;
0
1131} -
1132 -
1133void QMainWindowLayout::raise(QDockWidget *widget) -
1134{ -
1135 QDockAreaLayoutInfo *info = layoutState.dockAreaLayout.info(widget); -
1136 if (info == 0)
partially evaluated: info == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
1137 return;
never executed: return;
0
1138 -
1139 if (!info->tabbed)
partially evaluated: !info->tabbed
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
1140 return;
never executed: return;
0
1141 info->setCurrentTab(widget); -
1142 -
1143}
executed: }
Execution Count:4
4
1144int QMainWindowLayout::count() const -
1145{ -
1146 QMessageLogger("widgets/qmainwindowlayout.cpp", 1399, __PRETTY_FUNCTION__).warning("QMainWindowLayout::count: ?"); -
1147 return 0;
never executed: return 0;
0
1148} -
1149 -
1150QLayoutItem *QMainWindowLayout::itemAt(int index) const -
1151{ -
1152 int x = 0; -
1153 -
1154 if (QLayoutItem *ret = layoutState.itemAt(index, &x))
evaluated: QLayoutItem *ret = layoutState.itemAt(index, &x)
TRUEFALSE
yes
Evaluation Count:185
yes
Evaluation Count:232
185-232
1155 return ret;
executed: return ret;
Execution Count:185
185
1156 -
1157 if (statusbar && x++ == index)
evaluated: statusbar
TRUEFALSE
yes
Evaluation Count:59
yes
Evaluation Count:173
evaluated: x++ == index
TRUEFALSE
yes
Evaluation Count:30
yes
Evaluation Count:29
29-173
1158 return statusbar;
executed: return statusbar;
Execution Count:30
30
1159 -
1160 return 0;
executed: return 0;
Execution Count:202
202
1161} -
1162 -
1163QLayoutItem *QMainWindowLayout::takeAt(int index) -
1164{ -
1165 int x = 0; -
1166 -
1167 if (QLayoutItem *ret = layoutState.takeAt(index, &x)) {
evaluated: QLayoutItem *ret = layoutState.takeAt(index, &x)
TRUEFALSE
yes
Evaluation Count:22
yes
Evaluation Count:1
1-22
1168 -
1169 if (QWidget *w = ret->widget()) {
partially evaluated: QWidget *w = ret->widget()
TRUEFALSE
yes
Evaluation Count:22
no
Evaluation Count:0
0-22
1170 widgetAnimator.abort(w); -
1171 if (w == pluggingWidget)
partially evaluated: w == pluggingWidget
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:22
0-22
1172 pluggingWidget = 0;
never executed: pluggingWidget = 0;
0
1173 }
executed: }
Execution Count:22
22
1174 -
1175 if (savedState.isValid() ) {
partially evaluated: savedState.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:22
0-22
1176 -
1177 savedState.remove(ret); -
1178 -
1179 layoutState.remove(ret); -
1180 }
never executed: }
0
1181 -
1182 -
1183 if (!currentGapPos.isEmpty() && currentGapPos.first() == 0) {
partially evaluated: !currentGapPos.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:22
never evaluated: currentGapPos.first() == 0
0-22
1184 currentGapPos = layoutState.toolBarAreaLayout.currentGapIndex(); -
1185 if (!currentGapPos.isEmpty()) {
never evaluated: !currentGapPos.isEmpty()
0
1186 currentGapPos.prepend(0); -
1187 currentGapRect = layoutState.itemRect(currentGapPos); -
1188 }
never executed: }
0
1189 }
never executed: }
0
1190 -
1191 -
1192 return ret;
executed: return ret;
Execution Count:22
22
1193 } -
1194 -
1195 if (statusbar && x++ == index) {
partially evaluated: statusbar
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
partially evaluated: x++ == index
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
1196 QLayoutItem *ret = statusbar; -
1197 statusbar = 0; -
1198 return ret;
executed: return ret;
Execution Count:1
1
1199 } -
1200 -
1201 return 0;
never executed: return 0;
0
1202} -
1203 -
1204void QMainWindowLayout::setGeometry(const QRect &_r) -
1205{ -
1206 if (savedState.isValid())
partially evaluated: savedState.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:237
0-237
1207 return;
never executed: return;
0
1208 -
1209 QRect r = _r; -
1210 -
1211 QLayout::setGeometry(r); -
1212 -
1213 if (statusbar) {
evaluated: statusbar
TRUEFALSE
yes
Evaluation Count:29
yes
Evaluation Count:208
29-208
1214 QRect sbr(QPoint(0, 0), -
1215 QSize(r.width(), statusbar->heightForWidth(r.width())) -
1216 .expandedTo(statusbar->minimumSize())); -
1217 sbr.moveBottom(r.bottom()); -
1218 QRect vr = QStyle::visualRect(parentWidget()->layoutDirection(), _r, sbr); -
1219 statusbar->setGeometry(vr); -
1220 r.setBottom(sbr.top() - 1); -
1221 }
executed: }
Execution Count:29
29
1222 -
1223 layoutState.rect = r; -
1224 layoutState.fitLayout(); -
1225 applyState(layoutState, false); -
1226}
executed: }
Execution Count:237
237
1227 -
1228void QMainWindowLayout::addItem(QLayoutItem *) -
1229{ QMessageLogger("widgets/qmainwindowlayout.cpp", 1482, __PRETTY_FUNCTION__).warning("QMainWindowLayout::addItem: Please use the public QMainWindow API instead"); }
never executed: }
0
1230 -
1231QSize QMainWindowLayout::sizeHint() const -
1232{ -
1233 if (!szHint.isValid()) {
partially evaluated: !szHint.isValid()
TRUEFALSE
yes
Evaluation Count:30
no
Evaluation Count:0
0-30
1234 szHint = layoutState.sizeHint(); -
1235 const QSize sbHint = statusbar ? statusbar->sizeHint() : QSize(0, 0);
evaluated: statusbar
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:27
3-27
1236 szHint = QSize(qMax(sbHint.width(), szHint.width()), -
1237 sbHint.height() + szHint.height()); -
1238 }
executed: }
Execution Count:30
30
1239 return szHint;
executed: return szHint;
Execution Count:30
30
1240} -
1241 -
1242QSize QMainWindowLayout::minimumSize() const -
1243{ -
1244 if (!minSize.isValid()) {
partially evaluated: !minSize.isValid()
TRUEFALSE
yes
Evaluation Count:167
no
Evaluation Count:0
0-167
1245 minSize = layoutState.minimumSize(); -
1246 const QSize sbMin = statusbar ? statusbar->minimumSize() : QSize(0, 0);
evaluated: statusbar
TRUEFALSE
yes
Evaluation Count:21
yes
Evaluation Count:146
21-146
1247 minSize = QSize(qMax(sbMin.width(), minSize.width()), -
1248 sbMin.height() + minSize.height()); -
1249 }
executed: }
Execution Count:167
167
1250 return minSize;
executed: return minSize;
Execution Count:167
167
1251} -
1252 -
1253void QMainWindowLayout::invalidate() -
1254{ -
1255 QLayout::invalidate(); -
1256 minSize = szHint = QSize(); -
1257}
executed: }
Execution Count:825
825
1258 -
1259 -
1260 -
1261 -
1262 -
1263static void fixToolBarOrientation(QLayoutItem *item, int dockPos) -
1264{ -
1265 -
1266 QToolBar *toolBar = qobject_cast<QToolBar*>(item->widget()); -
1267 if (toolBar == 0)
never evaluated: toolBar == 0
0
1268 return;
never executed: return;
0
1269 -
1270 QRect oldGeo = toolBar->geometry(); -
1271 -
1272 QInternal::DockPosition pos -
1273 = static_cast<QInternal::DockPosition>(dockPos); -
1274 Qt::Orientation o = pos == QInternal::TopDock || pos == QInternal::BottomDock
never evaluated: pos == QInternal::TopDock
never evaluated: pos == QInternal::BottomDock
0
1275 ? Qt::Horizontal : Qt::Vertical; -
1276 if (o != toolBar->orientation())
never evaluated: o != toolBar->orientation()
0
1277 toolBar->setOrientation(o);
never executed: toolBar->setOrientation(o);
0
1278 -
1279 QSize hint = toolBar->sizeHint().boundedTo(toolBar->maximumSize()) -
1280 .expandedTo(toolBar->minimumSize()); -
1281 -
1282 if (toolBar->size() != hint) {
never evaluated: toolBar->size() != hint
0
1283 QRect newGeo(oldGeo.topLeft(), hint); -
1284 if (toolBar->layoutDirection() == Qt::RightToLeft)
never evaluated: toolBar->layoutDirection() == Qt::RightToLeft
0
1285 newGeo.moveRight(oldGeo.right());
never executed: newGeo.moveRight(oldGeo.right());
0
1286 toolBar->setGeometry(newGeo); -
1287 }
never executed: }
0
1288 -
1289 -
1290 -
1291 -
1292 -
1293}
never executed: }
0
1294 -
1295void QMainWindowLayout::revert(QLayoutItem *widgetItem) -
1296{ -
1297 if (!savedState.isValid())
never evaluated: !savedState.isValid()
0
1298 return;
never executed: return;
0
1299 -
1300 QWidget *widget = widgetItem->widget(); -
1301 layoutState = savedState; -
1302 currentGapPos = layoutState.indexOf(widget); -
1303 fixToolBarOrientation(widgetItem, currentGapPos.at(1)); -
1304 layoutState.unplug(currentGapPos); -
1305 layoutState.fitLayout(); -
1306 currentGapRect = layoutState.itemRect(currentGapPos); -
1307 -
1308 plug(widgetItem); -
1309}
never executed: }
0
1310 -
1311bool QMainWindowLayout::plug(QLayoutItem *widgetItem) -
1312{ -
1313 if (!parentWidget()->isVisible() || parentWidget()->isMinimized() || currentGapPos.isEmpty())
never evaluated: !parentWidget()->isVisible()
never evaluated: parentWidget()->isMinimized()
never evaluated: currentGapPos.isEmpty()
0
1314 return false;
never executed: return false;
0
1315 -
1316 fixToolBarOrientation(widgetItem, currentGapPos.at(1)); -
1317 -
1318 QWidget *widget = widgetItem->widget(); -
1319 -
1320 QList<int> previousPath = layoutState.indexOf(widget); -
1321 -
1322 QLayoutItem *it = layoutState.plug(currentGapPos); -
1323 qt_noop(); -
1324 (void)it;; -
1325 if (!previousPath.isEmpty())
never evaluated: !previousPath.isEmpty()
0
1326 layoutState.remove(previousPath);
never executed: layoutState.remove(previousPath);
0
1327 -
1328 pluggingWidget = widget; -
1329 QRect globalRect = currentGapRect; -
1330 globalRect.moveTopLeft(parentWidget()->mapToGlobal(globalRect.topLeft())); -
1331 -
1332 if (qobject_cast<QDockWidget*>(widget) != 0) {
never evaluated: qobject_cast<QDockWidget*>(widget) != 0
0
1333 QDockWidgetLayout *layout = qobject_cast<QDockWidgetLayout*>(widget->layout()); -
1334 if (layout->nativeWindowDeco()) {
never evaluated: layout->nativeWindowDeco()
0
1335 globalRect.adjust(0, layout->titleHeight(), 0, 0); -
1336 } else {
never executed: }
0
1337 int fw = widget->style()->pixelMetric(QStyle::PM_DockWidgetFrameWidth, 0, widget); -
1338 globalRect.adjust(-fw, -fw, fw, fw); -
1339 }
never executed: }
0
1340 } -
1341 -
1342 widgetAnimator.animate(widget, globalRect, dockOptions & QMainWindow::AnimatedDocks); -
1343 -
1344 return true;
never executed: return true;
0
1345} -
1346 -
1347void QMainWindowLayout::animationFinished(QWidget *widget) -
1348{ -
1349 -
1350 -
1351 -
1352 if (QToolBar *tb = qobject_cast<QToolBar*>(widget)) {
evaluated: QToolBar *tb = qobject_cast<QToolBar*>(widget)
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:210
10-210
1353 QToolBarLayout *tbl = qobject_cast<QToolBarLayout*>(tb->layout()); -
1354 if (tbl->animating) {
partially evaluated: tbl->animating
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:10
0-10
1355 tbl->animating = false; -
1356 if (tbl->expanded)
never evaluated: tbl->expanded
0
1357 tbl->layoutActions(tb->size());
never executed: tbl->layoutActions(tb->size());
0
1358 tb->update(); -
1359 }
never executed: }
0
1360 }
executed: }
Execution Count:10
10
1361 -
1362 -
1363 if (widget == pluggingWidget) {
partially evaluated: widget == pluggingWidget
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:220
0-220
1364 -
1365 -
1366 if (QDockWidget *dw = qobject_cast<QDockWidget*>(widget))
never evaluated: QDockWidget *dw = qobject_cast<QDockWidget*>(widget)
0
1367 dw->d_func()->plug(currentGapRect);
never executed: dw->d_func()->plug(currentGapRect);
0
1368 -
1369 -
1370 if (QToolBar *tb = qobject_cast<QToolBar*>(widget))
never evaluated: QToolBar *tb = qobject_cast<QToolBar*>(widget)
0
1371 tb->d_func()->plug(currentGapRect);
never executed: tb->d_func()->plug(currentGapRect);
0
1372 -
1373 -
1374 savedState.clear(); -
1375 currentGapPos.clear(); -
1376 pluggingWidget = 0; -
1377 -
1378 -
1379 layoutState.apply(false); -
1380 -
1381 -
1382 -
1383 if (qobject_cast<QDockWidget*>(widget) != 0) {
never evaluated: qobject_cast<QDockWidget*>(widget) != 0
0
1384 -
1385 -
1386 if (QDockAreaLayoutInfo *info = layoutState.dockAreaLayout.info(widget))
never evaluated: QDockAreaLayoutInfo *info = layoutState.dockAreaLayout.info(widget)
0
1387 info->setCurrentTab(widget);
never executed: info->setCurrentTab(widget);
0
1388 }
never executed: }
0
1389 -
1390 -
1391 }
never executed: }
0
1392 -
1393 if (!widgetAnimator.animating()) {
partially evaluated: !widgetAnimator.animating()
TRUEFALSE
yes
Evaluation Count:220
no
Evaluation Count:0
0-220
1394 -
1395 -
1396 parentWidget()->update(layoutState.dockAreaLayout.separatorRegion()); -
1397 -
1398 for (QForeachContainer<__typeof__(usedTabBars)> _container_(usedTabBars); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QTabBar *tab_bar = *_container_.i;; __extension__ ({--_container_.brk; break;})) -
1399 tab_bar->show();
executed: tab_bar->show();
Execution Count:48
48
1400 -
1401 -
1402 }
executed: }
Execution Count:220
220
1403 -
1404 updateGapIndicator(); -
1405}
executed: }
Execution Count:220
220
1406 -
1407void QMainWindowLayout::restore(bool keepSavedState) -
1408{ -
1409 if (!savedState.isValid())
never evaluated: !savedState.isValid()
0
1410 return;
never executed: return;
0
1411 -
1412 layoutState = savedState; -
1413 applyState(layoutState); -
1414 if (!keepSavedState)
never evaluated: !keepSavedState
0
1415 savedState.clear();
never executed: savedState.clear();
0
1416 currentGapPos.clear(); -
1417 pluggingWidget = 0; -
1418 updateGapIndicator(); -
1419}
never executed: }
0
1420 -
1421QMainWindowLayout::QMainWindowLayout(QMainWindow *mainwindow, QLayout *parentLayout) -
1422 : QLayout(parentLayout ? static_cast<QWidget *>(0) : mainwindow) -
1423 , layoutState(mainwindow) -
1424 , savedState(mainwindow) -
1425 , dockOptions(QMainWindow::AnimatedDocks | QMainWindow::AllowTabbedDocks) -
1426 , statusbar(0) -
1427 -
1428 -
1429 , _documentMode(false) -
1430 , verticalTabsEnabled(false) -
1431 -
1432 , _tabShape(QTabWidget::Rounded) -
1433 -
1434 -
1435 -
1436 , widgetAnimator(this) -
1437 , pluggingWidget(0) -
1438 -
1439 , gapIndicator(new QRubberBand(QRubberBand::Rectangle, mainwindow)) -
1440 -
1441 -
1442 -
1443 -
1444{ -
1445 if (parentLayout)
partially evaluated: parentLayout
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:44
0-44
1446 setParent(parentLayout);
never executed: setParent(parentLayout);
0
1447 -
1448 -
1449 -
1450 sep = mainwindow->style()->pixelMetric(QStyle::PM_DockWidgetSeparatorExtent, 0, mainwindow); -
1451 -
1452 -
1453 -
1454 for (int i = 0; i < QInternal::DockCount; ++i)
evaluated: i < QInternal::DockCount
TRUEFALSE
yes
Evaluation Count:176
yes
Evaluation Count:44
44-176
1455 tabPositions[i] = QTabWidget::South;
executed: tabPositions[i] = QTabWidget::South;
Execution Count:176
176
1456 -
1457 -
1458 -
1459 -
1460 -
1461 gapIndicator->setObjectName(QLatin1String("qt_rubberband")); -
1462 gapIndicator->hide(); -
1463 -
1464 pluggingWidget = 0; -
1465 -
1466 setObjectName(mainwindow->objectName() + QLatin1String("_layout")); -
1467}
executed: }
Execution Count:44
44
1468 -
1469QMainWindowLayout::~QMainWindowLayout() -
1470{ -
1471 layoutState.deleteAllLayoutItems(); -
1472 layoutState.deleteCentralWidgetItem(); -
1473 -
1474 -
1475 -
1476 -
1477 -
1478 delete statusbar; -
1479}
executed: }
Execution Count:43
43
1480 -
1481void QMainWindowLayout::setDockOptions(QMainWindow::DockOptions opts) -
1482{ -
1483 if (opts == dockOptions)
never evaluated: opts == dockOptions
0
1484 return;
never executed: return;
0
1485 -
1486 dockOptions = opts; -
1487 -
1488 -
1489 setVerticalTabsEnabled(opts & QMainWindow::VerticalTabs); -
1490 -
1491 -
1492 invalidate(); -
1493}
never executed: }
0
1494 -
1495 -
1496QStatusBar *QMainWindowLayout::statusBar() const -
1497{ return statusbar ? qobject_cast<QStatusBar *>(statusbar->widget()) : 0; }
executed: return statusbar ? qobject_cast<QStatusBar *>(statusbar->widget()) : 0;
Execution Count:97
97
1498 -
1499void QMainWindowLayout::setStatusBar(QStatusBar *sb) -
1500{ -
1501 if (sb)
partially evaluated: sb
TRUEFALSE
yes
Evaluation Count:5
no
Evaluation Count:0
0-5
1502 addChildWidget(sb);
executed: addChildWidget(sb);
Execution Count:5
5
1503 delete statusbar; -
1504 statusbar = sb ? new QWidgetItemV2(sb) : 0;
partially evaluated: sb
TRUEFALSE
yes
Evaluation Count:5
no
Evaluation Count:0
0-5
1505 invalidate(); -
1506}
executed: }
Execution Count:5
5
1507 -
1508 -
1509QWidget *QMainWindowLayout::centralWidget() const -
1510{ -
1511 return layoutState.centralWidget();
executed: return layoutState.centralWidget();
Execution Count:24
24
1512} -
1513 -
1514void QMainWindowLayout::setCentralWidget(QWidget *widget) -
1515{ -
1516 if (widget != 0)
partially evaluated: widget != 0
TRUEFALSE
yes
Evaluation Count:18
no
Evaluation Count:0
0-18
1517 addChildWidget(widget);
executed: addChildWidget(widget);
Execution Count:18
18
1518 layoutState.setCentralWidget(widget); -
1519 if (savedState.isValid()) {
partially evaluated: savedState.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:18
0-18
1520 -
1521 savedState.dockAreaLayout.centralWidgetItem = layoutState.dockAreaLayout.centralWidgetItem; -
1522 savedState.dockAreaLayout.fallbackToSizeHints = true; -
1523 -
1524 -
1525 -
1526 }
never executed: }
0
1527 invalidate(); -
1528}
executed: }
Execution Count:18
18
1529 -
1530QLayoutItem *QMainWindowLayout::unplug(QWidget *widget) -
1531{ -
1532 QList<int> path = layoutState.indexOf(widget); -
1533 if (path.isEmpty())
never evaluated: path.isEmpty()
0
1534 return 0;
never executed: return 0;
0
1535 -
1536 QLayoutItem *item = layoutState.item(path); -
1537 if (widget->isWindow())
never evaluated: widget->isWindow()
0
1538 return item;
never executed: return item;
0
1539 -
1540 QRect r = layoutState.itemRect(path); -
1541 savedState = layoutState; -
1542 -
1543 -
1544 if (QDockWidget *dw = qobject_cast<QDockWidget*>(widget)) {
never evaluated: QDockWidget *dw = qobject_cast<QDockWidget*>(widget)
0
1545 dw->d_func()->unplug(r); -
1546 }
never executed: }
0
1547 -
1548 -
1549 if (QToolBar *tb = qobject_cast<QToolBar*>(widget)) {
never evaluated: QToolBar *tb = qobject_cast<QToolBar*>(widget)
0
1550 tb->d_func()->unplug(r); -
1551 }
never executed: }
0
1552 -
1553 -
1554 -
1555 layoutState.unplug(path ,&savedState); -
1556 savedState.fitLayout(); -
1557 currentGapPos = path; -
1558 currentGapRect = r; -
1559 updateGapIndicator(); -
1560 -
1561 fixToolBarOrientation(item, currentGapPos.at(1)); -
1562 -
1563 return item;
never executed: return item;
0
1564} -
1565 -
1566void QMainWindowLayout::updateGapIndicator() -
1567{ -
1568 -
1569 gapIndicator->setVisible(!widgetAnimator.animating() && !currentGapPos.isEmpty()); -
1570 gapIndicator->setGeometry(currentGapRect); -
1571 -
1572}
executed: }
Execution Count:220
220
1573 -
1574QList<int> QMainWindowLayout::hover(QLayoutItem *widgetItem, const QPoint &mousePos) -
1575{ -
1576 if (!parentWidget()->isVisible() || parentWidget()->isMinimized()
never evaluated: !parentWidget()->isVisible()
never evaluated: parentWidget()->isMinimized()
0
1577 || pluggingWidget != 0 || widgetItem == 0)
never evaluated: pluggingWidget != 0
never evaluated: widgetItem == 0
0
1578 return QList<int>();
never executed: return QList<int>();
0
1579 -
1580 QWidget *widget = widgetItem->widget(); -
1581 QPoint pos = parentWidget()->mapFromGlobal(mousePos); -
1582 -
1583 if (!savedState.isValid())
never evaluated: !savedState.isValid()
0
1584 savedState = layoutState;
never executed: savedState = layoutState;
0
1585 -
1586 QList<int> path = savedState.gapIndex(widget, pos); -
1587 -
1588 if (!path.isEmpty()) {
never evaluated: !path.isEmpty()
0
1589 bool allowed = false; -
1590 -
1591 -
1592 if (QDockWidget *dw = qobject_cast<QDockWidget*>(widget))
never evaluated: QDockWidget *dw = qobject_cast<QDockWidget*>(widget)
0
1593 allowed = dw->isAreaAllowed(toDockWidgetArea(path.at(1)));
never executed: allowed = dw->isAreaAllowed(toDockWidgetArea(path.at(1)));
0
1594 -
1595 -
1596 if (QToolBar *tb = qobject_cast<QToolBar*>(widget))
never evaluated: QToolBar *tb = qobject_cast<QToolBar*>(widget)
0
1597 allowed = tb->isAreaAllowed(toToolBarArea(path.at(1)));
never executed: allowed = tb->isAreaAllowed(toToolBarArea(path.at(1)));
0
1598 -
1599 -
1600 if (!allowed)
never evaluated: !allowed
0
1601 path.clear();
never executed: path.clear();
0
1602 }
never executed: }
0
1603 -
1604 if (path == currentGapPos)
never evaluated: path == currentGapPos
0
1605 return currentGapPos;
never executed: return currentGapPos;
0
1606 -
1607 currentGapPos = path; -
1608 if (path.isEmpty()) {
never evaluated: path.isEmpty()
0
1609 fixToolBarOrientation(widgetItem, 2); -
1610 restore(true); -
1611 return QList<int>();
never executed: return QList<int>();
0
1612 } -
1613 -
1614 fixToolBarOrientation(widgetItem, currentGapPos.at(1)); -
1615 -
1616 QMainWindowLayoutState newState = savedState; -
1617 -
1618 if (!newState.insertGap(path, widgetItem)) {
never evaluated: !newState.insertGap(path, widgetItem)
0
1619 restore(true); -
1620 return QList<int>();
never executed: return QList<int>();
0
1621 } -
1622 -
1623 QSize min = newState.minimumSize(); -
1624 QSize size = newState.rect.size(); -
1625 -
1626 if (min.width() > size.width() || min.height() > size.height()) {
never evaluated: min.width() > size.width()
never evaluated: min.height() > size.height()
0
1627 restore(true); -
1628 return QList<int>();
never executed: return QList<int>();
0
1629 } -
1630 -
1631 newState.fitLayout(); -
1632 -
1633 currentGapRect = newState.gapRect(currentGapPos); -
1634 -
1635 -
1636 parentWidget()->update(layoutState.dockAreaLayout.separatorRegion()); -
1637 -
1638 layoutState = newState; -
1639 applyState(layoutState); -
1640 -
1641 updateGapIndicator(); -
1642 -
1643 return path;
never executed: return path;
0
1644} -
1645 -
1646void QMainWindowLayout::applyState(QMainWindowLayoutState &newState, bool animate) -
1647{ -
1648 -
1649 -
1650 QSet<QTabBar*> used = newState.dockAreaLayout.usedTabBars(); -
1651 QSet<QTabBar*> retired = usedTabBars - used; -
1652 usedTabBars = used; -
1653 for (QForeachContainer<__typeof__(retired)> _container_(retired); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QTabBar *tab_bar = *_container_.i;; __extension__ ({--_container_.brk; break;})) { -
1654 tab_bar->hide(); -
1655 while (tab_bar->count() > 0)
evaluated: tab_bar->count() > 0
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1
1-2
1656 tab_bar->removeTab(0);
executed: tab_bar->removeTab(0);
Execution Count:2
2
1657 unusedTabBars.append(tab_bar); -
1658 }
executed: }
Execution Count:1
1
1659 -
1660 if (sep == 1) {
partially evaluated: sep == 1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:237
0-237
1661 QSet<QWidget*> usedSeps = newState.dockAreaLayout.usedSeparatorWidgets(); -
1662 QSet<QWidget*> retiredSeps = usedSeparatorWidgets - usedSeps; -
1663 usedSeparatorWidgets = usedSeps; -
1664 for (QForeachContainer<__typeof__(retiredSeps)> _container_(retiredSeps); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QWidget *sepWidget = *_container_.i;; __extension__ ({--_container_.brk; break;})) { -
1665 unusedSeparatorWidgets.append(sepWidget); -
1666 }
never executed: }
0
1667 }
never executed: }
0
1668 -
1669 -
1670 -
1671 -
1672 newState.apply(dockOptions & QMainWindow::AnimatedDocks && animate); -
1673}
executed: }
Execution Count:237
237
1674 -
1675void QMainWindowLayout::saveState(QDataStream &stream) const -
1676{ -
1677 layoutState.saveState(stream); -
1678}
executed: }
Execution Count:2
2
1679 -
1680bool QMainWindowLayout::restoreState(QDataStream &stream) -
1681{ -
1682 savedState = layoutState; -
1683 layoutState.clear(); -
1684 layoutState.rect = savedState.rect; -
1685 -
1686 if (!layoutState.restoreState(stream, savedState)) {
partially evaluated: !layoutState.restoreState(stream, savedState)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
1687 layoutState.deleteAllLayoutItems(); -
1688 layoutState = savedState; -
1689 if (parentWidget()->isVisible())
never evaluated: parentWidget()->isVisible()
0
1690 applyState(layoutState, false);
never executed: applyState(layoutState, false);
0
1691 return false;
never executed: return false;
0
1692 } -
1693 -
1694 if (parentWidget()->isVisible()) {
partially evaluated: parentWidget()->isVisible()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
1695 layoutState.fitLayout(); -
1696 applyState(layoutState, false); -
1697 }
never executed: }
0
1698 -
1699 savedState.deleteAllLayoutItems(); -
1700 savedState.clear(); -
1701 -
1702 -
1703 if (parentWidget()->isVisible()) {
partially evaluated: parentWidget()->isVisible()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
1704 -
1705 for (QForeachContainer<__typeof__(usedTabBars)> _container_(usedTabBars); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QTabBar *tab_bar = *_container_.i;; __extension__ ({--_container_.brk; break;})) -
1706 tab_bar->show();
never executed: tab_bar->show();
0
1707 -
1708 -
1709 }
never executed: }
0
1710 -
1711 -
1712 return true;
executed: return true;
Execution Count:2
2
1713} -
1714 -
1715 -
1716 -
1717 -
1718 -
1719bool QMainWindowLayout::usesHIToolBar(QToolBar *toolbar) const -
1720{ -
1721 -
1722 (void)toolbar;; -
1723 return false;
executed: return false;
Execution Count:2
2
1724 -
1725 -
1726 -
1727 -
1728 -
1729} -
1730 -
1731void QMainWindowLayout::timerEvent(QTimerEvent *e) -
1732{ -
1733 -
1734 if (e->timerId() == separatorMoveTimer.timerId()) {
never evaluated: e->timerId() == separatorMoveTimer.timerId()
0
1735 -
1736 separatorMoveTimer.stop(); -
1737 if (movingSeparator.isEmpty())
never evaluated: movingSeparator.isEmpty()
0
1738 return;
never executed: return;
0
1739 if (movingSeparatorOrigin == movingSeparatorPos)
never evaluated: movingSeparatorOrigin == movingSeparatorPos
0
1740 return;
never executed: return;
0
1741 -
1742 -
1743 parentWidget()->update(layoutState.dockAreaLayout.separatorRegion()); -
1744 -
1745 layoutState = savedState; -
1746 layoutState.dockAreaLayout.separatorMove(movingSeparator, movingSeparatorOrigin, -
1747 movingSeparatorPos); -
1748 movingSeparatorPos = movingSeparatorOrigin; -
1749 }
never executed: }
0
1750 -
1751 QLayout::timerEvent(e); -
1752}
never executed: }
0
1753 -
1754 -
1755 -
1756 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial