widgets/qmainwindowlayout.cpp

Source codeSwitch to Preprocessed file
LineSource CodeCoverage
1/**************************************************************************** -
2** -
3** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -
4** Contact: http://www.qt-project.org/legal -
5** -
6** This file is part of the QtGui module of the Qt Toolkit. -
7** -
8** $QT_BEGIN_LICENSE:LGPL$ -
9** Commercial License Usage -
10** Licensees holding valid commercial Qt licenses may use this file in -
11** accordance with the commercial license agreement provided with the -
12** Software or, alternatively, in accordance with the terms contained in -
13** a written agreement between you and Digia. For licensing terms and -
14** conditions see http://qt.digia.com/licensing. For further information -
15** use the contact form at http://qt.digia.com/contact-us. -
16** -
17** GNU Lesser General Public License Usage -
18** Alternatively, this file may be used under the terms of the GNU Lesser -
19** General Public License version 2.1 as published by the Free Software -
20** Foundation and appearing in the file LICENSE.LGPL included in the -
21** packaging of this file. Please review the following information to -
22** ensure the GNU Lesser General Public License version 2.1 requirements -
23** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -
24** -
25** In addition, as a special exception, Digia gives you certain additional -
26** rights. These rights are described in the Digia Qt LGPL Exception -
27** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -
28** -
29** GNU General Public License Usage -
30** Alternatively, this file may be used under the terms of the GNU -
31** General Public License version 3.0 as published by the Free Software -
32** Foundation and appearing in the file LICENSE.GPL included in the -
33** packaging of this file. Please review the following information to -
34** ensure the GNU General Public License version 3.0 requirements will be -
35** met: http://www.gnu.org/copyleft/gpl.html. -
36** -
37** -
38** $QT_END_LICENSE$ -
39** -
40****************************************************************************/ -
41 -
42#include "qmainwindowlayout_p.h" -
43#include "qdockarealayout_p.h" -
44 -
45#ifndef QT_NO_MAINWINDOW -
46#include "qdockwidget.h" -
47#include "qdockwidget_p.h" -
48#include "qtoolbar_p.h" -
49#include "qmainwindow.h" -
50#include "qtoolbar.h" -
51#include "qtoolbarlayout_p.h" -
52#include "qwidgetanimator_p.h" -
53#include "qrubberband.h" -
54#include "qtabbar_p.h" -
55 -
56#include <qapplication.h> -
57#include <qstatusbar.h> -
58#include <qstring.h> -
59#include <qstyle.h> -
60#include <qvarlengtharray.h> -
61#include <qstack.h> -
62#include <qmap.h> -
63#include <qtimer.h> -
64 -
65#include <qdebug.h> -
66 -
67#include <private/qapplication_p.h> -
68#include <private/qlayoutengine_p.h> -
69#ifdef Q_WS_MAC -
70# include <private/qcore_mac_p.h> -
71# include <private/qt_cocoa_helpers_mac_p.h> -
72#endif -
73 -
74#ifdef QT_NO_DOCKWIDGET -
75extern QMainWindowLayout *qt_mainwindow_layout(const QMainWindow *window); -
76#endif -
77 -
78#ifdef Q_DEBUG_MAINWINDOW_LAYOUT -
79# include <QTextStream> -
80#endif -
81 -
82QT_BEGIN_NAMESPACE -
83 -
84/****************************************************************************** -
85** debug -
86*/ -
87 -
88#if defined(Q_DEBUG_MAINWINDOW_LAYOUT) && !defined(QT_NO_DOCKWIDGET) -
89 -
90static QTextStream qout(stderr, QIODevice::WriteOnly); -
91 -
92static void dumpLayout(QTextStream &qout, const QDockAreaLayoutInfo &layout, QString indent); -
93 -
94static void dumpLayout(QTextStream &qout, const QDockAreaLayoutItem &item, QString indent) -
95{ -
96 qout << indent << "QDockAreaLayoutItem: " -
97 << "pos: " << item.pos << " size:" << item.size -
98 << " gap:" << (item.flags & QDockAreaLayoutItem::GapItem) -
99 << " keepSize:" << (item.flags & QDockAreaLayoutItem::KeepSize) << '\n'; -
100 indent += QLatin1String(" "); -
101 if (item.widgetItem != 0) { -
102 qout << indent << "widget: " -
103 << item.widgetItem->widget()->metaObject()->className() -
104 << ' ' << item.widgetItem->widget()->windowTitle() << '\n'; -
105 } else if (item.subinfo != 0) { -
106 qout << indent << "subinfo:\n"; -
107 dumpLayout(qout, *item.subinfo, indent + QLatin1String(" ")); -
108 } else if (item.placeHolderItem != 0) { -
109 QRect r = item.placeHolderItem->topLevelRect; -
110 qout << indent << "placeHolder: " -
111 << "pos: " << item.pos << " size:" << item.size -
112 << " gap:" << (item.flags & QDockAreaLayoutItem::GapItem) -
113 << " keepSize:" << (item.flags & QDockAreaLayoutItem::KeepSize) -
114 << " objectName:" << item.placeHolderItem->objectName -
115 << " hidden:" << item.placeHolderItem->hidden -
116 << " window:" << item.placeHolderItem->window -
117 << " rect:" << r.x() << ',' << r.y() << ' ' -
118 << r.width() << 'x' << r.height() << '\n'; -
119 } -
120 qout.flush(); -
121} -
122 -
123static void dumpLayout(QTextStream &qout, const QDockAreaLayoutInfo &layout, QString indent) -
124{ -
125 qout << indent << "QDockAreaLayoutInfo: " -
126 << layout.rect.left() << ',' -
127 << layout.rect.top() << ' ' -
128 << layout.rect.width() << 'x' -
129 << layout.rect.height() -
130 << " orient:" << layout.o -
131 << " tabbed:" << layout.tabbed -
132 << " tbshape:" << layout.tabBarShape << '\n'; -
133 -
134 indent += QLatin1String(" "); -
135 -
136 for (int i = 0; i < layout.item_list.count(); ++i) { -
137 qout << indent << "Item: " << i << '\n'; -
138 dumpLayout(qout, layout.item_list.at(i), indent + QLatin1String(" ")); -
139 } -
140 qout.flush(); -
141}; -
142 -
143static void dumpLayout(QTextStream &qout, const QDockAreaLayout &layout, QString indent) -
144{ -
145 qout << indent << "QDockAreaLayout: " -
146 << layout.rect.left() << ',' -
147 << layout.rect.top() << ' ' -
148 << layout.rect.width() << 'x' -
149 << layout.rect.height() << '\n'; -
150 -
151 qout << indent << "TopDockArea:\n"; -
152 dumpLayout(qout, layout.docks[QInternal::TopDock], indent + QLatin1String(" ")); -
153 qout << indent << "LeftDockArea:\n"; -
154 dumpLayout(qout, layout.docks[QInternal::LeftDock], indent + QLatin1String(" ")); -
155 qout << indent << "RightDockArea:\n"; -
156 dumpLayout(qout, layout.docks[QInternal::RightDock], indent + QLatin1String(" ")); -
157 qout << indent << "BottomDockArea:\n"; -
158 dumpLayout(qout, layout.docks[QInternal::BottomDock], indent + QLatin1String(" ")); -
159 -
160 qout.flush(); -
161}; -
162 -
163void qt_dumpLayout(QTextStream &qout, QMainWindow *window) -
164{ -
165 QMainWindowLayout *layout = qt_mainwindow_layout(window); -
166 dumpLayout(qout, layout->layoutState.dockAreaLayout, QString()); -
167} -
168 -
169#endif // Q_DEBUG_MAINWINDOW_LAYOUT && !QT_NO_DOCKWIDGET -
170 -
171/****************************************************************************** -
172** QMainWindowLayoutState -
173*/ -
174 -
175// we deal with all the #ifndefferry here so QMainWindowLayout code is clean -
176 -
177QMainWindowLayoutState::QMainWindowLayoutState(QMainWindow *win) -
178 : -
179#ifndef QT_NO_TOOLBAR -
180 toolBarAreaLayout(win), -
181#endif -
182#ifndef QT_NO_DOCKWIDGET -
183 dockAreaLayout(win) -
184#else -
185 centralWidgetItem(0) -
186#endif -
187 -
188{ -
189 mainWindow = win;
executed (the execution status of this line is deduced): mainWindow = win;
-
190}
executed: }
Execution Count:88
88
191 -
192QSize QMainWindowLayoutState::sizeHint() const -
193{ -
194 -
195 QSize result(0, 0);
executed (the execution status of this line is deduced): QSize result(0, 0);
-
196 -
197#ifndef QT_NO_DOCKWIDGET -
198 result = dockAreaLayout.sizeHint();
executed (the execution status of this line is deduced): result = dockAreaLayout.sizeHint();
-
199#else -
200 if (centralWidgetItem != 0) -
201 result = centralWidgetItem->sizeHint(); -
202#endif -
203 -
204#ifndef QT_NO_TOOLBAR -
205 result = toolBarAreaLayout.sizeHint(result);
executed (the execution status of this line is deduced): result = toolBarAreaLayout.sizeHint(result);
-
206#endif // QT_NO_TOOLBAR -
207 -
208 return result;
executed: return result;
Execution Count:30
30
209} -
210 -
211QSize QMainWindowLayoutState::minimumSize() const -
212{ -
213 QSize result(0, 0);
executed (the execution status of this line is deduced): QSize result(0, 0);
-
214 -
215#ifndef QT_NO_DOCKWIDGET -
216 result = dockAreaLayout.minimumSize();
executed (the execution status of this line is deduced): result = dockAreaLayout.minimumSize();
-
217#else -
218 if (centralWidgetItem != 0) -
219 result = centralWidgetItem->minimumSize(); -
220#endif -
221 -
222#ifndef QT_NO_TOOLBAR -
223 result = toolBarAreaLayout.minimumSize(result);
executed (the execution status of this line is deduced): result = toolBarAreaLayout.minimumSize(result);
-
224#endif // QT_NO_TOOLBAR -
225 -
226 return result;
executed: return result;
Execution Count:167
167
227} -
228 -
229void QMainWindowLayoutState::apply(bool animated) -
230{ -
231#ifndef QT_NO_TOOLBAR -
232 toolBarAreaLayout.apply(animated);
executed (the execution status of this line is deduced): toolBarAreaLayout.apply(animated);
-
233#endif -
234 -
235#ifndef QT_NO_DOCKWIDGET -
236// dumpLayout(dockAreaLayout, QString()); -
237 dockAreaLayout.apply(animated);
executed (the execution status of this line is deduced): dockAreaLayout.apply(animated);
-
238#else -
239 if (centralWidgetItem != 0) { -
240 QMainWindowLayout *layout = qt_mainwindow_layout(mainWindow); -
241 Q_ASSERT(layout != 0); -
242 layout->widgetAnimator.animate(centralWidgetItem->widget(), centralWidgetRect, animated); -
243 } -
244#endif -
245}
executed: }
Execution Count:237
237
246 -
247void QMainWindowLayoutState::fitLayout() -
248{ -
249 QRect r;
executed (the execution status of this line is deduced): QRect r;
-
250#ifdef QT_NO_TOOLBAR -
251 r = rect; -
252#else -
253 toolBarAreaLayout.rect = rect;
executed (the execution status of this line is deduced): toolBarAreaLayout.rect = rect;
-
254 r = toolBarAreaLayout.fitLayout();
executed (the execution status of this line is deduced): r = toolBarAreaLayout.fitLayout();
-
255#endif // QT_NO_TOOLBAR -
256 -
257#ifndef QT_NO_DOCKWIDGET -
258 dockAreaLayout.rect = r;
executed (the execution status of this line is deduced): dockAreaLayout.rect = r;
-
259 dockAreaLayout.fitLayout();
executed (the execution status of this line is deduced): dockAreaLayout.fitLayout();
-
260#else -
261 centralWidgetRect = r; -
262#endif -
263}
executed: }
Execution Count:237
237
264 -
265void QMainWindowLayoutState::deleteAllLayoutItems() -
266{ -
267#ifndef QT_NO_TOOLBAR -
268 toolBarAreaLayout.deleteAllLayoutItems();
executed (the execution status of this line is deduced): toolBarAreaLayout.deleteAllLayoutItems();
-
269#endif -
270 -
271#ifndef QT_NO_DOCKWIDGET -
272 dockAreaLayout.deleteAllLayoutItems();
executed (the execution status of this line is deduced): dockAreaLayout.deleteAllLayoutItems();
-
273#endif -
274}
executed: }
Execution Count:45
45
275 -
276void QMainWindowLayoutState::deleteCentralWidgetItem() -
277{ -
278#ifndef QT_NO_DOCKWIDGET -
279 delete dockAreaLayout.centralWidgetItem;
executed (the execution status of this line is deduced): delete dockAreaLayout.centralWidgetItem;
-
280 dockAreaLayout.centralWidgetItem = 0;
executed (the execution status of this line is deduced): dockAreaLayout.centralWidgetItem = 0;
-
281#else -
282 delete centralWidgetItem; -
283 centralWidgetItem = 0; -
284#endif -
285}
executed: }
Execution Count:61
61
286 -
287QLayoutItem *QMainWindowLayoutState::itemAt(int index, int *x) const -
288{ -
289#ifndef QT_NO_TOOLBAR -
290 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
291 return ret;
executed: return ret;
Execution Count:7
7
292#endif -
293 -
294#ifndef QT_NO_DOCKWIDGET -
295 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
296 return ret;
executed: return ret;
Execution Count:178
178
297#else -
298 if (centralWidgetItem != 0 && (*x)++ == index) -
299 return centralWidgetItem; -
300#endif -
301 -
302 return 0;
executed: return 0;
Execution Count:232
232
303} -
304 -
305QLayoutItem *QMainWindowLayoutState::takeAt(int index, int *x) -
306{ -
307#ifndef QT_NO_TOOLBAR -
308 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
309 return ret;
executed: return ret;
Execution Count:1
1
310#endif -
311 -
312#ifndef QT_NO_DOCKWIDGET -
313 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
314 return ret;
executed: return ret;
Execution Count:21
21
315#else -
316 if (centralWidgetItem != 0 && (*x)++ == index) { -
317 QLayoutItem *ret = centralWidgetItem; -
318 centralWidgetItem = 0; -
319 return ret; -
320 } -
321#endif -
322 -
323 return 0;
executed: return 0;
Execution Count:1
1
324} -
325 -
326QList<int> QMainWindowLayoutState::indexOf(QWidget *widget) const -
327{ -
328 QList<int> result;
never executed (the execution status of this line is deduced): QList<int> result;
-
329 -
330#ifndef QT_NO_TOOLBAR -
331 // is it a toolbar? -
332 if (QToolBar *toolBar = qobject_cast<QToolBar*>(widget)) {
never evaluated: QToolBar *toolBar = qobject_cast<QToolBar*>(widget)
0
333 result = toolBarAreaLayout.indexOf(toolBar);
never executed (the execution status of this line is deduced): result = toolBarAreaLayout.indexOf(toolBar);
-
334 if (!result.isEmpty())
never evaluated: !result.isEmpty()
0
335 result.prepend(0);
never executed: result.prepend(0);
0
336 return result;
never executed: return result;
0
337 } -
338#endif -
339 -
340#ifndef QT_NO_DOCKWIDGET -
341 // is it a dock widget? -
342 if (QDockWidget *dockWidget = qobject_cast<QDockWidget *>(widget)) {
never evaluated: QDockWidget *dockWidget = qobject_cast<QDockWidget *>(widget)
0
343 result = dockAreaLayout.indexOf(dockWidget);
never executed (the execution status of this line is deduced): result = dockAreaLayout.indexOf(dockWidget);
-
344 if (!result.isEmpty())
never evaluated: !result.isEmpty()
0
345 result.prepend(1);
never executed: result.prepend(1);
0
346 return result;
never executed: return result;
0
347 } -
348#endif //QT_NO_DOCKWIDGET -
349 -
350 return result;
never executed: return result;
0
351} -
352 -
353bool QMainWindowLayoutState::contains(QWidget *widget) const -
354{ -
355#ifndef QT_NO_DOCKWIDGET -
356 if (dockAreaLayout.centralWidgetItem != 0 && dockAreaLayout.centralWidgetItem->widget() == widget)
never evaluated: dockAreaLayout.centralWidgetItem != 0
never evaluated: dockAreaLayout.centralWidgetItem->widget() == widget
0
357 return true;
never executed: return true;
0
358 if (!dockAreaLayout.indexOf(widget).isEmpty())
never evaluated: !dockAreaLayout.indexOf(widget).isEmpty()
0
359 return true;
never executed: return true;
0
360#else -
361 if (centralWidgetItem != 0 && centralWidgetItem->widget() == widget) -
362 return true; -
363#endif -
364 -
365#ifndef QT_NO_TOOLBAR -
366 if (!toolBarAreaLayout.indexOf(widget).isEmpty())
never evaluated: !toolBarAreaLayout.indexOf(widget).isEmpty()
0
367 return true;
never executed: return true;
0
368#endif -
369 return false;
never executed: return false;
0
370} -
371 -
372void QMainWindowLayoutState::setCentralWidget(QWidget *widget) -
373{ -
374 QLayoutItem *item = 0;
executed (the execution status of this line is deduced): QLayoutItem *item = 0;
-
375 //make sure we remove the widget -
376 deleteCentralWidgetItem();
executed (the execution status of this line is deduced): deleteCentralWidgetItem();
-
377 -
378 if (widget != 0)
partially evaluated: widget != 0
TRUEFALSE
yes
Evaluation Count:18
no
Evaluation Count:0
0-18
379 item = new QWidgetItemV2(widget);
executed: item = new QWidgetItemV2(widget);
Execution Count:18
18
380 -
381#ifndef QT_NO_DOCKWIDGET -
382 dockAreaLayout.centralWidgetItem = item;
executed (the execution status of this line is deduced): dockAreaLayout.centralWidgetItem = item;
-
383#else -
384 centralWidgetItem = item; -
385#endif -
386}
executed: }
Execution Count:18
18
387 -
388QWidget *QMainWindowLayoutState::centralWidget() const -
389{ -
390 QLayoutItem *item = 0;
executed (the execution status of this line is deduced): QLayoutItem *item = 0;
-
391 -
392#ifndef QT_NO_DOCKWIDGET -
393 item = dockAreaLayout.centralWidgetItem;
executed (the execution status of this line is deduced): item = dockAreaLayout.centralWidgetItem;
-
394#else -
395 item = centralWidgetItem; -
396#endif -
397 -
398 if (item != 0)
partially evaluated: item != 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:24
0-24
399 return item->widget();
never executed: return item->widget();
0
400 return 0;
executed: return 0;
Execution Count:24
24
401} -
402 -
403QList<int> QMainWindowLayoutState::gapIndex(QWidget *widget, -
404 const QPoint &pos) const -
405{ -
406 QList<int> result;
never executed (the execution status of this line is deduced): QList<int> result;
-
407 -
408#ifndef QT_NO_TOOLBAR -
409 // is it a toolbar? -
410 if (qobject_cast<QToolBar*>(widget) != 0) {
never evaluated: qobject_cast<QToolBar*>(widget) != 0
0
411 result = toolBarAreaLayout.gapIndex(pos);
never executed (the execution status of this line is deduced): result = toolBarAreaLayout.gapIndex(pos);
-
412 if (!result.isEmpty())
never evaluated: !result.isEmpty()
0
413 result.prepend(0);
never executed: result.prepend(0);
0
414 return result;
never executed: return result;
0
415 } -
416#endif -
417 -
418#ifndef QT_NO_DOCKWIDGET -
419 // is it a dock widget? -
420 if (qobject_cast<QDockWidget *>(widget) != 0) {
never evaluated: qobject_cast<QDockWidget *>(widget) != 0
0
421 result = dockAreaLayout.gapIndex(pos);
never executed (the execution status of this line is deduced): result = dockAreaLayout.gapIndex(pos);
-
422 if (!result.isEmpty())
never evaluated: !result.isEmpty()
0
423 result.prepend(1);
never executed: result.prepend(1);
0
424 return result;
never executed: return result;
0
425 } -
426#endif //QT_NO_DOCKWIDGET -
427 -
428 return result;
never executed: return result;
0
429} -
430 -
431bool QMainWindowLayoutState::insertGap(const QList<int> &path, QLayoutItem *item) -
432{ -
433 if (path.isEmpty())
never evaluated: path.isEmpty()
0
434 return false;
never executed: return false;
0
435 -
436 int i = path.first();
never executed (the execution status of this line is deduced): int i = path.first();
-
437 -
438#ifndef QT_NO_TOOLBAR -
439 if (i == 0) {
never evaluated: i == 0
0
440 Q_ASSERT(qobject_cast<QToolBar*>(item->widget()) != 0);
never executed (the execution status of this line is deduced): qt_noop();
-
441 return toolBarAreaLayout.insertGap(path.mid(1), item);
never executed: return toolBarAreaLayout.insertGap(path.mid(1), item);
0
442 } -
443#endif -
444 -
445#ifndef QT_NO_DOCKWIDGET -
446 if (i == 1) {
never evaluated: i == 1
0
447 Q_ASSERT(qobject_cast<QDockWidget*>(item->widget()) != 0);
never executed (the execution status of this line is deduced): qt_noop();
-
448 return dockAreaLayout.insertGap(path.mid(1), item);
never executed: return dockAreaLayout.insertGap(path.mid(1), item);
0
449 } -
450#endif //QT_NO_DOCKWIDGET -
451 -
452 return false;
never executed: return false;
0
453} -
454 -
455void QMainWindowLayoutState::remove(const QList<int> &path) -
456{ -
457 int i = path.first();
never executed (the execution status of this line is deduced): int i = path.first();
-
458 -
459#ifndef QT_NO_TOOLBAR -
460 if (i == 0)
never evaluated: i == 0
0
461 toolBarAreaLayout.remove(path.mid(1));
never executed: toolBarAreaLayout.remove(path.mid(1));
0
462#endif -
463 -
464#ifndef QT_NO_DOCKWIDGET -
465 if (i == 1)
never evaluated: i == 1
0
466 dockAreaLayout.remove(path.mid(1));
never executed: dockAreaLayout.remove(path.mid(1));
0
467#endif //QT_NO_DOCKWIDGET -
468}
never executed: }
0
469 -
470void QMainWindowLayoutState::remove(QLayoutItem *item) -
471{ -
472#ifndef QT_NO_TOOLBAR -
473 toolBarAreaLayout.remove(item);
never executed (the execution status of this line is deduced): toolBarAreaLayout.remove(item);
-
474#endif -
475 -
476#ifndef QT_NO_DOCKWIDGET -
477 // is it a dock widget? -
478 if (QDockWidget *dockWidget = qobject_cast<QDockWidget *>(item->widget())) {
never evaluated: QDockWidget *dockWidget = qobject_cast<QDockWidget *>(item->widget())
0
479 QList<int> path = dockAreaLayout.indexOf(dockWidget);
never executed (the execution status of this line is deduced): QList<int> path = dockAreaLayout.indexOf(dockWidget);
-
480 if (!path.isEmpty())
never evaluated: !path.isEmpty()
0
481 dockAreaLayout.remove(path);
never executed: dockAreaLayout.remove(path);
0
482 }
never executed: }
0
483#endif //QT_NO_DOCKWIDGET -
484}
never executed: }
0
485 -
486void QMainWindowLayoutState::clear() -
487{ -
488#ifndef QT_NO_TOOLBAR -
489 toolBarAreaLayout.clear();
executed (the execution status of this line is deduced): toolBarAreaLayout.clear();
-
490#endif -
491 -
492#ifndef QT_NO_DOCKWIDGET -
493 dockAreaLayout.clear();
executed (the execution status of this line is deduced): dockAreaLayout.clear();
-
494#else -
495 centralWidgetRect = QRect(); -
496#endif -
497 -
498 rect = QRect();
executed (the execution status of this line is deduced): rect = QRect();
-
499}
executed: }
Execution Count:4
4
500 -
501bool QMainWindowLayoutState::isValid() const -
502{ -
503 return rect.isValid();
executed: return rect.isValid();
Execution Count:279
279
504} -
505 -
506QLayoutItem *QMainWindowLayoutState::item(const QList<int> &path) -
507{ -
508 int i = path.first();
never executed (the execution status of this line is deduced): int i = path.first();
-
509 -
510#ifndef QT_NO_TOOLBAR -
511 if (i == 0)
never evaluated: i == 0
0
512 return toolBarAreaLayout.item(path.mid(1)).widgetItem;
never executed: return toolBarAreaLayout.item(path.mid(1)).widgetItem;
0
513#endif -
514 -
515#ifndef QT_NO_DOCKWIDGET -
516 if (i == 1)
never evaluated: i == 1
0
517 return dockAreaLayout.item(path.mid(1)).widgetItem;
never executed: return dockAreaLayout.item(path.mid(1)).widgetItem;
0
518#endif //QT_NO_DOCKWIDGET -
519 -
520 return 0;
never executed: return 0;
0
521} -
522 -
523QRect QMainWindowLayoutState::itemRect(const QList<int> &path) const -
524{ -
525 int i = path.first();
never executed (the execution status of this line is deduced): int i = path.first();
-
526 -
527#ifndef QT_NO_TOOLBAR -
528 if (i == 0)
never evaluated: i == 0
0
529 return toolBarAreaLayout.itemRect(path.mid(1));
never executed: return toolBarAreaLayout.itemRect(path.mid(1));
0
530#endif -
531 -
532#ifndef QT_NO_DOCKWIDGET -
533 if (i == 1)
never evaluated: i == 1
0
534 return dockAreaLayout.itemRect(path.mid(1));
never executed: return dockAreaLayout.itemRect(path.mid(1));
0
535#endif //QT_NO_DOCKWIDGET -
536 -
537 return QRect();
never executed: return QRect();
0
538} -
539 -
540QRect QMainWindowLayoutState::gapRect(const QList<int> &path) const -
541{ -
542 int i = path.first();
never executed (the execution status of this line is deduced): int i = path.first();
-
543 -
544#ifndef QT_NO_TOOLBAR -
545 if (i == 0)
never evaluated: i == 0
0
546 return toolBarAreaLayout.itemRect(path.mid(1));
never executed: return toolBarAreaLayout.itemRect(path.mid(1));
0
547#endif -
548 -
549#ifndef QT_NO_DOCKWIDGET -
550 if (i == 1)
never evaluated: i == 1
0
551 return dockAreaLayout.gapRect(path.mid(1));
never executed: return dockAreaLayout.gapRect(path.mid(1));
0
552#endif //QT_NO_DOCKWIDGET -
553 -
554 return QRect();
never executed: return QRect();
0
555} -
556 -
557QLayoutItem *QMainWindowLayoutState::plug(const QList<int> &path) -
558{ -
559 int i = path.first();
never executed (the execution status of this line is deduced): int i = path.first();
-
560 -
561#ifndef QT_NO_TOOLBAR -
562 if (i == 0)
never evaluated: i == 0
0
563 return toolBarAreaLayout.plug(path.mid(1));
never executed: return toolBarAreaLayout.plug(path.mid(1));
0
564#endif -
565 -
566#ifndef QT_NO_DOCKWIDGET -
567 if (i == 1)
never evaluated: i == 1
0
568 return dockAreaLayout.plug(path.mid(1));
never executed: return dockAreaLayout.plug(path.mid(1));
0
569#endif //QT_NO_DOCKWIDGET -
570 -
571 return 0;
never executed: return 0;
0
572} -
573 -
574QLayoutItem *QMainWindowLayoutState::unplug(const QList<int> &path, QMainWindowLayoutState *other) -
575{ -
576 int i = path.first();
never executed (the execution status of this line is deduced): int i = path.first();
-
577 -
578#ifdef QT_NO_TOOLBAR -
579 Q_UNUSED(other); -
580#else -
581 if (i == 0)
never evaluated: i == 0
0
582 return toolBarAreaLayout.unplug(path.mid(1), other ? &other->toolBarAreaLayout : 0);
never executed: return toolBarAreaLayout.unplug(path.mid(1), other ? &other->toolBarAreaLayout : 0);
0
583#endif -
584 -
585#ifndef QT_NO_DOCKWIDGET -
586 if (i == 1)
never evaluated: i == 1
0
587 return dockAreaLayout.unplug(path.mid(1));
never executed: return dockAreaLayout.unplug(path.mid(1));
0
588#endif //QT_NO_DOCKWIDGET -
589 -
590 return 0;
never executed: return 0;
0
591} -
592 -
593void QMainWindowLayoutState::saveState(QDataStream &stream) const -
594{ -
595#ifndef QT_NO_DOCKWIDGET -
596 dockAreaLayout.saveState(stream);
executed (the execution status of this line is deduced): dockAreaLayout.saveState(stream);
-
597#endif -
598#ifndef QT_NO_TOOLBAR -
599 toolBarAreaLayout.saveState(stream);
executed (the execution status of this line is deduced): toolBarAreaLayout.saveState(stream);
-
600#endif -
601}
executed: }
Execution Count:2
2
602 -
603template <typename T> -
604static QList<T> findChildrenHelper(const QObject *o) -
605{ -
606 const QObjectList &list = o->children();
executed (the execution status of this line is deduced): const QObjectList &list = o->children();
-
607 QList<T> result;
executed (the execution status of this line is deduced): QList<T> result;
-
608 -
609 for (int i=0; i < list.size(); ++i) {
evaluated: i < list.size()
TRUEFALSE
yes
Evaluation Count:33
yes
Evaluation Count:8
8-33
610 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
611 result.append(t);
executed (the execution status of this line is deduced): result.append(t);
-
612 }
executed: }
Execution Count:6
6
613 }
executed: }
Execution Count:33
33
614 -
615 return result;
executed: return result;
Execution Count:8
8
616} -
617 -
618//pre4.3 tests the format that was used before 4.3 -
619bool QMainWindowLayoutState::checkFormat(QDataStream &stream, bool pre43) -
620{ -
621#ifdef QT_NO_TOOLBAR -
622 Q_UNUSED(pre43); -
623#endif -
624 while (!stream.atEnd()) {
evaluated: !stream.atEnd()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:2
2-4
625 uchar marker;
executed (the execution status of this line is deduced): uchar marker;
-
626 stream >> marker;
executed (the execution status of this line is deduced): stream >> marker;
-
627 switch(marker) -
628 { -
629#ifndef QT_NO_TOOLBAR -
630 case QToolBarAreaLayout::ToolBarStateMarker: -
631 case QToolBarAreaLayout::ToolBarStateMarkerEx: -
632 { -
633 QList<QToolBar *> toolBars = findChildrenHelper<QToolBar*>(mainWindow);
executed (the execution status of this line is deduced): QList<QToolBar *> toolBars = findChildrenHelper<QToolBar*>(mainWindow);
-
634 if (!toolBarAreaLayout.restoreState(stream, toolBars, marker,
partially evaluated: !toolBarAreaLayout.restoreState(stream, toolBars, marker, pre43 , true )
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
635 pre43 /*testing 4.3 format*/, true /*testing*/)) {
partially evaluated: !toolBarAreaLayout.restoreState(stream, toolBars, marker, pre43 , true )
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
636 return false;
never executed: return false;
0
637 } -
638 } -
639 break;
executed: break;
Execution Count:2
2
640#endif // QT_NO_TOOLBAR -
641 -
642#ifndef QT_NO_DOCKWIDGET -
643 case QDockAreaLayout::DockWidgetStateMarker: -
644 { -
645 QList<QDockWidget *> dockWidgets = findChildrenHelper<QDockWidget*>(mainWindow);
executed (the execution status of this line is deduced): QList<QDockWidget *> dockWidgets = findChildrenHelper<QDockWidget*>(mainWindow);
-
646 if (!dockAreaLayout.restoreState(stream, dockWidgets, true /*testing*/)) {
partially evaluated: !dockAreaLayout.restoreState(stream, dockWidgets, true )
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
647 return false;
never executed: return false;
0
648 } -
649 } -
650 break;
executed: break;
Execution Count:2
2
651#endif -
652 default: -
653 //there was an error during the parsing -
654 return false;
never executed: return false;
0
655 }// switch -
656 } //while
executed: }
Execution Count:4
4
657 -
658 //everything went fine: it must be a pre-4.3 saved state -
659 return true;
executed: return true;
Execution Count:2
2
660} -
661 -
662bool QMainWindowLayoutState::restoreState(QDataStream &_stream, -
663 const QMainWindowLayoutState &oldState) -
664{ -
665 //make a copy of the data so that we can read it more than once -
666 QByteArray copy;
executed (the execution status of this line is deduced): QByteArray copy;
-
667 while(!_stream.atEnd()) {
evaluated: !_stream.atEnd()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2
2
668 int length = 1024;
executed (the execution status of this line is deduced): int length = 1024;
-
669 QByteArray ba(length, '\0');
executed (the execution status of this line is deduced): QByteArray ba(length, '\0');
-
670 length = _stream.readRawData(ba.data(), ba.size());
executed (the execution status of this line is deduced): length = _stream.readRawData(ba.data(), ba.size());
-
671 ba.resize(length);
executed (the execution status of this line is deduced): ba.resize(length);
-
672 copy += ba;
executed (the execution status of this line is deduced): copy += ba;
-
673 }
executed: }
Execution Count:2
2
674 -
675 QDataStream ds(copy);
executed (the execution status of this line is deduced): QDataStream ds(copy);
-
676 const bool oldFormat = !checkFormat(ds, false);
executed (the execution status of this line is deduced): const bool oldFormat = !checkFormat(ds, false);
-
677 if (oldFormat) {
partially evaluated: oldFormat
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
678 //we should try with the old format -
679 QDataStream ds2(copy);
never executed (the execution status of this line is deduced): QDataStream ds2(copy);
-
680 if (!checkFormat(ds2, true)) {
never evaluated: !checkFormat(ds2, true)
0
681 return false; //format unknown
never executed: return false;
0
682 } -
683 }
never executed: }
0
684 -
685 QDataStream stream(copy);
executed (the execution status of this line is deduced): QDataStream stream(copy);
-
686 -
687 while (!stream.atEnd()) {
evaluated: !stream.atEnd()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:2
2-4
688 uchar marker;
executed (the execution status of this line is deduced): uchar marker;
-
689 stream >> marker;
executed (the execution status of this line is deduced): stream >> marker;
-
690 switch(marker) -
691 { -
692#ifndef QT_NO_DOCKWIDGET -
693 case QDockAreaLayout::DockWidgetStateMarker: -
694 { -
695 QList<QDockWidget *> dockWidgets = findChildrenHelper<QDockWidget*>(mainWindow);
executed (the execution status of this line is deduced): QList<QDockWidget *> dockWidgets = findChildrenHelper<QDockWidget*>(mainWindow);
-
696 if (!dockAreaLayout.restoreState(stream, dockWidgets))
partially evaluated: !dockAreaLayout.restoreState(stream, dockWidgets)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
697 return false;
never executed: return false;
0
698 -
699 for (int i = 0; i < dockWidgets.size(); ++i) {
evaluated: i < dockWidgets.size()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:2
2-3
700 QDockWidget *w = dockWidgets.at(i);
executed (the execution status of this line is deduced): QDockWidget *w = dockWidgets.at(i);
-
701 QList<int> path = dockAreaLayout.indexOf(w);
executed (the execution status of this line is deduced): QList<int> path = dockAreaLayout.indexOf(w);
-
702 if (path.isEmpty()) {
partially evaluated: path.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
703 QList<int> oldPath = oldState.dockAreaLayout.indexOf(w);
never executed (the execution status of this line is deduced): QList<int> oldPath = oldState.dockAreaLayout.indexOf(w);
-
704 if (oldPath.isEmpty()) {
never evaluated: oldPath.isEmpty()
0
705 continue;
never executed: continue;
0
706 } -
707 QDockAreaLayoutInfo *info = dockAreaLayout.info(oldPath);
never executed (the execution status of this line is deduced): QDockAreaLayoutInfo *info = dockAreaLayout.info(oldPath);
-
708 if (info == 0) {
never evaluated: info == 0
0
709 continue;
never executed: continue;
0
710 } -
711 info->item_list.append(QDockAreaLayoutItem(new QDockWidgetItem(w)));
never executed (the execution status of this line is deduced): info->item_list.append(QDockAreaLayoutItem(new QDockWidgetItem(w)));
-
712 }
never executed: }
0
713 }
executed: }
Execution Count:3
3
714 } -
715 break;
executed: break;
Execution Count:2
2
716#endif // QT_NO_DOCKWIDGET -
717 -
718#ifndef QT_NO_TOOLBAR -
719 case QToolBarAreaLayout::ToolBarStateMarker: -
720 case QToolBarAreaLayout::ToolBarStateMarkerEx: -
721 { -
722 QList<QToolBar *> toolBars = findChildrenHelper<QToolBar*>(mainWindow);
executed (the execution status of this line is deduced): QList<QToolBar *> toolBars = findChildrenHelper<QToolBar*>(mainWindow);
-
723 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
724 return false;
never executed: return false;
0
725 -
726 for (int i = 0; i < toolBars.size(); ++i) {
partially evaluated: i < toolBars.size()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
727 QToolBar *w = toolBars.at(i);
never executed (the execution status of this line is deduced): QToolBar *w = toolBars.at(i);
-
728 QList<int> path = toolBarAreaLayout.indexOf(w);
never executed (the execution status of this line is deduced): QList<int> path = toolBarAreaLayout.indexOf(w);
-
729 if (path.isEmpty()) {
never evaluated: path.isEmpty()
0
730 QList<int> oldPath = oldState.toolBarAreaLayout.indexOf(w);
never executed (the execution status of this line is deduced): QList<int> oldPath = oldState.toolBarAreaLayout.indexOf(w);
-
731 if (oldPath.isEmpty()) {
never evaluated: oldPath.isEmpty()
0
732 continue;
never executed: continue;
0
733 } -
734 toolBarAreaLayout.docks[oldPath.at(0)].insertToolBar(0, w);
never executed (the execution status of this line is deduced): toolBarAreaLayout.docks[oldPath.at(0)].insertToolBar(0, w);
-
735 }
never executed: }
0
736 }
never executed: }
0
737 } -
738 break;
executed: break;
Execution Count:2
2
739#endif //QT_NO_TOOLBAR -
740 default: -
741 return false;
never executed: return false;
0
742 }// switch -
743 } //while
executed: }
Execution Count:4
4
744 -
745 -
746 return true;
executed: return true;
Execution Count:2
2
747} -
748 -
749/****************************************************************************** -
750** QMainWindowLayoutState - toolbars -
751*/ -
752 -
753#ifndef QT_NO_TOOLBAR -
754 -
755static inline void validateToolBarArea(Qt::ToolBarArea &area) -
756{ -
757 switch (area) { -
758 case Qt::LeftToolBarArea: -
759 case Qt::RightToolBarArea: -
760 case Qt::TopToolBarArea: -
761 case Qt::BottomToolBarArea: -
762 break;
executed: break;
Execution Count:2
2
763 default: -
764 area = Qt::TopToolBarArea;
never executed (the execution status of this line is deduced): area = Qt::TopToolBarArea;
-
765 }
never executed: }
0
766}
executed: }
Execution Count:2
2
767 -
768static QInternal::DockPosition toDockPos(Qt::ToolBarArea area) -
769{ -
770 switch (area) { -
771 case Qt::LeftToolBarArea: return QInternal::LeftDock;
never executed: return QInternal::LeftDock;
0
772 case Qt::RightToolBarArea: return QInternal::RightDock;
never executed: return QInternal::RightDock;
0
773 case Qt::TopToolBarArea: return QInternal::TopDock;
executed: return QInternal::TopDock;
Execution Count:2
2
774 case Qt::BottomToolBarArea: return QInternal::BottomDock;
never executed: return QInternal::BottomDock;
0
775 default: -
776 break;
never executed: break;
0
777 } -
778 -
779 return QInternal::DockCount;
never executed: return QInternal::DockCount;
0
780} -
781 -
782static Qt::ToolBarArea toToolBarArea(QInternal::DockPosition pos) -
783{ -
784 switch (pos) { -
785 case QInternal::LeftDock: return Qt::LeftToolBarArea;
never executed: return Qt::LeftToolBarArea;
0
786 case QInternal::RightDock: return Qt::RightToolBarArea;
never executed: return Qt::RightToolBarArea;
0
787 case QInternal::TopDock: return Qt::TopToolBarArea;
never executed: return Qt::TopToolBarArea;
0
788 case QInternal::BottomDock: return Qt::BottomToolBarArea;
never executed: return Qt::BottomToolBarArea;
0
789 default: break;
never executed: break;
0
790 } -
791 return Qt::NoToolBarArea;
never executed: return Qt::NoToolBarArea;
0
792} -
793 -
794static inline Qt::ToolBarArea toToolBarArea(int pos) -
795{ -
796 return toToolBarArea(static_cast<QInternal::DockPosition>(pos));
never executed: return toToolBarArea(static_cast<QInternal::DockPosition>(pos));
0
797} -
798 -
799void QMainWindowLayout::addToolBarBreak(Qt::ToolBarArea area) -
800{ -
801 validateToolBarArea(area);
never executed (the execution status of this line is deduced): validateToolBarArea(area);
-
802 -
803 layoutState.toolBarAreaLayout.addToolBarBreak(toDockPos(area));
never executed (the execution status of this line is deduced): layoutState.toolBarAreaLayout.addToolBarBreak(toDockPos(area));
-
804 if (savedState.isValid())
never evaluated: savedState.isValid()
0
805 savedState.toolBarAreaLayout.addToolBarBreak(toDockPos(area));
never executed: savedState.toolBarAreaLayout.addToolBarBreak(toDockPos(area));
0
806 -
807 invalidate();
never executed (the execution status of this line is deduced): invalidate();
-
808}
never executed: }
0
809 -
810void QMainWindowLayout::insertToolBarBreak(QToolBar *before) -
811{ -
812 layoutState.toolBarAreaLayout.insertToolBarBreak(before);
never executed (the execution status of this line is deduced): layoutState.toolBarAreaLayout.insertToolBarBreak(before);
-
813 if (savedState.isValid())
never evaluated: savedState.isValid()
0
814 savedState.toolBarAreaLayout.insertToolBarBreak(before);
never executed: savedState.toolBarAreaLayout.insertToolBarBreak(before);
0
815 invalidate();
never executed (the execution status of this line is deduced): invalidate();
-
816}
never executed: }
0
817 -
818void QMainWindowLayout::removeToolBarBreak(QToolBar *before) -
819{ -
820 layoutState.toolBarAreaLayout.removeToolBarBreak(before);
never executed (the execution status of this line is deduced): layoutState.toolBarAreaLayout.removeToolBarBreak(before);
-
821 if (savedState.isValid())
never evaluated: savedState.isValid()
0
822 savedState.toolBarAreaLayout.removeToolBarBreak(before);
never executed: savedState.toolBarAreaLayout.removeToolBarBreak(before);
0
823 invalidate();
never executed (the execution status of this line is deduced): invalidate();
-
824}
never executed: }
0
825 -
826void QMainWindowLayout::moveToolBar(QToolBar *toolbar, int pos) -
827{ -
828 layoutState.toolBarAreaLayout.moveToolBar(toolbar, pos);
never executed (the execution status of this line is deduced): layoutState.toolBarAreaLayout.moveToolBar(toolbar, pos);
-
829 if (savedState.isValid())
never evaluated: savedState.isValid()
0
830 savedState.toolBarAreaLayout.moveToolBar(toolbar, pos);
never executed: savedState.toolBarAreaLayout.moveToolBar(toolbar, pos);
0
831 invalidate();
never executed (the execution status of this line is deduced): invalidate();
-
832}
never executed: }
0
833 -
834/* Removes the toolbar from the mainwindow so that it can be added again. Does not -
835 explicitly hide the toolbar. */ -
836void QMainWindowLayout::removeToolBar(QToolBar *toolbar) -
837{ -
838 if (toolbar) {
never evaluated: toolbar
0
839 QObject::disconnect(parentWidget(), SIGNAL(iconSizeChanged(QSize)),
never executed (the execution status of this line is deduced): QObject::disconnect(parentWidget(), "2""iconSizeChanged(QSize)",
-
840 toolbar, SLOT(_q_updateIconSize(QSize)));
never executed (the execution status of this line is deduced): toolbar, "1""_q_updateIconSize(QSize)");
-
841 QObject::disconnect(parentWidget(), SIGNAL(toolButtonStyleChanged(Qt::ToolButtonStyle)),
never executed (the execution status of this line is deduced): QObject::disconnect(parentWidget(), "2""toolButtonStyleChanged(Qt::ToolButtonStyle)",
-
842 toolbar, SLOT(_q_updateToolButtonStyle(Qt::ToolButtonStyle)));
never executed (the execution status of this line is deduced): toolbar, "1""_q_updateToolButtonStyle(Qt::ToolButtonStyle)");
-
843 -
844#ifdef Q_WS_MAC -
845 if (usesHIToolBar(toolbar)) { -
846 removeFromMacToolbar(toolbar); -
847 } else -
848#endif // Q_WS_MAC -
849 { -
850 removeWidget(toolbar);
never executed (the execution status of this line is deduced): removeWidget(toolbar);
-
851 } -
852 }
never executed: }
0
853}
never executed: }
0
854 -
855/*! -
856 Adds \a toolbar to \a area, continuing the current line. -
857*/ -
858void QMainWindowLayout::addToolBar(Qt::ToolBarArea area, -
859 QToolBar *toolbar, -
860 bool) -
861{ -
862 validateToolBarArea(area);
executed (the execution status of this line is deduced): validateToolBarArea(area);
-
863#ifdef Q_WS_MAC -
864 if ((area == Qt::TopToolBarArea) -
865 && layoutState.mainWindow->unifiedTitleAndToolBarOnMac()) { -
866 insertIntoMacToolbar(0, toolbar); -
867 } else -
868#endif -
869 { -
870 //let's add the toolbar to the layout -
871 addChildWidget(toolbar);
executed (the execution status of this line is deduced): addChildWidget(toolbar);
-
872 QLayoutItem * item = layoutState.toolBarAreaLayout.addToolBar(toDockPos(area), toolbar);
executed (the execution status of this line is deduced): QLayoutItem * item = layoutState.toolBarAreaLayout.addToolBar(toDockPos(area), toolbar);
-
873 if (savedState.isValid() && item) {
partially evaluated: savedState.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
never evaluated: item
0-2
874 // copy the toolbar also in the saved state -
875 savedState.toolBarAreaLayout.insertItem(toDockPos(area), item);
never executed (the execution status of this line is deduced): savedState.toolBarAreaLayout.insertItem(toDockPos(area), item);
-
876 }
never executed: }
0
877 invalidate();
executed (the execution status of this line is deduced): invalidate();
-
878 -
879 //this ensures that the toolbar has the right window flags (not floating any more) -
880 toolbar->d_func()->updateWindowFlags(false /*floating*/);
executed (the execution status of this line is deduced): toolbar->d_func()->updateWindowFlags(false );
-
881 } -
882}
executed: }
Execution Count:2
2
883 -
884/*! -
885 Adds \a toolbar before \a before -
886*/ -
887void QMainWindowLayout::insertToolBar(QToolBar *before, QToolBar *toolbar) -
888{ -
889#ifdef Q_WS_MAC -
890 if (usesHIToolBar(before)) { -
891 insertIntoMacToolbar(before, toolbar); -
892 } else -
893#endif // Q_WS_MAC -
894 { -
895 addChildWidget(toolbar);
never executed (the execution status of this line is deduced): addChildWidget(toolbar);
-
896 QLayoutItem * item = layoutState.toolBarAreaLayout.insertToolBar(before, toolbar);
never executed (the execution status of this line is deduced): QLayoutItem * item = layoutState.toolBarAreaLayout.insertToolBar(before, toolbar);
-
897 if (savedState.isValid() && item) {
never evaluated: savedState.isValid()
never evaluated: item
0
898 // copy the toolbar also in the saved state -
899 savedState.toolBarAreaLayout.insertItem(before, item);
never executed (the execution status of this line is deduced): savedState.toolBarAreaLayout.insertItem(before, item);
-
900 }
never executed: }
0
901 if (!currentGapPos.isEmpty() && currentGapPos.first() == 0) {
never evaluated: !currentGapPos.isEmpty()
never evaluated: currentGapPos.first() == 0
0
902 currentGapPos = layoutState.toolBarAreaLayout.currentGapIndex();
never executed (the execution status of this line is deduced): currentGapPos = layoutState.toolBarAreaLayout.currentGapIndex();
-
903 if (!currentGapPos.isEmpty()) {
never evaluated: !currentGapPos.isEmpty()
0
904 currentGapPos.prepend(0);
never executed (the execution status of this line is deduced): currentGapPos.prepend(0);
-
905 currentGapRect = layoutState.itemRect(currentGapPos);
never executed (the execution status of this line is deduced): currentGapRect = layoutState.itemRect(currentGapPos);
-
906 }
never executed: }
0
907 }
never executed: }
0
908 invalidate();
never executed (the execution status of this line is deduced): invalidate();
-
909 } -
910}
never executed: }
0
911 -
912Qt::ToolBarArea QMainWindowLayout::toolBarArea(QToolBar *toolbar) const -
913{ -
914 QInternal::DockPosition pos = layoutState.toolBarAreaLayout.findToolBar(toolbar);
executed (the execution status of this line is deduced): QInternal::DockPosition pos = layoutState.toolBarAreaLayout.findToolBar(toolbar);
-
915 switch (pos) { -
916 case QInternal::LeftDock: return Qt::LeftToolBarArea;
never executed: return Qt::LeftToolBarArea;
0
917 case QInternal::RightDock: return Qt::RightToolBarArea;
never executed: return Qt::RightToolBarArea;
0
918 case QInternal::TopDock: return Qt::TopToolBarArea;
executed: return Qt::TopToolBarArea;
Execution Count:30
30
919 case QInternal::BottomDock: return Qt::BottomToolBarArea;
never executed: return Qt::BottomToolBarArea;
0
920 default: break;
executed: break;
Execution Count:3
3
921 } -
922#ifdef Q_WS_MAC -
923 if (pos == QInternal::DockCount) { -
924 if (qtoolbarsInUnifiedToolbarList.contains(toolbar)) -
925 return Qt::TopToolBarArea; -
926 } -
927#endif -
928 return Qt::NoToolBarArea;
executed: return Qt::NoToolBarArea;
Execution Count:3
3
929} -
930 -
931bool QMainWindowLayout::toolBarBreak(QToolBar *toolBar) const -
932{ -
933 return layoutState.toolBarAreaLayout.toolBarBreak(toolBar);
never executed: return layoutState.toolBarAreaLayout.toolBarBreak(toolBar);
0
934} -
935 -
936void QMainWindowLayout::getStyleOptionInfo(QStyleOptionToolBar *option, QToolBar *toolBar) const -
937{ -
938 option->toolBarArea = toolBarArea(toolBar);
executed (the execution status of this line is deduced): option->toolBarArea = toolBarArea(toolBar);
-
939 layoutState.toolBarAreaLayout.getStyleOptionInfo(option, toolBar);
executed (the execution status of this line is deduced): layoutState.toolBarAreaLayout.getStyleOptionInfo(option, toolBar);
-
940}
executed: }
Execution Count:33
33
941 -
942void QMainWindowLayout::toggleToolBarsVisible() -
943{ -
944 bool updateNonUnifiedParts = true;
never executed (the execution status of this line is deduced): bool updateNonUnifiedParts = true;
-
945#ifdef Q_WS_MAC -
946 if (layoutState.mainWindow->unifiedTitleAndToolBarOnMac()) { -
947 // If we hit this case, someone has pressed the "toolbar button" which will -
948 // toggle the unified toolbar visibility, because that's what the user wants. -
949 // We might be in a situation where someone has hidden all the toolbars -
950 // beforehand (maybe in construction), but now they've hit this button and -
951 // and are expecting the items to show. What do we do? -
952 // 1) Check the visibility of all the toolbars, if one is visible, do nothing, this -
953 // preserves what people would expect (these toolbars were visible when I clicked last time). -
954 // 2) If NONE are visible, then show them all. Again, this preserves the user expectation -
955 // of, "I want to see the toolbars." The user may get more toolbars than expected, but this -
956 // is better seeing nothing. -
957 // Don't worry about any of this if we are going invisible. This does mean we may get -
958 // into issues when switching into and out of fullscreen mode, but this is probably minor. -
959 // If we ever need to do hiding, that would have to be taken care of after the unified toolbar -
960 // has finished hiding. -
961 // People can of course handle the QEvent::ToolBarChange event themselves and do -
962 // WHATEVER they want if they don't like what we are doing (though the unified toolbar -
963 // will fire regardless). -
964 -
965 // Check if we REALLY need to update the geometry below. If we only have items in the -
966 // unified toolbar, all the docks will be empty, so there's very little point -
967 // in doing the geometry as Apple will do it (we also avoid flicker in Cocoa as well). -
968 // FWIW, layoutState.toolBarAreaLayout.visible and the state of the unified toolbar -
969 // visibility can get out of sync. I really don't think it's a big issue. It is kept -
970 // to a minimum because we only change the visibility if we absolutely must. -
971 // update the "non unified parts." -
972 updateNonUnifiedParts = !layoutState.toolBarAreaLayout.isEmpty(); -
973 -
974 // We get this function before the unified toolbar does its thing. -
975 // So, the value will be opposite of what we expect. -
976 bool goingVisible = !macWindowToolbarIsVisible(qt_mac_window_for(layoutState.mainWindow)); -
977 if (goingVisible) { -
978 const int ToolBarCount = qtoolbarsInUnifiedToolbarList.size(); -
979 bool needAllVisible = true; -
980 for (int i = 0; i < ToolBarCount; ++i) { -
981 if (!qtoolbarsInUnifiedToolbarList.at(i)->isHidden()) { -
982 needAllVisible = false; -
983 break; -
984 } -
985 } -
986 if (needAllVisible) { -
987 QBoolBlocker blocker(blockVisiblityCheck); // Disable the visibilty check because -
988 // the toggle has already happened. -
989 for (int i = 0; i < ToolBarCount; ++i) -
990 qtoolbarsInUnifiedToolbarList.at(i)->setVisible(true); -
991 } -
992 } -
993 if (!updateNonUnifiedParts) -
994 layoutState.toolBarAreaLayout.visible = goingVisible; -
995 } -
996#endif -
997 if (updateNonUnifiedParts) {
never evaluated: updateNonUnifiedParts
0
998 layoutState.toolBarAreaLayout.visible = !layoutState.toolBarAreaLayout.visible;
never executed (the execution status of this line is deduced): layoutState.toolBarAreaLayout.visible = !layoutState.toolBarAreaLayout.visible;
-
999 if (!layoutState.mainWindow->isMaximized()) {
never evaluated: !layoutState.mainWindow->isMaximized()
0
1000 QPoint topLeft = parentWidget()->geometry().topLeft();
never executed (the execution status of this line is deduced): QPoint topLeft = parentWidget()->geometry().topLeft();
-
1001 QRect r = parentWidget()->geometry();
never executed (the execution status of this line is deduced): QRect r = parentWidget()->geometry();
-
1002 r = layoutState.toolBarAreaLayout.rectHint(r);
never executed (the execution status of this line is deduced): r = layoutState.toolBarAreaLayout.rectHint(r);
-
1003 r.moveTo(topLeft);
never executed (the execution status of this line is deduced): r.moveTo(topLeft);
-
1004 parentWidget()->setGeometry(r);
never executed (the execution status of this line is deduced): parentWidget()->setGeometry(r);
-
1005 } else {
never executed: }
0
1006 update();
never executed (the execution status of this line is deduced): update();
-
1007 }
never executed: }
0
1008 } -
1009}
never executed: }
0
1010 -
1011#endif // QT_NO_TOOLBAR -
1012 -
1013/****************************************************************************** -
1014** QMainWindowLayoutState - dock areas -
1015*/ -
1016 -
1017#ifndef QT_NO_DOCKWIDGET -
1018 -
1019static inline void validateDockWidgetArea(Qt::DockWidgetArea &area) -
1020{ -
1021 switch (area) { -
1022 case Qt::LeftDockWidgetArea: -
1023 case Qt::RightDockWidgetArea: -
1024 case Qt::TopDockWidgetArea: -
1025 case Qt::BottomDockWidgetArea: -
1026 break;
never executed: break;
0
1027 default: -
1028 area = Qt::LeftDockWidgetArea;
never executed (the execution status of this line is deduced): area = Qt::LeftDockWidgetArea;
-
1029 }
never executed: }
0
1030}
never executed: }
0
1031 -
1032static QInternal::DockPosition toDockPos(Qt::DockWidgetArea area) -
1033{ -
1034 switch (area) { -
1035 case Qt::LeftDockWidgetArea: return QInternal::LeftDock;
executed: return QInternal::LeftDock;
Execution Count:9
9
1036 case Qt::RightDockWidgetArea: return QInternal::RightDock;
executed: return QInternal::RightDock;
Execution Count:5
5
1037 case Qt::TopDockWidgetArea: return QInternal::TopDock;
executed: return QInternal::TopDock;
Execution Count:3
3
1038 case Qt::BottomDockWidgetArea: return QInternal::BottomDock;
executed: return QInternal::BottomDock;
Execution Count:1
1
1039 default: -
1040 break;
never executed: break;
0
1041 } -
1042 -
1043 return QInternal::DockCount;
never executed: return QInternal::DockCount;
0
1044} -
1045 -
1046static Qt::DockWidgetArea toDockWidgetArea(QInternal::DockPosition pos) -
1047{ -
1048 switch (pos) { -
1049 case QInternal::LeftDock : return Qt::LeftDockWidgetArea;
executed: return Qt::LeftDockWidgetArea;
Execution Count:6
6
1050 case QInternal::RightDock : return Qt::RightDockWidgetArea;
executed: return Qt::RightDockWidgetArea;
Execution Count:2
2
1051 case QInternal::TopDock : return Qt::TopDockWidgetArea;
executed: return Qt::TopDockWidgetArea;
Execution Count:11
11
1052 case QInternal::BottomDock : return Qt::BottomDockWidgetArea;
never executed: return Qt::BottomDockWidgetArea;
0
1053 default: -
1054 break;
never executed: break;
0
1055 } -
1056 -
1057 return Qt::NoDockWidgetArea;
never executed: return Qt::NoDockWidgetArea;
0
1058} -
1059 -
1060inline static Qt::DockWidgetArea toDockWidgetArea(int pos) -
1061{ -
1062 return toDockWidgetArea(static_cast<QInternal::DockPosition>(pos));
executed: return toDockWidgetArea(static_cast<QInternal::DockPosition>(pos));
Execution Count:19
19
1063} -
1064 -
1065void QMainWindowLayout::setCorner(Qt::Corner corner, Qt::DockWidgetArea area) -
1066{ -
1067 if (layoutState.dockAreaLayout.corners[corner] == area)
never evaluated: layoutState.dockAreaLayout.corners[corner] == area
0
1068 return;
never executed: return;
0
1069 layoutState.dockAreaLayout.corners[corner] = area;
never executed (the execution status of this line is deduced): layoutState.dockAreaLayout.corners[corner] = area;
-
1070 if (savedState.isValid())
never evaluated: savedState.isValid()
0
1071 savedState.dockAreaLayout.corners[corner] = area;
never executed: savedState.dockAreaLayout.corners[corner] = area;
0
1072 invalidate();
never executed (the execution status of this line is deduced): invalidate();
-
1073}
never executed: }
0
1074 -
1075Qt::DockWidgetArea QMainWindowLayout::corner(Qt::Corner corner) const -
1076{ -
1077 return layoutState.dockAreaLayout.corners[corner];
never executed: return layoutState.dockAreaLayout.corners[corner];
0
1078} -
1079 -
1080void QMainWindowLayout::addDockWidget(Qt::DockWidgetArea area, -
1081 QDockWidget *dockwidget, -
1082 Qt::Orientation orientation) -
1083{ -
1084 addChildWidget(dockwidget);
executed (the execution status of this line is deduced): addChildWidget(dockwidget);
-
1085 -
1086 // If we are currently moving a separator, then we need to abort the move, since each -
1087 // time we move the mouse layoutState is replaced by savedState modified by the move. -
1088 if (!movingSeparator.isEmpty())
partially evaluated: !movingSeparator.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:18
0-18
1089 endSeparatorMove(movingSeparatorPos);
never executed: endSeparatorMove(movingSeparatorPos);
0
1090 -
1091 layoutState.dockAreaLayout.addDockWidget(toDockPos(area), dockwidget, orientation);
executed (the execution status of this line is deduced): layoutState.dockAreaLayout.addDockWidget(toDockPos(area), dockwidget, orientation);
-
1092 emit dockwidget->dockLocationChanged(area);
executed (the execution status of this line is deduced): dockwidget->dockLocationChanged(area);
-
1093 invalidate();
executed (the execution status of this line is deduced): invalidate();
-
1094}
executed: }
Execution Count:18
18
1095 -
1096void QMainWindowLayout::tabifyDockWidget(QDockWidget *first, QDockWidget *second) -
1097{ -
1098 addChildWidget(second);
executed (the execution status of this line is deduced): addChildWidget(second);
-
1099 layoutState.dockAreaLayout.tabifyDockWidget(first, second);
executed (the execution status of this line is deduced): layoutState.dockAreaLayout.tabifyDockWidget(first, second);
-
1100 emit second->dockLocationChanged(dockWidgetArea(first));
executed (the execution status of this line is deduced): second->dockLocationChanged(dockWidgetArea(first));
-
1101 invalidate();
executed (the execution status of this line is deduced): invalidate();
-
1102}
executed: }
Execution Count:4
4
1103 -
1104bool QMainWindowLayout::restoreDockWidget(QDockWidget *dockwidget) -
1105{ -
1106 addChildWidget(dockwidget);
never executed (the execution status of this line is deduced): addChildWidget(dockwidget);
-
1107 if (!layoutState.dockAreaLayout.restoreDockWidget(dockwidget))
never evaluated: !layoutState.dockAreaLayout.restoreDockWidget(dockwidget)
0
1108 return false;
never executed: return false;
0
1109 emit dockwidget->dockLocationChanged(dockWidgetArea(dockwidget));
never executed (the execution status of this line is deduced): dockwidget->dockLocationChanged(dockWidgetArea(dockwidget));
-
1110 invalidate();
never executed (the execution status of this line is deduced): invalidate();
-
1111 return true;
never executed: return true;
0
1112} -
1113 -
1114#ifndef QT_NO_TABBAR -
1115bool QMainWindowLayout::documentMode() const -
1116{ -
1117 return _documentMode;
never executed: return _documentMode;
0
1118} -
1119 -
1120void QMainWindowLayout::setDocumentMode(bool enabled) -
1121{ -
1122 if (_documentMode == enabled)
never evaluated: _documentMode == enabled
0
1123 return;
never executed: return;
0
1124 -
1125 _documentMode = enabled;
never executed (the execution status of this line is deduced): _documentMode = enabled;
-
1126 -
1127 // Update the document mode for all tab bars -
1128 foreach (QTabBar *bar, usedTabBars)
never executed (the execution status of this line is deduced): 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;}))
-
1129 bar->setDocumentMode(_documentMode);
never executed: bar->setDocumentMode(_documentMode);
0
1130 foreach (QTabBar *bar, unusedTabBars)
never executed (the execution status of this line is deduced): 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;}))
-
1131 bar->setDocumentMode(_documentMode);
never executed: bar->setDocumentMode(_documentMode);
0
1132}
never executed: }
0
1133#endif // QT_NO_TABBAR -
1134 -
1135void QMainWindowLayout::setVerticalTabsEnabled(bool enabled) -
1136{ -
1137#ifdef QT_NO_TABBAR -
1138 Q_UNUSED(enabled); -
1139#else -
1140 if (verticalTabsEnabled == enabled)
never evaluated: verticalTabsEnabled == enabled
0
1141 return;
never executed: return;
0
1142 -
1143 verticalTabsEnabled = enabled;
never executed (the execution status of this line is deduced): verticalTabsEnabled = enabled;
-
1144 -
1145 updateTabBarShapes();
never executed (the execution status of this line is deduced): updateTabBarShapes();
-
1146#endif // QT_NO_TABBAR -
1147}
never executed: }
0
1148 -
1149#ifndef QT_NO_TABWIDGET -
1150QTabWidget::TabShape QMainWindowLayout::tabShape() const -
1151{ -
1152 return _tabShape;
never executed: return _tabShape;
0
1153} -
1154 -
1155void QMainWindowLayout::setTabShape(QTabWidget::TabShape tabShape) -
1156{ -
1157 if (_tabShape == tabShape)
never evaluated: _tabShape == tabShape
0
1158 return;
never executed: return;
0
1159 -
1160 _tabShape = tabShape;
never executed (the execution status of this line is deduced): _tabShape = tabShape;
-
1161 -
1162 updateTabBarShapes();
never executed (the execution status of this line is deduced): updateTabBarShapes();
-
1163}
never executed: }
0
1164 -
1165QTabWidget::TabPosition QMainWindowLayout::tabPosition(Qt::DockWidgetArea area) const -
1166{ -
1167 return tabPositions[toDockPos(area)];
never executed: return tabPositions[toDockPos(area)];
0
1168} -
1169 -
1170void QMainWindowLayout::setTabPosition(Qt::DockWidgetAreas areas, QTabWidget::TabPosition tabPosition) -
1171{ -
1172 const Qt::DockWidgetArea dockWidgetAreas[] = {
never executed (the execution status of this line is deduced): const Qt::DockWidgetArea dockWidgetAreas[] = {
-
1173 Qt::TopDockWidgetArea,
never executed (the execution status of this line is deduced): Qt::TopDockWidgetArea,
-
1174 Qt::LeftDockWidgetArea,
never executed (the execution status of this line is deduced): Qt::LeftDockWidgetArea,
-
1175 Qt::BottomDockWidgetArea,
never executed (the execution status of this line is deduced): Qt::BottomDockWidgetArea,
-
1176 Qt::RightDockWidgetArea
never executed (the execution status of this line is deduced): Qt::RightDockWidgetArea
-
1177 };
never executed (the execution status of this line is deduced): };
-
1178 const QInternal::DockPosition dockPositions[] = {
never executed (the execution status of this line is deduced): const QInternal::DockPosition dockPositions[] = {
-
1179 QInternal::TopDock,
never executed (the execution status of this line is deduced): QInternal::TopDock,
-
1180 QInternal::LeftDock,
never executed (the execution status of this line is deduced): QInternal::LeftDock,
-
1181 QInternal::BottomDock,
never executed (the execution status of this line is deduced): QInternal::BottomDock,
-
1182 QInternal::RightDock
never executed (the execution status of this line is deduced): QInternal::RightDock
-
1183 };
never executed (the execution status of this line is deduced): };
-
1184 -
1185 for (int i = 0; i < QInternal::DockCount; ++i)
never evaluated: i < QInternal::DockCount
0
1186 if (areas & dockWidgetAreas[i])
never evaluated: areas & dockWidgetAreas[i]
0
1187 tabPositions[dockPositions[i]] = tabPosition;
never executed: tabPositions[dockPositions[i]] = tabPosition;
0
1188 -
1189 updateTabBarShapes();
never executed (the execution status of this line is deduced): updateTabBarShapes();
-
1190}
never executed: }
0
1191 -
1192static inline QTabBar::Shape tabBarShapeFrom(QTabWidget::TabShape shape, QTabWidget::TabPosition position) -
1193{ -
1194 const bool rounded = (shape == QTabWidget::Rounded);
never executed (the execution status of this line is deduced): const bool rounded = (shape == QTabWidget::Rounded);
-
1195 if (position == QTabWidget::North)
never evaluated: position == QTabWidget::North
0
1196 return rounded ? QTabBar::RoundedNorth : QTabBar::TriangularNorth;
never executed: return rounded ? QTabBar::RoundedNorth : QTabBar::TriangularNorth;
0
1197 if (position == QTabWidget::South)
never evaluated: position == QTabWidget::South
0
1198 return rounded ? QTabBar::RoundedSouth : QTabBar::TriangularSouth;
never executed: return rounded ? QTabBar::RoundedSouth : QTabBar::TriangularSouth;
0
1199 if (position == QTabWidget::East)
never evaluated: position == QTabWidget::East
0
1200 return rounded ? QTabBar::RoundedEast : QTabBar::TriangularEast;
never executed: return rounded ? QTabBar::RoundedEast : QTabBar::TriangularEast;
0
1201 if (position == QTabWidget::West)
never evaluated: position == QTabWidget::West
0
1202 return rounded ? QTabBar::RoundedWest : QTabBar::TriangularWest;
never executed: return rounded ? QTabBar::RoundedWest : QTabBar::TriangularWest;
0
1203 return QTabBar::RoundedNorth;
never executed: return QTabBar::RoundedNorth;
0
1204} -
1205#endif // QT_NO_TABWIDGET -
1206 -
1207#ifndef QT_NO_TABBAR -
1208void QMainWindowLayout::updateTabBarShapes() -
1209{ -
1210#ifndef QT_NO_TABWIDGET -
1211 const QTabWidget::TabPosition vertical[] = {
never executed (the execution status of this line is deduced): const QTabWidget::TabPosition vertical[] = {
-
1212 QTabWidget::West,
never executed (the execution status of this line is deduced): QTabWidget::West,
-
1213 QTabWidget::East,
never executed (the execution status of this line is deduced): QTabWidget::East,
-
1214 QTabWidget::North,
never executed (the execution status of this line is deduced): QTabWidget::North,
-
1215 QTabWidget::South
never executed (the execution status of this line is deduced): QTabWidget::South
-
1216 };
never executed (the execution status of this line is deduced): };
-
1217#else -
1218 const QTabBar::Shape vertical[] = { -
1219 QTabBar::RoundedWest, -
1220 QTabBar::RoundedEast, -
1221 QTabBar::RoundedNorth, -
1222 QTabBar::RoundedSouth -
1223 }; -
1224#endif -
1225 -
1226 QDockAreaLayout &layout = layoutState.dockAreaLayout;
never executed (the execution status of this line is deduced): QDockAreaLayout &layout = layoutState.dockAreaLayout;
-
1227 -
1228 for (int i = 0; i < QInternal::DockCount; ++i) {
never evaluated: i < QInternal::DockCount
0
1229#ifndef QT_NO_TABWIDGET -
1230 QTabWidget::TabPosition pos = verticalTabsEnabled ? vertical[i] : tabPositions[i];
never evaluated: verticalTabsEnabled
0
1231 QTabBar::Shape shape = tabBarShapeFrom(_tabShape, pos);
never executed (the execution status of this line is deduced): QTabBar::Shape shape = tabBarShapeFrom(_tabShape, pos);
-
1232#else -
1233 QTabBar::Shape shape = verticalTabsEnabled ? vertical[i] : QTabBar::RoundedSouth; -
1234#endif -
1235 layout.docks[i].setTabBarShape(shape);
never executed (the execution status of this line is deduced): layout.docks[i].setTabBarShape(shape);
-
1236 }
never executed: }
0
1237}
never executed: }
0
1238#endif // QT_NO_TABBAR -
1239 -
1240void QMainWindowLayout::splitDockWidget(QDockWidget *after, -
1241 QDockWidget *dockwidget, -
1242 Qt::Orientation orientation) -
1243{ -
1244 addChildWidget(dockwidget);
executed (the execution status of this line is deduced): addChildWidget(dockwidget);
-
1245 layoutState.dockAreaLayout.splitDockWidget(after, dockwidget, orientation);
executed (the execution status of this line is deduced): layoutState.dockAreaLayout.splitDockWidget(after, dockwidget, orientation);
-
1246 emit dockwidget->dockLocationChanged(dockWidgetArea(after));
executed (the execution status of this line is deduced): dockwidget->dockLocationChanged(dockWidgetArea(after));
-
1247 invalidate();
executed (the execution status of this line is deduced): invalidate();
-
1248}
executed: }
Execution Count:1
1
1249 -
1250Qt::DockWidgetArea QMainWindowLayout::dockWidgetArea(QDockWidget *widget) const -
1251{ -
1252 QList<int> pathToWidget = layoutState.dockAreaLayout.indexOf(widget);
executed (the execution status of this line is deduced): QList<int> pathToWidget = layoutState.dockAreaLayout.indexOf(widget);
-
1253 if (pathToWidget.isEmpty())
evaluated: pathToWidget.isEmpty()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:19
2-19
1254 return Qt::NoDockWidgetArea;
executed: return Qt::NoDockWidgetArea;
Execution Count:2
2
1255 return toDockWidgetArea(pathToWidget.first());
executed: return toDockWidgetArea(pathToWidget.first());
Execution Count:19
19
1256} -
1257 -
1258void QMainWindowLayout::keepSize(QDockWidget *w) -
1259{ -
1260 layoutState.dockAreaLayout.keepSize(w);
executed (the execution status of this line is deduced): layoutState.dockAreaLayout.keepSize(w);
-
1261}
executed: }
Execution Count:15
15
1262 -
1263#ifndef QT_NO_TABBAR -
1264 -
1265class QMainWindowTabBar : public QTabBar -
1266{ -
1267public: -
1268 QMainWindowTabBar(QWidget *parent); -
1269protected: -
1270 bool event(QEvent *e); -
1271}; -
1272 -
1273QMainWindowTabBar::QMainWindowTabBar(QWidget *parent) -
1274 : QTabBar(parent) -
1275{ -
1276 setExpanding(false);
executed (the execution status of this line is deduced): setExpanding(false);
-
1277}
executed: }
Execution Count:5
5
1278 -
1279bool QMainWindowTabBar::event(QEvent *e) -
1280{ -
1281 // show the tooltip if tab is too small to fit label -
1282 -
1283 if (e->type() != QEvent::ToolTip)
partially evaluated: e->type() != QEvent::ToolTip
TRUEFALSE
yes
Evaluation Count:92
no
Evaluation Count:0
0-92
1284 return QTabBar::event(e);
executed: return QTabBar::event(e);
Execution Count:92
92
1285 QSize size = this->size();
never executed (the execution status of this line is deduced): QSize size = this->size();
-
1286 QSize hint = sizeHint();
never executed (the execution status of this line is deduced): QSize hint = sizeHint();
-
1287 if (shape() == QTabBar::RoundedWest || shape() == QTabBar::RoundedEast) {
never evaluated: shape() == QTabBar::RoundedWest
never evaluated: shape() == QTabBar::RoundedEast
0
1288 size.transpose();
never executed (the execution status of this line is deduced): size.transpose();
-
1289 hint.transpose();
never executed (the execution status of this line is deduced): hint.transpose();
-
1290 }
never executed: }
0
1291 if (size.width() < hint.width())
never evaluated: size.width() < hint.width()
0
1292 return QTabBar::event(e);
never executed: return QTabBar::event(e);
0
1293 e->accept();
never executed (the execution status of this line is deduced): e->accept();
-
1294 return true;
never executed: return true;
0
1295} -
1296 -
1297QTabBar *QMainWindowLayout::getTabBar() -
1298{ -
1299 QTabBar *result = 0;
executed (the execution status of this line is deduced): QTabBar *result = 0;
-
1300 if (!unusedTabBars.isEmpty()) {
partially evaluated: !unusedTabBars.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-5
1301 result = unusedTabBars.takeLast();
never executed (the execution status of this line is deduced): result = unusedTabBars.takeLast();
-
1302 } else {
never executed: }
0
1303 result = new QMainWindowTabBar(parentWidget());
executed (the execution status of this line is deduced): result = new QMainWindowTabBar(parentWidget());
-
1304 result->setDrawBase(true);
executed (the execution status of this line is deduced): result->setDrawBase(true);
-
1305 result->setElideMode(Qt::ElideRight);
executed (the execution status of this line is deduced): result->setElideMode(Qt::ElideRight);
-
1306 result->setDocumentMode(_documentMode);
executed (the execution status of this line is deduced): result->setDocumentMode(_documentMode);
-
1307 connect(result, SIGNAL(currentChanged(int)), this, SLOT(tabChanged()));
executed (the execution status of this line is deduced): connect(result, "2""currentChanged(int)", this, "1""tabChanged()");
-
1308 }
executed: }
Execution Count:5
5
1309 -
1310 usedTabBars.insert(result);
executed (the execution status of this line is deduced): usedTabBars.insert(result);
-
1311 return result;
executed: return result;
Execution Count:5
5
1312} -
1313 -
1314// Allocates a new separator widget if needed -
1315QWidget *QMainWindowLayout::getSeparatorWidget() -
1316{ -
1317 QWidget *result = 0;
never executed (the execution status of this line is deduced): QWidget *result = 0;
-
1318 if (!unusedSeparatorWidgets.isEmpty()) {
never evaluated: !unusedSeparatorWidgets.isEmpty()
0
1319 result = unusedSeparatorWidgets.takeLast();
never executed (the execution status of this line is deduced): result = unusedSeparatorWidgets.takeLast();
-
1320 } else {
never executed: }
0
1321 result = new QWidget(parentWidget());
never executed (the execution status of this line is deduced): result = new QWidget(parentWidget());
-
1322 result->setAttribute(Qt::WA_MouseNoMask, true);
never executed (the execution status of this line is deduced): result->setAttribute(Qt::WA_MouseNoMask, true);
-
1323 result->setAutoFillBackground(false);
never executed (the execution status of this line is deduced): result->setAutoFillBackground(false);
-
1324 result->setObjectName(QLatin1String("qt_qmainwindow_extended_splitter"));
never executed (the execution status of this line is deduced): result->setObjectName(QLatin1String("qt_qmainwindow_extended_splitter"));
-
1325 }
never executed: }
0
1326 usedSeparatorWidgets.insert(result);
never executed (the execution status of this line is deduced): usedSeparatorWidgets.insert(result);
-
1327 return result;
never executed: return result;
0
1328} -
1329 -
1330void QMainWindowLayout::tabChanged() -
1331{ -
1332 QTabBar *tb = qobject_cast<QTabBar*>(sender());
executed (the execution status of this line is deduced): QTabBar *tb = qobject_cast<QTabBar*>(sender());
-
1333 if (tb == 0)
partially evaluated: tb == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
1334 return;
never executed: return;
0
1335 QDockAreaLayoutInfo *info = layoutState.dockAreaLayout.info(tb);
executed (the execution status of this line is deduced): QDockAreaLayoutInfo *info = layoutState.dockAreaLayout.info(tb);
-
1336 if (info == 0)
evaluated: info == 0
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:6
2-6
1337 return;
executed: return;
Execution Count:2
2
1338 info->apply(false);
executed (the execution status of this line is deduced): info->apply(false);
-
1339 -
1340 if (QWidget *w = centralWidget())
partially evaluated: QWidget *w = centralWidget()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6
0-6
1341 w->raise();
never executed: w->raise();
0
1342}
executed: }
Execution Count:6
6
1343#endif // QT_NO_TABBAR -
1344 -
1345bool QMainWindowLayout::startSeparatorMove(const QPoint &pos) -
1346{ -
1347 movingSeparator = layoutState.dockAreaLayout.findSeparator(pos);
never executed (the execution status of this line is deduced): movingSeparator = layoutState.dockAreaLayout.findSeparator(pos);
-
1348 -
1349 if (movingSeparator.isEmpty())
never evaluated: movingSeparator.isEmpty()
0
1350 return false;
never executed: return false;
0
1351 -
1352 layoutState.dockAreaLayout.fallbackToSizeHints = false;
never executed (the execution status of this line is deduced): layoutState.dockAreaLayout.fallbackToSizeHints = false;
-
1353 -
1354 savedState = layoutState;
never executed (the execution status of this line is deduced): savedState = layoutState;
-
1355 movingSeparatorPos = movingSeparatorOrigin = pos;
never executed (the execution status of this line is deduced): movingSeparatorPos = movingSeparatorOrigin = pos;
-
1356 -
1357 return true;
never executed: return true;
0
1358} -
1359 -
1360bool QMainWindowLayout::separatorMove(const QPoint &pos) -
1361{ -
1362 if (movingSeparator.isEmpty())
never evaluated: movingSeparator.isEmpty()
0
1363 return false;
never executed: return false;
0
1364 movingSeparatorPos = pos;
never executed (the execution status of this line is deduced): movingSeparatorPos = pos;
-
1365 separatorMoveTimer.start(0, this);
never executed (the execution status of this line is deduced): separatorMoveTimer.start(0, this);
-
1366 return true;
never executed: return true;
0
1367} -
1368 -
1369bool QMainWindowLayout::endSeparatorMove(const QPoint&) -
1370{ -
1371 if (movingSeparator.isEmpty())
never evaluated: movingSeparator.isEmpty()
0
1372 return false;
never executed: return false;
0
1373 movingSeparator.clear();
never executed (the execution status of this line is deduced): movingSeparator.clear();
-
1374 savedState.clear();
never executed (the execution status of this line is deduced): savedState.clear();
-
1375 return true;
never executed: return true;
0
1376} -
1377 -
1378void QMainWindowLayout::raise(QDockWidget *widget) -
1379{ -
1380 QDockAreaLayoutInfo *info = layoutState.dockAreaLayout.info(widget);
executed (the execution status of this line is deduced): QDockAreaLayoutInfo *info = layoutState.dockAreaLayout.info(widget);
-
1381 if (info == 0)
partially evaluated: info == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
1382 return;
never executed: return;
0
1383#ifndef QT_NO_TABBAR -
1384 if (!info->tabbed)
partially evaluated: !info->tabbed
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
1385 return;
never executed: return;
0
1386 info->setCurrentTab(widget);
executed (the execution status of this line is deduced): info->setCurrentTab(widget);
-
1387#endif -
1388}
executed: }
Execution Count:4
4
1389 -
1390#endif // QT_NO_DOCKWIDGET -
1391 -
1392 -
1393/****************************************************************************** -
1394** QMainWindowLayoutState - layout interface -
1395*/ -
1396 -
1397int QMainWindowLayout::count() const -
1398{ -
1399 qWarning("QMainWindowLayout::count: ?");
never executed (the execution status of this line is deduced): QMessageLogger("widgets/qmainwindowlayout.cpp", 1399, __PRETTY_FUNCTION__).warning("QMainWindowLayout::count: ?");
-
1400 return 0; //#################################################
never executed: return 0;
0
1401} -
1402 -
1403QLayoutItem *QMainWindowLayout::itemAt(int index) const -
1404{ -
1405 int x = 0;
executed (the execution status of this line is deduced): int x = 0;
-
1406 -
1407 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
1408 return ret;
executed: return ret;
Execution Count:185
185
1409 -
1410 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
1411 return statusbar;
executed: return statusbar;
Execution Count:30
30
1412 -
1413 return 0;
executed: return 0;
Execution Count:202
202
1414} -
1415 -
1416QLayoutItem *QMainWindowLayout::takeAt(int index) -
1417{ -
1418 int x = 0;
executed (the execution status of this line is deduced): int x = 0;
-
1419 -
1420 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
1421 // the widget might in fact have been destroyed by now -
1422 if (QWidget *w = ret->widget()) {
partially evaluated: QWidget *w = ret->widget()
TRUEFALSE
yes
Evaluation Count:22
no
Evaluation Count:0
0-22
1423 widgetAnimator.abort(w);
executed (the execution status of this line is deduced): widgetAnimator.abort(w);
-
1424 if (w == pluggingWidget)
partially evaluated: w == pluggingWidget
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:22
0-22
1425 pluggingWidget = 0;
never executed: pluggingWidget = 0;
0
1426 }
executed: }
Execution Count:22
22
1427 -
1428 if (savedState.isValid() ) {
partially evaluated: savedState.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:22
0-22
1429 //we need to remove the item also from the saved state to prevent crash -
1430 savedState.remove(ret);
never executed (the execution status of this line is deduced): savedState.remove(ret);
-
1431 //Also, the item may be contained several times as a gap item. -
1432 layoutState.remove(ret);
never executed (the execution status of this line is deduced): layoutState.remove(ret);
-
1433 }
never executed: }
0
1434 -
1435#ifndef QT_NO_TOOLBAR -
1436 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
1437 currentGapPos = layoutState.toolBarAreaLayout.currentGapIndex();
never executed (the execution status of this line is deduced): currentGapPos = layoutState.toolBarAreaLayout.currentGapIndex();
-
1438 if (!currentGapPos.isEmpty()) {
never evaluated: !currentGapPos.isEmpty()
0
1439 currentGapPos.prepend(0);
never executed (the execution status of this line is deduced): currentGapPos.prepend(0);
-
1440 currentGapRect = layoutState.itemRect(currentGapPos);
never executed (the execution status of this line is deduced): currentGapRect = layoutState.itemRect(currentGapPos);
-
1441 }
never executed: }
0
1442 }
never executed: }
0
1443#endif -
1444 -
1445 return ret;
executed: return ret;
Execution Count:22
22
1446 } -
1447 -
1448 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
1449 QLayoutItem *ret = statusbar;
executed (the execution status of this line is deduced): QLayoutItem *ret = statusbar;
-
1450 statusbar = 0;
executed (the execution status of this line is deduced): statusbar = 0;
-
1451 return ret;
executed: return ret;
Execution Count:1
1
1452 } -
1453 -
1454 return 0;
never executed: return 0;
0
1455} -
1456 -
1457void QMainWindowLayout::setGeometry(const QRect &_r) -
1458{ -
1459 if (savedState.isValid())
partially evaluated: savedState.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:237
0-237
1460 return;
never executed: return;
0
1461 -
1462 QRect r = _r;
executed (the execution status of this line is deduced): QRect r = _r;
-
1463 -
1464 QLayout::setGeometry(r);
executed (the execution status of this line is deduced): QLayout::setGeometry(r);
-
1465 -
1466 if (statusbar) {
evaluated: statusbar
TRUEFALSE
yes
Evaluation Count:29
yes
Evaluation Count:208
29-208
1467 QRect sbr(QPoint(0, 0),
executed (the execution status of this line is deduced): QRect sbr(QPoint(0, 0),
-
1468 QSize(r.width(), statusbar->heightForWidth(r.width()))
executed (the execution status of this line is deduced): QSize(r.width(), statusbar->heightForWidth(r.width()))
-
1469 .expandedTo(statusbar->minimumSize()));
executed (the execution status of this line is deduced): .expandedTo(statusbar->minimumSize()));
-
1470 sbr.moveBottom(r.bottom());
executed (the execution status of this line is deduced): sbr.moveBottom(r.bottom());
-
1471 QRect vr = QStyle::visualRect(parentWidget()->layoutDirection(), _r, sbr);
executed (the execution status of this line is deduced): QRect vr = QStyle::visualRect(parentWidget()->layoutDirection(), _r, sbr);
-
1472 statusbar->setGeometry(vr);
executed (the execution status of this line is deduced): statusbar->setGeometry(vr);
-
1473 r.setBottom(sbr.top() - 1);
executed (the execution status of this line is deduced): r.setBottom(sbr.top() - 1);
-
1474 }
executed: }
Execution Count:29
29
1475 -
1476 layoutState.rect = r;
executed (the execution status of this line is deduced): layoutState.rect = r;
-
1477 layoutState.fitLayout();
executed (the execution status of this line is deduced): layoutState.fitLayout();
-
1478 applyState(layoutState, false);
executed (the execution status of this line is deduced): applyState(layoutState, false);
-
1479}
executed: }
Execution Count:237
237
1480 -
1481void QMainWindowLayout::addItem(QLayoutItem *) -
1482{ qWarning("QMainWindowLayout::addItem: Please use the public QMainWindow API instead"); }
never executed: }
0
1483 -
1484QSize QMainWindowLayout::sizeHint() const -
1485{ -
1486 if (!szHint.isValid()) {
partially evaluated: !szHint.isValid()
TRUEFALSE
yes
Evaluation Count:30
no
Evaluation Count:0
0-30
1487 szHint = layoutState.sizeHint();
executed (the execution status of this line is deduced): szHint = layoutState.sizeHint();
-
1488 const QSize sbHint = statusbar ? statusbar->sizeHint() : QSize(0, 0);
evaluated: statusbar
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:27
3-27
1489 szHint = QSize(qMax(sbHint.width(), szHint.width()),
executed (the execution status of this line is deduced): szHint = QSize(qMax(sbHint.width(), szHint.width()),
-
1490 sbHint.height() + szHint.height());
executed (the execution status of this line is deduced): sbHint.height() + szHint.height());
-
1491 }
executed: }
Execution Count:30
30
1492 return szHint;
executed: return szHint;
Execution Count:30
30
1493} -
1494 -
1495QSize QMainWindowLayout::minimumSize() const -
1496{ -
1497 if (!minSize.isValid()) {
partially evaluated: !minSize.isValid()
TRUEFALSE
yes
Evaluation Count:167
no
Evaluation Count:0
0-167
1498 minSize = layoutState.minimumSize();
executed (the execution status of this line is deduced): minSize = layoutState.minimumSize();
-
1499 const QSize sbMin = statusbar ? statusbar->minimumSize() : QSize(0, 0);
evaluated: statusbar
TRUEFALSE
yes
Evaluation Count:21
yes
Evaluation Count:146
21-146
1500 minSize = QSize(qMax(sbMin.width(), minSize.width()),
executed (the execution status of this line is deduced): minSize = QSize(qMax(sbMin.width(), minSize.width()),
-
1501 sbMin.height() + minSize.height());
executed (the execution status of this line is deduced): sbMin.height() + minSize.height());
-
1502#ifdef Q_WS_MAC -
1503 const QSize storedSize = minSize; -
1504 int minWidth = 0; -
1505 foreach (QToolBar *toolbar, qtoolbarsInUnifiedToolbarList) { -
1506 minWidth += toolbar->sizeHint().width() + 20; -
1507 } -
1508 minSize = QSize(qMax(minWidth, storedSize.width()), storedSize.height()); -
1509#endif -
1510 }
executed: }
Execution Count:167
167
1511 return minSize;
executed: return minSize;
Execution Count:167
167
1512} -
1513 -
1514void QMainWindowLayout::invalidate() -
1515{ -
1516 QLayout::invalidate();
executed (the execution status of this line is deduced): QLayout::invalidate();
-
1517 minSize = szHint = QSize();
executed (the execution status of this line is deduced): minSize = szHint = QSize();
-
1518}
executed: }
Execution Count:825
825
1519 -
1520/****************************************************************************** -
1521** QMainWindowLayout - remaining stuff -
1522*/ -
1523 -
1524static void fixToolBarOrientation(QLayoutItem *item, int dockPos) -
1525{ -
1526#ifndef QT_NO_TOOLBAR -
1527 QToolBar *toolBar = qobject_cast<QToolBar*>(item->widget());
never executed (the execution status of this line is deduced): QToolBar *toolBar = qobject_cast<QToolBar*>(item->widget());
-
1528 if (toolBar == 0)
never evaluated: toolBar == 0
0
1529 return;
never executed: return;
0
1530 -
1531 QRect oldGeo = toolBar->geometry();
never executed (the execution status of this line is deduced): QRect oldGeo = toolBar->geometry();
-
1532 -
1533 QInternal::DockPosition pos
never executed (the execution status of this line is deduced): QInternal::DockPosition pos
-
1534 = static_cast<QInternal::DockPosition>(dockPos);
never executed (the execution status of this line is deduced): = static_cast<QInternal::DockPosition>(dockPos);
-
1535 Qt::Orientation o = pos == QInternal::TopDock || pos == QInternal::BottomDock
never evaluated: pos == QInternal::TopDock
never evaluated: pos == QInternal::BottomDock
0
1536 ? Qt::Horizontal : Qt::Vertical;
never executed (the execution status of this line is deduced): ? Qt::Horizontal : Qt::Vertical;
-
1537 if (o != toolBar->orientation())
never evaluated: o != toolBar->orientation()
0
1538 toolBar->setOrientation(o);
never executed: toolBar->setOrientation(o);
0
1539 -
1540 QSize hint = toolBar->sizeHint().boundedTo(toolBar->maximumSize())
never executed (the execution status of this line is deduced): QSize hint = toolBar->sizeHint().boundedTo(toolBar->maximumSize())
-
1541 .expandedTo(toolBar->minimumSize());
never executed (the execution status of this line is deduced): .expandedTo(toolBar->minimumSize());
-
1542 -
1543 if (toolBar->size() != hint) {
never evaluated: toolBar->size() != hint
0
1544 QRect newGeo(oldGeo.topLeft(), hint);
never executed (the execution status of this line is deduced): QRect newGeo(oldGeo.topLeft(), hint);
-
1545 if (toolBar->layoutDirection() == Qt::RightToLeft)
never evaluated: toolBar->layoutDirection() == Qt::RightToLeft
0
1546 newGeo.moveRight(oldGeo.right());
never executed: newGeo.moveRight(oldGeo.right());
0
1547 toolBar->setGeometry(newGeo);
never executed (the execution status of this line is deduced): toolBar->setGeometry(newGeo);
-
1548 }
never executed: }
0
1549 -
1550#else -
1551 Q_UNUSED(item); -
1552 Q_UNUSED(dockPos); -
1553#endif -
1554}
never executed: }
0
1555 -
1556void QMainWindowLayout::revert(QLayoutItem *widgetItem) -
1557{ -
1558 if (!savedState.isValid())
never evaluated: !savedState.isValid()
0
1559 return;
never executed: return;
0
1560 -
1561 QWidget *widget = widgetItem->widget();
never executed (the execution status of this line is deduced): QWidget *widget = widgetItem->widget();
-
1562 layoutState = savedState;
never executed (the execution status of this line is deduced): layoutState = savedState;
-
1563 currentGapPos = layoutState.indexOf(widget);
never executed (the execution status of this line is deduced): currentGapPos = layoutState.indexOf(widget);
-
1564 fixToolBarOrientation(widgetItem, currentGapPos.at(1));
never executed (the execution status of this line is deduced): fixToolBarOrientation(widgetItem, currentGapPos.at(1));
-
1565 layoutState.unplug(currentGapPos);
never executed (the execution status of this line is deduced): layoutState.unplug(currentGapPos);
-
1566 layoutState.fitLayout();
never executed (the execution status of this line is deduced): layoutState.fitLayout();
-
1567 currentGapRect = layoutState.itemRect(currentGapPos);
never executed (the execution status of this line is deduced): currentGapRect = layoutState.itemRect(currentGapPos);
-
1568 -
1569 plug(widgetItem);
never executed (the execution status of this line is deduced): plug(widgetItem);
-
1570}
never executed: }
0
1571 -
1572bool QMainWindowLayout::plug(QLayoutItem *widgetItem) -
1573{ -
1574 if (!parentWidget()->isVisible() || parentWidget()->isMinimized() || currentGapPos.isEmpty())
never evaluated: !parentWidget()->isVisible()
never evaluated: parentWidget()->isMinimized()
never evaluated: currentGapPos.isEmpty()
0
1575 return false;
never executed: return false;
0
1576 -
1577 fixToolBarOrientation(widgetItem, currentGapPos.at(1));
never executed (the execution status of this line is deduced): fixToolBarOrientation(widgetItem, currentGapPos.at(1));
-
1578 -
1579 QWidget *widget = widgetItem->widget();
never executed (the execution status of this line is deduced): QWidget *widget = widgetItem->widget();
-
1580 -
1581 QList<int> previousPath = layoutState.indexOf(widget);
never executed (the execution status of this line is deduced): QList<int> previousPath = layoutState.indexOf(widget);
-
1582 -
1583 QLayoutItem *it = layoutState.plug(currentGapPos);
never executed (the execution status of this line is deduced): QLayoutItem *it = layoutState.plug(currentGapPos);
-
1584 Q_ASSERT(it == widgetItem);
never executed (the execution status of this line is deduced): qt_noop();
-
1585 Q_UNUSED(it);
never executed (the execution status of this line is deduced): (void)it;;
-
1586 if (!previousPath.isEmpty())
never evaluated: !previousPath.isEmpty()
0
1587 layoutState.remove(previousPath);
never executed: layoutState.remove(previousPath);
0
1588 -
1589 pluggingWidget = widget;
never executed (the execution status of this line is deduced): pluggingWidget = widget;
-
1590 QRect globalRect = currentGapRect;
never executed (the execution status of this line is deduced): QRect globalRect = currentGapRect;
-
1591 globalRect.moveTopLeft(parentWidget()->mapToGlobal(globalRect.topLeft()));
never executed (the execution status of this line is deduced): globalRect.moveTopLeft(parentWidget()->mapToGlobal(globalRect.topLeft()));
-
1592#ifndef QT_NO_DOCKWIDGET -
1593 if (qobject_cast<QDockWidget*>(widget) != 0) {
never evaluated: qobject_cast<QDockWidget*>(widget) != 0
0
1594 QDockWidgetLayout *layout = qobject_cast<QDockWidgetLayout*>(widget->layout());
never executed (the execution status of this line is deduced): QDockWidgetLayout *layout = qobject_cast<QDockWidgetLayout*>(widget->layout());
-
1595 if (layout->nativeWindowDeco()) {
never evaluated: layout->nativeWindowDeco()
0
1596 globalRect.adjust(0, layout->titleHeight(), 0, 0);
never executed (the execution status of this line is deduced): globalRect.adjust(0, layout->titleHeight(), 0, 0);
-
1597 } else {
never executed: }
0
1598 int fw = widget->style()->pixelMetric(QStyle::PM_DockWidgetFrameWidth, 0, widget);
never executed (the execution status of this line is deduced): int fw = widget->style()->pixelMetric(QStyle::PM_DockWidgetFrameWidth, 0, widget);
-
1599 globalRect.adjust(-fw, -fw, fw, fw);
never executed (the execution status of this line is deduced): globalRect.adjust(-fw, -fw, fw, fw);
-
1600 }
never executed: }
0
1601 } -
1602#endif -
1603 widgetAnimator.animate(widget, globalRect, dockOptions & QMainWindow::AnimatedDocks);
never executed (the execution status of this line is deduced): widgetAnimator.animate(widget, globalRect, dockOptions & QMainWindow::AnimatedDocks);
-
1604 -
1605 return true;
never executed: return true;
0
1606} -
1607 -
1608void QMainWindowLayout::animationFinished(QWidget *widget) -
1609{ -
1610 //this function is called from within the Widget Animator whenever an animation is finished -
1611 //on a certain widget -
1612#ifndef QT_NO_TOOLBAR -
1613 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
1614 QToolBarLayout *tbl = qobject_cast<QToolBarLayout*>(tb->layout());
executed (the execution status of this line is deduced): QToolBarLayout *tbl = qobject_cast<QToolBarLayout*>(tb->layout());
-
1615 if (tbl->animating) {
partially evaluated: tbl->animating
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:10
0-10
1616 tbl->animating = false;
never executed (the execution status of this line is deduced): tbl->animating = false;
-
1617 if (tbl->expanded)
never evaluated: tbl->expanded
0
1618 tbl->layoutActions(tb->size());
never executed: tbl->layoutActions(tb->size());
0
1619 tb->update();
never executed (the execution status of this line is deduced): tb->update();
-
1620 }
never executed: }
0
1621 }
executed: }
Execution Count:10
10
1622#endif -
1623 -
1624 if (widget == pluggingWidget) {
partially evaluated: widget == pluggingWidget
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:220
0-220
1625 -
1626#ifndef QT_NO_DOCKWIDGET -
1627 if (QDockWidget *dw = qobject_cast<QDockWidget*>(widget))
never evaluated: QDockWidget *dw = qobject_cast<QDockWidget*>(widget)
0
1628 dw->d_func()->plug(currentGapRect);
never executed: dw->d_func()->plug(currentGapRect);
0
1629#endif -
1630#ifndef QT_NO_TOOLBAR -
1631 if (QToolBar *tb = qobject_cast<QToolBar*>(widget))
never evaluated: QToolBar *tb = qobject_cast<QToolBar*>(widget)
0
1632 tb->d_func()->plug(currentGapRect);
never executed: tb->d_func()->plug(currentGapRect);
0
1633#endif -
1634 -
1635 savedState.clear();
never executed (the execution status of this line is deduced): savedState.clear();
-
1636 currentGapPos.clear();
never executed (the execution status of this line is deduced): currentGapPos.clear();
-
1637 pluggingWidget = 0;
never executed (the execution status of this line is deduced): pluggingWidget = 0;
-
1638 //applying the state will make sure that the currentGap is updated correctly -
1639 //and all the geometries (especially the one from the central widget) is correct -
1640 layoutState.apply(false);
never executed (the execution status of this line is deduced): layoutState.apply(false);
-
1641 -
1642#ifndef QT_NO_DOCKWIDGET -
1643#ifndef QT_NO_TABBAR -
1644 if (qobject_cast<QDockWidget*>(widget) != 0) {
never evaluated: qobject_cast<QDockWidget*>(widget) != 0
0
1645 // info() might return null if the widget is destroyed while -
1646 // animating but before the animationFinished signal is received. -
1647 if (QDockAreaLayoutInfo *info = layoutState.dockAreaLayout.info(widget))
never evaluated: QDockAreaLayoutInfo *info = layoutState.dockAreaLayout.info(widget)
0
1648 info->setCurrentTab(widget);
never executed: info->setCurrentTab(widget);
0
1649 }
never executed: }
0
1650#endif -
1651#endif -
1652 }
never executed: }
0
1653 -
1654 if (!widgetAnimator.animating()) {
partially evaluated: !widgetAnimator.animating()
TRUEFALSE
yes
Evaluation Count:220
no
Evaluation Count:0
0-220
1655 //all animations are finished -
1656#ifndef QT_NO_DOCKWIDGET -
1657 parentWidget()->update(layoutState.dockAreaLayout.separatorRegion());
executed (the execution status of this line is deduced): parentWidget()->update(layoutState.dockAreaLayout.separatorRegion());
-
1658#ifndef QT_NO_TABBAR -
1659 foreach (QTabBar *tab_bar, usedTabBars)
executed (the execution status of this line is deduced): 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;}))
-
1660 tab_bar->show();
executed: tab_bar->show();
Execution Count:48
48
1661#endif // QT_NO_TABBAR -
1662#endif // QT_NO_DOCKWIDGET -
1663 }
executed: }
Execution Count:220
220
1664 -
1665 updateGapIndicator();
executed (the execution status of this line is deduced): updateGapIndicator();
-
1666}
executed: }
Execution Count:220
220
1667 -
1668void QMainWindowLayout::restore(bool keepSavedState) -
1669{ -
1670 if (!savedState.isValid())
never evaluated: !savedState.isValid()
0
1671 return;
never executed: return;
0
1672 -
1673 layoutState = savedState;
never executed (the execution status of this line is deduced): layoutState = savedState;
-
1674 applyState(layoutState);
never executed (the execution status of this line is deduced): applyState(layoutState);
-
1675 if (!keepSavedState)
never evaluated: !keepSavedState
0
1676 savedState.clear();
never executed: savedState.clear();
0
1677 currentGapPos.clear();
never executed (the execution status of this line is deduced): currentGapPos.clear();
-
1678 pluggingWidget = 0;
never executed (the execution status of this line is deduced): pluggingWidget = 0;
-
1679 updateGapIndicator();
never executed (the execution status of this line is deduced): updateGapIndicator();
-
1680}
never executed: }
0
1681 -
1682QMainWindowLayout::QMainWindowLayout(QMainWindow *mainwindow, QLayout *parentLayout) -
1683 : QLayout(parentLayout ? static_cast<QWidget *>(0) : mainwindow) -
1684 , layoutState(mainwindow) -
1685 , savedState(mainwindow) -
1686 , dockOptions(QMainWindow::AnimatedDocks | QMainWindow::AllowTabbedDocks) -
1687 , statusbar(0) -
1688#ifndef QT_NO_DOCKWIDGET -
1689#ifndef QT_NO_TABBAR -
1690 , _documentMode(false) -
1691 , verticalTabsEnabled(false) -
1692#ifndef QT_NO_TABWIDGET -
1693 , _tabShape(QTabWidget::Rounded) -
1694#endif -
1695#endif -
1696#endif // QT_NO_DOCKWIDGET -
1697 , widgetAnimator(this) -
1698 , pluggingWidget(0) -
1699#ifndef QT_NO_RUBBERBAND -
1700 , gapIndicator(new QRubberBand(QRubberBand::Rectangle, mainwindow)) -
1701#endif //QT_NO_RUBBERBAND -
1702#ifdef Q_WS_MAC -
1703 , blockVisiblityCheck(false) -
1704#endif -
1705{ -
1706 if (parentLayout)
partially evaluated: parentLayout
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:44
0-44
1707 setParent(parentLayout);
never executed: setParent(parentLayout);
0
1708 -
1709#ifndef QT_NO_DOCKWIDGET -
1710#ifndef QT_NO_TABBAR -
1711 sep = mainwindow->style()->pixelMetric(QStyle::PM_DockWidgetSeparatorExtent, 0, mainwindow);
executed (the execution status of this line is deduced): sep = mainwindow->style()->pixelMetric(QStyle::PM_DockWidgetSeparatorExtent, 0, mainwindow);
-
1712#endif -
1713 -
1714#ifndef QT_NO_TABWIDGET -
1715 for (int i = 0; i < QInternal::DockCount; ++i)
evaluated: i < QInternal::DockCount
TRUEFALSE
yes
Evaluation Count:176
yes
Evaluation Count:44
44-176
1716 tabPositions[i] = QTabWidget::South;
executed: tabPositions[i] = QTabWidget::South;
Execution Count:176
176
1717#endif -
1718#endif // QT_NO_DOCKWIDGET -
1719 -
1720#ifndef QT_NO_RUBBERBAND -
1721 // For accessibility to identify this special widget. -
1722 gapIndicator->setObjectName(QLatin1String("qt_rubberband"));
executed (the execution status of this line is deduced): gapIndicator->setObjectName(QLatin1String("qt_rubberband"));
-
1723 gapIndicator->hide();
executed (the execution status of this line is deduced): gapIndicator->hide();
-
1724#endif -
1725 pluggingWidget = 0;
executed (the execution status of this line is deduced): pluggingWidget = 0;
-
1726 -
1727 setObjectName(mainwindow->objectName() + QLatin1String("_layout"));
executed (the execution status of this line is deduced): setObjectName(mainwindow->objectName() + QLatin1String("_layout"));
-
1728}
executed: }
Execution Count:44
44
1729 -
1730QMainWindowLayout::~QMainWindowLayout() -
1731{ -
1732 layoutState.deleteAllLayoutItems();
executed (the execution status of this line is deduced): layoutState.deleteAllLayoutItems();
-
1733 layoutState.deleteCentralWidgetItem();
executed (the execution status of this line is deduced): layoutState.deleteCentralWidgetItem();
-
1734 -
1735#ifdef Q_WS_MAC -
1736 cleanUpMacToolbarItems(); -
1737#endif -
1738 -
1739 delete statusbar;
executed (the execution status of this line is deduced): delete statusbar;
-
1740}
executed: }
Execution Count:43
43
1741 -
1742void QMainWindowLayout::setDockOptions(QMainWindow::DockOptions opts) -
1743{ -
1744 if (opts == dockOptions)
never evaluated: opts == dockOptions
0
1745 return;
never executed: return;
0
1746 -
1747 dockOptions = opts;
never executed (the execution status of this line is deduced): dockOptions = opts;
-
1748 -
1749#ifndef QT_NO_DOCKWIDGET -
1750 setVerticalTabsEnabled(opts & QMainWindow::VerticalTabs);
never executed (the execution status of this line is deduced): setVerticalTabsEnabled(opts & QMainWindow::VerticalTabs);
-
1751#endif -
1752 -
1753 invalidate();
never executed (the execution status of this line is deduced): invalidate();
-
1754}
never executed: }
0
1755 -
1756#ifndef QT_NO_STATUSBAR -
1757QStatusBar *QMainWindowLayout::statusBar() const -
1758{ return statusbar ? qobject_cast<QStatusBar *>(statusbar->widget()) : 0; }
executed: return statusbar ? qobject_cast<QStatusBar *>(statusbar->widget()) : 0;
Execution Count:97
97
1759 -
1760void QMainWindowLayout::setStatusBar(QStatusBar *sb) -
1761{ -
1762 if (sb)
partially evaluated: sb
TRUEFALSE
yes
Evaluation Count:5
no
Evaluation Count:0
0-5
1763 addChildWidget(sb);
executed: addChildWidget(sb);
Execution Count:5
5
1764 delete statusbar;
executed (the execution status of this line is deduced): delete statusbar;
-
1765 statusbar = sb ? new QWidgetItemV2(sb) : 0;
partially evaluated: sb
TRUEFALSE
yes
Evaluation Count:5
no
Evaluation Count:0
0-5
1766 invalidate();
executed (the execution status of this line is deduced): invalidate();
-
1767}
executed: }
Execution Count:5
5
1768#endif // QT_NO_STATUSBAR -
1769 -
1770QWidget *QMainWindowLayout::centralWidget() const -
1771{ -
1772 return layoutState.centralWidget();
executed: return layoutState.centralWidget();
Execution Count:24
24
1773} -
1774 -
1775void QMainWindowLayout::setCentralWidget(QWidget *widget) -
1776{ -
1777 if (widget != 0)
partially evaluated: widget != 0
TRUEFALSE
yes
Evaluation Count:18
no
Evaluation Count:0
0-18
1778 addChildWidget(widget);
executed: addChildWidget(widget);
Execution Count:18
18
1779 layoutState.setCentralWidget(widget);
executed (the execution status of this line is deduced): layoutState.setCentralWidget(widget);
-
1780 if (savedState.isValid()) {
partially evaluated: savedState.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:18
0-18
1781#ifndef QT_NO_DOCKWIDGET -
1782 savedState.dockAreaLayout.centralWidgetItem = layoutState.dockAreaLayout.centralWidgetItem;
never executed (the execution status of this line is deduced): savedState.dockAreaLayout.centralWidgetItem = layoutState.dockAreaLayout.centralWidgetItem;
-
1783 savedState.dockAreaLayout.fallbackToSizeHints = true;
never executed (the execution status of this line is deduced): savedState.dockAreaLayout.fallbackToSizeHints = true;
-
1784#else -
1785 savedState.centralWidgetItem = layoutState.centralWidgetItem; -
1786#endif -
1787 }
never executed: }
0
1788 invalidate();
executed (the execution status of this line is deduced): invalidate();
-
1789}
executed: }
Execution Count:18
18
1790 -
1791QLayoutItem *QMainWindowLayout::unplug(QWidget *widget) -
1792{ -
1793 QList<int> path = layoutState.indexOf(widget);
never executed (the execution status of this line is deduced): QList<int> path = layoutState.indexOf(widget);
-
1794 if (path.isEmpty())
never evaluated: path.isEmpty()
0
1795 return 0;
never executed: return 0;
0
1796 -
1797 QLayoutItem *item = layoutState.item(path);
never executed (the execution status of this line is deduced): QLayoutItem *item = layoutState.item(path);
-
1798 if (widget->isWindow())
never evaluated: widget->isWindow()
0
1799 return item;
never executed: return item;
0
1800 -
1801 QRect r = layoutState.itemRect(path);
never executed (the execution status of this line is deduced): QRect r = layoutState.itemRect(path);
-
1802 savedState = layoutState;
never executed (the execution status of this line is deduced): savedState = layoutState;
-
1803 -
1804#ifndef QT_NO_DOCKWIDGET -
1805 if (QDockWidget *dw = qobject_cast<QDockWidget*>(widget)) {
never evaluated: QDockWidget *dw = qobject_cast<QDockWidget*>(widget)
0
1806 dw->d_func()->unplug(r);
never executed (the execution status of this line is deduced): dw->d_func()->unplug(r);
-
1807 }
never executed: }
0
1808#endif -
1809#ifndef QT_NO_TOOLBAR -
1810 if (QToolBar *tb = qobject_cast<QToolBar*>(widget)) {
never evaluated: QToolBar *tb = qobject_cast<QToolBar*>(widget)
0
1811 tb->d_func()->unplug(r);
never executed (the execution status of this line is deduced): tb->d_func()->unplug(r);
-
1812 }
never executed: }
0
1813#endif -
1814 -
1815 -
1816 layoutState.unplug(path ,&savedState);
never executed (the execution status of this line is deduced): layoutState.unplug(path ,&savedState);
-
1817 savedState.fitLayout();
never executed (the execution status of this line is deduced): savedState.fitLayout();
-
1818 currentGapPos = path;
never executed (the execution status of this line is deduced): currentGapPos = path;
-
1819 currentGapRect = r;
never executed (the execution status of this line is deduced): currentGapRect = r;
-
1820 updateGapIndicator();
never executed (the execution status of this line is deduced): updateGapIndicator();
-
1821 -
1822 fixToolBarOrientation(item, currentGapPos.at(1));
never executed (the execution status of this line is deduced): fixToolBarOrientation(item, currentGapPos.at(1));
-
1823 -
1824 return item;
never executed: return item;
0
1825} -
1826 -
1827void QMainWindowLayout::updateGapIndicator() -
1828{ -
1829#ifndef QT_NO_RUBBERBAND -
1830 gapIndicator->setVisible(!widgetAnimator.animating() && !currentGapPos.isEmpty());
executed (the execution status of this line is deduced): gapIndicator->setVisible(!widgetAnimator.animating() && !currentGapPos.isEmpty());
-
1831 gapIndicator->setGeometry(currentGapRect);
executed (the execution status of this line is deduced): gapIndicator->setGeometry(currentGapRect);
-
1832#endif -
1833}
executed: }
Execution Count:220
220
1834 -
1835QList<int> QMainWindowLayout::hover(QLayoutItem *widgetItem, const QPoint &mousePos) -
1836{ -
1837 if (!parentWidget()->isVisible() || parentWidget()->isMinimized()
never evaluated: !parentWidget()->isVisible()
never evaluated: parentWidget()->isMinimized()
0
1838 || pluggingWidget != 0 || widgetItem == 0)
never evaluated: pluggingWidget != 0
never evaluated: widgetItem == 0
0
1839 return QList<int>();
never executed: return QList<int>();
0
1840 -
1841 QWidget *widget = widgetItem->widget();
never executed (the execution status of this line is deduced): QWidget *widget = widgetItem->widget();
-
1842 QPoint pos = parentWidget()->mapFromGlobal(mousePos);
never executed (the execution status of this line is deduced): QPoint pos = parentWidget()->mapFromGlobal(mousePos);
-
1843 -
1844 if (!savedState.isValid())
never evaluated: !savedState.isValid()
0
1845 savedState = layoutState;
never executed: savedState = layoutState;
0
1846 -
1847 QList<int> path = savedState.gapIndex(widget, pos);
never executed (the execution status of this line is deduced): QList<int> path = savedState.gapIndex(widget, pos);
-
1848 -
1849 if (!path.isEmpty()) {
never evaluated: !path.isEmpty()
0
1850 bool allowed = false;
never executed (the execution status of this line is deduced): bool allowed = false;
-
1851 -
1852#ifndef QT_NO_DOCKWIDGET -
1853 if (QDockWidget *dw = qobject_cast<QDockWidget*>(widget))
never evaluated: QDockWidget *dw = qobject_cast<QDockWidget*>(widget)
0
1854 allowed = dw->isAreaAllowed(toDockWidgetArea(path.at(1)));
never executed: allowed = dw->isAreaAllowed(toDockWidgetArea(path.at(1)));
0
1855#endif -
1856#ifndef QT_NO_TOOLBAR -
1857 if (QToolBar *tb = qobject_cast<QToolBar*>(widget))
never evaluated: QToolBar *tb = qobject_cast<QToolBar*>(widget)
0
1858 allowed = tb->isAreaAllowed(toToolBarArea(path.at(1)));
never executed: allowed = tb->isAreaAllowed(toToolBarArea(path.at(1)));
0
1859#endif -
1860 -
1861 if (!allowed)
never evaluated: !allowed
0
1862 path.clear();
never executed: path.clear();
0
1863 }
never executed: }
0
1864 -
1865 if (path == currentGapPos)
never evaluated: path == currentGapPos
0
1866 return currentGapPos; // the gap is already there
never executed: return currentGapPos;
0
1867 -
1868 currentGapPos = path;
never executed (the execution status of this line is deduced): currentGapPos = path;
-
1869 if (path.isEmpty()) {
never evaluated: path.isEmpty()
0
1870 fixToolBarOrientation(widgetItem, 2); // 2 = top dock, ie. horizontal
never executed (the execution status of this line is deduced): fixToolBarOrientation(widgetItem, 2);
-
1871 restore(true);
never executed (the execution status of this line is deduced): restore(true);
-
1872 return QList<int>();
never executed: return QList<int>();
0
1873 } -
1874 -
1875 fixToolBarOrientation(widgetItem, currentGapPos.at(1));
never executed (the execution status of this line is deduced): fixToolBarOrientation(widgetItem, currentGapPos.at(1));
-
1876 -
1877 QMainWindowLayoutState newState = savedState;
never executed (the execution status of this line is deduced): QMainWindowLayoutState newState = savedState;
-
1878 -
1879 if (!newState.insertGap(path, widgetItem)) {
never evaluated: !newState.insertGap(path, widgetItem)
0
1880 restore(true); // not enough space
never executed (the execution status of this line is deduced): restore(true);
-
1881 return QList<int>();
never executed: return QList<int>();
0
1882 } -
1883 -
1884 QSize min = newState.minimumSize();
never executed (the execution status of this line is deduced): QSize min = newState.minimumSize();
-
1885 QSize size = newState.rect.size();
never executed (the execution status of this line is deduced): QSize size = newState.rect.size();
-
1886 -
1887 if (min.width() > size.width() || min.height() > size.height()) {
never evaluated: min.width() > size.width()
never evaluated: min.height() > size.height()
0
1888 restore(true);
never executed (the execution status of this line is deduced): restore(true);
-
1889 return QList<int>();
never executed: return QList<int>();
0
1890 } -
1891 -
1892 newState.fitLayout();
never executed (the execution status of this line is deduced): newState.fitLayout();
-
1893 -
1894 currentGapRect = newState.gapRect(currentGapPos);
never executed (the execution status of this line is deduced): currentGapRect = newState.gapRect(currentGapPos);
-
1895 -
1896#ifndef QT_NO_DOCKWIDGET -
1897 parentWidget()->update(layoutState.dockAreaLayout.separatorRegion());
never executed (the execution status of this line is deduced): parentWidget()->update(layoutState.dockAreaLayout.separatorRegion());
-
1898#endif -
1899 layoutState = newState;
never executed (the execution status of this line is deduced): layoutState = newState;
-
1900 applyState(layoutState);
never executed (the execution status of this line is deduced): applyState(layoutState);
-
1901 -
1902 updateGapIndicator();
never executed (the execution status of this line is deduced): updateGapIndicator();
-
1903 -
1904 return path;
never executed: return path;
0
1905} -
1906 -
1907void QMainWindowLayout::applyState(QMainWindowLayoutState &newState, bool animate) -
1908{ -
1909#ifndef QT_NO_DOCKWIDGET -
1910#ifndef QT_NO_TABBAR -
1911 QSet<QTabBar*> used = newState.dockAreaLayout.usedTabBars();
executed (the execution status of this line is deduced): QSet<QTabBar*> used = newState.dockAreaLayout.usedTabBars();
-
1912 QSet<QTabBar*> retired = usedTabBars - used;
executed (the execution status of this line is deduced): QSet<QTabBar*> retired = usedTabBars - used;
-
1913 usedTabBars = used;
executed (the execution status of this line is deduced): usedTabBars = used;
-
1914 foreach (QTabBar *tab_bar, retired) {
executed (the execution status of this line is deduced): 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;})) {
-
1915 tab_bar->hide();
executed (the execution status of this line is deduced): tab_bar->hide();
-
1916 while (tab_bar->count() > 0)
evaluated: tab_bar->count() > 0
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1
1-2
1917 tab_bar->removeTab(0);
executed: tab_bar->removeTab(0);
Execution Count:2
2
1918 unusedTabBars.append(tab_bar);
executed (the execution status of this line is deduced): unusedTabBars.append(tab_bar);
-
1919 }
executed: }
Execution Count:1
1
1920 -
1921 if (sep == 1) {
partially evaluated: sep == 1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:237
0-237
1922 QSet<QWidget*> usedSeps = newState.dockAreaLayout.usedSeparatorWidgets();
never executed (the execution status of this line is deduced): QSet<QWidget*> usedSeps = newState.dockAreaLayout.usedSeparatorWidgets();
-
1923 QSet<QWidget*> retiredSeps = usedSeparatorWidgets - usedSeps;
never executed (the execution status of this line is deduced): QSet<QWidget*> retiredSeps = usedSeparatorWidgets - usedSeps;
-
1924 usedSeparatorWidgets = usedSeps;
never executed (the execution status of this line is deduced): usedSeparatorWidgets = usedSeps;
-
1925 foreach (QWidget *sepWidget, retiredSeps) {
never executed (the execution status of this line is deduced): 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;})) {
-
1926 unusedSeparatorWidgets.append(sepWidget);
never executed (the execution status of this line is deduced): unusedSeparatorWidgets.append(sepWidget);
-
1927 }
never executed: }
0
1928 }
never executed: }
0
1929 -
1930 -
1931#endif // QT_NO_TABBAR -
1932#endif // QT_NO_DOCKWIDGET -
1933 newState.apply(dockOptions & QMainWindow::AnimatedDocks && animate);
executed (the execution status of this line is deduced): newState.apply(dockOptions & QMainWindow::AnimatedDocks && animate);
-
1934}
executed: }
Execution Count:237
237
1935 -
1936void QMainWindowLayout::saveState(QDataStream &stream) const -
1937{ -
1938 layoutState.saveState(stream);
executed (the execution status of this line is deduced): layoutState.saveState(stream);
-
1939}
executed: }
Execution Count:2
2
1940 -
1941bool QMainWindowLayout::restoreState(QDataStream &stream) -
1942{ -
1943 savedState = layoutState;
executed (the execution status of this line is deduced): savedState = layoutState;
-
1944 layoutState.clear();
executed (the execution status of this line is deduced): layoutState.clear();
-
1945 layoutState.rect = savedState.rect;
executed (the execution status of this line is deduced): layoutState.rect = savedState.rect;
-
1946 -
1947 if (!layoutState.restoreState(stream, savedState)) {
partially evaluated: !layoutState.restoreState(stream, savedState)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
1948 layoutState.deleteAllLayoutItems();
never executed (the execution status of this line is deduced): layoutState.deleteAllLayoutItems();
-
1949 layoutState = savedState;
never executed (the execution status of this line is deduced): layoutState = savedState;
-
1950 if (parentWidget()->isVisible())
never evaluated: parentWidget()->isVisible()
0
1951 applyState(layoutState, false); // hides tabBars allocated by newState
never executed: applyState(layoutState, false);
0
1952 return false;
never executed: return false;
0
1953 } -
1954 -
1955 if (parentWidget()->isVisible()) {
partially evaluated: parentWidget()->isVisible()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
1956 layoutState.fitLayout();
never executed (the execution status of this line is deduced): layoutState.fitLayout();
-
1957 applyState(layoutState, false);
never executed (the execution status of this line is deduced): applyState(layoutState, false);
-
1958 }
never executed: }
0
1959 -
1960 savedState.deleteAllLayoutItems();
executed (the execution status of this line is deduced): savedState.deleteAllLayoutItems();
-
1961 savedState.clear();
executed (the execution status of this line is deduced): savedState.clear();
-
1962 -
1963#ifndef QT_NO_DOCKWIDGET -
1964 if (parentWidget()->isVisible()) {
partially evaluated: parentWidget()->isVisible()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
1965#ifndef QT_NO_TABBAR -
1966 foreach (QTabBar *tab_bar, usedTabBars)
never executed (the execution status of this line is deduced): 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;}))
-
1967 tab_bar->show();
never executed: tab_bar->show();
0
1968 -
1969#endif -
1970 }
never executed: }
0
1971#endif // QT_NO_DOCKWIDGET -
1972 -
1973 return true;
executed: return true;
Execution Count:2
2
1974} -
1975 -
1976 -
1977// Returns if this toolbar *should* be using HIToolbar. Won't work for all in between cases -
1978// for example, you have a toolbar in the top area and then you suddenly turn on -
1979// HIToolbar. -
1980bool QMainWindowLayout::usesHIToolBar(QToolBar *toolbar) const -
1981{ -
1982#ifndef Q_WS_MAC -
1983 Q_UNUSED(toolbar);
executed (the execution status of this line is deduced): (void)toolbar;;
-
1984 return false;
executed: return false;
Execution Count:2
2
1985#else -
1986 return qtoolbarsInUnifiedToolbarList.contains(toolbar) -
1987 || ((toolBarArea(toolbar) == Qt::TopToolBarArea) -
1988 && layoutState.mainWindow->unifiedTitleAndToolBarOnMac()); -
1989#endif -
1990} -
1991 -
1992void QMainWindowLayout::timerEvent(QTimerEvent *e) -
1993{ -
1994#ifndef QT_NO_DOCKWIDGET -
1995 if (e->timerId() == separatorMoveTimer.timerId()) {
never evaluated: e->timerId() == separatorMoveTimer.timerId()
0
1996 //let's move the separators -
1997 separatorMoveTimer.stop();
never executed (the execution status of this line is deduced): separatorMoveTimer.stop();
-
1998 if (movingSeparator.isEmpty())
never evaluated: movingSeparator.isEmpty()
0
1999 return;
never executed: return;
0
2000 if (movingSeparatorOrigin == movingSeparatorPos)
never evaluated: movingSeparatorOrigin == movingSeparatorPos
0
2001 return;
never executed: return;
0
2002 -
2003 //when moving the separator, we need to update the previous position -
2004 parentWidget()->update(layoutState.dockAreaLayout.separatorRegion());
never executed (the execution status of this line is deduced): parentWidget()->update(layoutState.dockAreaLayout.separatorRegion());
-
2005 -
2006 layoutState = savedState;
never executed (the execution status of this line is deduced): layoutState = savedState;
-
2007 layoutState.dockAreaLayout.separatorMove(movingSeparator, movingSeparatorOrigin,
never executed (the execution status of this line is deduced): layoutState.dockAreaLayout.separatorMove(movingSeparator, movingSeparatorOrigin,
-
2008 movingSeparatorPos);
never executed (the execution status of this line is deduced): movingSeparatorPos);
-
2009 movingSeparatorPos = movingSeparatorOrigin;
never executed (the execution status of this line is deduced): movingSeparatorPos = movingSeparatorOrigin;
-
2010 }
never executed: }
0
2011#endif -
2012 QLayout::timerEvent(e);
never executed (the execution status of this line is deduced): QLayout::timerEvent(e);
-
2013}
never executed: }
0
2014 -
2015 -
2016QT_END_NAMESPACE -
2017 -
2018#endif // QT_NO_MAINWINDOW -
2019 -
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial