qdockarealayout.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/widgets/widgets/qdockarealayout.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2016 The Qt Company Ltd.-
4** Copyright (C) 2015 Olivier Goffart <ogoffart@woboq.com>-
5** Contact: https://www.qt.io/licensing/-
6**-
7** This file is part of the QtWidgets module of the Qt Toolkit.-
8**-
9** $QT_BEGIN_LICENSE:LGPL$-
10** Commercial License Usage-
11** Licensees holding valid commercial Qt licenses may use this file in-
12** accordance with the commercial license agreement provided with the-
13** Software or, alternatively, in accordance with the terms contained in-
14** a written agreement between you and The Qt Company. For licensing terms-
15** and conditions see https://www.qt.io/terms-conditions. For further-
16** information use the contact form at https://www.qt.io/contact-us.-
17**-
18** GNU Lesser General Public License Usage-
19** Alternatively, this file may be used under the terms of the GNU Lesser-
20** General Public License version 3 as published by the Free Software-
21** Foundation and appearing in the file LICENSE.LGPL3 included in the-
22** packaging of this file. Please review the following information to-
23** ensure the GNU Lesser General Public License version 3 requirements-
24** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.-
25**-
26** GNU General Public License Usage-
27** Alternatively, this file may be used under the terms of the GNU-
28** General Public License version 2.0 or (at your option) the GNU General-
29** Public license version 3 or any later version approved by the KDE Free-
30** Qt Foundation. The licenses are as published by the Free Software-
31** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3-
32** included in the packaging of this file. Please review the following-
33** information to ensure the GNU General Public License requirements will-
34** be met: https://www.gnu.org/licenses/gpl-2.0.html and-
35** https://www.gnu.org/licenses/gpl-3.0.html.-
36**-
37** $QT_END_LICENSE$-
38**-
39****************************************************************************/-
40-
41#include "QtWidgets/qapplication.h"-
42#include "QtWidgets/qwidget.h"-
43#include "QtWidgets/qtabbar.h"-
44#include "QtWidgets/qstyle.h"-
45#include "QtWidgets/qdesktopwidget.h"-
46#include "QtWidgets/qapplication.h"-
47#include "QtCore/qvariant.h"-
48#include "qdockarealayout_p.h"-
49#include "qdockwidget.h"-
50#include "qmainwindow.h"-
51#include "qwidgetanimator_p.h"-
52#include "qmainwindowlayout_p.h"-
53#include "qdockwidget_p.h"-
54#include <private/qlayoutengine_p.h>-
55-
56#include <qpainter.h>-
57#include <qstyleoption.h>-
58-
59#ifndef QT_NO_DOCKWIDGET-
60-
61QT_BEGIN_NAMESPACE-
62-
63// qmainwindow.cpp-
64extern QMainWindowLayout *qt_mainwindow_layout(const QMainWindow *window);-
65-
66enum { StateFlagVisible = 1, StateFlagFloating = 2 };-
67-
68/******************************************************************************-
69** QPlaceHolderItem-
70*/-
71-
72QPlaceHolderItem::QPlaceHolderItem(QWidget *w)-
73{-
74 objectName = w->objectName();-
75 hidden = w->isHidden();-
76 window = w->isWindow();-
77 if (window)
windowDescription
TRUEnever evaluated
FALSEnever evaluated
0
78 topLevelRect = w->geometry();
never executed: topLevelRect = w->geometry();
0
79}
never executed: end of block
0
80-
81/******************************************************************************-
82** QDockAreaLayoutItem-
83*/-
84-
85QDockAreaLayoutItem::QDockAreaLayoutItem(QLayoutItem *_widgetItem)-
86 : widgetItem(_widgetItem), subinfo(0), placeHolderItem(0), pos(0), size(-1), flags(NoFlags)-
87{-
88}
never executed: end of block
0
89-
90QDockAreaLayoutItem::QDockAreaLayoutItem(QDockAreaLayoutInfo *_subinfo)-
91 : widgetItem(0), subinfo(_subinfo), placeHolderItem(0), pos(0), size(-1), flags(NoFlags)-
92{-
93}
never executed: end of block
0
94-
95QDockAreaLayoutItem::QDockAreaLayoutItem(QPlaceHolderItem *_placeHolderItem)-
96 : widgetItem(0), subinfo(0), placeHolderItem(_placeHolderItem), pos(0), size(-1), flags(NoFlags)-
97{-
98}
never executed: end of block
0
99-
100QDockAreaLayoutItem::QDockAreaLayoutItem(const QDockAreaLayoutItem &other)-
101 : widgetItem(other.widgetItem), subinfo(0), placeHolderItem(0), pos(other.pos),-
102 size(other.size), flags(other.flags)-
103{-
104 if (other.subinfo != 0)
other.subinfo != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
105 subinfo = new QDockAreaLayoutInfo(*other.subinfo);
never executed: subinfo = new QDockAreaLayoutInfo(*other.subinfo);
0
106 else if (other.placeHolderItem != 0)
other.placeHolderItem != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
107 placeHolderItem = new QPlaceHolderItem(*other.placeHolderItem);
never executed: placeHolderItem = new QPlaceHolderItem(*other.placeHolderItem);
0
108}
never executed: end of block
0
109-
110QDockAreaLayoutItem::~QDockAreaLayoutItem()-
111{-
112 delete subinfo;-
113 delete placeHolderItem;-
114}
never executed: end of block
0
115-
116bool QDockAreaLayoutItem::skip() const-
117{-
118 if (placeHolderItem != 0)
placeHolderItem != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
119 return true;
never executed: return true;
0
120-
121 if (flags & GapItem)
flags & GapItemDescription
TRUEnever evaluated
FALSEnever evaluated
0
122 return false;
never executed: return false;
0
123-
124 if (widgetItem != 0)
widgetItem != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
125 return widgetItem->isEmpty();
never executed: return widgetItem->isEmpty();
0
126-
127 if (subinfo != 0) {
subinfo != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
128 for (int i = 0; i < subinfo->item_list.count(); ++i) {
i < subinfo->item_list.count()Description
TRUEnever evaluated
FALSEnever evaluated
0
129 if (!subinfo->item_list.at(i).skip())
!subinfo->item...t.at(i).skip()Description
TRUEnever evaluated
FALSEnever evaluated
0
130 return false;
never executed: return false;
0
131 }
never executed: end of block
0
132 }
never executed: end of block
0
133-
134 return true;
never executed: return true;
0
135}-
136-
137QSize QDockAreaLayoutItem::minimumSize() const-
138{-
139 if (widgetItem != 0) {
widgetItem != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
140 int left, top, right, bottom;-
141 widgetItem->widget()->getContentsMargins(&left, &top, &right, &bottom);-
142 return widgetItem->minimumSize() + QSize(left+right, top+bottom);
never executed: return widgetItem->minimumSize() + QSize(left+right, top+bottom);
0
143 }-
144 if (subinfo != 0)
subinfo != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
145 return subinfo->minimumSize();
never executed: return subinfo->minimumSize();
0
146 return QSize(0, 0);
never executed: return QSize(0, 0);
0
147}-
148-
149QSize QDockAreaLayoutItem::maximumSize() const-
150{-
151 if (widgetItem != 0) {
widgetItem != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
152 int left, top, right, bottom;-
153 widgetItem->widget()->getContentsMargins(&left, &top, &right, &bottom);-
154 return widgetItem->maximumSize()+ QSize(left+right, top+bottom);
never executed: return widgetItem->maximumSize()+ QSize(left+right, top+bottom);
0
155 }-
156 if (subinfo != 0)
subinfo != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
157 return subinfo->maximumSize();
never executed: return subinfo->maximumSize();
0
158 return QSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX);
never executed: return QSize(((1<<24)-1), ((1<<24)-1));
0
159}-
160-
161bool QDockAreaLayoutItem::hasFixedSize(Qt::Orientation o) const-
162{-
163 return perp(o, minimumSize()) == perp(o, maximumSize());
never executed: return perp(o, minimumSize()) == perp(o, maximumSize());
0
164}-
165-
166bool QDockAreaLayoutItem::expansive(Qt::Orientation o) const-
167{-
168 if ((flags & GapItem) || placeHolderItem != 0)
(flags & GapItem)Description
TRUEnever evaluated
FALSEnever evaluated
placeHolderItem != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
169 return false;
never executed: return false;
0
170 if (widgetItem != 0)
widgetItem != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
171 return ((widgetItem->expandingDirections() & o) == o);
never executed: return ((widgetItem->expandingDirections() & o) == o);
0
172 if (subinfo != 0)
subinfo != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
173 return subinfo->expansive(o);
never executed: return subinfo->expansive(o);
0
174 return false;
never executed: return false;
0
175}-
176-
177QSize QDockAreaLayoutItem::sizeHint() const-
178{-
179 if (placeHolderItem != 0)
placeHolderItem != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
180 return QSize(0, 0);
never executed: return QSize(0, 0);
0
181 if (widgetItem != 0) {
widgetItem != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
182 int left, top, right, bottom;-
183 widgetItem->widget()->getContentsMargins(&left, &top, &right, &bottom);-
184 return widgetItem->sizeHint() + QSize(left+right, top+bottom);
never executed: return widgetItem->sizeHint() + QSize(left+right, top+bottom);
0
185 }-
186 if (subinfo != 0)
subinfo != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
187 return subinfo->sizeHint();
never executed: return subinfo->sizeHint();
0
188 return QSize(-1, -1);
never executed: return QSize(-1, -1);
0
189}-
190-
191QDockAreaLayoutItem-
192 &QDockAreaLayoutItem::operator = (const QDockAreaLayoutItem &other)-
193{-
194 widgetItem = other.widgetItem;-
195 if (other.subinfo == 0)
other.subinfo == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
196 subinfo = 0;
never executed: subinfo = 0;
0
197 else-
198 subinfo = new QDockAreaLayoutInfo(*other.subinfo);
never executed: subinfo = new QDockAreaLayoutInfo(*other.subinfo);
0
199-
200 delete placeHolderItem;-
201 if (other.placeHolderItem == 0)
other.placeHolderItem == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
202 placeHolderItem = 0;
never executed: placeHolderItem = 0;
0
203 else-
204 placeHolderItem = new QPlaceHolderItem(*other.placeHolderItem);
never executed: placeHolderItem = new QPlaceHolderItem(*other.placeHolderItem);
0
205-
206 pos = other.pos;-
207 size = other.size;-
208 flags = other.flags;-
209-
210 return *this;
never executed: return *this;
0
211}-
212-
213/******************************************************************************-
214** QDockAreaLayoutInfo-
215*/-
216-
217#ifndef QT_NO_TABBAR-
218static quintptr tabId(const QDockAreaLayoutItem &item)-
219{-
220 if (item.widgetItem == 0)
item.widgetItem == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
221 return 0;
never executed: return 0;
0
222 return reinterpret_cast<quintptr>(item.widgetItem->widget());
never executed: return reinterpret_cast<quintptr>(item.widgetItem->widget());
0
223}-
224#endif-
225-
226static const int zero = 0;-
227-
228QDockAreaLayoutInfo::QDockAreaLayoutInfo()-
229 : sep(&zero), dockPos(QInternal::LeftDock), o(Qt::Horizontal), mainWindow(0)-
230#ifndef QT_NO_TABBAR-
231 , tabbed(false), tabBar(0), tabBarShape(QTabBar::RoundedSouth)-
232#endif-
233{-
234}
never executed: end of block
0
235-
236QDockAreaLayoutInfo::QDockAreaLayoutInfo(const int *_sep, QInternal::DockPosition _dockPos,-
237 Qt::Orientation _o, int tbshape,-
238 QMainWindow *window)-
239 : sep(_sep), dockPos(_dockPos), o(_o), mainWindow(window)-
240#ifndef QT_NO_TABBAR-
241 , tabbed(false), tabBar(0), tabBarShape(static_cast<QTabBar::Shape>(tbshape))-
242#endif-
243{-
244#ifdef QT_NO_TABBAR-
245 Q_UNUSED(tbshape);-
246#endif-
247}
never executed: end of block
0
248-
249QSize QDockAreaLayoutInfo::size() const-
250{-
251 return isEmpty() ? QSize(0, 0) : rect.size();
never executed: return isEmpty() ? QSize(0, 0) : rect.size();
0
252}-
253-
254void QDockAreaLayoutInfo::clear()-
255{-
256 item_list.clear();-
257 rect = QRect();-
258#ifndef QT_NO_TABBAR-
259 tabbed = false;-
260 tabBar = 0;-
261#endif-
262}
never executed: end of block
0
263-
264bool QDockAreaLayoutInfo::isEmpty() const-
265{-
266 return next(-1) == -1;
never executed: return next(-1) == -1;
0
267}-
268-
269QSize QDockAreaLayoutInfo::minimumSize() const-
270{-
271 if (isEmpty())
isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
272 return QSize(0, 0);
never executed: return QSize(0, 0);
0
273-
274 int a = 0, b = 0;-
275 bool first = true;-
276 for (int i = 0; i < item_list.size(); ++i) {
i < item_list.size()Description
TRUEnever evaluated
FALSEnever evaluated
0
277 const QDockAreaLayoutItem &item = item_list.at(i);-
278 if (item.skip())
item.skip()Description
TRUEnever evaluated
FALSEnever evaluated
0
279 continue;
never executed: continue;
0
280-
281 QSize min_size = item.minimumSize();-
282#ifndef QT_NO_TABBAR-
283 if (tabbed) {
tabbedDescription
TRUEnever evaluated
FALSEnever evaluated
0
284 a = qMax(a, pick(o, min_size));-
285 } else
never executed: end of block
0
286#endif-
287 {-
288 if (!first)
!firstDescription
TRUEnever evaluated
FALSEnever evaluated
0
289 a += *sep;
never executed: a += *sep;
0
290 a += pick(o, min_size);-
291 }
never executed: end of block
0
292 b = qMax(b, perp(o, min_size));-
293-
294 first = false;-
295 }
never executed: end of block
0
296-
297 QSize result;-
298 rpick(o, result) = a;-
299 rperp(o, result) = b;-
300-
301#ifndef QT_NO_TABBAR-
302 QSize tbm = tabBarMinimumSize();-
303 if (!tbm.isNull()) {
!tbm.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
0
304 switch (tabBarShape) {-
305 case QTabBar::RoundedNorth:
never executed: case QTabBar::RoundedNorth:
0
306 case QTabBar::RoundedSouth:
never executed: case QTabBar::RoundedSouth:
0
307 case QTabBar::TriangularNorth:
never executed: case QTabBar::TriangularNorth:
0
308 case QTabBar::TriangularSouth:
never executed: case QTabBar::TriangularSouth:
0
309 result.rheight() += tbm.height();-
310 result.rwidth() = qMax(tbm.width(), result.width());-
311 break;
never executed: break;
0
312 case QTabBar::RoundedEast:
never executed: case QTabBar::RoundedEast:
0
313 case QTabBar::RoundedWest:
never executed: case QTabBar::RoundedWest:
0
314 case QTabBar::TriangularEast:
never executed: case QTabBar::TriangularEast:
0
315 case QTabBar::TriangularWest:
never executed: case QTabBar::TriangularWest:
0
316 result.rheight() = qMax(tbm.height(), result.height());-
317 result.rwidth() += tbm.width();-
318 break;
never executed: break;
0
319 default:
never executed: default:
0
320 break;
never executed: break;
0
321 }-
322 }-
323#endif // QT_NO_TABBAR-
324-
325 return result;
never executed: return result;
0
326}-
327-
328QSize QDockAreaLayoutInfo::maximumSize() const-
329{-
330 if (isEmpty())
isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
331 return QSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX);
never executed: return QSize(((1<<24)-1), ((1<<24)-1));
0
332-
333 int a = 0, b = QWIDGETSIZE_MAX;-
334#ifndef QT_NO_TABBAR-
335 if (tabbed)
tabbedDescription
TRUEnever evaluated
FALSEnever evaluated
0
336 a = QWIDGETSIZE_MAX;
never executed: a = ((1<<24)-1);
0
337#endif-
338-
339 int min_perp = 0;-
340-
341 bool first = true;-
342 for (int i = 0; i < item_list.size(); ++i) {
i < item_list.size()Description
TRUEnever evaluated
FALSEnever evaluated
0
343 const QDockAreaLayoutItem &item = item_list.at(i);-
344 if (item.skip())
item.skip()Description
TRUEnever evaluated
FALSEnever evaluated
0
345 continue;
never executed: continue;
0
346-
347 QSize max_size = item.maximumSize();-
348 min_perp = qMax(min_perp, perp(o, item.minimumSize()));-
349-
350#ifndef QT_NO_TABBAR-
351 if (tabbed) {
tabbedDescription
TRUEnever evaluated
FALSEnever evaluated
0
352 a = qMin(a, pick(o, max_size));-
353 } else
never executed: end of block
0
354#endif-
355 {-
356 if (!first)
!firstDescription
TRUEnever evaluated
FALSEnever evaluated
0
357 a += *sep;
never executed: a += *sep;
0
358 a += pick(o, max_size);-
359 }
never executed: end of block
0
360 b = qMin(b, perp(o, max_size));-
361-
362 a = qMin(a, int(QWIDGETSIZE_MAX));-
363 b = qMin(b, int(QWIDGETSIZE_MAX));-
364-
365 first = false;-
366 }
never executed: end of block
0
367-
368 b = qMax(b, min_perp);-
369-
370 QSize result;-
371 rpick(o, result) = a;-
372 rperp(o, result) = b;-
373-
374#ifndef QT_NO_TABBAR-
375 QSize tbh = tabBarSizeHint();-
376 if (!tbh.isNull()) {
!tbh.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
0
377 switch (tabBarShape) {-
378 case QTabBar::RoundedNorth:
never executed: case QTabBar::RoundedNorth:
0
379 case QTabBar::RoundedSouth:
never executed: case QTabBar::RoundedSouth:
0
380 result.rheight() += tbh.height();-
381 break;
never executed: break;
0
382 case QTabBar::RoundedEast:
never executed: case QTabBar::RoundedEast:
0
383 case QTabBar::RoundedWest:
never executed: case QTabBar::RoundedWest:
0
384 result.rwidth() += tbh.width();-
385 break;
never executed: break;
0
386 default:
never executed: default:
0
387 break;
never executed: break;
0
388 }-
389 }-
390#endif // QT_NO_TABBAR-
391-
392 return result;
never executed: return result;
0
393}-
394-
395QSize QDockAreaLayoutInfo::sizeHint() const-
396{-
397 if (isEmpty())
isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
398 return QSize(0, 0);
never executed: return QSize(0, 0);
0
399-
400 int a = 0, b = 0;-
401 int min_perp = 0;-
402 int max_perp = QWIDGETSIZE_MAX;-
403 const QDockAreaLayoutItem *previous = 0;-
404 for (int i = 0; i < item_list.size(); ++i) {
i < item_list.size()Description
TRUEnever evaluated
FALSEnever evaluated
0
405 const QDockAreaLayoutItem &item = item_list.at(i);-
406 if (item.skip())
item.skip()Description
TRUEnever evaluated
FALSEnever evaluated
0
407 continue;
never executed: continue;
0
408-
409 bool gap = item.flags & QDockAreaLayoutItem::GapItem;-
410-
411 QSize size_hint = item.sizeHint();-
412 min_perp = qMax(min_perp, perp(o, item.minimumSize()));-
413 max_perp = qMin(max_perp, perp(o, item.maximumSize()));-
414-
415#ifndef QT_NO_TABBAR-
416 if (tabbed) {
tabbedDescription
TRUEnever evaluated
FALSEnever evaluated
0
417 a = qMax(a, gap ? item.size : pick(o, size_hint));-
418 } else
never executed: end of block
0
419#endif-
420 {-
421 if (previous && !gap && !(previous->flags & QDockAreaLayoutItem::GapItem)
previousDescription
TRUEnever evaluated
FALSEnever evaluated
!gapDescription
TRUEnever evaluated
FALSEnever evaluated
!(previous->fl...Item::GapItem)Description
TRUEnever evaluated
FALSEnever evaluated
0
422 && !previous->hasFixedSize(o)) {
!previous->hasFixedSize(o)Description
TRUEnever evaluated
FALSEnever evaluated
0
423 a += *sep;-
424 }
never executed: end of block
0
425 a += gap ? item.size : pick(o, size_hint);
gapDescription
TRUEnever evaluated
FALSEnever evaluated
0
426 }
never executed: end of block
0
427 b = qMax(b, perp(o, size_hint));-
428-
429 previous = &item;-
430 }
never executed: end of block
0
431-
432 max_perp = qMax(max_perp, min_perp);-
433 b = qMax(b, min_perp);-
434 b = qMin(b, max_perp);-
435-
436 QSize result;-
437 rpick(o, result) = a;-
438 rperp(o, result) = b;-
439-
440#ifndef QT_NO_TABBAR-
441 if (tabbed) {
tabbedDescription
TRUEnever evaluated
FALSEnever evaluated
0
442 QSize tbh = tabBarSizeHint();-
443 switch (tabBarShape) {-
444 case QTabBar::RoundedNorth:
never executed: case QTabBar::RoundedNorth:
0
445 case QTabBar::RoundedSouth:
never executed: case QTabBar::RoundedSouth:
0
446 case QTabBar::TriangularNorth:
never executed: case QTabBar::TriangularNorth:
0
447 case QTabBar::TriangularSouth:
never executed: case QTabBar::TriangularSouth:
0
448 result.rheight() += tbh.height();-
449 result.rwidth() = qMax(tbh.width(), result.width());-
450 break;
never executed: break;
0
451 case QTabBar::RoundedEast:
never executed: case QTabBar::RoundedEast:
0
452 case QTabBar::RoundedWest:
never executed: case QTabBar::RoundedWest:
0
453 case QTabBar::TriangularEast:
never executed: case QTabBar::TriangularEast:
0
454 case QTabBar::TriangularWest:
never executed: case QTabBar::TriangularWest:
0
455 result.rheight() = qMax(tbh.height(), result.height());-
456 result.rwidth() += tbh.width();-
457 break;
never executed: break;
0
458 default:
never executed: default:
0
459 break;
never executed: break;
0
460 }-
461 }-
462#endif // QT_NO_TABBAR-
463-
464 return result;
never executed: return result;
0
465}-
466-
467bool QDockAreaLayoutInfo::expansive(Qt::Orientation o) const-
468{-
469 for (int i = 0; i < item_list.size(); ++i) {
i < item_list.size()Description
TRUEnever evaluated
FALSEnever evaluated
0
470 if (item_list.at(i).expansive(o))
item_list.at(i).expansive(o)Description
TRUEnever evaluated
FALSEnever evaluated
0
471 return true;
never executed: return true;
0
472 }
never executed: end of block
0
473 return false;
never executed: return false;
0
474}-
475-
476/* QDockAreaLayoutInfo::maximumSize() doesn't return the real max size. For example,-
477 if the layout is empty, it returns QWIDGETSIZE_MAX. This is so that empty dock areas-
478 don't constrain the size of the QMainWindow, but sometimes we really need to know the-
479 maximum size. Also, these functions take into account widgets that want to keep their-
480 size (f.ex. when they are hidden and then shown, they should not change size).-
481*/-
482-
483static int realMinSize(const QDockAreaLayoutInfo &info)-
484{-
485 int result = 0;-
486 bool first = true;-
487 for (int i = 0; i < info.item_list.size(); ++i) {
i < info.item_list.size()Description
TRUEnever evaluated
FALSEnever evaluated
0
488 const QDockAreaLayoutItem &item = info.item_list.at(i);-
489 if (item.skip())
item.skip()Description
TRUEnever evaluated
FALSEnever evaluated
0
490 continue;
never executed: continue;
0
491-
492 int min = 0;-
493 if ((item.flags & QDockAreaLayoutItem::KeepSize) && item.size != -1)
(item.flags & ...tem::KeepSize)Description
TRUEnever evaluated
FALSEnever evaluated
item.size != -1Description
TRUEnever evaluated
FALSEnever evaluated
0
494 min = item.size;
never executed: min = item.size;
0
495 else-
496 min = pick(info.o, item.minimumSize());
never executed: min = pick(info.o, item.minimumSize());
0
497-
498 if (!first)
!firstDescription
TRUEnever evaluated
FALSEnever evaluated
0
499 result += *info.sep;
never executed: result += *info.sep;
0
500 result += min;-
501-
502 first = false;-
503 }
never executed: end of block
0
504-
505 return result;
never executed: return result;
0
506}-
507-
508static int realMaxSize(const QDockAreaLayoutInfo &info)-
509{-
510 int result = 0;-
511 bool first = true;-
512 for (int i = 0; i < info.item_list.size(); ++i) {
i < info.item_list.size()Description
TRUEnever evaluated
FALSEnever evaluated
0
513 const QDockAreaLayoutItem &item = info.item_list.at(i);-
514 if (item.skip())
item.skip()Description
TRUEnever evaluated
FALSEnever evaluated
0
515 continue;
never executed: continue;
0
516-
517 int max = 0;-
518 if ((item.flags & QDockAreaLayoutItem::KeepSize) && item.size != -1)
(item.flags & ...tem::KeepSize)Description
TRUEnever evaluated
FALSEnever evaluated
item.size != -1Description
TRUEnever evaluated
FALSEnever evaluated
0
519 max = item.size;
never executed: max = item.size;
0
520 else-
521 max = pick(info.o, item.maximumSize());
never executed: max = pick(info.o, item.maximumSize());
0
522-
523 if (!first)
!firstDescription
TRUEnever evaluated
FALSEnever evaluated
0
524 result += *info.sep;
never executed: result += *info.sep;
0
525 result += max;-
526-
527 if (result >= QWIDGETSIZE_MAX)
result >= ((1<<24)-1)Description
TRUEnever evaluated
FALSEnever evaluated
0
528 return QWIDGETSIZE_MAX;
never executed: return ((1<<24)-1);
0
529-
530 first = false;-
531 }
never executed: end of block
0
532-
533 return result;
never executed: return result;
0
534}-
535-
536void QDockAreaLayoutInfo::fitItems()-
537{-
538#ifndef QT_NO_TABBAR-
539 if (tabbed) {
tabbedDescription
TRUEnever evaluated
FALSEnever evaluated
0
540 return;
never executed: return;
0
541 }-
542#endif-
543-
544 QVector<QLayoutStruct> layout_struct_list(item_list.size()*2);-
545 int j = 0;-
546-
547 int size = pick(o, rect.size());-
548 int min_size = realMinSize(*this);-
549 int max_size = realMaxSize(*this);-
550 int last_index = -1;-
551-
552 const QDockAreaLayoutItem *previous = 0;-
553 for (int i = 0; i < item_list.size(); ++i) {
i < item_list.size()Description
TRUEnever evaluated
FALSEnever evaluated
0
554 QDockAreaLayoutItem &item = item_list[i];-
555 if (item.skip())
item.skip()Description
TRUEnever evaluated
FALSEnever evaluated
0
556 continue;
never executed: continue;
0
557-
558 bool gap = item.flags & QDockAreaLayoutItem::GapItem;-
559 if (previous && !gap) {
previousDescription
TRUEnever evaluated
FALSEnever evaluated
!gapDescription
TRUEnever evaluated
FALSEnever evaluated
0
560 if (!(previous->flags & QDockAreaLayoutItem::GapItem)) {
!(previous->fl...Item::GapItem)Description
TRUEnever evaluated
FALSEnever evaluated
0
561 QLayoutStruct &ls = layout_struct_list[j++];-
562 ls.init();-
563 ls.minimumSize = ls.maximumSize = ls.sizeHint = previous->hasFixedSize(o) ? 0 : *sep;
previous->hasFixedSize(o)Description
TRUEnever evaluated
FALSEnever evaluated
0
564 ls.empty = false;-
565 }
never executed: end of block
0
566 }
never executed: end of block
0
567-
568 if (item.flags & QDockAreaLayoutItem::KeepSize) {
item.flags & Q...Item::KeepSizeDescription
TRUEnever evaluated
FALSEnever evaluated
0
569 // Check if the item can keep its size, without violating size constraints-
570 // of other items.-
571-
572 if (size < min_size) {
size < min_sizeDescription
TRUEnever evaluated
FALSEnever evaluated
0
573 // There is too little space to keep this widget's size-
574 item.flags &= ~QDockAreaLayoutItem::KeepSize;-
575 min_size -= item.size;-
576 min_size += pick(o, item.minimumSize());-
577 min_size = qMax(0, min_size);-
578 } else if (size > max_size) {
never executed: end of block
size > max_sizeDescription
TRUEnever evaluated
FALSEnever evaluated
0
579 // There is too much space to keep this widget's size-
580 item.flags &= ~QDockAreaLayoutItem::KeepSize;-
581 max_size -= item.size;-
582 max_size += pick(o, item.maximumSize());-
583 max_size = qMin<int>(QWIDGETSIZE_MAX, max_size);-
584 }
never executed: end of block
0
585 }
never executed: end of block
0
586-
587 last_index = j;-
588 QLayoutStruct &ls = layout_struct_list[j++];-
589 ls.init();-
590 ls.empty = false;-
591 if (item.flags & QDockAreaLayoutItem::KeepSize) {
item.flags & Q...Item::KeepSizeDescription
TRUEnever evaluated
FALSEnever evaluated
0
592 ls.minimumSize = ls.maximumSize = ls.sizeHint = item.size;-
593 ls.expansive = false;-
594 ls.stretch = 0;-
595 } else {
never executed: end of block
0
596 ls.maximumSize = pick(o, item.maximumSize());-
597 ls.expansive = item.expansive(o);-
598 ls.minimumSize = pick(o, item.minimumSize());-
599 ls.sizeHint = item.size == -1 ? pick(o, item.sizeHint()) : item.size;
item.size == -1Description
TRUEnever evaluated
FALSEnever evaluated
0
600 ls.stretch = ls.expansive ? ls.sizeHint : 0;
ls.expansiveDescription
TRUEnever evaluated
FALSEnever evaluated
0
601 }
never executed: end of block
0
602-
603 item.flags &= ~QDockAreaLayoutItem::KeepSize;-
604 previous = &item;-
605 }
never executed: end of block
0
606 layout_struct_list.resize(j);-
607-
608 // If there is more space than the widgets can take (due to maximum size constraints),-
609 // we detect it here and stretch the last widget to take up the rest of the space.-
610 if (size > max_size && last_index != -1) {
size > max_sizeDescription
TRUEnever evaluated
FALSEnever evaluated
last_index != -1Description
TRUEnever evaluated
FALSEnever evaluated
0
611 layout_struct_list[last_index].maximumSize = QWIDGETSIZE_MAX;-
612 layout_struct_list[last_index].expansive = true;-
613 }
never executed: end of block
0
614-
615 qGeomCalc(layout_struct_list, 0, j, pick(o, rect.topLeft()), size, 0);-
616-
617 j = 0;-
618 bool prev_gap = false;-
619 bool first = true;-
620 for (int i = 0; i < item_list.size(); ++i) {
i < item_list.size()Description
TRUEnever evaluated
FALSEnever evaluated
0
621 QDockAreaLayoutItem &item = item_list[i];-
622 if (item.skip())
item.skip()Description
TRUEnever evaluated
FALSEnever evaluated
0
623 continue;
never executed: continue;
0
624-
625 bool gap = item.flags & QDockAreaLayoutItem::GapItem;-
626 if (!first && !gap && !prev_gap)
!firstDescription
TRUEnever evaluated
FALSEnever evaluated
!gapDescription
TRUEnever evaluated
FALSEnever evaluated
!prev_gapDescription
TRUEnever evaluated
FALSEnever evaluated
0
627 ++j;
never executed: ++j;
0
628-
629 const QLayoutStruct &ls = layout_struct_list.at(j++);-
630 item.size = ls.size;-
631 item.pos = ls.pos;-
632-
633 if (item.subinfo != 0) {
item.subinfo != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
634 item.subinfo->rect = itemRect(i);-
635 item.subinfo->fitItems();-
636 }
never executed: end of block
0
637-
638 prev_gap = gap;-
639 first = false;-
640 }
never executed: end of block
0
641}
never executed: end of block
0
642-
643static QInternal::DockPosition dockPosHelper(const QRect &rect, const QPoint &_pos,-
644 Qt::Orientation o,-
645 bool nestingEnabled,-
646 QDockAreaLayoutInfo::TabMode tabMode)-
647{-
648 if (tabMode == QDockAreaLayoutInfo::ForceTabs)
tabMode == QDo...nfo::ForceTabsDescription
TRUEnever evaluated
FALSEnever evaluated
0
649 return QInternal::DockCount;
never executed: return QInternal::DockCount;
0
650-
651 QPoint pos = _pos - rect.topLeft();-
652-
653 int x = pos.x();-
654 int y = pos.y();-
655 int w = rect.width();-
656 int h = rect.height();-
657-
658 if (tabMode != QDockAreaLayoutInfo::NoTabs) {
tabMode != QDo...utInfo::NoTabsDescription
TRUEnever evaluated
FALSEnever evaluated
0
659 // is it in the center?-
660 if (nestingEnabled) {
nestingEnabledDescription
TRUEnever evaluated
FALSEnever evaluated
0
661 /* 2/3-
662 +--------------+-
663 | |-
664 | CCCCCCCC |-
665 2/3 | CCCCCCCC |-
666 | CCCCCCCC |-
667 | |-
668 +--------------+ */-
669-
670 QRect center(w/6, h/6, 2*w/3, 2*h/3);-
671 if (center.contains(pos))
center.contains(pos)Description
TRUEnever evaluated
FALSEnever evaluated
0
672 return QInternal::DockCount;
never executed: return QInternal::DockCount;
0
673 } else if (o == Qt::Horizontal) {
never executed: end of block
o == Qt::HorizontalDescription
TRUEnever evaluated
FALSEnever evaluated
0
674 /* 2/3-
675 +--------------+-
676 | CCCCCCCC |-
677 | CCCCCCCC |-
678 | CCCCCCCC |-
679 | CCCCCCCC |-
680 | CCCCCCCC |-
681 +--------------+ */-
682-
683 if (x > w/6 && x < w*5/6)
x > w/6Description
TRUEnever evaluated
FALSEnever evaluated
x < w*5/6Description
TRUEnever evaluated
FALSEnever evaluated
0
684 return QInternal::DockCount;
never executed: return QInternal::DockCount;
0
685 } else {
never executed: end of block
0
686 /*-
687 +--------------+-
688 | |-
689 2/3 |CCCCCCCCCCCCCC|-
690 |CCCCCCCCCCCCCC|-
691 | |-
692 +--------------+ */-
693 if (y > h/6 && y < 5*h/6)
y > h/6Description
TRUEnever evaluated
FALSEnever evaluated
y < 5*h/6Description
TRUEnever evaluated
FALSEnever evaluated
0
694 return QInternal::DockCount;
never executed: return QInternal::DockCount;
0
695 }
never executed: end of block
0
696 }-
697-
698 // not in the center. which edge?-
699 if (nestingEnabled) {
nestingEnabledDescription
TRUEnever evaluated
FALSEnever evaluated
0
700 if (o == Qt::Horizontal) {
o == Qt::HorizontalDescription
TRUEnever evaluated
FALSEnever evaluated
0
701 /* 1/3 1/3 1/3-
702 +------------+ (we've already ruled out the center)-
703 |LLLLTTTTRRRR|-
704 |LLLLTTTTRRRR|-
705 |LLLLBBBBRRRR|-
706 |LLLLBBBBRRRR|-
707 +------------+ */-
708-
709 if (x < w/3)
x < w/3Description
TRUEnever evaluated
FALSEnever evaluated
0
710 return QInternal::LeftDock;
never executed: return QInternal::LeftDock;
0
711 if (x > 2*w/3)
x > 2*w/3Description
TRUEnever evaluated
FALSEnever evaluated
0
712 return QInternal::RightDock;
never executed: return QInternal::RightDock;
0
713 if (y < h/2)
y < h/2Description
TRUEnever evaluated
FALSEnever evaluated
0
714 return QInternal::TopDock;
never executed: return QInternal::TopDock;
0
715 return QInternal::BottomDock;
never executed: return QInternal::BottomDock;
0
716 } else {-
717 /* +------------+ (we've already ruled out the center)-
718 1/3 |TTTTTTTTTTTT|-
719 |LLLLLLRRRRRR|-
720 1/3 |LLLLLLRRRRRR|-
721 1/3 |BBBBBBBBBBBB|-
722 +------------+ */-
723-
724 if (y < h/3)
y < h/3Description
TRUEnever evaluated
FALSEnever evaluated
0
725 return QInternal::TopDock;
never executed: return QInternal::TopDock;
0
726 if (y > 2*h/3)
y > 2*h/3Description
TRUEnever evaluated
FALSEnever evaluated
0
727 return QInternal::BottomDock;
never executed: return QInternal::BottomDock;
0
728 if (x < w/2)
x < w/2Description
TRUEnever evaluated
FALSEnever evaluated
0
729 return QInternal::LeftDock;
never executed: return QInternal::LeftDock;
0
730 return QInternal::RightDock;
never executed: return QInternal::RightDock;
0
731 }-
732 } else {-
733 if (o == Qt::Horizontal) {
o == Qt::HorizontalDescription
TRUEnever evaluated
FALSEnever evaluated
0
734 return x < w/2
never executed: return x < w/2 ? QInternal::LeftDock : QInternal::RightDock;
0
735 ? QInternal::LeftDock
never executed: return x < w/2 ? QInternal::LeftDock : QInternal::RightDock;
0
736 : QInternal::RightDock;
never executed: return x < w/2 ? QInternal::LeftDock : QInternal::RightDock;
0
737 } else {-
738 return y < h/2
never executed: return y < h/2 ? QInternal::TopDock : QInternal::BottomDock;
0
739 ? QInternal::TopDock
never executed: return y < h/2 ? QInternal::TopDock : QInternal::BottomDock;
0
740 : QInternal::BottomDock;
never executed: return y < h/2 ? QInternal::TopDock : QInternal::BottomDock;
0
741 }-
742 }-
743}-
744-
745QList<int> QDockAreaLayoutInfo::gapIndex(const QPoint& _pos,-
746 bool nestingEnabled, TabMode tabMode) const-
747{-
748 QList<int> result;-
749 QRect item_rect;-
750 int item_index = 0;-
751-
752#ifndef QT_NO_TABBAR-
753 if (tabbed) {
tabbedDescription
TRUEnever evaluated
FALSEnever evaluated
0
754 item_rect = tabContentRect();-
755 } else
never executed: end of block
0
756#endif-
757 {-
758 int pos = pick(o, _pos);-
759-
760 int last = -1;-
761 for (int i = 0; i < item_list.size(); ++i) {
i < item_list.size()Description
TRUEnever evaluated
FALSEnever evaluated
0
762 const QDockAreaLayoutItem &item = item_list.at(i);-
763 if (item.skip())
item.skip()Description
TRUEnever evaluated
FALSEnever evaluated
0
764 continue;
never executed: continue;
0
765-
766 last = i;-
767-
768 if (item.pos + item.size < pos)
item.pos + item.size < posDescription
TRUEnever evaluated
FALSEnever evaluated
0
769 continue;
never executed: continue;
0
770-
771 if (item.subinfo != 0
item.subinfo != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
772#ifndef QT_NO_TABBAR-
773 && !item.subinfo->tabbed
!item.subinfo->tabbedDescription
TRUEnever evaluated
FALSEnever evaluated
0
774#endif-
775 ) {-
776 result = item.subinfo->gapIndex(_pos, nestingEnabled,-
777 tabMode);-
778 result.prepend(i);-
779 return result;
never executed: return result;
0
780 }-
781-
782 item_rect = itemRect(i);-
783 item_index = i;-
784 break;
never executed: break;
0
785 }-
786-
787 if (item_rect.isNull()) {
item_rect.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
0
788 result.append(last + 1);-
789 return result;
never executed: return result;
0
790 }-
791 }
never executed: end of block
0
792-
793 Q_ASSERT(!item_rect.isNull());-
794-
795 QInternal::DockPosition dock_pos-
796 = dockPosHelper(item_rect, _pos, o, nestingEnabled, tabMode);-
797-
798 switch (dock_pos) {-
799 case QInternal::LeftDock:
never executed: case QInternal::LeftDock:
0
800 if (o == Qt::Horizontal)
o == Qt::HorizontalDescription
TRUEnever evaluated
FALSEnever evaluated
0
801 result << item_index;
never executed: result << item_index;
0
802 else-
803 result << item_index << 0; // this subinfo doesn't exist yet, but insertGap()
never executed: result << item_index << 0;
0
804 // handles this by inserting it-
805 break;
never executed: break;
0
806 case QInternal::RightDock:
never executed: case QInternal::RightDock:
0
807 if (o == Qt::Horizontal)
o == Qt::HorizontalDescription
TRUEnever evaluated
FALSEnever evaluated
0
808 result << item_index + 1;
never executed: result << item_index + 1;
0
809 else-
810 result << item_index << 1;
never executed: result << item_index << 1;
0
811 break;
never executed: break;
0
812 case QInternal::TopDock:
never executed: case QInternal::TopDock:
0
813 if (o == Qt::Horizontal)
o == Qt::HorizontalDescription
TRUEnever evaluated
FALSEnever evaluated
0
814 result << item_index << 0;
never executed: result << item_index << 0;
0
815 else-
816 result << item_index;
never executed: result << item_index;
0
817 break;
never executed: break;
0
818 case QInternal::BottomDock:
never executed: case QInternal::BottomDock:
0
819 if (o == Qt::Horizontal)
o == Qt::HorizontalDescription
TRUEnever evaluated
FALSEnever evaluated
0
820 result << item_index << 1;
never executed: result << item_index << 1;
0
821 else-
822 result << item_index + 1;
never executed: result << item_index + 1;
0
823 break;
never executed: break;
0
824 case QInternal::DockCount:
never executed: case QInternal::DockCount:
0
825 result << (-item_index - 1) << 0; // negative item_index means "on top of"-
826 // -item_index - 1, insertGap()-
827 // will insert a tabbed subinfo-
828 break;
never executed: break;
0
829 default:
never executed: default:
0
830 break;
never executed: break;
0
831 }-
832-
833 return result;
never executed: return result;
0
834}-
835-
836static inline int shrink(QLayoutStruct &ls, int delta)-
837{-
838 if (ls.empty)
ls.emptyDescription
TRUEnever evaluated
FALSEnever evaluated
0
839 return 0;
never executed: return 0;
0
840 int old_size = ls.size;-
841 ls.size = qMax(ls.size - delta, ls.minimumSize);-
842 return old_size - ls.size;
never executed: return old_size - ls.size;
0
843}-
844-
845static inline int grow(QLayoutStruct &ls, int delta)-
846{-
847 if (ls.empty)
ls.emptyDescription
TRUEnever evaluated
FALSEnever evaluated
0
848 return 0;
never executed: return 0;
0
849 int old_size = ls.size;-
850 ls.size = qMin(ls.size + delta, ls.maximumSize);-
851 return ls.size - old_size;
never executed: return ls.size - old_size;
0
852}-
853-
854static int separatorMoveHelper(QVector<QLayoutStruct> &list, int index, int delta, int sep)-
855{-
856 // adjust sizes-
857 int pos = -1;-
858 for (int i = 0; i < list.size(); ++i) {
i < list.size()Description
TRUEnever evaluated
FALSEnever evaluated
0
859 const QLayoutStruct &ls = list.at(i);-
860 if (!ls.empty) {
!ls.emptyDescription
TRUEnever evaluated
FALSEnever evaluated
0
861 pos = ls.pos;-
862 break;
never executed: break;
0
863 }-
864 }
never executed: end of block
0
865 if (pos == -1)
pos == -1Description
TRUEnever evaluated
FALSEnever evaluated
0
866 return 0;
never executed: return 0;
0
867-
868 if (delta > 0) {
delta > 0Description
TRUEnever evaluated
FALSEnever evaluated
0
869 int growlimit = 0;-
870 for (int i = 0; i<=index; ++i) {
i<=indexDescription
TRUEnever evaluated
FALSEnever evaluated
0
871 const QLayoutStruct &ls = list.at(i);-
872 if (ls.empty)
ls.emptyDescription
TRUEnever evaluated
FALSEnever evaluated
0
873 continue;
never executed: continue;
0
874 if (ls.maximumSize == QLAYOUTSIZE_MAX) {
ls.maximumSize...LAYOUTSIZE_MAXDescription
TRUEnever evaluated
FALSEnever evaluated
0
875 growlimit = QLAYOUTSIZE_MAX;-
876 break;
never executed: break;
0
877 }-
878 growlimit += ls.maximumSize - ls.size;-
879 }
never executed: end of block
0
880 if (delta > growlimit)
delta > growlimitDescription
TRUEnever evaluated
FALSEnever evaluated
0
881 delta = growlimit;
never executed: delta = growlimit;
0
882-
883 int d = 0;-
884 for (int i = index + 1; d < delta && i < list.count(); ++i)
d < deltaDescription
TRUEnever evaluated
FALSEnever evaluated
i < list.count()Description
TRUEnever evaluated
FALSEnever evaluated
0
885 d += shrink(list[i], delta - d);
never executed: d += shrink(list[i], delta - d);
0
886 delta = d;-
887 d = 0;-
888 for (int i = index; d < delta && i >= 0; --i)
d < deltaDescription
TRUEnever evaluated
FALSEnever evaluated
i >= 0Description
TRUEnever evaluated
FALSEnever evaluated
0
889 d += grow(list[i], delta - d);
never executed: d += grow(list[i], delta - d);
0
890 } else if (delta < 0) {
never executed: end of block
delta < 0Description
TRUEnever evaluated
FALSEnever evaluated
0
891 int growlimit = 0;-
892 for (int i = index + 1; i < list.count(); ++i) {
i < list.count()Description
TRUEnever evaluated
FALSEnever evaluated
0
893 const QLayoutStruct &ls = list.at(i);-
894 if (ls.empty)
ls.emptyDescription
TRUEnever evaluated
FALSEnever evaluated
0
895 continue;
never executed: continue;
0
896 if (ls.maximumSize == QLAYOUTSIZE_MAX) {
ls.maximumSize...LAYOUTSIZE_MAXDescription
TRUEnever evaluated
FALSEnever evaluated
0
897 growlimit = QLAYOUTSIZE_MAX;-
898 break;
never executed: break;
0
899 }-
900 growlimit += ls.maximumSize - ls.size;-
901 }
never executed: end of block
0
902 if (-delta > growlimit)
-delta > growlimitDescription
TRUEnever evaluated
FALSEnever evaluated
0
903 delta = -growlimit;
never executed: delta = -growlimit;
0
904-
905 int d = 0;-
906 for (int i = index; d < -delta && i >= 0; --i)
d < -deltaDescription
TRUEnever evaluated
FALSEnever evaluated
i >= 0Description
TRUEnever evaluated
FALSEnever evaluated
0
907 d += shrink(list[i], -delta - d);
never executed: d += shrink(list[i], -delta - d);
0
908 delta = -d;-
909 d = 0;-
910 for (int i = index + 1; d < -delta && i < list.count(); ++i)
d < -deltaDescription
TRUEnever evaluated
FALSEnever evaluated
i < list.count()Description
TRUEnever evaluated
FALSEnever evaluated
0
911 d += grow(list[i], -delta - d);
never executed: d += grow(list[i], -delta - d);
0
912 }
never executed: end of block
0
913-
914 // adjust positions-
915 bool first = true;-
916 for (int i = 0; i < list.size(); ++i) {
i < list.size()Description
TRUEnever evaluated
FALSEnever evaluated
0
917 QLayoutStruct &ls = list[i];-
918 if (ls.empty) {
ls.emptyDescription
TRUEnever evaluated
FALSEnever evaluated
0
919 ls.pos = pos + (first ? 0 : sep);
firstDescription
TRUEnever evaluated
FALSEnever evaluated
0
920 continue;
never executed: continue;
0
921 }-
922 if (!first)
!firstDescription
TRUEnever evaluated
FALSEnever evaluated
0
923 pos += sep;
never executed: pos += sep;
0
924 ls.pos = pos;-
925 pos += ls.size;-
926 first = false;-
927 }
never executed: end of block
0
928-
929 return delta;
never executed: return delta;
0
930}-
931-
932int QDockAreaLayoutInfo::separatorMove(int index, int delta)-
933{-
934#ifndef QT_NO_TABBAR-
935 Q_ASSERT(!tabbed);-
936#endif-
937-
938 QVector<QLayoutStruct> list(item_list.size());-
939 for (int i = 0; i < list.size(); ++i) {
i < list.size()Description
TRUEnever evaluated
FALSEnever evaluated
0
940 const QDockAreaLayoutItem &item = item_list.at(i);-
941 QLayoutStruct &ls = list[i];-
942 Q_ASSERT(!(item.flags & QDockAreaLayoutItem::GapItem));-
943 if (item.skip()) {
item.skip()Description
TRUEnever evaluated
FALSEnever evaluated
0
944 ls.empty = true;-
945 } else {
never executed: end of block
0
946 const int separatorSpace = item.hasFixedSize(o) ? 0 : *sep;
item.hasFixedSize(o)Description
TRUEnever evaluated
FALSEnever evaluated
0
947 ls.empty = false;-
948 ls.pos = item.pos;-
949 ls.size = item.size + separatorSpace;-
950 ls.minimumSize = pick(o, item.minimumSize()) + separatorSpace;-
951 ls.maximumSize = pick(o, item.maximumSize()) + separatorSpace;-
952-
953 }
never executed: end of block
0
954 }-
955-
956 //the separator space has been added to the size, so we pass 0 as a parameter-
957 delta = separatorMoveHelper(list, index, delta, 0 /*separator*/);-
958-
959 for (int i = 0; i < list.size(); ++i) {
i < list.size()Description
TRUEnever evaluated
FALSEnever evaluated
0
960 QDockAreaLayoutItem &item = item_list[i];-
961 if (item.skip())
item.skip()Description
TRUEnever evaluated
FALSEnever evaluated
0
962 continue;
never executed: continue;
0
963 QLayoutStruct &ls = list[i];-
964 const int separatorSpace = item.hasFixedSize(o) ? 0 : *sep;
item.hasFixedSize(o)Description
TRUEnever evaluated
FALSEnever evaluated
0
965 item.size = ls.size - separatorSpace;-
966 item.pos = ls.pos;-
967 if (item.subinfo != 0) {
item.subinfo != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
968 item.subinfo->rect = itemRect(i);-
969 item.subinfo->fitItems();-
970 }
never executed: end of block
0
971 }
never executed: end of block
0
972-
973 return delta;
never executed: return delta;
0
974}-
975-
976void QDockAreaLayoutInfo::unnest(int index)-
977{-
978 QDockAreaLayoutItem &item = item_list[index];-
979 if (item.subinfo == 0)
item.subinfo == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
980 return;
never executed: return;
0
981 if (item.subinfo->item_list.count() > 1)
item.subinfo->...st.count() > 1Description
TRUEnever evaluated
FALSEnever evaluated
0
982 return;
never executed: return;
0
983-
984 if (item.subinfo->item_list.count() == 0) {
item.subinfo->...t.count() == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
985 item_list.removeAt(index);-
986 } else if (item.subinfo->item_list.count() == 1) {
never executed: end of block
item.subinfo->...t.count() == 1Description
TRUEnever evaluated
FALSEnever evaluated
0
987 QDockAreaLayoutItem &child = item.subinfo->item_list.first();-
988 if (child.widgetItem != 0) {
child.widgetItem != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
989 item.widgetItem = child.widgetItem;-
990 delete item.subinfo;-
991 item.subinfo = 0;-
992 } else if (child.subinfo != 0) {
never executed: end of block
child.subinfo != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
993 QDockAreaLayoutInfo *tmp = item.subinfo;-
994 item.subinfo = child.subinfo;-
995 child.subinfo = 0;-
996 tmp->item_list.clear();-
997 delete tmp;-
998 }
never executed: end of block
0
999 }
never executed: end of block
0
1000}
never executed: end of block
0
1001-
1002void QDockAreaLayoutInfo::remove(const QList<int> &path)-
1003{-
1004 Q_ASSERT(!path.isEmpty());-
1005-
1006 if (path.count() > 1) {
path.count() > 1Description
TRUEnever evaluated
FALSEnever evaluated
0
1007 const int index = path.first();-
1008 QDockAreaLayoutItem &item = item_list[index];-
1009 Q_ASSERT(item.subinfo != 0);-
1010 item.subinfo->remove(path.mid(1));-
1011 unnest(index);-
1012 } else {
never executed: end of block
0
1013 int index = path.first();-
1014 item_list.removeAt(index);-
1015 }
never executed: end of block
0
1016}-
1017-
1018QLayoutItem *QDockAreaLayoutInfo::plug(const QList<int> &path)-
1019{-
1020 Q_ASSERT(!path.isEmpty());-
1021-
1022 int index = path.first();-
1023 if (index < 0)
index < 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1024 index = -index - 1;
never executed: index = -index - 1;
0
1025-
1026 if (path.count() > 1) {
path.count() > 1Description
TRUEnever evaluated
FALSEnever evaluated
0
1027 QDockAreaLayoutItem &item = item_list[index];-
1028 Q_ASSERT(item.subinfo != 0);-
1029 return item.subinfo->plug(path.mid(1));
never executed: return item.subinfo->plug(path.mid(1));
0
1030 }-
1031-
1032 QDockAreaLayoutItem &item = item_list[index];-
1033-
1034 Q_ASSERT(item.widgetItem != 0);-
1035 Q_ASSERT(item.flags & QDockAreaLayoutItem::GapItem);-
1036 item.flags &= ~QDockAreaLayoutItem::GapItem;-
1037-
1038 QRect result;-
1039-
1040#ifndef QT_NO_TABBAR-
1041 if (tabbed) {
tabbedDescription
TRUEnever evaluated
FALSEnever evaluated
0
1042 } else
never executed: end of block
0
1043#endif-
1044 {-
1045 int prev = this->prev(index);-
1046 int next = this->next(index);-
1047-
1048 if (prev != -1 && !(item_list.at(prev).flags & QDockAreaLayoutItem::GapItem)) {
prev != -1Description
TRUEnever evaluated
FALSEnever evaluated
!(item_list.at...Item::GapItem)Description
TRUEnever evaluated
FALSEnever evaluated
0
1049 item.pos += *sep;-
1050 item.size -= *sep;-
1051 }
never executed: end of block
0
1052 if (next != -1 && !(item_list.at(next).flags & QDockAreaLayoutItem::GapItem))
next != -1Description
TRUEnever evaluated
FALSEnever evaluated
!(item_list.at...Item::GapItem)Description
TRUEnever evaluated
FALSEnever evaluated
0
1053 item.size -= *sep;
never executed: item.size -= *sep;
0
1054-
1055 QPoint pos;-
1056 rpick(o, pos) = item.pos;-
1057 rperp(o, pos) = perp(o, rect.topLeft());-
1058 QSize s;-
1059 rpick(o, s) = item.size;-
1060 rperp(o, s) = perp(o, rect.size());-
1061 result = QRect(pos, s);-
1062 }
never executed: end of block
0
1063-
1064 return item.widgetItem;
never executed: return item.widgetItem;
0
1065}-
1066-
1067QLayoutItem *QDockAreaLayoutInfo::unplug(const QList<int> &path)-
1068{-
1069 Q_ASSERT(!path.isEmpty());-
1070-
1071 const int index = path.first();-
1072 if (path.count() > 1) {
path.count() > 1Description
TRUEnever evaluated
FALSEnever evaluated
0
1073 QDockAreaLayoutItem &item = item_list[index];-
1074 Q_ASSERT(item.subinfo != 0);-
1075 return item.subinfo->unplug(path.mid(1));
never executed: return item.subinfo->unplug(path.mid(1));
0
1076 }-
1077-
1078 QDockAreaLayoutItem &item = item_list[index];-
1079 int prev = this->prev(index);-
1080 int next = this->next(index);-
1081-
1082 Q_ASSERT(!(item.flags & QDockAreaLayoutItem::GapItem));-
1083 item.flags |= QDockAreaLayoutItem::GapItem;-
1084-
1085#ifndef QT_NO_TABBAR-
1086 if (tabbed) {
tabbedDescription
TRUEnever evaluated
FALSEnever evaluated
0
1087 } else
never executed: end of block
0
1088#endif-
1089 {-
1090 if (prev != -1 && !(item_list.at(prev).flags & QDockAreaLayoutItem::GapItem)) {
prev != -1Description
TRUEnever evaluated
FALSEnever evaluated
!(item_list.at...Item::GapItem)Description
TRUEnever evaluated
FALSEnever evaluated
0
1091 item.pos -= *sep;-
1092 item.size += *sep;-
1093 }
never executed: end of block
0
1094 if (next != -1 && !(item_list.at(next).flags & QDockAreaLayoutItem::GapItem))
next != -1Description
TRUEnever evaluated
FALSEnever evaluated
!(item_list.at...Item::GapItem)Description
TRUEnever evaluated
FALSEnever evaluated
0
1095 item.size += *sep;
never executed: item.size += *sep;
0
1096 }
never executed: end of block
0
1097-
1098 return item.widgetItem;
never executed: return item.widgetItem;
0
1099}-
1100-
1101#ifndef QT_NO_TABBAR-
1102-
1103quintptr QDockAreaLayoutInfo::currentTabId() const-
1104{-
1105 if (!tabbed || tabBar == 0)
!tabbedDescription
TRUEnever evaluated
FALSEnever evaluated
tabBar == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1106 return 0;
never executed: return 0;
0
1107-
1108 int index = tabBar->currentIndex();-
1109 if (index == -1)
index == -1Description
TRUEnever evaluated
FALSEnever evaluated
0
1110 return 0;
never executed: return 0;
0
1111-
1112 return qvariant_cast<quintptr>(tabBar->tabData(index));
never executed: return qvariant_cast<quintptr>(tabBar->tabData(index));
0
1113}-
1114-
1115void QDockAreaLayoutInfo::setCurrentTab(QWidget *widget)-
1116{-
1117 setCurrentTabId(reinterpret_cast<quintptr>(widget));-
1118}
never executed: end of block
0
1119-
1120void QDockAreaLayoutInfo::setCurrentTabId(quintptr id)-
1121{-
1122 if (!tabbed || tabBar == 0)
!tabbedDescription
TRUEnever evaluated
FALSEnever evaluated
tabBar == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1123 return;
never executed: return;
0
1124-
1125 for (int i = 0; i < tabBar->count(); ++i) {
i < tabBar->count()Description
TRUEnever evaluated
FALSEnever evaluated
0
1126 if (qvariant_cast<quintptr>(tabBar->tabData(i)) == id) {
qvariant_cast<...Data(i)) == idDescription
TRUEnever evaluated
FALSEnever evaluated
0
1127 tabBar->setCurrentIndex(i);-
1128 return;
never executed: return;
0
1129 }-
1130 }
never executed: end of block
0
1131}
never executed: end of block
0
1132-
1133#endif // QT_NO_TABBAR-
1134-
1135static QRect dockedGeometry(QWidget *widget)-
1136{-
1137 int titleHeight = 0;-
1138-
1139 QDockWidgetLayout *layout-
1140 = qobject_cast<QDockWidgetLayout*>(widget->layout());-
1141 if(layout != 0 && layout->nativeWindowDeco())
layout != 0Description
TRUEnever evaluated
FALSEnever evaluated
layout->nativeWindowDeco()Description
TRUEnever evaluated
FALSEnever evaluated
0
1142 titleHeight = layout->titleHeight();
never executed: titleHeight = layout->titleHeight();
0
1143-
1144 QRect result = widget->geometry();-
1145 result.adjust(0, -titleHeight, 0, 0);-
1146 return result;
never executed: return result;
0
1147}-
1148-
1149bool QDockAreaLayoutInfo::insertGap(const QList<int> &path, QLayoutItem *dockWidgetItem)-
1150{-
1151 Q_ASSERT(!path.isEmpty());-
1152-
1153 bool insert_tabbed = false;-
1154 int index = path.first();-
1155 if (index < 0) {
index < 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1156 insert_tabbed = true;-
1157 index = -index - 1;-
1158 }
never executed: end of block
0
1159-
1160// dump(qDebug() << "insertGap() before:" << index << tabIndex, *this, QString());-
1161-
1162 if (path.count() > 1) {
path.count() > 1Description
TRUEnever evaluated
FALSEnever evaluated
0
1163 QDockAreaLayoutItem &item = item_list[index];-
1164-
1165 if (item.subinfo == 0
item.subinfo == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1166#ifndef QT_NO_TABBAR-
1167 || (item.subinfo->tabbed && !insert_tabbed)
item.subinfo->tabbedDescription
TRUEnever evaluated
FALSEnever evaluated
!insert_tabbedDescription
TRUEnever evaluated
FALSEnever evaluated
0
1168#endif-
1169 ) {-
1170-
1171 // this is not yet a nested layout - make it-
1172-
1173 QDockAreaLayoutInfo *subinfo = item.subinfo;-
1174 QLayoutItem *widgetItem = item.widgetItem;-
1175 QPlaceHolderItem *placeHolderItem = item.placeHolderItem;-
1176 QRect r = subinfo == 0 ? widgetItem ? dockedGeometry(widgetItem->widget()) : placeHolderItem->topLevelRect : subinfo->rect;
subinfo == 0Description
TRUEnever evaluated
FALSEnever evaluated
widgetItemDescription
TRUEnever evaluated
FALSEnever evaluated
0
1177-
1178 Qt::Orientation opposite = o == Qt::Horizontal ? Qt::Vertical : Qt::Horizontal;
o == Qt::HorizontalDescription
TRUEnever evaluated
FALSEnever evaluated
0
1179#ifdef QT_NO_TABBAR-
1180 const int tabBarShape = 0;-
1181#endif-
1182 QDockAreaLayoutInfo *new_info-
1183 = new QDockAreaLayoutInfo(sep, dockPos, opposite, tabBarShape, mainWindow);-
1184-
1185 //item become a new top-level-
1186 item.subinfo = new_info;-
1187 item.widgetItem = 0;-
1188 item.placeHolderItem = 0;-
1189-
1190 QDockAreaLayoutItem new_item-
1191 = widgetItem == 0
widgetItem == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1192 ? QDockAreaLayoutItem(subinfo)-
1193 : widgetItem ? QDockAreaLayoutItem(widgetItem) : QDockAreaLayoutItem(placeHolderItem);
widgetItemDescription
TRUEnever evaluated
FALSEnever evaluated
0
1194 new_item.size = pick(opposite, r.size());-
1195 new_item.pos = pick(opposite, r.topLeft());-
1196 new_info->item_list.append(new_item);-
1197#ifndef QT_NO_TABBAR-
1198 if (insert_tabbed) {
insert_tabbedDescription
TRUEnever evaluated
FALSEnever evaluated
0
1199 new_info->tabbed = true;-
1200 }
never executed: end of block
0
1201#endif-
1202 }
never executed: end of block
0
1203-
1204 return item.subinfo->insertGap(path.mid(1), dockWidgetItem);
never executed: return item.subinfo->insertGap(path.mid(1), dockWidgetItem);
0
1205 }-
1206-
1207 // create the gap item-
1208 QDockAreaLayoutItem gap_item;-
1209 gap_item.flags |= QDockAreaLayoutItem::GapItem;-
1210 gap_item.widgetItem = dockWidgetItem; // so minimumSize(), maximumSize() and-
1211 // sizeHint() will work-
1212#ifndef QT_NO_TABBAR-
1213 if (!tabbed)
!tabbedDescription
TRUEnever evaluated
FALSEnever evaluated
0
1214#endif-
1215 {-
1216 int prev = this->prev(index);-
1217 int next = this->next(index - 1);-
1218 // find out how much space we have in the layout-
1219 int space = 0;-
1220 if (isEmpty()) {
isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
1221 // I am an empty dock area, therefore I am a top-level dock area.-
1222 switch (dockPos) {-
1223 case QInternal::LeftDock:
never executed: case QInternal::LeftDock:
0
1224 case QInternal::RightDock:
never executed: case QInternal::RightDock:
0
1225 if (o == Qt::Vertical) {
o == Qt::VerticalDescription
TRUEnever evaluated
FALSEnever evaluated
0
1226 // the "size" is the height of the dock area (remember we are empty)-
1227 space = pick(Qt::Vertical, rect.size());-
1228 } else {
never executed: end of block
0
1229 space = pick(Qt::Horizontal, dockWidgetItem->widget()->size());-
1230 }
never executed: end of block
0
1231 break;
never executed: break;
0
1232 case QInternal::TopDock:
never executed: case QInternal::TopDock:
0
1233 case QInternal::BottomDock:
never executed: case QInternal::BottomDock:
0
1234 default:
never executed: default:
0
1235 if (o == Qt::Horizontal) {
o == Qt::HorizontalDescription
TRUEnever evaluated
FALSEnever evaluated
0
1236 // the "size" is width of the dock area-
1237 space = pick(Qt::Horizontal, rect.size());-
1238 } else {
never executed: end of block
0
1239 space = pick(Qt::Vertical, dockWidgetItem->widget()->size());-
1240 }
never executed: end of block
0
1241 break;
never executed: break;
0
1242 }-
1243 } else {-
1244 for (int i = 0; i < item_list.count(); ++i) {
i < item_list.count()Description
TRUEnever evaluated
FALSEnever evaluated
0
1245 const QDockAreaLayoutItem &item = item_list.at(i);-
1246 if (item.skip())
item.skip()Description
TRUEnever evaluated
FALSEnever evaluated
0
1247 continue;
never executed: continue;
0
1248 Q_ASSERT(!(item.flags & QDockAreaLayoutItem::GapItem));-
1249 space += item.size - pick(o, item.minimumSize());-
1250 }
never executed: end of block
0
1251 }
never executed: end of block
0
1252-
1253 // find the actual size of the gap-
1254 int gap_size = 0;-
1255 int sep_size = 0;-
1256 if (isEmpty()) {
isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
1257 gap_size = space;-
1258 sep_size = 0;-
1259 } else {
never executed: end of block
0
1260 QRect r = dockedGeometry(dockWidgetItem->widget());-
1261 gap_size = pick(o, r.size());-
1262 if (prev != -1 && !(item_list.at(prev).flags & QDockAreaLayoutItem::GapItem))
prev != -1Description
TRUEnever evaluated
FALSEnever evaluated
!(item_list.at...Item::GapItem)Description
TRUEnever evaluated
FALSEnever evaluated
0
1263 sep_size += *sep;
never executed: sep_size += *sep;
0
1264 if (next != -1 && !(item_list.at(next).flags & QDockAreaLayoutItem::GapItem))
next != -1Description
TRUEnever evaluated
FALSEnever evaluated
!(item_list.at...Item::GapItem)Description
TRUEnever evaluated
FALSEnever evaluated
0
1265 sep_size += *sep;
never executed: sep_size += *sep;
0
1266 }
never executed: end of block
0
1267 if (gap_size + sep_size > space)
gap_size + sep_size > spaceDescription
TRUEnever evaluated
FALSEnever evaluated
0
1268 gap_size = pick(o, gap_item.minimumSize());
never executed: gap_size = pick(o, gap_item.minimumSize());
0
1269 gap_item.size = gap_size + sep_size;-
1270 }
never executed: end of block
0
1271-
1272 // finally, insert the gap-
1273 item_list.insert(index, gap_item);-
1274-
1275// dump(qDebug() << "insertGap() after:" << index << tabIndex, *this, QString());-
1276-
1277 return true;
never executed: return true;
0
1278}-
1279-
1280QDockAreaLayoutInfo *QDockAreaLayoutInfo::info(QWidget *widget)-
1281{-
1282 for (int i = 0; i < item_list.count(); ++i) {
i < item_list.count()Description
TRUEnever evaluated
FALSEnever evaluated
0
1283 const QDockAreaLayoutItem &item = item_list.at(i);-
1284 if (item.skip())
item.skip()Description
TRUEnever evaluated
FALSEnever evaluated
0
1285 continue;
never executed: continue;
0
1286-
1287#ifndef QT_NO_TABBAR-
1288 if (tabbed && widget == tabBar)
tabbedDescription
TRUEnever evaluated
FALSEnever evaluated
widget == tabBarDescription
TRUEnever evaluated
FALSEnever evaluated
0
1289 return this;
never executed: return this;
0
1290#endif-
1291-
1292 if (item.widgetItem != 0 && item.widgetItem->widget() == widget)
item.widgetItem != 0Description
TRUEnever evaluated
FALSEnever evaluated
item.widgetIte...et() == widgetDescription
TRUEnever evaluated
FALSEnever evaluated
0
1293 return this;
never executed: return this;
0
1294-
1295 if (item.subinfo != 0) {
item.subinfo != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1296 if (QDockAreaLayoutInfo *result = item.subinfo->info(widget))
QDockAreaLayou...->info(widget)Description
TRUEnever evaluated
FALSEnever evaluated
0
1297 return result;
never executed: return result;
0
1298 }
never executed: end of block
0
1299 }
never executed: end of block
0
1300-
1301 return 0;
never executed: return 0;
0
1302}-
1303-
1304QDockAreaLayoutInfo *QDockAreaLayoutInfo::info(const QList<int> &path)-
1305{-
1306 int index = path.first();-
1307 if (index < 0)
index < 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1308 index = -index - 1;
never executed: index = -index - 1;
0
1309 if (index >= item_list.count())
index >= item_list.count()Description
TRUEnever evaluated
FALSEnever evaluated
0
1310 return this;
never executed: return this;
0
1311 if (path.count() == 1 || item_list[index].subinfo == 0)
path.count() == 1Description
TRUEnever evaluated
FALSEnever evaluated
item_list[index].subinfo == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1312 return this;
never executed: return this;
0
1313 return item_list[index].subinfo->info(path.mid(1));
never executed: return item_list[index].subinfo->info(path.mid(1));
0
1314}-
1315-
1316QRect QDockAreaLayoutInfo::itemRect(int index) const-
1317{-
1318 const QDockAreaLayoutItem &item = item_list.at(index);-
1319-
1320 if (item.skip())
item.skip()Description
TRUEnever evaluated
FALSEnever evaluated
0
1321 return QRect();
never executed: return QRect();
0
1322-
1323 QRect result;-
1324-
1325#ifndef QT_NO_TABBAR-
1326 if (tabbed) {
tabbedDescription
TRUEnever evaluated
FALSEnever evaluated
0
1327 if (tabId(item) == currentTabId())
tabId(item) == currentTabId()Description
TRUEnever evaluated
FALSEnever evaluated
0
1328 result = tabContentRect();
never executed: result = tabContentRect();
0
1329 } else
never executed: end of block
0
1330#endif-
1331 {-
1332 QPoint pos;-
1333 rpick(o, pos) = item.pos;-
1334 rperp(o, pos) = perp(o, rect.topLeft());-
1335 QSize s;-
1336 rpick(o, s) = item.size;-
1337 rperp(o, s) = perp(o, rect.size());-
1338 result = QRect(pos, s);-
1339 }
never executed: end of block
0
1340-
1341 return result;
never executed: return result;
0
1342}-
1343-
1344QRect QDockAreaLayoutInfo::itemRect(const QList<int> &path) const-
1345{-
1346 Q_ASSERT(!path.isEmpty());-
1347-
1348 const int index = path.first();-
1349 if (path.count() > 1) {
path.count() > 1Description
TRUEnever evaluated
FALSEnever evaluated
0
1350 const QDockAreaLayoutItem &item = item_list.at(index);-
1351 Q_ASSERT(item.subinfo != 0);-
1352 return item.subinfo->itemRect(path.mid(1));
never executed: return item.subinfo->itemRect(path.mid(1));
0
1353 }-
1354-
1355 return itemRect(index);
never executed: return itemRect(index);
0
1356}-
1357-
1358QRect QDockAreaLayoutInfo::separatorRect(int index) const-
1359{-
1360#ifndef QT_NO_TABBAR-
1361 if (tabbed)
tabbedDescription
TRUEnever evaluated
FALSEnever evaluated
0
1362 return QRect();
never executed: return QRect();
0
1363#endif-
1364-
1365 const QDockAreaLayoutItem &item = item_list.at(index);-
1366 if (item.skip())
item.skip()Description
TRUEnever evaluated
FALSEnever evaluated
0
1367 return QRect();
never executed: return QRect();
0
1368-
1369 QPoint pos = rect.topLeft();-
1370 rpick(o, pos) = item.pos + item.size;-
1371 QSize s = rect.size();-
1372 rpick(o, s) = *sep;-
1373-
1374 return QRect(pos, s);
never executed: return QRect(pos, s);
0
1375}-
1376-
1377QRect QDockAreaLayoutInfo::separatorRect(const QList<int> &path) const-
1378{-
1379 Q_ASSERT(!path.isEmpty());-
1380-
1381 const int index = path.first();-
1382 if (path.count() > 1) {
path.count() > 1Description
TRUEnever evaluated
FALSEnever evaluated
0
1383 const QDockAreaLayoutItem &item = item_list.at(index);-
1384 Q_ASSERT(item.subinfo != 0);-
1385 return item.subinfo->separatorRect(path.mid(1));
never executed: return item.subinfo->separatorRect(path.mid(1));
0
1386 }-
1387 return separatorRect(index);
never executed: return separatorRect(index);
0
1388}-
1389-
1390QList<int> QDockAreaLayoutInfo::findSeparator(const QPoint &_pos) const-
1391{-
1392#ifndef QT_NO_TABBAR-
1393 if (tabbed)
tabbedDescription
TRUEnever evaluated
FALSEnever evaluated
0
1394 return QList<int>();
never executed: return QList<int>();
0
1395#endif-
1396-
1397 int pos = pick(o, _pos);-
1398-
1399 for (int i = 0; i < item_list.size(); ++i) {
i < item_list.size()Description
TRUEnever evaluated
FALSEnever evaluated
0
1400 const QDockAreaLayoutItem &item = item_list.at(i);-
1401 if (item.skip() || (item.flags & QDockAreaLayoutItem::GapItem))
item.skip()Description
TRUEnever evaluated
FALSEnever evaluated
(item.flags & ...Item::GapItem)Description
TRUEnever evaluated
FALSEnever evaluated
0
1402 continue;
never executed: continue;
0
1403-
1404 if (item.pos + item.size > pos) {
item.pos + item.size > posDescription
TRUEnever evaluated
FALSEnever evaluated
0
1405 if (item.subinfo != 0) {
item.subinfo != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1406 QList<int> result = item.subinfo->findSeparator(_pos);-
1407 if (!result.isEmpty()) {
!result.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
1408 result.prepend(i);-
1409 return result;
never executed: return result;
0
1410 } else {-
1411 return QList<int>();
never executed: return QList<int>();
0
1412 }-
1413 }-
1414 }
never executed: end of block
0
1415-
1416 int next = this->next(i);-
1417 if (next == -1 || (item_list.at(next).flags & QDockAreaLayoutItem::GapItem))
next == -1Description
TRUEnever evaluated
FALSEnever evaluated
(item_list.at(...Item::GapItem)Description
TRUEnever evaluated
FALSEnever evaluated
0
1418 continue;
never executed: continue;
0
1419-
1420 QRect sepRect = separatorRect(i);-
1421 if (!sepRect.isNull() && *sep == 1)
!sepRect.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
*sep == 1Description
TRUEnever evaluated
FALSEnever evaluated
0
1422 sepRect.adjust(-2, -2, 2, 2);
never executed: sepRect.adjust(-2, -2, 2, 2);
0
1423 //we also make sure we don't find a separator that's not there-
1424 if (sepRect.contains(_pos) && !item.hasFixedSize(o)) {
sepRect.contains(_pos)Description
TRUEnever evaluated
FALSEnever evaluated
!item.hasFixedSize(o)Description
TRUEnever evaluated
FALSEnever evaluated
0
1425 return QList<int>() << i;
never executed: return QList<int>() << i;
0
1426 }-
1427-
1428 }
never executed: end of block
0
1429-
1430 return QList<int>();
never executed: return QList<int>();
0
1431}-
1432-
1433QList<int> QDockAreaLayoutInfo::indexOfPlaceHolder(const QString &objectName) const-
1434{-
1435 for (int i = 0; i < item_list.size(); ++i) {
i < item_list.size()Description
TRUEnever evaluated
FALSEnever evaluated
0
1436 const QDockAreaLayoutItem &item = item_list.at(i);-
1437-
1438 if (item.subinfo != 0) {
item.subinfo != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1439 QList<int> result = item.subinfo->indexOfPlaceHolder(objectName);-
1440 if (!result.isEmpty()) {
!result.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
1441 result.prepend(i);-
1442 return result;
never executed: return result;
0
1443 }-
1444 continue;
never executed: continue;
0
1445 }-
1446-
1447 if (item.placeHolderItem != 0 && item.placeHolderItem->objectName == objectName) {
item.placeHolderItem != 0Description
TRUEnever evaluated
FALSEnever evaluated
item.placeHold... == objectNameDescription
TRUEnever evaluated
FALSEnever evaluated
0
1448 QList<int> result;-
1449 result << i;-
1450 return result;
never executed: return result;
0
1451 }-
1452 }
never executed: end of block
0
1453-
1454 return QList<int>();
never executed: return QList<int>();
0
1455}-
1456-
1457QList<int> QDockAreaLayoutInfo::indexOf(QWidget *widget) const-
1458{-
1459 for (int i = 0; i < item_list.size(); ++i) {
i < item_list.size()Description
TRUEnever evaluated
FALSEnever evaluated
0
1460 const QDockAreaLayoutItem &item = item_list.at(i);-
1461-
1462 if (item.placeHolderItem != 0)
item.placeHolderItem != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1463 continue;
never executed: continue;
0
1464-
1465 if (item.subinfo != 0) {
item.subinfo != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1466 QList<int> result = item.subinfo->indexOf(widget);-
1467 if (!result.isEmpty()) {
!result.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
1468 result.prepend(i);-
1469 return result;
never executed: return result;
0
1470 }-
1471 continue;
never executed: continue;
0
1472 }-
1473-
1474 if (!(item.flags & QDockAreaLayoutItem::GapItem) && item.widgetItem && item.widgetItem->widget() == widget) {
!(item.flags &...Item::GapItem)Description
TRUEnever evaluated
FALSEnever evaluated
item.widgetItemDescription
TRUEnever evaluated
FALSEnever evaluated
item.widgetIte...et() == widgetDescription
TRUEnever evaluated
FALSEnever evaluated
0
1475 QList<int> result;-
1476 result << i;-
1477 return result;
never executed: return result;
0
1478 }-
1479 }
never executed: end of block
0
1480-
1481 return QList<int>();
never executed: return QList<int>();
0
1482}-
1483-
1484QMainWindowLayout *QDockAreaLayoutInfo::mainWindowLayout() const-
1485{-
1486 QMainWindowLayout *result = qt_mainwindow_layout(mainWindow);-
1487 Q_ASSERT(result != 0);-
1488 return result;
never executed: return result;
0
1489}-
1490-
1491bool QDockAreaLayoutInfo::hasFixedSize() const-
1492{-
1493 return perp(o, minimumSize()) == perp(o, maximumSize());
never executed: return perp(o, minimumSize()) == perp(o, maximumSize());
0
1494}-
1495-
1496-
1497void QDockAreaLayoutInfo::apply(bool animate)-
1498{-
1499 QWidgetAnimator &widgetAnimator = mainWindowLayout()->widgetAnimator;-
1500-
1501#ifndef QT_NO_TABBAR-
1502 if (tabbed) {
tabbedDescription
TRUEnever evaluated
FALSEnever evaluated
0
1503 QRect tab_rect;-
1504 QSize tbh = tabBarSizeHint();-
1505-
1506 if (!tbh.isNull()) {
!tbh.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
0
1507 switch (tabBarShape) {-
1508 case QTabBar::RoundedNorth:
never executed: case QTabBar::RoundedNorth:
0
1509 case QTabBar::TriangularNorth:
never executed: case QTabBar::TriangularNorth:
0
1510 tab_rect = QRect(rect.left(), rect.top(), rect.width(), tbh.height());-
1511 break;
never executed: break;
0
1512 case QTabBar::RoundedSouth:
never executed: case QTabBar::RoundedSouth:
0
1513 case QTabBar::TriangularSouth:
never executed: case QTabBar::TriangularSouth:
0
1514 tab_rect = QRect(rect.left(), rect.bottom() - tbh.height() + 1,-
1515 rect.width(), tbh.height());-
1516 break;
never executed: break;
0
1517 case QTabBar::RoundedEast:
never executed: case QTabBar::RoundedEast:
0
1518 case QTabBar::TriangularEast:
never executed: case QTabBar::TriangularEast:
0
1519 tab_rect = QRect(rect.right() - tbh.width() + 1, rect.top(),-
1520 tbh.width(), rect.height());-
1521 break;
never executed: break;
0
1522 case QTabBar::RoundedWest:
never executed: case QTabBar::RoundedWest:
0
1523 case QTabBar::TriangularWest:
never executed: case QTabBar::TriangularWest:
0
1524 tab_rect = QRect(rect.left(), rect.top(),-
1525 tbh.width(), rect.height());-
1526 break;
never executed: break;
0
1527 default:
never executed: default:
0
1528 break;
never executed: break;
0
1529 }-
1530 }-
1531-
1532 widgetAnimator.animate(tabBar, tab_rect, animate);-
1533 }
never executed: end of block
0
1534#endif // QT_NO_TABBAR-
1535-
1536 for (int i = 0; i < item_list.size(); ++i) {
i < item_list.size()Description
TRUEnever evaluated
FALSEnever evaluated
0
1537 QDockAreaLayoutItem &item = item_list[i];-
1538-
1539 if (item.flags & QDockAreaLayoutItem::GapItem)
item.flags & Q...tItem::GapItemDescription
TRUEnever evaluated
FALSEnever evaluated
0
1540 continue;
never executed: continue;
0
1541-
1542 if (item.subinfo != 0) {
item.subinfo != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1543 item.subinfo->apply(animate);-
1544 continue;
never executed: continue;
0
1545 }-
1546-
1547 if (item.skip())
item.skip()Description
TRUEnever evaluated
FALSEnever evaluated
0
1548 continue;
never executed: continue;
0
1549-
1550 Q_ASSERT(item.widgetItem);-
1551 QRect r = itemRect(i);-
1552 QWidget *w = item.widgetItem->widget();-
1553-
1554 QRect geo = w->geometry();-
1555 widgetAnimator.animate(w, r, animate);-
1556 if (!w->isHidden() && w->window()->isVisible()) {
!w->isHidden()Description
TRUEnever evaluated
FALSEnever evaluated
w->window()->isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
0
1557 QDockWidget *dw = qobject_cast<QDockWidget*>(w);-
1558 if (!r.isValid() && geo.right() >= 0 && geo.bottom() >= 0) {
!r.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
geo.right() >= 0Description
TRUEnever evaluated
FALSEnever evaluated
geo.bottom() >= 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1559 dw->lower();-
1560 emit dw->visibilityChanged(false);-
1561 } else if (r.isValid()
never executed: end of block
r.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
0
1562 && (geo.right() < 0 || geo.bottom() < 0)) {
geo.right() < 0Description
TRUEnever evaluated
FALSEnever evaluated
geo.bottom() < 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1563 emit dw->visibilityChanged(true);-
1564 }
never executed: end of block
0
1565 }
never executed: end of block
0
1566 }
never executed: end of block
0
1567#ifndef QT_NO_TABBAR-
1568 if (*sep == 1)
*sep == 1Description
TRUEnever evaluated
FALSEnever evaluated
0
1569 updateSeparatorWidgets();
never executed: updateSeparatorWidgets();
0
1570#endif //QT_NO_TABBAR-
1571}
never executed: end of block
0
1572-
1573static void paintSep(QPainter *p, QWidget *w, const QRect &r, Qt::Orientation o, bool mouse_over)-
1574{-
1575 QStyleOption opt(0);-
1576 opt.state = QStyle::State_None;-
1577 if (w->isEnabled())
w->isEnabled()Description
TRUEnever evaluated
FALSEnever evaluated
0
1578 opt.state |= QStyle::State_Enabled;
never executed: opt.state |= QStyle::State_Enabled;
0
1579 if (o != Qt::Horizontal)
o != Qt::HorizontalDescription
TRUEnever evaluated
FALSEnever evaluated
0
1580 opt.state |= QStyle::State_Horizontal;
never executed: opt.state |= QStyle::State_Horizontal;
0
1581 if (mouse_over)
mouse_overDescription
TRUEnever evaluated
FALSEnever evaluated
0
1582 opt.state |= QStyle::State_MouseOver;
never executed: opt.state |= QStyle::State_MouseOver;
0
1583 opt.rect = r;-
1584 opt.palette = w->palette();-
1585-
1586 w->style()->drawPrimitive(QStyle::PE_IndicatorDockWidgetResizeHandle, &opt, p, w);-
1587}
never executed: end of block
0
1588-
1589QRegion QDockAreaLayoutInfo::separatorRegion() const-
1590{-
1591 QRegion result;-
1592-
1593 if (isEmpty())
isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
1594 return result;
never executed: return result;
0
1595#ifndef QT_NO_TABBAR-
1596 if (tabbed)
tabbedDescription
TRUEnever evaluated
FALSEnever evaluated
0
1597 return result;
never executed: return result;
0
1598#endif-
1599-
1600 for (int i = 0; i < item_list.count(); ++i) {
i < item_list.count()Description
TRUEnever evaluated
FALSEnever evaluated
0
1601 const QDockAreaLayoutItem &item = item_list.at(i);-
1602-
1603 if (item.skip())
item.skip()Description
TRUEnever evaluated
FALSEnever evaluated
0
1604 continue;
never executed: continue;
0
1605-
1606 int next = this->next(i);-
1607-
1608 if (item.subinfo)
item.subinfoDescription
TRUEnever evaluated
FALSEnever evaluated
0
1609 result |= item.subinfo->separatorRegion();
never executed: result |= item.subinfo->separatorRegion();
0
1610-
1611 if (next == -1)
next == -1Description
TRUEnever evaluated
FALSEnever evaluated
0
1612 break;
never executed: break;
0
1613 result |= separatorRect(i);-
1614 }
never executed: end of block
0
1615-
1616 return result;
never executed: return result;
0
1617}-
1618-
1619void QDockAreaLayoutInfo::paintSeparators(QPainter *p, QWidget *widget,-
1620 const QRegion &clip,-
1621 const QPoint &mouse) const-
1622{-
1623 if (isEmpty())
isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
1624 return;
never executed: return;
0
1625#ifndef QT_NO_TABBAR-
1626 if (tabbed)
tabbedDescription
TRUEnever evaluated
FALSEnever evaluated
0
1627 return;
never executed: return;
0
1628#endif-
1629-
1630 for (int i = 0; i < item_list.count(); ++i) {
i < item_list.count()Description
TRUEnever evaluated
FALSEnever evaluated
0
1631 const QDockAreaLayoutItem &item = item_list.at(i);-
1632-
1633 if (item.skip())
item.skip()Description
TRUEnever evaluated
FALSEnever evaluated
0
1634 continue;
never executed: continue;
0
1635-
1636 int next = this->next(i);-
1637 if ((item.flags & QDockAreaLayoutItem::GapItem)
(item.flags & ...Item::GapItem)Description
TRUEnever evaluated
FALSEnever evaluated
0
1638 || (next != -1 && (item_list.at(next).flags & QDockAreaLayoutItem::GapItem)))
next != -1Description
TRUEnever evaluated
FALSEnever evaluated
(item_list.at(...Item::GapItem)Description
TRUEnever evaluated
FALSEnever evaluated
0
1639 continue;
never executed: continue;
0
1640-
1641 if (item.subinfo) {
item.subinfoDescription
TRUEnever evaluated
FALSEnever evaluated
0
1642 if (clip.contains(item.subinfo->rect))
clip.contains(...subinfo->rect)Description
TRUEnever evaluated
FALSEnever evaluated
0
1643 item.subinfo->paintSeparators(p, widget, clip, mouse);
never executed: item.subinfo->paintSeparators(p, widget, clip, mouse);
0
1644 }
never executed: end of block
0
1645-
1646 if (next == -1)
next == -1Description
TRUEnever evaluated
FALSEnever evaluated
0
1647 break;
never executed: break;
0
1648 QRect r = separatorRect(i);-
1649 if (clip.contains(r) && !item.hasFixedSize(o))
clip.contains(r)Description
TRUEnever evaluated
FALSEnever evaluated
!item.hasFixedSize(o)Description
TRUEnever evaluated
FALSEnever evaluated
0
1650 paintSep(p, widget, r, o, r.contains(mouse));
never executed: paintSep(p, widget, r, o, r.contains(mouse));
0
1651 }
never executed: end of block
0
1652}
never executed: end of block
0
1653-
1654int QDockAreaLayoutInfo::next(int index) const-
1655{-
1656 for (int i = index + 1; i < item_list.size(); ++i) {
i < item_list.size()Description
TRUEnever evaluated
FALSEnever evaluated
0
1657 if (!item_list.at(i).skip())
!item_list.at(i).skip()Description
TRUEnever evaluated
FALSEnever evaluated
0
1658 return i;
never executed: return i;
0
1659 }
never executed: end of block
0
1660 return -1;
never executed: return -1;
0
1661}-
1662-
1663int QDockAreaLayoutInfo::prev(int index) const-
1664{-
1665 for (int i = index - 1; i >= 0; --i) {
i >= 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1666 if (!item_list.at(i).skip())
!item_list.at(i).skip()Description
TRUEnever evaluated
FALSEnever evaluated
0
1667 return i;
never executed: return i;
0
1668 }
never executed: end of block
0
1669 return -1;
never executed: return -1;
0
1670}-
1671-
1672void QDockAreaLayoutInfo::tab(int index, QLayoutItem *dockWidgetItem)-
1673{-
1674#ifdef QT_NO_TABBAR-
1675 Q_UNUSED(index);-
1676 Q_UNUSED(dockWidgetItem);-
1677#else-
1678 if (tabbed) {
tabbedDescription
TRUEnever evaluated
FALSEnever evaluated
0
1679 item_list.append(QDockAreaLayoutItem(dockWidgetItem));-
1680 updateTabBar();-
1681 setCurrentTab(dockWidgetItem->widget());-
1682 } else {
never executed: end of block
0
1683 QDockAreaLayoutInfo *new_info-
1684 = new QDockAreaLayoutInfo(sep, dockPos, o, tabBarShape, mainWindow);-
1685 item_list[index].subinfo = new_info;-
1686 new_info->item_list.append(QDockAreaLayoutItem(item_list.at(index).widgetItem));-
1687 item_list[index].widgetItem = 0;-
1688 new_info->item_list.append(QDockAreaLayoutItem(dockWidgetItem));-
1689 new_info->tabbed = true;-
1690 new_info->updateTabBar();-
1691 new_info->setCurrentTab(dockWidgetItem->widget());-
1692 }
never executed: end of block
0
1693#endif // QT_NO_TABBAR-
1694}-
1695-
1696void QDockAreaLayoutInfo::split(int index, Qt::Orientation orientation,-
1697 QLayoutItem *dockWidgetItem)-
1698{-
1699 if (orientation == o) {
orientation == oDescription
TRUEnever evaluated
FALSEnever evaluated
0
1700 item_list.insert(index + 1, QDockAreaLayoutItem(dockWidgetItem));-
1701 } else {
never executed: end of block
0
1702#ifdef QT_NO_TABBAR-
1703 const int tabBarShape = 0;-
1704#endif-
1705 QDockAreaLayoutInfo *new_info-
1706 = new QDockAreaLayoutInfo(sep, dockPos, orientation, tabBarShape, mainWindow);-
1707 item_list[index].subinfo = new_info;-
1708 new_info->item_list.append(QDockAreaLayoutItem(item_list.at(index).widgetItem));-
1709 item_list[index].widgetItem = 0;-
1710 new_info->item_list.append(QDockAreaLayoutItem(dockWidgetItem));-
1711 }
never executed: end of block
0
1712}-
1713-
1714QDockAreaLayoutItem &QDockAreaLayoutInfo::item(const QList<int> &path)-
1715{-
1716 Q_ASSERT(!path.isEmpty());-
1717 const int index = path.first();-
1718 if (path.count() > 1) {
path.count() > 1Description
TRUEnever evaluated
FALSEnever evaluated
0
1719 const QDockAreaLayoutItem &item = item_list[index];-
1720 Q_ASSERT(item.subinfo != 0);-
1721 return item.subinfo->item(path.mid(1));
never executed: return item.subinfo->item(path.mid(1));
0
1722 }-
1723 return item_list[index];
never executed: return item_list[index];
0
1724}-
1725-
1726QLayoutItem *QDockAreaLayoutInfo::itemAt(int *x, int index) const-
1727{-
1728 for (int i = 0; i < item_list.count(); ++i) {
i < item_list.count()Description
TRUEnever evaluated
FALSEnever evaluated
0
1729 const QDockAreaLayoutItem &item = item_list.at(i);-
1730 if (item.placeHolderItem != 0)
item.placeHolderItem != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1731 continue;
never executed: continue;
0
1732 if (item.subinfo) {
item.subinfoDescription
TRUEnever evaluated
FALSEnever evaluated
0
1733 if (QLayoutItem *ret = item.subinfo->itemAt(x, index))
QLayoutItem *r...emAt(x, index)Description
TRUEnever evaluated
FALSEnever evaluated
0
1734 return ret;
never executed: return ret;
0
1735 } else if (item.widgetItem) {
never executed: end of block
item.widgetItemDescription
TRUEnever evaluated
FALSEnever evaluated
0
1736 if ((*x)++ == index)
(*x)++ == indexDescription
TRUEnever evaluated
FALSEnever evaluated
0
1737 return item.widgetItem;
never executed: return item.widgetItem;
0
1738 }
never executed: end of block
0
1739 }
never executed: end of block
0
1740 return 0;
never executed: return 0;
0
1741}-
1742-
1743QLayoutItem *QDockAreaLayoutInfo::takeAt(int *x, int index)-
1744{-
1745 for (int i = 0; i < item_list.count(); ++i) {
i < item_list.count()Description
TRUEnever evaluated
FALSEnever evaluated
0
1746 QDockAreaLayoutItem &item = item_list[i];-
1747 if (item.placeHolderItem != 0)
item.placeHolderItem != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1748 continue;
never executed: continue;
0
1749 else if (item.subinfo) {
item.subinfoDescription
TRUEnever evaluated
FALSEnever evaluated
0
1750 if (QLayoutItem *ret = item.subinfo->takeAt(x, index)) {
QLayoutItem *r...keAt(x, index)Description
TRUEnever evaluated
FALSEnever evaluated
0
1751 unnest(i);-
1752 return ret;
never executed: return ret;
0
1753 }-
1754 } else if (item.widgetItem) {
never executed: end of block
item.widgetItemDescription
TRUEnever evaluated
FALSEnever evaluated
0
1755 if ((*x)++ == index) {
(*x)++ == indexDescription
TRUEnever evaluated
FALSEnever evaluated
0
1756 item.placeHolderItem = new QPlaceHolderItem(item.widgetItem->widget());-
1757 QLayoutItem *ret = item.widgetItem;-
1758 item.widgetItem = 0;-
1759 if (item.size != -1)
item.size != -1Description
TRUEnever evaluated
FALSEnever evaluated
0
1760 item.flags |= QDockAreaLayoutItem::KeepSize;
never executed: item.flags |= QDockAreaLayoutItem::KeepSize;
0
1761 return ret;
never executed: return ret;
0
1762 }-
1763 }
never executed: end of block
0
1764 }
never executed: end of block
0
1765 return 0;
never executed: return 0;
0
1766}-
1767-
1768void QDockAreaLayoutInfo::deleteAllLayoutItems()-
1769{-
1770 for (int i = 0; i < item_list.count(); ++i) {
i < item_list.count()Description
TRUEnever evaluated
FALSEnever evaluated
0
1771 QDockAreaLayoutItem &item= item_list[i];-
1772 if (item.subinfo) {
item.subinfoDescription
TRUEnever evaluated
FALSEnever evaluated
0
1773 item.subinfo->deleteAllLayoutItems();-
1774 } else {
never executed: end of block
0
1775 delete item.widgetItem;-
1776 item.widgetItem = 0;-
1777 }
never executed: end of block
0
1778 }-
1779}
never executed: end of block
0
1780-
1781void QDockAreaLayoutInfo::saveState(QDataStream &stream) const-
1782{-
1783#ifndef QT_NO_TABBAR-
1784 if (tabbed) {
tabbedDescription
TRUEnever evaluated
FALSEnever evaluated
0
1785 stream << (uchar) TabMarker;-
1786-
1787 // write the index in item_list of the widget that's currently on top.-
1788 quintptr id = currentTabId();-
1789 int index = -1;-
1790 for (int i = 0; i < item_list.count(); ++i) {
i < item_list.count()Description
TRUEnever evaluated
FALSEnever evaluated
0
1791 if (tabId(item_list.at(i)) == id) {
tabId(item_list.at(i)) == idDescription
TRUEnever evaluated
FALSEnever evaluated
0
1792 index = i;-
1793 break;
never executed: break;
0
1794 }-
1795 }
never executed: end of block
0
1796 stream << index;-
1797 } else
never executed: end of block
0
1798#endif // QT_NO_TABBAR-
1799 {-
1800 stream << (uchar) SequenceMarker;-
1801 }
never executed: end of block
0
1802-
1803 stream << (uchar) o << item_list.count();-
1804-
1805 for (int i = 0; i < item_list.count(); ++i) {
i < item_list.count()Description
TRUEnever evaluated
FALSEnever evaluated
0
1806 const QDockAreaLayoutItem &item = item_list.at(i);-
1807 if (item.widgetItem != 0) {
item.widgetItem != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1808 stream << (uchar) WidgetMarker;-
1809 QWidget *w = item.widgetItem->widget();-
1810 QString name = w->objectName();-
1811 if (Q_UNLIKELY(name.isEmpty())) {
__builtin_expe...pty()), false)Description
TRUEnever evaluated
FALSEnever evaluated
0
1812 qWarning("QMainWindow::saveState(): 'objectName' not set for QDockWidget %p '%ls;",-
1813 w, qUtf16Printable(w->windowTitle()));-
1814 }
never executed: end of block
0
1815 stream << name;-
1816-
1817 uchar flags = 0;-
1818 if (!w->isHidden())
!w->isHidden()Description
TRUEnever evaluated
FALSEnever evaluated
0
1819 flags |= StateFlagVisible;
never executed: flags |= StateFlagVisible;
0
1820 if (w->isWindow())
w->isWindow()Description
TRUEnever evaluated
FALSEnever evaluated
0
1821 flags |= StateFlagFloating;
never executed: flags |= StateFlagFloating;
0
1822 stream << flags;-
1823-
1824 if (w->isWindow()) {
w->isWindow()Description
TRUEnever evaluated
FALSEnever evaluated
0
1825 const QRect geometry = w->geometry();-
1826 stream << geometry.x() << geometry.y() << geometry.width() << geometry.height();-
1827 } else {
never executed: end of block
0
1828 stream << item.pos << item.size << pick(o, item.minimumSize())-
1829 << pick(o, item.maximumSize());-
1830 }
never executed: end of block
0
1831 } else if (item.placeHolderItem != 0) {
item.placeHolderItem != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1832 stream << (uchar) WidgetMarker;-
1833 stream << item.placeHolderItem->objectName;-
1834 uchar flags = 0;-
1835 if (!item.placeHolderItem->hidden)
!item.placeHolderItem->hiddenDescription
TRUEnever evaluated
FALSEnever evaluated
0
1836 flags |= StateFlagVisible;
never executed: flags |= StateFlagVisible;
0
1837 if (item.placeHolderItem->window)
item.placeHolderItem->windowDescription
TRUEnever evaluated
FALSEnever evaluated
0
1838 flags |= StateFlagFloating;
never executed: flags |= StateFlagFloating;
0
1839 stream << flags;-
1840 if (item.placeHolderItem->window) {
item.placeHolderItem->windowDescription
TRUEnever evaluated
FALSEnever evaluated
0
1841 QRect r = item.placeHolderItem->topLevelRect;-
1842 stream << r.x() << r.y() << r.width() << r.height();-
1843 } else {
never executed: end of block
0
1844 stream << item.pos << item.size << (int)0 << (int)0;-
1845 }
never executed: end of block
0
1846 } else if (item.subinfo != 0) {
item.subinfo != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1847 stream << (uchar) SequenceMarker << item.pos << item.size << pick(o, item.minimumSize()) << pick(o, item.maximumSize());-
1848 item.subinfo->saveState(stream);-
1849 }
never executed: end of block
0
1850 }
never executed: end of block
0
1851}
never executed: end of block
0
1852-
1853static Qt::DockWidgetArea toDockWidgetArea(QInternal::DockPosition pos)-
1854{-
1855 switch (pos) {-
1856 case QInternal::LeftDock: return Qt::LeftDockWidgetArea;
never executed: return Qt::LeftDockWidgetArea;
never executed: case QInternal::LeftDock:
0
1857 case QInternal::RightDock: return Qt::RightDockWidgetArea;
never executed: return Qt::RightDockWidgetArea;
never executed: case QInternal::RightDock:
0
1858 case QInternal::TopDock: return Qt::TopDockWidgetArea;
never executed: return Qt::TopDockWidgetArea;
never executed: case QInternal::TopDock:
0
1859 case QInternal::BottomDock: return Qt::BottomDockWidgetArea;
never executed: return Qt::BottomDockWidgetArea;
never executed: case QInternal::BottomDock:
0
1860 default: break;
never executed: break;
never executed: default:
0
1861 }-
1862 return Qt::NoDockWidgetArea;
never executed: return Qt::NoDockWidgetArea;
0
1863}-
1864-
1865bool QDockAreaLayoutInfo::restoreState(QDataStream &stream, QList<QDockWidget*> &widgets, bool testing)-
1866{-
1867 uchar marker;-
1868 stream >> marker;-
1869 if (marker != TabMarker && marker != SequenceMarker)
marker != TabMarkerDescription
TRUEnever evaluated
FALSEnever evaluated
marker != SequenceMarkerDescription
TRUEnever evaluated
FALSEnever evaluated
0
1870 return false;
never executed: return false;
0
1871-
1872#ifndef QT_NO_TABBAR-
1873 tabbed = marker == TabMarker;-
1874-
1875 int index = -1;-
1876 if (tabbed)
tabbedDescription
TRUEnever evaluated
FALSEnever evaluated
0
1877 stream >> index;
never executed: stream >> index;
0
1878#endif-
1879-
1880 uchar orientation;-
1881 stream >> orientation;-
1882 o = static_cast<Qt::Orientation>(orientation);-
1883-
1884 int cnt;-
1885 stream >> cnt;-
1886-
1887 for (int i = 0; i < cnt; ++i) {
i < cntDescription
TRUEnever evaluated
FALSEnever evaluated
0
1888 uchar nextMarker;-
1889 stream >> nextMarker;-
1890 if (nextMarker == WidgetMarker) {
nextMarker == WidgetMarkerDescription
TRUEnever evaluated
FALSEnever evaluated
0
1891 QString name;-
1892 uchar flags;-
1893 stream >> name >> flags;-
1894 if (name.isEmpty()) {
name.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
1895 int dummy;-
1896 stream >> dummy >> dummy >> dummy >> dummy;-
1897 continue;
never executed: continue;
0
1898 }-
1899-
1900 QDockWidget *widget = 0;-
1901 for (int j = 0; j < widgets.count(); ++j) {
j < widgets.count()Description
TRUEnever evaluated
FALSEnever evaluated
0
1902 if (widgets.at(j)->objectName() == name) {
widgets.at(j)-...Name() == nameDescription
TRUEnever evaluated
FALSEnever evaluated
0
1903 widget = widgets.takeAt(j);-
1904 break;
never executed: break;
0
1905 }-
1906 }
never executed: end of block
0
1907-
1908 if (widget == 0) {
widget == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1909 QPlaceHolderItem *placeHolder = new QPlaceHolderItem;-
1910 QDockAreaLayoutItem item(placeHolder);-
1911-
1912 placeHolder->objectName = name;-
1913 placeHolder->window = flags & StateFlagFloating;-
1914 placeHolder->hidden = !(flags & StateFlagVisible);-
1915 if (placeHolder->window) {
placeHolder->windowDescription
TRUEnever evaluated
FALSEnever evaluated
0
1916 int x, y, w, h;-
1917 stream >> x >> y >> w >> h;-
1918 placeHolder->topLevelRect = QRect(x, y, w, h);-
1919 } else {
never executed: end of block
0
1920 int dummy;-
1921 stream >> item.pos >> item.size >> dummy >> dummy;-
1922 }
never executed: end of block
0
1923 if (item.size != -1)
item.size != -1Description
TRUEnever evaluated
FALSEnever evaluated
0
1924 item.flags |= QDockAreaLayoutItem::KeepSize;
never executed: item.flags |= QDockAreaLayoutItem::KeepSize;
0
1925 if (!testing)
!testingDescription
TRUEnever evaluated
FALSEnever evaluated
0
1926 item_list.append(item);
never executed: item_list.append(item);
0
1927 } else {
never executed: end of block
0
1928 QDockAreaLayoutItem item(new QDockWidgetItem(widget));-
1929 if (flags & StateFlagFloating) {
flags & StateFlagFloatingDescription
TRUEnever evaluated
FALSEnever evaluated
0
1930 bool drawer = false;-
1931#ifdef Q_DEAD_CODE_FROM_QT4_MAC // drawer support-
1932 extern bool qt_mac_is_macdrawer(const QWidget *); //qwidget_mac.cpp-
1933 extern bool qt_mac_set_drawer_preferred_edge(QWidget *, Qt::DockWidgetArea); //qwidget_mac.cpp-
1934 drawer = qt_mac_is_macdrawer(widget);-
1935#endif-
1936-
1937 if (!testing) {
!testingDescription
TRUEnever evaluated
FALSEnever evaluated
0
1938 widget->hide();-
1939 if (!drawer)
!drawerDescription
TRUEnever evaluated
FALSEnever evaluated
0
1940 widget->setFloating(true);
never executed: widget->setFloating(true);
0
1941 }
never executed: end of block
0
1942-
1943 int x, y, w, h;-
1944 stream >> x >> y >> w >> h;-
1945-
1946#ifdef Q_DEAD_CODE_FROM_QT4_MAC // drawer support-
1947 if (drawer) {-
1948 mainWindow->window()->createWinId();-
1949 widget->window()->createWinId();-
1950 qt_mac_set_drawer_preferred_edge(widget, toDockWidgetArea(dockPos));-
1951 } else-
1952#endif-
1953 if (!testing)
!testingDescription
TRUEnever evaluated
FALSEnever evaluated
0
1954 widget->setGeometry(QDockAreaLayout::constrainedRect(QRect(x, y, w, h), widget));
never executed: widget->setGeometry(QDockAreaLayout::constrainedRect(QRect(x, y, w, h), widget));
0
1955-
1956 if (!testing) {
!testingDescription
TRUEnever evaluated
FALSEnever evaluated
0
1957 widget->setVisible(flags & StateFlagVisible);-
1958 item_list.append(item);-
1959 }
never executed: end of block
0
1960 } else {
never executed: end of block
0
1961 int dummy;-
1962 stream >> item.pos >> item.size >> dummy >> dummy;-
1963 if (!testing) {
!testingDescription
TRUEnever evaluated
FALSEnever evaluated
0
1964 item_list.append(item);-
1965 widget->setFloating(false);-
1966 widget->setVisible(flags & StateFlagVisible);-
1967 emit widget->dockLocationChanged(toDockWidgetArea(dockPos));-
1968 }
never executed: end of block
0
1969 }
never executed: end of block
0
1970 if (testing) {
testingDescription
TRUEnever evaluated
FALSEnever evaluated
0
1971 //was it is not really added to the layout, we need to delete the object here-
1972 delete item.widgetItem;-
1973 }
never executed: end of block
0
1974 }
never executed: end of block
0
1975 } else if (nextMarker == SequenceMarker) {
nextMarker == SequenceMarkerDescription
TRUEnever evaluated
FALSEnever evaluated
0
1976 int dummy;-
1977#ifdef QT_NO_TABBAR-
1978 const int tabBarShape = 0;-
1979#endif-
1980 QDockAreaLayoutItem item(new QDockAreaLayoutInfo(sep, dockPos, o,-
1981 tabBarShape, mainWindow));-
1982 stream >> item.pos >> item.size >> dummy >> dummy;-
1983 //we need to make sure the element is in the list so the dock widget can eventually be docked correctly-
1984 if (!testing)
!testingDescription
TRUEnever evaluated
FALSEnever evaluated
0
1985 item_list.append(item);
never executed: item_list.append(item);
0
1986-
1987 //here we need to make sure we change the item in the item_list-
1988 QDockAreaLayoutItem &lastItem = testing ? item : item_list.last();
testingDescription
TRUEnever evaluated
FALSEnever evaluated
0
1989-
1990 if (!lastItem.subinfo->restoreState(stream, widgets, testing))
!lastItem.subi...gets, testing)Description
TRUEnever evaluated
FALSEnever evaluated
0
1991 return false;
never executed: return false;
0
1992-
1993 } else {
never executed: end of block
0
1994 return false;
never executed: return false;
0
1995 }-
1996 }-
1997-
1998#ifndef QT_NO_TABBAR-
1999 if (!testing && tabbed && index >= 0 && index < item_list.count()) {
!testingDescription
TRUEnever evaluated
FALSEnever evaluated
tabbedDescription
TRUEnever evaluated
FALSEnever evaluated
index >= 0Description
TRUEnever evaluated
FALSEnever evaluated
index < item_list.count()Description
TRUEnever evaluated
FALSEnever evaluated
0
2000 updateTabBar();-
2001 setCurrentTabId(tabId(item_list.at(index)));-
2002 }
never executed: end of block
0
2003 if (!testing && *sep == 1)
!testingDescription
TRUEnever evaluated
FALSEnever evaluated
*sep == 1Description
TRUEnever evaluated
FALSEnever evaluated
0
2004 updateSeparatorWidgets();
never executed: updateSeparatorWidgets();
0
2005#endif-
2006-
2007 return true;
never executed: return true;
0
2008}-
2009-
2010#ifndef QT_NO_TABBAR-
2011void QDockAreaLayoutInfo::updateSeparatorWidgets() const-
2012{-
2013 if (tabbed) {
tabbedDescription
TRUEnever evaluated
FALSEnever evaluated
0
2014 separatorWidgets.clear();-
2015 return;
never executed: return;
0
2016 }-
2017-
2018 int j = 0;-
2019 for (int i = 0; i < item_list.count(); ++i) {
i < item_list.count()Description
TRUEnever evaluated
FALSEnever evaluated
0
2020 const QDockAreaLayoutItem &item = item_list.at(i);-
2021-
2022 if (item.skip())
item.skip()Description
TRUEnever evaluated
FALSEnever evaluated
0
2023 continue;
never executed: continue;
0
2024-
2025 int next = this->next(i);-
2026 if ((item.flags & QDockAreaLayoutItem::GapItem)
(item.flags & ...Item::GapItem)Description
TRUEnever evaluated
FALSEnever evaluated
0
2027 || (next != -1 && (item_list.at(next).flags & QDockAreaLayoutItem::GapItem)))
next != -1Description
TRUEnever evaluated
FALSEnever evaluated
(item_list.at(...Item::GapItem)Description
TRUEnever evaluated
FALSEnever evaluated
0
2028 continue;
never executed: continue;
0
2029-
2030 if (item.subinfo) {
item.subinfoDescription
TRUEnever evaluated
FALSEnever evaluated
0
2031 item.subinfo->updateSeparatorWidgets();-
2032 }
never executed: end of block
0
2033-
2034 if (next == -1)
next == -1Description
TRUEnever evaluated
FALSEnever evaluated
0
2035 break;
never executed: break;
0
2036-
2037 QWidget *sepWidget;-
2038 if (j < separatorWidgets.size() && separatorWidgets.at(j)) {
j < separatorWidgets.size()Description
TRUEnever evaluated
FALSEnever evaluated
separatorWidgets.at(j)Description
TRUEnever evaluated
FALSEnever evaluated
0
2039 sepWidget = separatorWidgets.at(j);-
2040 } else {
never executed: end of block
0
2041 sepWidget = mainWindowLayout()->getSeparatorWidget();-
2042 separatorWidgets.append(sepWidget);-
2043 }
never executed: end of block
0
2044 j++;-
2045-
2046#ifndef Q_DEAD_CODE_FROM_QT4_MAC-
2047 sepWidget->raise();-
2048#endif-
2049 QRect sepRect = separatorRect(i).adjusted(-2, -2, 2, 2);-
2050 sepWidget->setGeometry(sepRect);-
2051 sepWidget->setMask( QRegion(separatorRect(i).translated( - sepRect.topLeft())));-
2052 sepWidget->show();-
2053 }
never executed: end of block
0
2054-
2055 for (int k = j; k < separatorWidgets.size(); ++k) {
k < separatorWidgets.size()Description
TRUEnever evaluated
FALSEnever evaluated
0
2056 separatorWidgets[k]->hide();-
2057 }
never executed: end of block
0
2058 separatorWidgets.resize(j);-
2059 Q_ASSERT(separatorWidgets.size() == j);-
2060}
never executed: end of block
0
2061#endif //QT_NO_TABBAR-
2062-
2063#ifndef QT_NO_TABBAR-
2064/*! \internal-
2065 reparent all the widgets contained in this layout portion to the-
2066 specified parent. This is used to reparent dock widgets and tabbars-
2067 to the floating window or the main window-
2068 */-
2069void QDockAreaLayoutInfo::reparentWidgets(QWidget *parent)-
2070{-
2071 if (tabBar)
tabBarDescription
TRUEnever evaluated
FALSEnever evaluated
0
2072 tabBar->setParent(parent);
never executed: tabBar->setParent(parent);
0
2073-
2074 for (int i = 0; i < item_list.count(); ++i) {
i < item_list.count()Description
TRUEnever evaluated
FALSEnever evaluated
0
2075 const QDockAreaLayoutItem &item = item_list.at(i);-
2076 if (item.flags & QDockAreaLayoutItem::GapItem)
item.flags & Q...tItem::GapItemDescription
TRUEnever evaluated
FALSEnever evaluated
0
2077 continue;
never executed: continue;
0
2078 if (item.skip())
item.skip()Description
TRUEnever evaluated
FALSEnever evaluated
0
2079 continue;
never executed: continue;
0
2080 if (item.subinfo)
item.subinfoDescription
TRUEnever evaluated
FALSEnever evaluated
0
2081 item.subinfo->reparentWidgets(parent);
never executed: item.subinfo->reparentWidgets(parent);
0
2082 if (item.widgetItem) {
item.widgetItemDescription
TRUEnever evaluated
FALSEnever evaluated
0
2083 QWidget *w = item.widgetItem->widget();-
2084 if (w->parent() != parent) {
w->parent() != parentDescription
TRUEnever evaluated
FALSEnever evaluated
0
2085 bool hidden = w->isHidden();-
2086 w->setParent(parent);-
2087 if (!hidden)
!hiddenDescription
TRUEnever evaluated
FALSEnever evaluated
0
2088 w->show();
never executed: w->show();
0
2089 }
never executed: end of block
0
2090 }
never executed: end of block
0
2091 }
never executed: end of block
0
2092}
never executed: end of block
0
2093-
2094//returns whether the tabbar is visible or not-
2095bool QDockAreaLayoutInfo::updateTabBar() const-
2096{-
2097 if (!tabbed)
!tabbedDescription
TRUEnever evaluated
FALSEnever evaluated
0
2098 return false;
never executed: return false;
0
2099-
2100 QDockAreaLayoutInfo *that = const_cast<QDockAreaLayoutInfo*>(this);-
2101-
2102 if (that->tabBar == 0) {
that->tabBar == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
2103 that->tabBar = mainWindowLayout()->getTabBar();-
2104 that->tabBar->setShape(static_cast<QTabBar::Shape>(tabBarShape));-
2105 that->tabBar->setDrawBase(true);-
2106 }
never executed: end of block
0
2107-
2108 const QSignalBlocker blocker(tabBar);-
2109 bool gap = false;-
2110-
2111 const quintptr oldCurrentId = currentTabId();-
2112-
2113 int tab_idx = 0;-
2114 for (int i = 0; i < item_list.count(); ++i) {
i < item_list.count()Description
TRUEnever evaluated
FALSEnever evaluated
0
2115 const QDockAreaLayoutItem &item = item_list.at(i);-
2116 if (item.skip())
item.skip()Description
TRUEnever evaluated
FALSEnever evaluated
0
2117 continue;
never executed: continue;
0
2118 if (item.flags & QDockAreaLayoutItem::GapItem) {
item.flags & Q...tItem::GapItemDescription
TRUEnever evaluated
FALSEnever evaluated
0
2119 gap = true;-
2120 continue;
never executed: continue;
0
2121 }-
2122 if (item.widgetItem == 0)
item.widgetItem == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
2123 continue;
never executed: continue;
0
2124-
2125 QDockWidget *dw = qobject_cast<QDockWidget*>(item.widgetItem->widget());-
2126 QString title = dw->d_func()->fixedWindowTitle;-
2127 quintptr id = tabId(item);-
2128 if (tab_idx == tabBar->count()) {
tab_idx == tabBar->count()Description
TRUEnever evaluated
FALSEnever evaluated
0
2129 tabBar->insertTab(tab_idx, title);-
2130#ifndef QT_NO_TOOLTIP-
2131 tabBar->setTabToolTip(tab_idx, title);-
2132#endif-
2133 tabBar->setTabData(tab_idx, id);-
2134 } else if (qvariant_cast<quintptr>(tabBar->tabData(tab_idx)) != id) {
never executed: end of block
qvariant_cast<...ab_idx)) != idDescription
TRUEnever evaluated
FALSEnever evaluated
0
2135 if (tab_idx + 1 < tabBar->count()
tab_idx + 1 < tabBar->count()Description
TRUEnever evaluated
FALSEnever evaluated
0
2136 && qvariant_cast<quintptr>(tabBar->tabData(tab_idx + 1)) == id)
qvariant_cast<...dx + 1)) == idDescription
TRUEnever evaluated
FALSEnever evaluated
0
2137 tabBar->removeTab(tab_idx);
never executed: tabBar->removeTab(tab_idx);
0
2138 else {-
2139 tabBar->insertTab(tab_idx, title);-
2140#ifndef QT_NO_TOOLTIP-
2141 tabBar->setTabToolTip(tab_idx, title);-
2142#endif-
2143 tabBar->setTabData(tab_idx, id);-
2144 }
never executed: end of block
0
2145 }-
2146-
2147 if (title != tabBar->tabText(tab_idx)) {
title != tabBa...bText(tab_idx)Description
TRUEnever evaluated
FALSEnever evaluated
0
2148 tabBar->setTabText(tab_idx, title);-
2149#ifndef QT_NO_TOOLTIP-
2150 tabBar->setTabToolTip(tab_idx, title);-
2151#endif-
2152 }
never executed: end of block
0
2153-
2154 ++tab_idx;-
2155 }
never executed: end of block
0
2156-
2157 while (tab_idx < tabBar->count()) {
tab_idx < tabBar->count()Description
TRUEnever evaluated
FALSEnever evaluated
0
2158 tabBar->removeTab(tab_idx);-
2159 }
never executed: end of block
0
2160-
2161 if (oldCurrentId > 0 && currentTabId() != oldCurrentId)
oldCurrentId > 0Description
TRUEnever evaluated
FALSEnever evaluated
currentTabId() != oldCurrentIdDescription
TRUEnever evaluated
FALSEnever evaluated
0
2162 that->setCurrentTabId(oldCurrentId);
never executed: that->setCurrentTabId(oldCurrentId);
0
2163-
2164 if (QDockWidgetGroupWindow *dwgw = qobject_cast<QDockWidgetGroupWindow *>(tabBar->parent()))
QDockWidgetGro...Bar->parent())Description
TRUEnever evaluated
FALSEnever evaluated
0
2165 dwgw->adjustFlags();
never executed: dwgw->adjustFlags();
0
2166-
2167 //returns if the tabbar is visible or not-
2168 return ( (gap ? 1 : 0) + tabBar->count()) > 1;
never executed: return ( (gap ? 1 : 0) + tabBar->count()) > 1;
0
2169}-
2170-
2171void QDockAreaLayoutInfo::setTabBarShape(int shape)-
2172{-
2173 if (shape == tabBarShape)
shape == tabBarShapeDescription
TRUEnever evaluated
FALSEnever evaluated
0
2174 return;
never executed: return;
0
2175 tabBarShape = shape;-
2176 if (tabBar != 0)
tabBar != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
2177 tabBar->setShape(static_cast<QTabBar::Shape>(shape));
never executed: tabBar->setShape(static_cast<QTabBar::Shape>(shape));
0
2178-
2179 for (int i = 0; i < item_list.count(); ++i) {
i < item_list.count()Description
TRUEnever evaluated
FALSEnever evaluated
0
2180 QDockAreaLayoutItem &item = item_list[i];-
2181 if (item.subinfo != 0)
item.subinfo != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
2182 item.subinfo->setTabBarShape(shape);
never executed: item.subinfo->setTabBarShape(shape);
0
2183 }
never executed: end of block
0
2184}
never executed: end of block
0
2185-
2186QSize QDockAreaLayoutInfo::tabBarMinimumSize() const-
2187{-
2188 if (!updateTabBar())
!updateTabBar()Description
TRUEnever evaluated
FALSEnever evaluated
0
2189 return QSize(0, 0);
never executed: return QSize(0, 0);
0
2190-
2191 return tabBar->minimumSizeHint();
never executed: return tabBar->minimumSizeHint();
0
2192}-
2193-
2194QSize QDockAreaLayoutInfo::tabBarSizeHint() const-
2195{-
2196 if (!updateTabBar())
!updateTabBar()Description
TRUEnever evaluated
FALSEnever evaluated
0
2197 return QSize(0, 0);
never executed: return QSize(0, 0);
0
2198-
2199 return tabBar->sizeHint();
never executed: return tabBar->sizeHint();
0
2200}-
2201-
2202QSet<QTabBar*> QDockAreaLayoutInfo::usedTabBars() const-
2203{-
2204 QSet<QTabBar*> result;-
2205-
2206 if (tabbed) {
tabbedDescription
TRUEnever evaluated
FALSEnever evaluated
0
2207 updateTabBar();-
2208 result.insert(tabBar);-
2209 }
never executed: end of block
0
2210-
2211 for (int i = 0; i < item_list.count(); ++i) {
i < item_list.count()Description
TRUEnever evaluated
FALSEnever evaluated
0
2212 const QDockAreaLayoutItem &item = item_list.at(i);-
2213 if (item.subinfo != 0)
item.subinfo != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
2214 result += item.subinfo->usedTabBars();
never executed: result += item.subinfo->usedTabBars();
0
2215 }
never executed: end of block
0
2216-
2217 return result;
never executed: return result;
0
2218}-
2219-
2220// returns a set of all used separator widgets for this dockarelayout info-
2221// and all subinfos-
2222QSet<QWidget*> QDockAreaLayoutInfo::usedSeparatorWidgets() const-
2223{-
2224 QSet<QWidget*> result;-
2225 const int numSeparatorWidgets = separatorWidgets.count();-
2226 result.reserve(numSeparatorWidgets);-
2227-
2228 for (int i = 0; i < numSeparatorWidgets; ++i)
i < numSeparatorWidgetsDescription
TRUEnever evaluated
FALSEnever evaluated
0
2229 result << separatorWidgets.at(i);
never executed: result << separatorWidgets.at(i);
0
2230-
2231 for (int i = 0; i < item_list.count(); ++i) {
i < item_list.count()Description
TRUEnever evaluated
FALSEnever evaluated
0
2232 const QDockAreaLayoutItem &item = item_list.at(i);-
2233 if (item.subinfo != 0)
item.subinfo != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
2234 result += item.subinfo->usedSeparatorWidgets();
never executed: result += item.subinfo->usedSeparatorWidgets();
0
2235 }
never executed: end of block
0
2236-
2237 return result;
never executed: return result;
0
2238}-
2239-
2240QRect QDockAreaLayoutInfo::tabContentRect() const-
2241{-
2242 if (!tabbed)
!tabbedDescription
TRUEnever evaluated
FALSEnever evaluated
0
2243 return QRect();
never executed: return QRect();
0
2244-
2245 QRect result = rect;-
2246 QSize tbh = tabBarSizeHint();-
2247-
2248 if (!tbh.isNull()) {
!tbh.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
0
2249 switch (tabBarShape) {-
2250 case QTabBar::RoundedNorth:
never executed: case QTabBar::RoundedNorth:
0
2251 case QTabBar::TriangularNorth:
never executed: case QTabBar::TriangularNorth:
0
2252 result.adjust(0, tbh.height(), 0, 0);-
2253 break;
never executed: break;
0
2254 case QTabBar::RoundedSouth:
never executed: case QTabBar::RoundedSouth:
0
2255 case QTabBar::TriangularSouth:
never executed: case QTabBar::TriangularSouth:
0
2256 result.adjust(0, 0, 0, -tbh.height());-
2257 break;
never executed: break;
0
2258 case QTabBar::RoundedEast:
never executed: case QTabBar::RoundedEast:
0
2259 case QTabBar::TriangularEast:
never executed: case QTabBar::TriangularEast:
0
2260 result.adjust(0, 0, -tbh.width(), 0);-
2261 break;
never executed: break;
0
2262 case QTabBar::RoundedWest:
never executed: case QTabBar::RoundedWest:
0
2263 case QTabBar::TriangularWest:
never executed: case QTabBar::TriangularWest:
0
2264 result.adjust(tbh.width(), 0, 0, 0);-
2265 break;
never executed: break;
0
2266 default:
never executed: default:
0
2267 break;
never executed: break;
0
2268 }-
2269 }-
2270-
2271 return result;
never executed: return result;
0
2272}-
2273-
2274int QDockAreaLayoutInfo::tabIndexToListIndex(int tabIndex) const-
2275{-
2276 Q_ASSERT(tabbed && tabBar);-
2277 quintptr data = qvariant_cast<quintptr>(tabBar->tabData(tabIndex));-
2278 for (int i = 0; i < item_list.count(); ++i) {
i < item_list.count()Description
TRUEnever evaluated
FALSEnever evaluated
0
2279 if (tabId(item_list.at(i)) == data)
tabId(item_list.at(i)) == dataDescription
TRUEnever evaluated
FALSEnever evaluated
0
2280 return i;
never executed: return i;
0
2281 }
never executed: end of block
0
2282 return -1;
never executed: return -1;
0
2283}-
2284-
2285void QDockAreaLayoutInfo::moveTab(int from, int to)-
2286{-
2287 item_list.move(tabIndexToListIndex(from), tabIndexToListIndex(to));-
2288}
never executed: end of block
0
2289#endif // QT_NO_TABBAR-
2290-
2291/******************************************************************************-
2292** QDockAreaLayout-
2293*/-
2294-
2295QDockAreaLayout::QDockAreaLayout(QMainWindow *win) : fallbackToSizeHints(true)-
2296{-
2297 mainWindow = win;-
2298 sep = win->style()->pixelMetric(QStyle::PM_DockWidgetSeparatorExtent, 0, win);-
2299#ifndef QT_NO_TABBAR-
2300 const int tabShape = QTabBar::RoundedSouth;-
2301#else-
2302 const int tabShape = 0;-
2303#endif-
2304 docks[QInternal::LeftDock]-
2305 = QDockAreaLayoutInfo(&sep, QInternal::LeftDock, Qt::Vertical, tabShape, win);-
2306 docks[QInternal::RightDock]-
2307 = QDockAreaLayoutInfo(&sep, QInternal::RightDock, Qt::Vertical, tabShape, win);-
2308 docks[QInternal::TopDock]-
2309 = QDockAreaLayoutInfo(&sep, QInternal::TopDock, Qt::Horizontal, tabShape, win);-
2310 docks[QInternal::BottomDock]-
2311 = QDockAreaLayoutInfo(&sep, QInternal::BottomDock, Qt::Horizontal, tabShape, win);-
2312 centralWidgetItem = 0;-
2313-
2314-
2315 corners[Qt::TopLeftCorner] = Qt::TopDockWidgetArea;-
2316 corners[Qt::TopRightCorner] = Qt::TopDockWidgetArea;-
2317 corners[Qt::BottomLeftCorner] = Qt::BottomDockWidgetArea;-
2318 corners[Qt::BottomRightCorner] = Qt::BottomDockWidgetArea;-
2319}
never executed: end of block
0
2320-
2321bool QDockAreaLayout::isValid() const-
2322{-
2323 return rect.isValid();
never executed: return rect.isValid();
0
2324}-
2325-
2326void QDockAreaLayout::saveState(QDataStream &stream) const-
2327{-
2328 stream << (uchar) DockWidgetStateMarker;-
2329 int cnt = 0;-
2330 for (int i = 0; i < QInternal::DockCount; ++i) {
i < QInternal::DockCountDescription
TRUEnever evaluated
FALSEnever evaluated
0
2331 if (!docks[i].item_list.isEmpty())
!docks[i].item_list.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
2332 ++cnt;
never executed: ++cnt;
0
2333 }
never executed: end of block
0
2334 stream << cnt;-
2335 for (int i = 0; i < QInternal::DockCount; ++i) {
i < QInternal::DockCountDescription
TRUEnever evaluated
FALSEnever evaluated
0
2336 if (docks[i].item_list.isEmpty())
docks[i].item_list.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
2337 continue;
never executed: continue;
0
2338 stream << i << docks[i].rect.size();-
2339 docks[i].saveState(stream);-
2340 }
never executed: end of block
0
2341-
2342 stream << centralWidgetRect.size();-
2343-
2344 for (int i = 0; i < 4; ++i)
i < 4Description
TRUEnever evaluated
FALSEnever evaluated
0
2345 stream << static_cast<int>(corners[i]);
never executed: stream << static_cast<int>(corners[i]);
0
2346}
never executed: end of block
0
2347-
2348bool QDockAreaLayout::restoreState(QDataStream &stream, const QList<QDockWidget*> &_dockwidgets, bool testing)-
2349{-
2350 QList<QDockWidget*> dockwidgets = _dockwidgets;-
2351-
2352 int cnt;-
2353 stream >> cnt;-
2354 for (int i = 0; i < cnt; ++i) {
i < cntDescription
TRUEnever evaluated
FALSEnever evaluated
0
2355 int pos;-
2356 stream >> pos;-
2357 QSize size;-
2358 stream >> size;-
2359 if (!testing) {
!testingDescription
TRUEnever evaluated
FALSEnever evaluated
0
2360 docks[pos].rect = QRect(QPoint(0, 0), size);-
2361 }
never executed: end of block
0
2362 if (!docks[pos].restoreState(stream, dockwidgets, testing)) {
!docks[pos].re...gets, testing)Description
TRUEnever evaluated
FALSEnever evaluated
0
2363 stream.setStatus(QDataStream::ReadCorruptData);-
2364 return false;
never executed: return false;
0
2365 }-
2366 }
never executed: end of block
0
2367-
2368 QSize size;-
2369 stream >> size;-
2370 centralWidgetRect = QRect(QPoint(0, 0), size);-
2371-
2372 bool ok = stream.status() == QDataStream::Ok;-
2373-
2374 if (ok) {
okDescription
TRUEnever evaluated
FALSEnever evaluated
0
2375 int cornerData[4];-
2376 for (int i = 0; i < 4; ++i)
i < 4Description
TRUEnever evaluated
FALSEnever evaluated
0
2377 stream >> cornerData[i];
never executed: stream >> cornerData[i];
0
2378 if (stream.status() == QDataStream::Ok) {
stream.status(...DataStream::OkDescription
TRUEnever evaluated
FALSEnever evaluated
0
2379 for (int i = 0; i < 4; ++i)
i < 4Description
TRUEnever evaluated
FALSEnever evaluated
0
2380 corners[i] = static_cast<Qt::DockWidgetArea>(cornerData[i]);
never executed: corners[i] = static_cast<Qt::DockWidgetArea>(cornerData[i]);
0
2381 }
never executed: end of block
0
2382-
2383 if (!testing)
!testingDescription
TRUEnever evaluated
FALSEnever evaluated
0
2384 fallbackToSizeHints = false;
never executed: fallbackToSizeHints = false;
0
2385 }
never executed: end of block
0
2386-
2387 return ok;
never executed: return ok;
0
2388}-
2389-
2390QList<int> QDockAreaLayout::indexOfPlaceHolder(const QString &objectName) const-
2391{-
2392 for (int i = 0; i < QInternal::DockCount; ++i) {
i < QInternal::DockCountDescription
TRUEnever evaluated
FALSEnever evaluated
0
2393 QList<int> result = docks[i].indexOfPlaceHolder(objectName);-
2394 if (!result.isEmpty()) {
!result.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
2395 result.prepend(i);-
2396 return result;
never executed: return result;
0
2397 }-
2398 }
never executed: end of block
0
2399 return QList<int>();
never executed: return QList<int>();
0
2400}-
2401-
2402QList<int> QDockAreaLayout::indexOf(QWidget *dockWidget) const-
2403{-
2404 for (int i = 0; i < QInternal::DockCount; ++i) {
i < QInternal::DockCountDescription
TRUEnever evaluated
FALSEnever evaluated
0
2405 QList<int> result = docks[i].indexOf(dockWidget);-
2406 if (!result.isEmpty()) {
!result.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
2407 result.prepend(i);-
2408 return result;
never executed: return result;
0
2409 }-
2410 }
never executed: end of block
0
2411 return QList<int>();
never executed: return QList<int>();
0
2412}-
2413-
2414QList<int> QDockAreaLayout::gapIndex(const QPoint &pos) const-
2415{-
2416 QMainWindow::DockOptions opts = mainWindow->dockOptions();-
2417 bool nestingEnabled = opts & QMainWindow::AllowNestedDocks;-
2418 QDockAreaLayoutInfo::TabMode tabMode = QDockAreaLayoutInfo::NoTabs;-
2419#ifndef QT_NO_TABBAR-
2420 if (opts & QMainWindow::AllowTabbedDocks
opts & QMainWi...lowTabbedDocksDescription
TRUEnever evaluated
FALSEnever evaluated
0
2421 || opts & QMainWindow::VerticalTabs)
opts & QMainWi...::VerticalTabsDescription
TRUEnever evaluated
FALSEnever evaluated
0
2422 tabMode = QDockAreaLayoutInfo::AllowTabs;
never executed: tabMode = QDockAreaLayoutInfo::AllowTabs;
0
2423 if (opts & QMainWindow::ForceTabbedDocks)
opts & QMainWi...rceTabbedDocksDescription
TRUEnever evaluated
FALSEnever evaluated
0
2424 tabMode = QDockAreaLayoutInfo::ForceTabs;
never executed: tabMode = QDockAreaLayoutInfo::ForceTabs;
0
2425-
2426 if (tabMode == QDockAreaLayoutInfo::ForceTabs)
tabMode == QDo...nfo::ForceTabsDescription
TRUEnever evaluated
FALSEnever evaluated
0
2427 nestingEnabled = false;
never executed: nestingEnabled = false;
0
2428#endif-
2429-
2430-
2431 for (int i = 0; i < QInternal::DockCount; ++i) {
i < QInternal::DockCountDescription
TRUEnever evaluated
FALSEnever evaluated
0
2432 const QDockAreaLayoutInfo &info = docks[i];-
2433-
2434 if (!info.isEmpty() && info.rect.contains(pos)) {
!info.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
info.rect.contains(pos)Description
TRUEnever evaluated
FALSEnever evaluated
0
2435 QList<int> result-
2436 = docks[i].gapIndex(pos, nestingEnabled, tabMode);-
2437 if (!result.isEmpty())
!result.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
2438 result.prepend(i);
never executed: result.prepend(i);
0
2439 return result;
never executed: return result;
0
2440 }-
2441 }
never executed: end of block
0
2442-
2443 for (int i = 0; i < QInternal::DockCount; ++i) {
i < QInternal::DockCountDescription
TRUEnever evaluated
FALSEnever evaluated
0
2444 const QDockAreaLayoutInfo &info = docks[i];-
2445-
2446 if (info.isEmpty()) {
info.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
2447 QRect r;-
2448 switch (i) {-
2449 case QInternal::LeftDock:
never executed: case QInternal::LeftDock:
0
2450 r = QRect(rect.left(), rect.top(), EmptyDropAreaSize, rect.height());-
2451 break;
never executed: break;
0
2452 case QInternal::RightDock:
never executed: case QInternal::RightDock:
0
2453 r = QRect(rect.right() - EmptyDropAreaSize, rect.top(),-
2454 EmptyDropAreaSize, rect.height());-
2455 break;
never executed: break;
0
2456 case QInternal::TopDock:
never executed: case QInternal::TopDock:
0
2457 r = QRect(rect.left(), rect.top(), rect.width(), EmptyDropAreaSize);-
2458 break;
never executed: break;
0
2459 case QInternal::BottomDock:
never executed: case QInternal::BottomDock:
0
2460 r = QRect(rect.left(), rect.bottom() - EmptyDropAreaSize,-
2461 rect.width(), EmptyDropAreaSize);-
2462 break;
never executed: break;
0
2463 }-
2464 if (r.contains(pos)) {
r.contains(pos)Description
TRUEnever evaluated
FALSEnever evaluated
0
2465 if (opts & QMainWindow::ForceTabbedDocks && !info.item_list.isEmpty()) {
opts & QMainWi...rceTabbedDocksDescription
TRUEnever evaluated
FALSEnever evaluated
!info.item_list.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
2466 //in case of ForceTabbedDocks, we pass -1 in order to force the gap to be tabbed-
2467 //it mustn't be completely empty otherwise it won't work-
2468 return QList<int>() << i << -1 << 0;
never executed: return QList<int>() << i << -1 << 0;
0
2469 } else {-
2470 return QList<int>() << i << 0;
never executed: return QList<int>() << i << 0;
0
2471 }-
2472 }-
2473 }
never executed: end of block
0
2474 }
never executed: end of block
0
2475-
2476 return QList<int>();
never executed: return QList<int>();
0
2477}-
2478-
2479QList<int> QDockAreaLayout::findSeparator(const QPoint &pos) const-
2480{-
2481 QList<int> result;-
2482 for (int i = 0; i < QInternal::DockCount; ++i) {
i < QInternal::DockCountDescription
TRUEnever evaluated
FALSEnever evaluated
0
2483 const QDockAreaLayoutInfo &info = docks[i];-
2484 if (info.isEmpty())
info.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
2485 continue;
never executed: continue;
0
2486 QRect rect = separatorRect(i);-
2487 if (!rect.isNull() && sep == 1)
!rect.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
sep == 1Description
TRUEnever evaluated
FALSEnever evaluated
0
2488 rect.adjust(-2, -2, 2, 2);
never executed: rect.adjust(-2, -2, 2, 2);
0
2489 if (rect.contains(pos) && !info.hasFixedSize()) {
rect.contains(pos)Description
TRUEnever evaluated
FALSEnever evaluated
!info.hasFixedSize()Description
TRUEnever evaluated
FALSEnever evaluated
0
2490 result << i;-
2491 break;
never executed: break;
0
2492 } else if (info.rect.contains(pos)) {
info.rect.contains(pos)Description
TRUEnever evaluated
FALSEnever evaluated
0
2493 result = docks[i].findSeparator(pos);-
2494 if (!result.isEmpty()) {
!result.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
2495 result.prepend(i);-
2496 break;
never executed: break;
0
2497 }-
2498 }
never executed: end of block
0
2499 }
never executed: end of block
0
2500-
2501 return result;
never executed: return result;
0
2502}-
2503-
2504QDockAreaLayoutInfo *QDockAreaLayout::info(QWidget *widget)-
2505{-
2506 for (int i = 0; i < QInternal::DockCount; ++i) {
i < QInternal::DockCountDescription
TRUEnever evaluated
FALSEnever evaluated
0
2507 if (QDockAreaLayoutInfo *result = docks[i].info(widget))
QDockAreaLayou...].info(widget)Description
TRUEnever evaluated
FALSEnever evaluated
0
2508 return result;
never executed: return result;
0
2509 }
never executed: end of block
0
2510-
2511 return 0;
never executed: return 0;
0
2512}-
2513-
2514QDockAreaLayoutInfo *QDockAreaLayout::info(const QList<int> &path)-
2515{-
2516 Q_ASSERT(!path.isEmpty());-
2517 const int index = path.first();-
2518 Q_ASSERT(index >= 0 && index < QInternal::DockCount);-
2519-
2520 if (path.count() == 1)
path.count() == 1Description
TRUEnever evaluated
FALSEnever evaluated
0
2521 return &docks[index];
never executed: return &docks[index];
0
2522-
2523 return docks[index].info(path.mid(1));
never executed: return docks[index].info(path.mid(1));
0
2524}-
2525-
2526const QDockAreaLayoutInfo *QDockAreaLayout::info(const QList<int> &path) const-
2527{-
2528 return const_cast<QDockAreaLayout*>(this)->info(path);
never executed: return const_cast<QDockAreaLayout*>(this)->info(path);
0
2529}-
2530-
2531QDockAreaLayoutItem &QDockAreaLayout::item(const QList<int> &path)-
2532{-
2533 Q_ASSERT(!path.isEmpty());-
2534 const int index = path.first();-
2535 Q_ASSERT(index >= 0 && index < QInternal::DockCount);-
2536 return docks[index].item(path.mid(1));
never executed: return docks[index].item(path.mid(1));
0
2537}-
2538-
2539QRect QDockAreaLayout::itemRect(const QList<int> &path) const-
2540{-
2541 Q_ASSERT(!path.isEmpty());-
2542 const int index = path.first();-
2543 Q_ASSERT(index >= 0 && index < QInternal::DockCount);-
2544 return docks[index].itemRect(path.mid(1));
never executed: return docks[index].itemRect(path.mid(1));
0
2545}-
2546-
2547QRect QDockAreaLayout::separatorRect(int index) const-
2548{-
2549 const QDockAreaLayoutInfo &dock = docks[index];-
2550 if (dock.isEmpty())
dock.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
2551 return QRect();
never executed: return QRect();
0
2552 QRect r = dock.rect;-
2553 switch (index) {-
2554 case QInternal::LeftDock:
never executed: case QInternal::LeftDock:
0
2555 return QRect(r.right() + 1, r.top(), sep, r.height());
never executed: return QRect(r.right() + 1, r.top(), sep, r.height());
0
2556 case QInternal::RightDock:
never executed: case QInternal::RightDock:
0
2557 return QRect(r.left() - sep, r.top(), sep, r.height());
never executed: return QRect(r.left() - sep, r.top(), sep, r.height());
0
2558 case QInternal::TopDock:
never executed: case QInternal::TopDock:
0
2559 return QRect(r.left(), r.bottom() + 1, r.width(), sep);
never executed: return QRect(r.left(), r.bottom() + 1, r.width(), sep);
0
2560 case QInternal::BottomDock:
never executed: case QInternal::BottomDock:
0
2561 return QRect(r.left(), r.top() - sep, r.width(), sep);
never executed: return QRect(r.left(), r.top() - sep, r.width(), sep);
0
2562 default:
never executed: default:
0
2563 break;
never executed: break;
0
2564 }-
2565 return QRect();
never executed: return QRect();
0
2566}-
2567-
2568QRect QDockAreaLayout::separatorRect(const QList<int> &path) const-
2569{-
2570 Q_ASSERT(!path.isEmpty());-
2571-
2572 const int index = path.first();-
2573 Q_ASSERT(index >= 0 && index < QInternal::DockCount);-
2574-
2575 if (path.count() == 1)
path.count() == 1Description
TRUEnever evaluated
FALSEnever evaluated
0
2576 return separatorRect(index);
never executed: return separatorRect(index);
0
2577 else-
2578 return docks[index].separatorRect(path.mid(1));
never executed: return docks[index].separatorRect(path.mid(1));
0
2579}-
2580-
2581bool QDockAreaLayout::insertGap(const QList<int> &path, QLayoutItem *dockWidgetItem)-
2582{-
2583 Q_ASSERT(!path.isEmpty());-
2584 const int index = path.first();-
2585 Q_ASSERT(index >= 0 && index < QInternal::DockCount);-
2586 return docks[index].insertGap(path.mid(1), dockWidgetItem);
never executed: return docks[index].insertGap(path.mid(1), dockWidgetItem);
0
2587}-
2588-
2589QLayoutItem *QDockAreaLayout::plug(const QList<int> &path)-
2590{-
2591 Q_ASSERT(!path.isEmpty());-
2592 const int index = path.first();-
2593 Q_ASSERT(index >= 0 && index < QInternal::DockCount);-
2594 return docks[index].plug(path.mid(1));
never executed: return docks[index].plug(path.mid(1));
0
2595}-
2596-
2597QLayoutItem *QDockAreaLayout::unplug(const QList<int> &path)-
2598{-
2599 Q_ASSERT(!path.isEmpty());-
2600 const int index = path.first();-
2601 Q_ASSERT(index >= 0 && index < QInternal::DockCount);-
2602 return docks[index].unplug(path.mid(1));
never executed: return docks[index].unplug(path.mid(1));
0
2603}-
2604-
2605void QDockAreaLayout::remove(const QList<int> &path)-
2606{-
2607 Q_ASSERT(!path.isEmpty());-
2608 const int index = path.first();-
2609 Q_ASSERT(index >= 0 && index < QInternal::DockCount);-
2610 docks[index].remove(path.mid(1));-
2611}
never executed: end of block
0
2612-
2613void QDockAreaLayout::removePlaceHolder(const QString &name)-
2614{-
2615 QList<int> index = indexOfPlaceHolder(name);-
2616 if (!index.isEmpty())
!index.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
2617 remove(index);
never executed: remove(index);
0
2618 foreach (QDockWidgetGroupWindow *dwgw, mainWindow->findChildren<QDockWidgetGroupWindow *>(-
2619 QString(), Qt::FindDirectChildrenOnly)) {-
2620 index = dwgw->layoutInfo()->indexOfPlaceHolder(name);-
2621 if (!index.isEmpty()) {
!index.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
2622 dwgw->layoutInfo()->remove(index);-
2623 dwgw->destroyOrHideIfEmpty();-
2624 }
never executed: end of block
0
2625 }
never executed: end of block
0
2626}
never executed: end of block
0
2627-
2628static
never executed: return qMax(i1, qMax(i2, i3));
inline int qMax(int i1, int i2, int i3) { return qMax(i1, qMax(i2, i3)); }
never executed: return qMax(i1, qMax(i2, i3));
0
2629-
2630void QDockAreaLayout::getGrid(QVector<QLayoutStruct> *_ver_struct_list,-
2631 QVector<QLayoutStruct> *_hor_struct_list)-
2632{-
2633 QSize center_hint(0, 0);-
2634 QSize center_min(0, 0);-
2635 QSize center_max(0, 0);-
2636 const bool have_central = centralWidgetItem != 0 && !centralWidgetItem->isEmpty();
centralWidgetItem != 0Description
TRUEnever evaluated
FALSEnever evaluated
!centralWidgetItem->isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
2637 if (have_central) {
have_centralDescription
TRUEnever evaluated
FALSEnever evaluated
0
2638 center_hint = centralWidgetRect.size();-
2639 if (!center_hint.isValid())
!center_hint.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
0
2640 center_hint = centralWidgetItem->sizeHint();
never executed: center_hint = centralWidgetItem->sizeHint();
0
2641 center_min = centralWidgetItem->minimumSize();-
2642 center_max = centralWidgetItem->maximumSize();-
2643 }
never executed: end of block
0
2644-
2645 QRect center_rect = rect;-
2646 if (!docks[QInternal::LeftDock].isEmpty())
!docks[QIntern...ock].isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
2647 center_rect.setLeft(rect.left() + docks[QInternal::LeftDock].rect.width() + sep);
never executed: center_rect.setLeft(rect.left() + docks[QInternal::LeftDock].rect.width() + sep);
0
2648 if (!docks[QInternal::TopDock].isEmpty())
!docks[QIntern...ock].isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
2649 center_rect.setTop(rect.top() + docks[QInternal::TopDock].rect.height() + sep);
never executed: center_rect.setTop(rect.top() + docks[QInternal::TopDock].rect.height() + sep);
0
2650 if (!docks[QInternal::RightDock].isEmpty())
!docks[QIntern...ock].isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
2651 center_rect.setRight(rect.right() - docks[QInternal::RightDock].rect.width() - sep);
never executed: center_rect.setRight(rect.right() - docks[QInternal::RightDock].rect.width() - sep);
0
2652 if (!docks[QInternal::BottomDock].isEmpty())
!docks[QIntern...ock].isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
2653 center_rect.setBottom(rect.bottom() - docks[QInternal::BottomDock].rect.height() - sep);
never executed: center_rect.setBottom(rect.bottom() - docks[QInternal::BottomDock].rect.height() - sep);
0
2654-
2655 QSize left_hint = docks[QInternal::LeftDock].size();-
2656 if (left_hint.isNull() || fallbackToSizeHints)
left_hint.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
fallbackToSizeHintsDescription
TRUEnever evaluated
FALSEnever evaluated
0
2657 left_hint = docks[QInternal::LeftDock].sizeHint();
never executed: left_hint = docks[QInternal::LeftDock].sizeHint();
0
2658 QSize left_min = docks[QInternal::LeftDock].minimumSize();-
2659 QSize left_max = docks[QInternal::LeftDock].maximumSize();-
2660 left_hint = left_hint.boundedTo(left_max).expandedTo(left_min);-
2661-
2662 QSize right_hint = docks[QInternal::RightDock].size();-
2663 if (right_hint.isNull() || fallbackToSizeHints)
right_hint.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
fallbackToSizeHintsDescription
TRUEnever evaluated
FALSEnever evaluated
0
2664 right_hint = docks[QInternal::RightDock].sizeHint();
never executed: right_hint = docks[QInternal::RightDock].sizeHint();
0
2665 QSize right_min = docks[QInternal::RightDock].minimumSize();-
2666 QSize right_max = docks[QInternal::RightDock].maximumSize();-
2667 right_hint = right_hint.boundedTo(right_max).expandedTo(right_min);-
2668-
2669 QSize top_hint = docks[QInternal::TopDock].size();-
2670 if (top_hint.isNull() || fallbackToSizeHints)
top_hint.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
fallbackToSizeHintsDescription
TRUEnever evaluated
FALSEnever evaluated
0
2671 top_hint = docks[QInternal::TopDock].sizeHint();
never executed: top_hint = docks[QInternal::TopDock].sizeHint();
0
2672 QSize top_min = docks[QInternal::TopDock].minimumSize();-
2673 QSize top_max = docks[QInternal::TopDock].maximumSize();-
2674 top_hint = top_hint.boundedTo(top_max).expandedTo(top_min);-
2675-
2676 QSize bottom_hint = docks[QInternal::BottomDock].size();-
2677 if (bottom_hint.isNull() || fallbackToSizeHints)
bottom_hint.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
fallbackToSizeHintsDescription
TRUEnever evaluated
FALSEnever evaluated
0
2678 bottom_hint = docks[QInternal::BottomDock].sizeHint();
never executed: bottom_hint = docks[QInternal::BottomDock].sizeHint();
0
2679 QSize bottom_min = docks[QInternal::BottomDock].minimumSize();-
2680 QSize bottom_max = docks[QInternal::BottomDock].maximumSize();-
2681 bottom_hint = bottom_hint.boundedTo(bottom_max).expandedTo(bottom_min);-
2682-
2683 if (_ver_struct_list != 0) {
_ver_struct_list != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
2684 QVector<QLayoutStruct> &ver_struct_list = *_ver_struct_list;-
2685 ver_struct_list.resize(3);-
2686-
2687 // top ---------------------------------------------------
2688 ver_struct_list[0].init();-
2689 ver_struct_list[0].stretch = 0;-
2690 ver_struct_list[0].sizeHint = top_hint.height();-
2691 ver_struct_list[0].minimumSize = top_min.height();-
2692 ver_struct_list[0].maximumSize = top_max.height();-
2693 ver_struct_list[0].expansive = false;-
2694 ver_struct_list[0].empty = docks[QInternal::TopDock].isEmpty();-
2695 ver_struct_list[0].pos = docks[QInternal::TopDock].rect.top();-
2696 ver_struct_list[0].size = docks[QInternal::TopDock].rect.height();-
2697-
2698 // center ---------------------------------------------------
2699 ver_struct_list[1].init();-
2700 ver_struct_list[1].stretch = center_hint.height();-
2701-
2702 bool tl_significant = corners[Qt::TopLeftCorner] == Qt::TopDockWidgetArea
corners[Qt::To...DockWidgetAreaDescription
TRUEnever evaluated
FALSEnever evaluated
0
2703 || docks[QInternal::TopDock].isEmpty();
docks[QInterna...ock].isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
2704 bool bl_significant = corners[Qt::BottomLeftCorner] == Qt::BottomDockWidgetArea
corners[Qt::Bo...DockWidgetAreaDescription
TRUEnever evaluated
FALSEnever evaluated
0
2705 || docks[QInternal::BottomDock].isEmpty();
docks[QInterna...ock].isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
2706 bool tr_significant = corners[Qt::TopRightCorner] == Qt::TopDockWidgetArea
corners[Qt::To...DockWidgetAreaDescription
TRUEnever evaluated
FALSEnever evaluated
0
2707 || docks[QInternal::TopDock].isEmpty();
docks[QInterna...ock].isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
2708 bool br_significant = corners[Qt::BottomRightCorner] == Qt::BottomDockWidgetArea
corners[Qt::Bo...DockWidgetAreaDescription
TRUEnever evaluated
FALSEnever evaluated
0
2709 || docks[QInternal::BottomDock].isEmpty();
docks[QInterna...ock].isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
2710-
2711 int left = (tl_significant && bl_significant) ? left_hint.height() : 0;
tl_significantDescription
TRUEnever evaluated
FALSEnever evaluated
bl_significantDescription
TRUEnever evaluated
FALSEnever evaluated
0
2712 int right = (tr_significant && br_significant) ? right_hint.height() : 0;
tr_significantDescription
TRUEnever evaluated
FALSEnever evaluated
br_significantDescription
TRUEnever evaluated
FALSEnever evaluated
0
2713 ver_struct_list[1].sizeHint = qMax(left, center_hint.height(), right);-
2714-
2715 left = (tl_significant && bl_significant) ? left_min.height() : 0;
tl_significantDescription
TRUEnever evaluated
FALSEnever evaluated
bl_significantDescription
TRUEnever evaluated
FALSEnever evaluated
0
2716 right = (tr_significant && br_significant) ? right_min.height() : 0;
tr_significantDescription
TRUEnever evaluated
FALSEnever evaluated
br_significantDescription
TRUEnever evaluated
FALSEnever evaluated
0
2717 ver_struct_list[1].minimumSize = qMax(left, center_min.height(), right);-
2718 ver_struct_list[1].maximumSize = center_max.height();-
2719 ver_struct_list[1].expansive = have_central;-
2720 ver_struct_list[1].empty = docks[QInternal::LeftDock].isEmpty()
docks[QInterna...ock].isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
2721 && !have_central
!have_centralDescription
TRUEnever evaluated
FALSEnever evaluated
0
2722 && docks[QInternal::RightDock].isEmpty();
docks[QInterna...ock].isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
2723 ver_struct_list[1].pos = center_rect.top();-
2724 ver_struct_list[1].size = center_rect.height();-
2725-
2726 // bottom ---------------------------------------------------
2727 ver_struct_list[2].init();-
2728 ver_struct_list[2].stretch = 0;-
2729 ver_struct_list[2].sizeHint = bottom_hint.height();-
2730 ver_struct_list[2].minimumSize = bottom_min.height();-
2731 ver_struct_list[2].maximumSize = bottom_max.height();-
2732 ver_struct_list[2].expansive = false;-
2733 ver_struct_list[2].empty = docks[QInternal::BottomDock].isEmpty();-
2734 ver_struct_list[2].pos = docks[QInternal::BottomDock].rect.top();-
2735 ver_struct_list[2].size = docks[QInternal::BottomDock].rect.height();-
2736-
2737 for (int i = 0; i < 3; ++i) {
i < 3Description
TRUEnever evaluated
FALSEnever evaluated
0
2738 ver_struct_list[i].sizeHint-
2739 = qMax(ver_struct_list[i].sizeHint, ver_struct_list[i].minimumSize);-
2740 }
never executed: end of block
0
2741 if (have_central && ver_struct_list[0].empty && ver_struct_list[2].empty)
have_centralDescription
TRUEnever evaluated
FALSEnever evaluated
ver_struct_list[0].emptyDescription
TRUEnever evaluated
FALSEnever evaluated
ver_struct_list[2].emptyDescription
TRUEnever evaluated
FALSEnever evaluated
0
2742 ver_struct_list[1].maximumSize = QWIDGETSIZE_MAX;
never executed: ver_struct_list[1].maximumSize = ((1<<24)-1);
0
2743 }
never executed: end of block
0
2744-
2745 if (_hor_struct_list != 0) {
_hor_struct_list != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
2746 QVector<QLayoutStruct> &hor_struct_list = *_hor_struct_list;-
2747 hor_struct_list.resize(3);-
2748-
2749 // left ---------------------------------------------------
2750 hor_struct_list[0].init();-
2751 hor_struct_list[0].stretch = 0;-
2752 hor_struct_list[0].sizeHint = left_hint.width();-
2753 hor_struct_list[0].minimumSize = left_min.width();-
2754 hor_struct_list[0].maximumSize = left_max.width();-
2755 hor_struct_list[0].expansive = false;-
2756 hor_struct_list[0].empty = docks[QInternal::LeftDock].isEmpty();-
2757 hor_struct_list[0].pos = docks[QInternal::LeftDock].rect.left();-
2758 hor_struct_list[0].size = docks[QInternal::LeftDock].rect.width();-
2759-
2760 // center ---------------------------------------------------
2761 hor_struct_list[1].init();-
2762 hor_struct_list[1].stretch = center_hint.width();-
2763-
2764 bool tl_significant = corners[Qt::TopLeftCorner] == Qt::LeftDockWidgetArea
corners[Qt::To...DockWidgetAreaDescription
TRUEnever evaluated
FALSEnever evaluated
0
2765 || docks[QInternal::LeftDock].isEmpty();
docks[QInterna...ock].isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
2766 bool tr_significant = corners[Qt::TopRightCorner] == Qt::RightDockWidgetArea
corners[Qt::To...DockWidgetAreaDescription
TRUEnever evaluated
FALSEnever evaluated
0
2767 || docks[QInternal::RightDock].isEmpty();
docks[QInterna...ock].isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
2768 bool bl_significant = corners[Qt::BottomLeftCorner] == Qt::LeftDockWidgetArea
corners[Qt::Bo...DockWidgetAreaDescription
TRUEnever evaluated
FALSEnever evaluated
0
2769 || docks[QInternal::LeftDock].isEmpty();
docks[QInterna...ock].isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
2770 bool br_significant = corners[Qt::BottomRightCorner] == Qt::RightDockWidgetArea
corners[Qt::Bo...DockWidgetAreaDescription
TRUEnever evaluated
FALSEnever evaluated
0
2771 || docks[QInternal::RightDock].isEmpty();
docks[QInterna...ock].isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
2772-
2773 int top = (tl_significant && tr_significant) ? top_hint.width() : 0;
tl_significantDescription
TRUEnever evaluated
FALSEnever evaluated
tr_significantDescription
TRUEnever evaluated
FALSEnever evaluated
0
2774 int bottom = (bl_significant && br_significant) ? bottom_hint.width() : 0;
bl_significantDescription
TRUEnever evaluated
FALSEnever evaluated
br_significantDescription
TRUEnever evaluated
FALSEnever evaluated
0
2775 hor_struct_list[1].sizeHint = qMax(top, center_hint.width(), bottom);-
2776-
2777 top = (tl_significant && tr_significant) ? top_min.width() : 0;
tl_significantDescription
TRUEnever evaluated
FALSEnever evaluated
tr_significantDescription
TRUEnever evaluated
FALSEnever evaluated
0
2778 bottom = (bl_significant && br_significant) ? bottom_min.width() : 0;
bl_significantDescription
TRUEnever evaluated
FALSEnever evaluated
br_significantDescription
TRUEnever evaluated
FALSEnever evaluated
0
2779 hor_struct_list[1].minimumSize = qMax(top, center_min.width(), bottom);-
2780-
2781 hor_struct_list[1].maximumSize = center_max.width();-
2782 hor_struct_list[1].expansive = have_central;-
2783 hor_struct_list[1].empty = !have_central;-
2784 hor_struct_list[1].pos = center_rect.left();-
2785 hor_struct_list[1].size = center_rect.width();-
2786-
2787 // right ---------------------------------------------------
2788 hor_struct_list[2].init();-
2789 hor_struct_list[2].stretch = 0;-
2790 hor_struct_list[2].sizeHint = right_hint.width();-
2791 hor_struct_list[2].minimumSize = right_min.width();-
2792 hor_struct_list[2].maximumSize = right_max.width();-
2793 hor_struct_list[2].expansive = false;-
2794 hor_struct_list[2].empty = docks[QInternal::RightDock].isEmpty();-
2795 hor_struct_list[2].pos = docks[QInternal::RightDock].rect.left();-
2796 hor_struct_list[2].size = docks[QInternal::RightDock].rect.width();-
2797-
2798 for (int i = 0; i < 3; ++i) {
i < 3Description
TRUEnever evaluated
FALSEnever evaluated
0
2799 hor_struct_list[i].sizeHint-
2800 = qMax(hor_struct_list[i].sizeHint, hor_struct_list[i].minimumSize);-
2801 }
never executed: end of block
0
2802 if (have_central && hor_struct_list[0].empty && hor_struct_list[2].empty)
have_centralDescription
TRUEnever evaluated
FALSEnever evaluated
hor_struct_list[0].emptyDescription
TRUEnever evaluated
FALSEnever evaluated
hor_struct_list[2].emptyDescription
TRUEnever evaluated
FALSEnever evaluated
0
2803 hor_struct_list[1].maximumSize = QWIDGETSIZE_MAX;
never executed: hor_struct_list[1].maximumSize = ((1<<24)-1);
0
2804-
2805 }
never executed: end of block
0
2806}
never executed: end of block
0
2807-
2808void QDockAreaLayout::setGrid(QVector<QLayoutStruct> *ver_struct_list,-
2809 QVector<QLayoutStruct> *hor_struct_list)-
2810{-
2811-
2812 // top ----------------------------------------------------
2813-
2814 if (!docks[QInternal::TopDock].isEmpty()) {
!docks[QIntern...ock].isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
2815 QRect r = docks[QInternal::TopDock].rect;-
2816 if (hor_struct_list != 0) {
hor_struct_list != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
2817 r.setLeft(corners[Qt::TopLeftCorner] == Qt::TopDockWidgetArea-
2818 || docks[QInternal::LeftDock].isEmpty()-
2819 ? rect.left() : hor_struct_list->at(1).pos);-
2820 r.setRight(corners[Qt::TopRightCorner] == Qt::TopDockWidgetArea-
2821 || docks[QInternal::RightDock].isEmpty()-
2822 ? rect.right() : hor_struct_list->at(2).pos - sep - 1);-
2823 }
never executed: end of block
0
2824 if (ver_struct_list != 0) {
ver_struct_list != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
2825 r.setTop(rect.top());-
2826 r.setBottom(ver_struct_list->at(1).pos - sep - 1);-
2827 }
never executed: end of block
0
2828 docks[QInternal::TopDock].rect = r;-
2829 docks[QInternal::TopDock].fitItems();-
2830 }
never executed: end of block
0
2831-
2832 // bottom ----------------------------------------------------
2833-
2834 if (!docks[QInternal::BottomDock].isEmpty()) {
!docks[QIntern...ock].isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
2835 QRect r = docks[QInternal::BottomDock].rect;-
2836 if (hor_struct_list != 0) {
hor_struct_list != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
2837 r.setLeft(corners[Qt::BottomLeftCorner] == Qt::BottomDockWidgetArea-
2838 || docks[QInternal::LeftDock].isEmpty()-
2839 ? rect.left() : hor_struct_list->at(1).pos);-
2840 r.setRight(corners[Qt::BottomRightCorner] == Qt::BottomDockWidgetArea-
2841 || docks[QInternal::RightDock].isEmpty()-
2842 ? rect.right() : hor_struct_list->at(2).pos - sep - 1);-
2843 }
never executed: end of block
0
2844 if (ver_struct_list != 0) {
ver_struct_list != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
2845 r.setTop(ver_struct_list->at(2).pos);-
2846 r.setBottom(rect.bottom());-
2847 }
never executed: end of block
0
2848 docks[QInternal::BottomDock].rect = r;-
2849 docks[QInternal::BottomDock].fitItems();-
2850 }
never executed: end of block
0
2851-
2852 // left ----------------------------------------------------
2853-
2854 if (!docks[QInternal::LeftDock].isEmpty()) {
!docks[QIntern...ock].isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
2855 QRect r = docks[QInternal::LeftDock].rect;-
2856 if (hor_struct_list != 0) {
hor_struct_list != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
2857 r.setLeft(rect.left());-
2858 r.setRight(hor_struct_list->at(1).pos - sep - 1);-
2859 }
never executed: end of block
0
2860 if (ver_struct_list != 0) {
ver_struct_list != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
2861 r.setTop(corners[Qt::TopLeftCorner] == Qt::LeftDockWidgetArea-
2862 || docks[QInternal::TopDock].isEmpty()-
2863 ? rect.top() : ver_struct_list->at(1).pos);-
2864 r.setBottom(corners[Qt::BottomLeftCorner] == Qt::LeftDockWidgetArea-
2865 || docks[QInternal::BottomDock].isEmpty()-
2866 ? rect.bottom() : ver_struct_list->at(2).pos - sep - 1);-
2867 }
never executed: end of block
0
2868 docks[QInternal::LeftDock].rect = r;-
2869 docks[QInternal::LeftDock].fitItems();-
2870 }
never executed: end of block
0
2871-
2872 // right ----------------------------------------------------
2873-
2874 if (!docks[QInternal::RightDock].isEmpty()) {
!docks[QIntern...ock].isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
2875 QRect r = docks[QInternal::RightDock].rect;-
2876 if (hor_struct_list != 0) {
hor_struct_list != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
2877 r.setLeft(hor_struct_list->at(2).pos);-
2878 r.setRight(rect.right());-
2879 }
never executed: end of block
0
2880 if (ver_struct_list != 0) {
ver_struct_list != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
2881 r.setTop(corners[Qt::TopRightCorner] == Qt::RightDockWidgetArea-
2882 || docks[QInternal::TopDock].isEmpty()-
2883 ? rect.top() : ver_struct_list->at(1).pos);-
2884 r.setBottom(corners[Qt::BottomRightCorner] == Qt::RightDockWidgetArea-
2885 || docks[QInternal::BottomDock].isEmpty()-
2886 ? rect.bottom() : ver_struct_list->at(2).pos - sep - 1);-
2887 }
never executed: end of block
0
2888 docks[QInternal::RightDock].rect = r;-
2889 docks[QInternal::RightDock].fitItems();-
2890 }
never executed: end of block
0
2891-
2892 // center ----------------------------------------------------
2893-
2894 if (hor_struct_list != 0) {
hor_struct_list != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
2895 centralWidgetRect.setLeft(hor_struct_list->at(1).pos);-
2896 centralWidgetRect.setWidth(hor_struct_list->at(1).size);-
2897 }
never executed: end of block
0
2898 if (ver_struct_list != 0) {
ver_struct_list != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
2899 centralWidgetRect.setTop(ver_struct_list->at(1).pos);-
2900 centralWidgetRect.setHeight(ver_struct_list->at(1).size);-
2901 }
never executed: end of block
0
2902}
never executed: end of block
0
2903-
2904void QDockAreaLayout::fitLayout()-
2905{-
2906 QVector<QLayoutStruct> ver_struct_list(3);-
2907 QVector<QLayoutStruct> hor_struct_list(3);-
2908 getGrid(&ver_struct_list, &hor_struct_list);-
2909-
2910 qGeomCalc(ver_struct_list, 0, 3, rect.top(), rect.height(), sep);-
2911 qGeomCalc(hor_struct_list, 0, 3, rect.left(), rect.width(), sep);-
2912-
2913 setGrid(&ver_struct_list, &hor_struct_list);-
2914}
never executed: end of block
0
2915-
2916void QDockAreaLayout::clear()-
2917{-
2918 for (int i = 0; i < QInternal::DockCount; ++i)
i < QInternal::DockCountDescription
TRUEnever evaluated
FALSEnever evaluated
0
2919 docks[i].clear();
never executed: docks[i].clear();
0
2920-
2921 rect = QRect();-
2922 centralWidgetRect = QRect();-
2923}
never executed: end of block
0
2924-
2925QSize QDockAreaLayout::sizeHint() const-
2926{-
2927 int left_sep = 0;-
2928 int right_sep = 0;-
2929 int top_sep = 0;-
2930 int bottom_sep = 0;-
2931-
2932 if (centralWidgetItem != 0) {
centralWidgetItem != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
2933 left_sep = docks[QInternal::LeftDock].isEmpty() ? 0 : sep;
docks[QInterna...ock].isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
2934 right_sep = docks[QInternal::RightDock].isEmpty() ? 0 : sep;
docks[QInterna...ock].isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
2935 top_sep = docks[QInternal::TopDock].isEmpty() ? 0 : sep;
docks[QInterna...ock].isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
2936 bottom_sep = docks[QInternal::BottomDock].isEmpty() ? 0 : sep;
docks[QInterna...ock].isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
2937 }
never executed: end of block
0
2938-
2939 QSize left = docks[QInternal::LeftDock].sizeHint() + QSize(left_sep, 0);-
2940 QSize right = docks[QInternal::RightDock].sizeHint() + QSize(right_sep, 0);-
2941 QSize top = docks[QInternal::TopDock].sizeHint() + QSize(0, top_sep);-
2942 QSize bottom = docks[QInternal::BottomDock].sizeHint() + QSize(0, bottom_sep);-
2943 QSize center = centralWidgetItem == 0 ? QSize(0, 0) : centralWidgetItem->sizeHint();
centralWidgetItem == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
2944-
2945 int row1 = top.width();-
2946 int row2 = left.width() + center.width() + right.width();-
2947 int row3 = bottom.width();-
2948 int col1 = left.height();-
2949 int col2 = top.height() + center.height() + bottom.height();-
2950 int col3 = right.height();-
2951-
2952 if (corners[Qt::TopLeftCorner] == Qt::LeftDockWidgetArea)
corners[Qt::To...DockWidgetAreaDescription
TRUEnever evaluated
FALSEnever evaluated
0
2953 row1 += left.width();
never executed: row1 += left.width();
0
2954 else-
2955 col1 += top.height();
never executed: col1 += top.height();
0
2956-
2957 if (corners[Qt::TopRightCorner] == Qt::RightDockWidgetArea)
corners[Qt::To...DockWidgetAreaDescription
TRUEnever evaluated
FALSEnever evaluated
0
2958 row1 += right.width();
never executed: row1 += right.width();
0
2959 else-
2960 col3 += top.height();
never executed: col3 += top.height();
0
2961-
2962 if (corners[Qt::BottomLeftCorner] == Qt::LeftDockWidgetArea)
corners[Qt::Bo...DockWidgetAreaDescription
TRUEnever evaluated
FALSEnever evaluated
0
2963 row3 += left.width();
never executed: row3 += left.width();
0
2964 else-
2965 col1 += bottom.height();
never executed: col1 += bottom.height();
0
2966-
2967 if (corners[Qt::BottomRightCorner] == Qt::RightDockWidgetArea)
corners[Qt::Bo...DockWidgetAreaDescription
TRUEnever evaluated
FALSEnever evaluated
0
2968 row3 += right.width();
never executed: row3 += right.width();
0
2969 else-
2970 col3 += bottom.height();
never executed: col3 += bottom.height();
0
2971-
2972 return QSize(qMax(row1, row2, row3), qMax(col1, col2, col3));
never executed: return QSize(qMax(row1, row2, row3), qMax(col1, col2, col3));
0
2973}-
2974-
2975QSize QDockAreaLayout::minimumSize() const-
2976{-
2977 int left_sep = 0;-
2978 int right_sep = 0;-
2979 int top_sep = 0;-
2980 int bottom_sep = 0;-
2981-
2982 if (centralWidgetItem != 0) {
centralWidgetItem != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
2983 left_sep = docks[QInternal::LeftDock].isEmpty() ? 0 : sep;
docks[QInterna...ock].isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
2984 right_sep = docks[QInternal::RightDock].isEmpty() ? 0 : sep;
docks[QInterna...ock].isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
2985 top_sep = docks[QInternal::TopDock].isEmpty() ? 0 : sep;
docks[QInterna...ock].isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
2986 bottom_sep = docks[QInternal::BottomDock].isEmpty() ? 0 : sep;
docks[QInterna...ock].isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
2987 }
never executed: end of block
0
2988-
2989 QSize left = docks[QInternal::LeftDock].minimumSize() + QSize(left_sep, 0);-
2990 QSize right = docks[QInternal::RightDock].minimumSize() + QSize(right_sep, 0);-
2991 QSize top = docks[QInternal::TopDock].minimumSize() + QSize(0, top_sep);-
2992 QSize bottom = docks[QInternal::BottomDock].minimumSize() + QSize(0, bottom_sep);-
2993 QSize center = centralWidgetItem == 0 ? QSize(0, 0) : centralWidgetItem->minimumSize();
centralWidgetItem == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
2994-
2995 int row1 = top.width();-
2996 int row2 = left.width() + center.width() + right.width();-
2997 int row3 = bottom.width();-
2998 int col1 = left.height();-
2999 int col2 = top.height() + center.height() + bottom.height();-
3000 int col3 = right.height();-
3001-
3002 if (corners[Qt::TopLeftCorner] == Qt::LeftDockWidgetArea)
corners[Qt::To...DockWidgetAreaDescription
TRUEnever evaluated
FALSEnever evaluated
0
3003 row1 += left.width();
never executed: row1 += left.width();
0
3004 else-
3005 col1 += top.height();
never executed: col1 += top.height();
0
3006-
3007 if (corners[Qt::TopRightCorner] == Qt::RightDockWidgetArea)
corners[Qt::To...DockWidgetAreaDescription
TRUEnever evaluated
FALSEnever evaluated
0
3008 row1 += right.width();
never executed: row1 += right.width();
0
3009 else-
3010 col3 += top.height();
never executed: col3 += top.height();
0
3011-
3012 if (corners[Qt::BottomLeftCorner] == Qt::LeftDockWidgetArea)
corners[Qt::Bo...DockWidgetAreaDescription
TRUEnever evaluated
FALSEnever evaluated
0
3013 row3 += left.width();
never executed: row3 += left.width();
0
3014 else-
3015 col1 += bottom.height();
never executed: col1 += bottom.height();
0
3016-
3017 if (corners[Qt::BottomRightCorner] == Qt::RightDockWidgetArea)
corners[Qt::Bo...DockWidgetAreaDescription
TRUEnever evaluated
FALSEnever evaluated
0
3018 row3 += right.width();
never executed: row3 += right.width();
0
3019 else-
3020 col3 += bottom.height();
never executed: col3 += bottom.height();
0
3021-
3022 return QSize(qMax(row1, row2, row3), qMax(col1, col2, col3));
never executed: return QSize(qMax(row1, row2, row3), qMax(col1, col2, col3));
0
3023}-
3024-
3025/*! \internal-
3026 Try to fit the given rectangle \a rect on the screen which contains-
3027 the window \a widget.-
3028 Used to compute the geometry of a dragged a dock widget that should-
3029 be shown with \a rect, but needs to be visible on the screen-
3030 */-
3031QRect QDockAreaLayout::constrainedRect(QRect rect, QWidget* widget)-
3032{-
3033 QRect desktop;-
3034 QDesktopWidget *desktopW = QApplication::desktop();-
3035 if (desktopW->isVirtualDesktop())
desktopW->isVirtualDesktop()Description
TRUEnever evaluated
FALSEnever evaluated
0
3036 desktop = desktopW->screenGeometry(rect.topLeft());
never executed: desktop = desktopW->screenGeometry(rect.topLeft());
0
3037 else-
3038 desktop = desktopW->screenGeometry(widget);
never executed: desktop = desktopW->screenGeometry(widget);
0
3039-
3040 if (desktop.isValid()) {
desktop.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
0
3041 rect.setWidth(qMin(rect.width(), desktop.width()));-
3042 rect.setHeight(qMin(rect.height(), desktop.height()));-
3043 rect.moveLeft(qMax(rect.left(), desktop.left()));-
3044 rect.moveTop(qMax(rect.top(), desktop.top()));-
3045 rect.moveRight(qMin(rect.right(), desktop.right()));-
3046 rect.moveBottom(qMin(rect.bottom(), desktop.bottom()));-
3047 }
never executed: end of block
0
3048-
3049 return rect;
never executed: return rect;
0
3050}-
3051-
3052bool QDockAreaLayout::restoreDockWidget(QDockWidget *dockWidget)-
3053{-
3054 QDockAreaLayoutItem *item = 0;-
3055 foreach (QDockWidgetGroupWindow *dwgw, mainWindow->findChildren<QDockWidgetGroupWindow *>(-
3056 QString(), Qt::FindDirectChildrenOnly)) {-
3057 QList<int> index = dwgw->layoutInfo()->indexOfPlaceHolder(dockWidget->objectName());-
3058 if (!index.isEmpty()) {
!index.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
3059 dockWidget->setParent(dwgw);-
3060 item = const_cast<QDockAreaLayoutItem *>(&dwgw->layoutInfo()->item(index));-
3061 break;
never executed: break;
0
3062 }-
3063 }
never executed: end of block
0
3064 if (!item) {
!itemDescription
TRUEnever evaluated
FALSEnever evaluated
0
3065 QList<int> index = indexOfPlaceHolder(dockWidget->objectName());-
3066 if (index.isEmpty())
index.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
3067 return false;
never executed: return false;
0
3068 item = const_cast<QDockAreaLayoutItem *>(&this->item(index));-
3069 }
never executed: end of block
0
3070-
3071 QPlaceHolderItem *placeHolder = item->placeHolderItem;-
3072 Q_ASSERT(placeHolder != 0);-
3073-
3074 item->widgetItem = new QDockWidgetItem(dockWidget);-
3075-
3076 if (placeHolder->window) {
placeHolder->windowDescription
TRUEnever evaluated
FALSEnever evaluated
0
3077 const QRect r = constrainedRect(placeHolder->topLevelRect, dockWidget);-
3078 dockWidget->d_func()->setWindowState(true, true, r);-
3079 }
never executed: end of block
0
3080 dockWidget->setVisible(!placeHolder->hidden);-
3081#ifdef Q_DEAD_CODE_FROM_QT4_X11-
3082 if (placeHolder->window) // gets rid of the X11BypassWindowManager window flag-
3083 dockWidget->d_func()->setWindowState(true);-
3084#endif-
3085-
3086 item->placeHolderItem = 0;-
3087 delete placeHolder;-
3088-
3089 return true;
never executed: return true;
0
3090}-
3091-
3092void QDockAreaLayout::addDockWidget(QInternal::DockPosition pos, QDockWidget *dockWidget,-
3093 Qt::Orientation orientation)-
3094{-
3095 QLayoutItem *dockWidgetItem = new QDockWidgetItem(dockWidget);-
3096 QDockAreaLayoutInfo &info = docks[pos];-
3097 if (orientation == info.o || info.item_list.count() <= 1) {
orientation == info.oDescription
TRUEnever evaluated
FALSEnever evaluated
info.item_list.count() <= 1Description
TRUEnever evaluated
FALSEnever evaluated
0
3098 // empty dock areas, or dock areas containing exactly one widget can have their orientation-
3099 // switched.-
3100 info.o = orientation;-
3101-
3102 QDockAreaLayoutItem new_item(dockWidgetItem);-
3103 info.item_list.append(new_item);-
3104#ifndef QT_NO_TABBAR-
3105 if (info.tabbed && !new_item.skip()) {
info.tabbedDescription
TRUEnever evaluated
FALSEnever evaluated
!new_item.skip()Description
TRUEnever evaluated
FALSEnever evaluated
0
3106 info.updateTabBar();-
3107 info.setCurrentTabId(tabId(new_item));-
3108 }
never executed: end of block
0
3109#endif-
3110 } else {
never executed: end of block
0
3111#ifndef QT_NO_TABBAR-
3112 int tbshape = info.tabBarShape;-
3113#else-
3114 int tbshape = 0;-
3115#endif-
3116 QDockAreaLayoutInfo new_info(&sep, pos, orientation, tbshape, mainWindow);-
3117 new_info.item_list.append(QDockAreaLayoutItem(new QDockAreaLayoutInfo(info)));-
3118 new_info.item_list.append(QDockAreaLayoutItem(dockWidgetItem));-
3119 info = new_info;-
3120 }
never executed: end of block
0
3121-
3122 removePlaceHolder(dockWidget->objectName());-
3123}
never executed: end of block
0
3124-
3125void QDockAreaLayout::tabifyDockWidget(QDockWidget *first, QDockWidget *second)-
3126{-
3127 const QList<int> path = indexOf(first);-
3128 if (path.isEmpty())
path.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
3129 return;
never executed: return;
0
3130-
3131 QDockAreaLayoutInfo *info = this->info(path);-
3132 Q_ASSERT(info != 0);-
3133 info->tab(path.last(), new QDockWidgetItem(second));-
3134-
3135 removePlaceHolder(second->objectName());-
3136}
never executed: end of block
0
3137-
3138void QDockAreaLayout::resizeDocks(const QList<QDockWidget *> &docks,-
3139 const QList<int> &sizes, Qt::Orientation o)-
3140{-
3141 if (Q_UNLIKELY(docks.count() != sizes.count())) {
__builtin_expe...unt()), false)Description
TRUEnever evaluated
FALSEnever evaluated
0
3142 qWarning("QMainWidget::resizeDocks: size of the lists are not the same");-
3143 return;
never executed: return;
0
3144 }-
3145 int count = docks.count();-
3146 fallbackToSizeHints = false;-
3147 for (int i = 0; i < count; ++i) {
i < countDescription
TRUEnever evaluated
FALSEnever evaluated
0
3148 QList<int> path = indexOf(docks[i]);-
3149 if (Q_UNLIKELY(path.isEmpty())) {
__builtin_expe...pty()), false)Description
TRUEnever evaluated
FALSEnever evaluated
0
3150 qWarning("QMainWidget::resizeDocks: one QDockWidget is not part of the layout");-
3151 continue;
never executed: continue;
0
3152 }-
3153 int size = sizes[i];-
3154 if (Q_UNLIKELY(size <= 0)) {
__builtin_expe... <= 0), false)Description
TRUEnever evaluated
FALSEnever evaluated
0
3155 qWarning("QMainWidget::resizeDocks: all sizes need to be larger than 0");-
3156 size = 1;-
3157 }
never executed: end of block
0
3158-
3159 while (path.size() > 1) {
path.size() > 1Description
TRUEnever evaluated
FALSEnever evaluated
0
3160 QDockAreaLayoutInfo *info = this->info(path);-
3161 if (!info->tabbed && info->o == o) {
!info->tabbedDescription
TRUEnever evaluated
FALSEnever evaluated
info->o == oDescription
TRUEnever evaluated
FALSEnever evaluated
0
3162 info->item_list[path.constLast()].size = size;-
3163 int totalSize = 0;-
3164 foreach (const QDockAreaLayoutItem &item, info->item_list) {-
3165 if (!item.skip()) {
!item.skip()Description
TRUEnever evaluated
FALSEnever evaluated
0
3166 if (totalSize != 0)
totalSize != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
3167 totalSize += sep;
never executed: totalSize += sep;
0
3168 totalSize += item.size == -1 ? pick(o, item.sizeHint()) : item.size;
item.size == -1Description
TRUEnever evaluated
FALSEnever evaluated
0
3169 }
never executed: end of block
0
3170 }
never executed: end of block
0
3171 size = totalSize;-
3172 }
never executed: end of block
0
3173 path.removeLast();-
3174 }
never executed: end of block
0
3175-
3176 const int dockNum = path.constFirst();-
3177 Q_ASSERT(dockNum < QInternal::DockCount);-
3178 QRect &r = this->docks[dockNum].rect;-
3179 QSize s = r.size();-
3180 rpick(o, s) = size;-
3181 r.setSize(s);-
3182 }
never executed: end of block
0
3183}
never executed: end of block
0
3184-
3185void QDockAreaLayout::splitDockWidget(QDockWidget *after,-
3186 QDockWidget *dockWidget,-
3187 Qt::Orientation orientation)-
3188{-
3189 const QList<int> path = indexOf(after);-
3190 if (path.isEmpty())
path.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
3191 return;
never executed: return;
0
3192-
3193 QDockAreaLayoutInfo *info = this->info(path);-
3194 Q_ASSERT(info != 0);-
3195 info->split(path.last(), orientation, new QDockWidgetItem(dockWidget));-
3196-
3197 removePlaceHolder(dockWidget->objectName());-
3198}
never executed: end of block
0
3199-
3200void QDockAreaLayout::apply(bool animate)-
3201{-
3202 QWidgetAnimator &widgetAnimator = qt_mainwindow_layout(mainWindow)->widgetAnimator;-
3203-
3204 for (int i = 0; i < QInternal::DockCount; ++i)
i < QInternal::DockCountDescription
TRUEnever evaluated
FALSEnever evaluated
0
3205 docks[i].apply(animate);
never executed: docks[i].apply(animate);
0
3206 if (centralWidgetItem != 0 && !centralWidgetItem->isEmpty()) {
centralWidgetItem != 0Description
TRUEnever evaluated
FALSEnever evaluated
!centralWidgetItem->isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
3207 widgetAnimator.animate(centralWidgetItem->widget(), centralWidgetRect,-
3208 animate);-
3209 }
never executed: end of block
0
3210#ifndef QT_NO_TABBAR-
3211 if (sep == 1)
sep == 1Description
TRUEnever evaluated
FALSEnever evaluated
0
3212 updateSeparatorWidgets();
never executed: updateSeparatorWidgets();
0
3213#endif //QT_NO_TABBAR-
3214}
never executed: end of block
0
3215-
3216void QDockAreaLayout::paintSeparators(QPainter *p, QWidget *widget,-
3217 const QRegion &clip,-
3218 const QPoint &mouse) const-
3219{-
3220 for (int i = 0; i < QInternal::DockCount; ++i) {
i < QInternal::DockCountDescription
TRUEnever evaluated
FALSEnever evaluated
0
3221 const QDockAreaLayoutInfo &dock = docks[i];-
3222 if (dock.isEmpty())
dock.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
3223 continue;
never executed: continue;
0
3224 QRect r = separatorRect(i);-
3225 if (clip.contains(r) && !dock.hasFixedSize()) {
clip.contains(r)Description
TRUEnever evaluated
FALSEnever evaluated
!dock.hasFixedSize()Description
TRUEnever evaluated
FALSEnever evaluated
0
3226 Qt::Orientation opposite = dock.o == Qt::Horizontal
dock.o == Qt::HorizontalDescription
TRUEnever evaluated
FALSEnever evaluated
0
3227 ? Qt::Vertical : Qt::Horizontal;-
3228 paintSep(p, widget, r, opposite, r.contains(mouse));-
3229 }
never executed: end of block
0
3230 if (clip.contains(dock.rect))
clip.contains(dock.rect)Description
TRUEnever evaluated
FALSEnever evaluated
0
3231 dock.paintSeparators(p, widget, clip, mouse);
never executed: dock.paintSeparators(p, widget, clip, mouse);
0
3232 }
never executed: end of block
0
3233}
never executed: end of block
0
3234-
3235QRegion QDockAreaLayout::separatorRegion() const-
3236{-
3237 QRegion result;-
3238-
3239 for (int i = 0; i < QInternal::DockCount; ++i) {
i < QInternal::DockCountDescription
TRUEnever evaluated
FALSEnever evaluated
0
3240 const QDockAreaLayoutInfo &dock = docks[i];-
3241 if (dock.isEmpty())
dock.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
3242 continue;
never executed: continue;
0
3243 result |= separatorRect(i);-
3244 result |= dock.separatorRegion();-
3245 }
never executed: end of block
0
3246-
3247 return result;
never executed: return result;
0
3248}-
3249-
3250int QDockAreaLayout::separatorMove(const QList<int> &separator, const QPoint &origin,-
3251 const QPoint &dest)-
3252{-
3253 int delta = 0;-
3254 int index = separator.last();-
3255-
3256 if (separator.count() > 1) {
separator.count() > 1Description
TRUEnever evaluated
FALSEnever evaluated
0
3257 QDockAreaLayoutInfo *info = this->info(separator);-
3258 delta = pick(info->o, dest - origin);-
3259 if (delta != 0)
delta != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
3260 delta = info->separatorMove(index, delta);
never executed: delta = info->separatorMove(index, delta);
0
3261 info->apply(false);-
3262 return delta;
never executed: return delta;
0
3263 }-
3264-
3265 QVector<QLayoutStruct> list;-
3266-
3267 if (index == QInternal::LeftDock || index == QInternal::RightDock)
index == QInternal::LeftDockDescription
TRUEnever evaluated
FALSEnever evaluated
index == QInternal::RightDockDescription
TRUEnever evaluated
FALSEnever evaluated
0
3268 getGrid(0, &list);
never executed: getGrid(0, &list);
0
3269 else-
3270 getGrid(&list, 0);
never executed: getGrid(&list, 0);
0
3271-
3272 int sep_index = index == QInternal::LeftDock || index == QInternal::TopDock
index == QInternal::LeftDockDescription
TRUEnever evaluated
FALSEnever evaluated
index == QInternal::TopDockDescription
TRUEnever evaluated
FALSEnever evaluated
0
3273 ? 0 : 1;-
3274 Qt::Orientation o = index == QInternal::LeftDock || index == QInternal::RightDock
index == QInternal::LeftDockDescription
TRUEnever evaluated
FALSEnever evaluated
index == QInternal::RightDockDescription
TRUEnever evaluated
FALSEnever evaluated
0
3275 ? Qt::Horizontal-
3276 : Qt::Vertical;-
3277-
3278 delta = pick(o, dest - origin);-
3279 delta = separatorMoveHelper(list, sep_index, delta, sep);-
3280-
3281 if (index == QInternal::LeftDock || index == QInternal::RightDock)
index == QInternal::LeftDockDescription
TRUEnever evaluated
FALSEnever evaluated
index == QInternal::RightDockDescription
TRUEnever evaluated
FALSEnever evaluated
0
3282 setGrid(0, &list);
never executed: setGrid(0, &list);
0
3283 else-
3284 setGrid(&list, 0);
never executed: setGrid(&list, 0);
0
3285-
3286 apply(false);-
3287-
3288 return delta;
never executed: return delta;
0
3289}-
3290-
3291#ifndef QT_NO_TABBAR-
3292// Sets the correct positions for the separator widgets-
3293// Allocates new sepearator widgets with getSeparatorWidget-
3294void QDockAreaLayout::updateSeparatorWidgets() const-
3295{-
3296 int j = 0;-
3297-
3298 for (int i = 0; i < QInternal::DockCount; ++i) {
i < QInternal::DockCountDescription
TRUEnever evaluated
FALSEnever evaluated
0
3299 const QDockAreaLayoutInfo &dock = docks[i];-
3300 if (dock.isEmpty())
dock.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
3301 continue;
never executed: continue;
0
3302-
3303 QWidget *sepWidget;-
3304 if (j < separatorWidgets.size()) {
j < separatorWidgets.size()Description
TRUEnever evaluated
FALSEnever evaluated
0
3305 sepWidget = separatorWidgets.at(j);-
3306 } else {
never executed: end of block
0
3307 sepWidget = qt_mainwindow_layout(mainWindow)->getSeparatorWidget();-
3308 separatorWidgets.append(sepWidget);-
3309 }
never executed: end of block
0
3310 j++;-
3311-
3312#ifndef Q_DEAD_CODE_FROM_QT4_MAC-
3313 sepWidget->raise();-
3314#endif-
3315 QRect sepRect = separatorRect(i).adjusted(-2, -2, 2, 2);-
3316 sepWidget->setGeometry(sepRect);-
3317 sepWidget->setMask( QRegion(separatorRect(i).translated( - sepRect.topLeft())));-
3318 sepWidget->show();-
3319 }
never executed: end of block
0
3320 for (int i = j; i < separatorWidgets.size(); ++i)
i < separatorWidgets.size()Description
TRUEnever evaluated
FALSEnever evaluated
0
3321 separatorWidgets.at(i)->hide();
never executed: separatorWidgets.at(i)->hide();
0
3322-
3323 separatorWidgets.resize(j);-
3324}
never executed: end of block
0
3325#endif //QT_NO_TABBAR-
3326-
3327QLayoutItem *QDockAreaLayout::itemAt(int *x, int index) const-
3328{-
3329 Q_ASSERT(x != 0);-
3330-
3331 for (int i = 0; i < QInternal::DockCount; ++i) {
i < QInternal::DockCountDescription
TRUEnever evaluated
FALSEnever evaluated
0
3332 const QDockAreaLayoutInfo &dock = docks[i];-
3333 if (QLayoutItem *ret = dock.itemAt(x, index))
QLayoutItem *r...emAt(x, index)Description
TRUEnever evaluated
FALSEnever evaluated
0
3334 return ret;
never executed: return ret;
0
3335 }
never executed: end of block
0
3336-
3337 if (centralWidgetItem && (*x)++ == index)
centralWidgetItemDescription
TRUEnever evaluated
FALSEnever evaluated
(*x)++ == indexDescription
TRUEnever evaluated
FALSEnever evaluated
0
3338 return centralWidgetItem;
never executed: return centralWidgetItem;
0
3339-
3340 return 0;
never executed: return 0;
0
3341}-
3342-
3343QLayoutItem *QDockAreaLayout::takeAt(int *x, int index)-
3344{-
3345 Q_ASSERT(x != 0);-
3346-
3347 for (int i = 0; i < QInternal::DockCount; ++i) {
i < QInternal::DockCountDescription
TRUEnever evaluated
FALSEnever evaluated
0
3348 QDockAreaLayoutInfo &dock = docks[i];-
3349 if (QLayoutItem *ret = dock.takeAt(x, index))
QLayoutItem *r...keAt(x, index)Description
TRUEnever evaluated
FALSEnever evaluated
0
3350 return ret;
never executed: return ret;
0
3351 }
never executed: end of block
0
3352-
3353 if (centralWidgetItem && (*x)++ == index) {
centralWidgetItemDescription
TRUEnever evaluated
FALSEnever evaluated
(*x)++ == indexDescription
TRUEnever evaluated
FALSEnever evaluated
0
3354 QLayoutItem *ret = centralWidgetItem;-
3355 centralWidgetItem = 0;-
3356 return ret;
never executed: return ret;
0
3357 }-
3358-
3359 return 0;
never executed: return 0;
0
3360}-
3361-
3362void QDockAreaLayout::deleteAllLayoutItems()-
3363{-
3364 for (int i = 0; i < QInternal::DockCount; ++i)
i < QInternal::DockCountDescription
TRUEnever evaluated
FALSEnever evaluated
0
3365 docks[i].deleteAllLayoutItems();
never executed: docks[i].deleteAllLayoutItems();
0
3366}
never executed: end of block
0
3367-
3368#ifndef QT_NO_TABBAR-
3369QSet<QTabBar*> QDockAreaLayout::usedTabBars() const-
3370{-
3371 QSet<QTabBar*> result;-
3372 for (int i = 0; i < QInternal::DockCount; ++i) {
i < QInternal::DockCountDescription
TRUEnever evaluated
FALSEnever evaluated
0
3373 const QDockAreaLayoutInfo &dock = docks[i];-
3374 result += dock.usedTabBars();-
3375 }
never executed: end of block
0
3376 return result;
never executed: return result;
0
3377}-
3378-
3379// Returns the set of all used separator widgets-
3380QSet<QWidget*> QDockAreaLayout::usedSeparatorWidgets() const-
3381{-
3382 QSet<QWidget*> result;-
3383 const int numSeparators = separatorWidgets.count();-
3384 result.reserve(numSeparators);-
3385 for (int i = 0; i < numSeparators; ++i)
i < numSeparatorsDescription
TRUEnever evaluated
FALSEnever evaluated
0
3386 result << separatorWidgets.at(i);
never executed: result << separatorWidgets.at(i);
0
3387 for (int i = 0; i < QInternal::DockCount; ++i) {
i < QInternal::DockCountDescription
TRUEnever evaluated
FALSEnever evaluated
0
3388 const QDockAreaLayoutInfo &dock = docks[i];-
3389 result += dock.usedSeparatorWidgets();-
3390 }
never executed: end of block
0
3391 return result;
never executed: return result;
0
3392}-
3393#endif-
3394-
3395QRect QDockAreaLayout::gapRect(const QList<int> &path) const-
3396{-
3397 const QDockAreaLayoutInfo *info = this->info(path);-
3398 if (info == 0)
info == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
3399 return QRect();
never executed: return QRect();
0
3400 const QList<QDockAreaLayoutItem> &item_list = info->item_list;-
3401 Qt::Orientation o = info->o;-
3402 int index = path.last();-
3403 if (index < 0 || index >= item_list.count())
index < 0Description
TRUEnever evaluated
FALSEnever evaluated
index >= item_list.count()Description
TRUEnever evaluated
FALSEnever evaluated
0
3404 return QRect();
never executed: return QRect();
0
3405 const QDockAreaLayoutItem &item = item_list.at(index);-
3406 if (!(item.flags & QDockAreaLayoutItem::GapItem))
!(item.flags &...Item::GapItem)Description
TRUEnever evaluated
FALSEnever evaluated
0
3407 return QRect();
never executed: return QRect();
0
3408-
3409 QRect result;-
3410-
3411#ifndef QT_NO_TABBAR-
3412 if (info->tabbed) {
info->tabbedDescription
TRUEnever evaluated
FALSEnever evaluated
0
3413 result = info->tabContentRect();-
3414 } else
never executed: end of block
0
3415#endif-
3416 {-
3417 int pos = item.pos;-
3418 int size = item.size;-
3419-
3420 int prev = info->prev(index);-
3421 int next = info->next(index);-
3422-
3423 if (prev != -1 && !(item_list.at(prev).flags & QDockAreaLayoutItem::GapItem)) {
prev != -1Description
TRUEnever evaluated
FALSEnever evaluated
!(item_list.at...Item::GapItem)Description
TRUEnever evaluated
FALSEnever evaluated
0
3424 pos += sep;-
3425 size -= sep;-
3426 }
never executed: end of block
0
3427 if (next != -1 && !(item_list.at(next).flags & QDockAreaLayoutItem::GapItem))
next != -1Description
TRUEnever evaluated
FALSEnever evaluated
!(item_list.at...Item::GapItem)Description
TRUEnever evaluated
FALSEnever evaluated
0
3428 size -= sep;
never executed: size -= sep;
0
3429-
3430 QPoint p;-
3431 rpick(o, p) = pos;-
3432 rperp(o, p) = perp(o, info->rect.topLeft());-
3433 QSize s;-
3434 rpick(o, s) = size;-
3435 rperp(o, s) = perp(o, info->rect.size());-
3436-
3437 result = QRect(p, s);-
3438 }
never executed: end of block
0
3439-
3440 return result;
never executed: return result;
0
3441}-
3442-
3443void QDockAreaLayout::keepSize(QDockWidget *w)-
3444{-
3445 QList<int> path = indexOf(w);-
3446 if (path.isEmpty())
path.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
3447 return;
never executed: return;
0
3448 QDockAreaLayoutItem &item = this->item(path);-
3449 if (item.size != -1)
item.size != -1Description
TRUEnever evaluated
FALSEnever evaluated
0
3450 item.flags |= QDockAreaLayoutItem::KeepSize;
never executed: item.flags |= QDockAreaLayoutItem::KeepSize;
0
3451}
never executed: end of block
0
3452-
3453void QDockAreaLayout::styleChangedEvent()-
3454{-
3455 sep = mainWindow->style()->pixelMetric(QStyle::PM_DockWidgetSeparatorExtent, 0, mainWindow);-
3456 if (isValid())
isValid()Description
TRUEnever evaluated
FALSEnever evaluated
0
3457 fitLayout();
never executed: fitLayout();
0
3458}
never executed: end of block
0
3459-
3460QT_END_NAMESPACE-
3461-
3462#endif // QT_NO_DOCKWIDGET-
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9