qmainwindowlayout.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/widgets/widgets/qmainwindowlayout.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8-
9-
10-
11-
12-
13-
14-
15-
16-
17-
18extern QMainWindowLayout *qt_mainwindow_layout(const QMainWindow *window);-
19-
20-
21-
22-
23-
24-
25-
26static void dumpLayout(QTextStream &qout, const QDockAreaLayoutInfo &layout, QString indent);-
27-
28static void dumpLayout(QTextStream &qout, const QDockAreaLayoutItem &item, QString indent)-
29{-
30 qout << indent << "QDockAreaLayoutItem: "-
31 << "pos: " << item.pos << " size:" << item.size-
32 << " gap:" << (item.flags & QDockAreaLayoutItem::GapItem)-
33 << " keepSize:" << (item.flags & QDockAreaLayoutItem::KeepSize) << '\n';-
34 indent += QLatin1String(" ");-
35 if (item.widgetItem != 0
item.widgetItem != 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
36 qout << indent << "widget: "-
37 << item.widgetItem->widget()->metaObject()->className()-
38 << " \"" << item.widgetItem->widget()->windowTitle() << "\"\n";-
39 }
never executed: end of block
else if (item.subinfo != 0
item.subinfo != 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
40 qout << indent << "subinfo:\n";-
41 dumpLayout(qout, *item.subinfo, indent + QLatin1String(" "));-
42 }
never executed: end of block
else if (item.placeHolderItem != 0
item.placeHolderItem != 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
43 QRect r = item.placeHolderItem->topLevelRect;-
44 qout << indent << "placeHolder: "-
45 << "pos: " << item.pos << " size:" << item.size-
46 << " gap:" << (item.flags & QDockAreaLayoutItem::GapItem)-
47 << " keepSize:" << (item.flags & QDockAreaLayoutItem::KeepSize)-
48 << " objectName:" << item.placeHolderItem->objectName-
49 << " hidden:" << item.placeHolderItem->hidden-
50 << " window:" << item.placeHolderItem->window-
51 << " rect:" << r.x() << ',' << r.y() << ' '-
52 << r.width() << 'x' << r.height() << '\n';-
53 }
never executed: end of block
0
54}
never executed: end of block
0
55-
56static void dumpLayout(QTextStream &qout, const QDockAreaLayoutInfo &layout, QString indent)-
57{-
58 const QSize minSize = layout.minimumSize();-
59 qout << indent << "QDockAreaLayoutInfo: "-
60 << layout.rect.left() << ','-
61 << layout.rect.top() << ' '-
62 << layout.rect.width() << 'x'-
63 << layout.rect.height()-
64 << " min size: " << minSize.width() << ',' << minSize.height()-
65 << " orient:" << layout.o-
66 << " tabbed:" << layout.tabbed-
67 << " tbshape:" << layout.tabBarShape << '\n';-
68-
69 indent += QLatin1String(" ");-
70-
71 for (int i = 0; i < layout.item_list.count()
i < layout.item_list.count()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
72 qout << indent << "Item: " << i << '\n';-
73 dumpLayout(qout, layout.item_list.at(i), indent + QLatin1String(" "));-
74 }
never executed: end of block
0
75}
never executed: end of block
0
76-
77static void dumpLayout(QTextStream &qout, const QDockAreaLayout &layout)-
78{-
79 qout << "QDockAreaLayout: "-
80 << layout.rect.left() << ','-
81 << layout.rect.top() << ' '-
82 << layout.rect.width() << 'x'-
83 << layout.rect.height() << '\n';-
84-
85 qout << "TopDockArea:\n";-
86 dumpLayout(qout, layout.docks[QInternal::TopDock], QLatin1String(" "));-
87 qout << "LeftDockArea:\n";-
88 dumpLayout(qout, layout.docks[QInternal::LeftDock], QLatin1String(" "));-
89 qout << "RightDockArea:\n";-
90 dumpLayout(qout, layout.docks[QInternal::RightDock], QLatin1String(" "));-
91 qout << "BottomDockArea:\n";-
92 dumpLayout(qout, layout.docks[QInternal::BottomDock], QLatin1String(" "));-
93}
never executed: end of block
0
94-
95QDebug operator<<(QDebug debug, const QDockAreaLayout &layout)-
96{-
97 QString s;-
98 QTextStream str(&s);-
99 dumpLayout(str, layout);-
100 debug << s;-
101 return
never executed: return debug;
debug;
never executed: return debug;
0
102}-
103-
104QDebug operator<<(QDebug debug, const QMainWindowLayout *layout)-
105{-
106 debug << layout->layoutState.dockAreaLayout;-
107 return
never executed: return debug;
debug;
never executed: return debug;
0
108}-
109class QDockWidgetGroupLayout : public QLayout {-
110 QDockAreaLayoutInfo info;-
111 QWidgetResizeHandler *resizer;-
112public:-
113 QDockWidgetGroupLayout(QWidget* parent) : QLayout(parent) {-
114 setSizeConstraint(QLayout::SetMinAndMaxSize);-
115 resizer = new QWidgetResizeHandler(parent);-
116 resizer->setMovingEnabled(false);-
117 }
never executed: end of block
0
118 ~QDockWidgetGroupLayout() {-
119 info.deleteAllLayoutItems();-
120 }
never executed: end of block
0
121-
122 void addItem(QLayoutItem*) override { do { ((!(false)) ? qt_assert_x("Q_UNREACHABLE()", "Q_UNREACHABLE was reached",__FILE__,195) : qt_noop()); __builtin_unreachable(); } while (0); }
never executed: end of block
0
123 int count() const override { return
never executed: return 0;
0;
never executed: return 0;
}
0
124 QLayoutItem* itemAt(int index) const override-
125 {-
126 int x = 0;-
127 return
never executed: return info.itemAt(&x, index);
info.itemAt(&x, index);
never executed: return info.itemAt(&x, index);
0
128 }-
129 QLayoutItem* takeAt(int index) override-
130 {-
131 int x = 0;-
132 return
never executed: return info.takeAt(&x, index);
info.takeAt(&x, index);
never executed: return info.takeAt(&x, index);
0
133 }-
134 QSize sizeHint() const override-
135 {-
136 int fw = frameWidth();-
137 return
never executed: return info.sizeHint() + QSize(fw, fw);
info.sizeHint() + QSize(fw, fw);
never executed: return info.sizeHint() + QSize(fw, fw);
0
138 }-
139 QSize minimumSize() const override-
140 {-
141 int fw = frameWidth();-
142 return
never executed: return info.minimumSize() + QSize(fw, fw);
info.minimumSize() + QSize(fw, fw);
never executed: return info.minimumSize() + QSize(fw, fw);
0
143 }-
144 QSize maximumSize() const override-
145 {-
146 int fw = frameWidth();-
147 return
never executed: return info.maximumSize() + QSize(fw, fw);
info.maximumSize() + QSize(fw, fw);
never executed: return info.maximumSize() + QSize(fw, fw);
0
148 }-
149 void setGeometry(const QRect&r) override-
150 {-
151 static_cast<QDockWidgetGroupWindow *>(parent())->destroyOrHideIfEmpty();-
152 QDockAreaLayoutInfo *li = layoutInfo();-
153 if (li->isEmpty()
li->isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
154 return;
never executed: return;
0
155 int fw = frameWidth();-
156 li->reparentWidgets(parentWidget());-
157 li->rect = r.adjusted(fw, fw, -fw, -fw);-
158 li->fitItems();-
159 li->apply(false);-
160 resizer->setActive(QWidgetResizeHandler::Resize, !nativeWindowDeco());-
161 }
never executed: end of block
0
162-
163 QDockAreaLayoutInfo *layoutInfo() {-
164 return
never executed: return &info;
&info;
never executed: return &info;
0
165 }-
166-
167 bool nativeWindowDeco() const-
168 {-
169 return
never executed: return QDockWidgetLayout::wmSupportsNativeWindowDeco();
QDockWidgetLayout::wmSupportsNativeWindowDeco();
never executed: return QDockWidgetLayout::wmSupportsNativeWindowDeco();
0
170 }-
171-
172 int frameWidth() const-
173 {-
174 return
never executed: return nativeWindowDeco() ? 0 : parentWidget()->style()->pixelMetric(QStyle::PM_DockWidgetFrameWidth, 0, parentWidget());
nativeWindowDeco() ? 0 :
never executed: return nativeWindowDeco() ? 0 : parentWidget()->style()->pixelMetric(QStyle::PM_DockWidgetFrameWidth, 0, parentWidget());
0
175 parentWidget()->style()->pixelMetric(QStyle::PM_DockWidgetFrameWidth, 0, parentWidget());
never executed: return nativeWindowDeco() ? 0 : parentWidget()->style()->pixelMetric(QStyle::PM_DockWidgetFrameWidth, 0, parentWidget());
0
176 }-
177};-
178-
179bool QDockWidgetGroupWindow::event(QEvent *e)-
180{-
181 switch (e->type()) {-
182 case
never executed: case QEvent::Close:
QEvent::Close:
never executed: case QEvent::Close:
0
183-
184 if (QDockWidget *dw = topDockWidget()
QDockWidget *d...opDockWidget()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
185 e->ignore();-
186 dw->close();-
187 adjustFlags();-
188 }
never executed: end of block
0
189 return
never executed: return true;
true;
never executed: return true;
0
190 case
never executed: case QEvent::Move:
QEvent::Move:
never executed: case QEvent::Move:
0
191-
192 if (QDockWidget *dw = topDockWidget()
QDockWidget *d...opDockWidget()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
193 static_cast<
never executed: static_cast<QDockWidgetPrivate *>(QObjectPrivate::get(dw))->moveEvent(static_cast<QMoveEvent*>(e));
QDockWidgetPrivate *>(QObjectPrivate::get(dw))->moveEvent(static_cast<QMoveEvent*>(e));
never executed: static_cast<QDockWidgetPrivate *>(QObjectPrivate::get(dw))->moveEvent(static_cast<QMoveEvent*>(e));
0
194 return
never executed: return true;
true;
never executed: return true;
0
195 case
never executed: case QEvent::NonClientAreaMouseMove:
QEvent::NonClientAreaMouseMove:
never executed: case QEvent::NonClientAreaMouseMove:
0
196 case
never executed: case QEvent::NonClientAreaMouseButtonPress:
QEvent::NonClientAreaMouseButtonPress:
never executed: case QEvent::NonClientAreaMouseButtonPress:
0
197 case
never executed: case QEvent::NonClientAreaMouseButtonRelease:
QEvent::NonClientAreaMouseButtonRelease:
never executed: case QEvent::NonClientAreaMouseButtonRelease:
0
198 case
never executed: case QEvent::NonClientAreaMouseButtonDblClick:
QEvent::NonClientAreaMouseButtonDblClick:
never executed: case QEvent::NonClientAreaMouseButtonDblClick:
0
199-
200 if (QDockWidget *dw = topDockWidget()
QDockWidget *d...opDockWidget()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
201 static_cast<
never executed: static_cast<QDockWidgetPrivate *>(QObjectPrivate::get(dw))->nonClientAreaMouseEvent(static_cast<QMouseEvent*>(e));
QDockWidgetPrivate *>(QObjectPrivate::get(dw))->nonClientAreaMouseEvent(static_cast<QMouseEvent*>(e));
never executed: static_cast<QDockWidgetPrivate *>(QObjectPrivate::get(dw))->nonClientAreaMouseEvent(static_cast<QMouseEvent*>(e));
0
202 return
never executed: return true;
true;
never executed: return true;
0
203 case
never executed: case QEvent::ChildAdded:
QEvent::ChildAdded:
never executed: case QEvent::ChildAdded:
0
204 if (qobject_cast<QDockWidget *>(static_cast<QChildEvent*>(e)->child())
qobject_cast<Q...>(e)->child())Description
TRUEnever evaluated
FALSEnever evaluated
)
0
205 adjustFlags();
never executed: adjustFlags();
0
206 break;
never executed: break;
0
207 case
never executed: case QEvent::LayoutRequest:
QEvent::LayoutRequest:
never executed: case QEvent::LayoutRequest:
0
208-
209 destroyOrHideIfEmpty();-
210 break;
never executed: break;
0
211 default
never executed: default:
:
never executed: default:
0
212 break;
never executed: break;
0
213 }-
214 return
never executed: return QWidget::event(e);
QWidget::event(e);
never executed: return QWidget::event(e);
0
215}-
216-
217void QDockWidgetGroupWindow::paintEvent(QPaintEvent *)-
218{-
219 QDockWidgetGroupLayout *lay = static_cast<QDockWidgetGroupLayout *>(layout());-
220 bool nativeDeco = lay->nativeWindowDeco();-
221-
222 if (!nativeDeco
!nativeDecoDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
223 QStyleOptionFrame framOpt;-
224 framOpt.init(this);-
225 QStylePainter p(this);-
226 p.drawPrimitive(QStyle::PE_FrameDockWidget, framOpt);-
227 }
never executed: end of block
0
228}
never executed: end of block
0
229-
230QDockAreaLayoutInfo *QDockWidgetGroupWindow::layoutInfo() const-
231{-
232 return
never executed: return static_cast<QDockWidgetGroupLayout*>(layout())->layoutInfo();
static_cast<QDockWidgetGroupLayout*>(layout())->layoutInfo();
never executed: return static_cast<QDockWidgetGroupLayout*>(layout())->layoutInfo();
0
233}-
234-
235-
236-
237-
238QDockWidget *QDockWidgetGroupWindow::topDockWidget() const-
239{-
240 QDockAreaLayoutInfo *info = layoutInfo();-
241 QDockWidget *dw = 0;-
242 if (info->tabBar
info->tabBarDescription
TRUEnever evaluated
FALSEnever evaluated
&& info->tabBar->currentIndex() >= 0
info->tabBar->...ntIndex() >= 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
243 int i = info->tabIndexToListIndex(info->tabBar->currentIndex());-
244 if (i >= 0
i >= 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
245 const QDockAreaLayoutItem &item = info->item_list.at(i);-
246 if (item.widgetItem
item.widgetItemDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
247 dw = qobject_cast<QDockWidget *>(item.widgetItem->widget());
never executed: dw = qobject_cast<QDockWidget *>(item.widgetItem->widget());
0
248 }
never executed: end of block
0
249 }
never executed: end of block
0
250 if (!dw
!dwDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
251 for (int i = 0; !dw
!dwDescription
TRUEnever evaluated
FALSEnever evaluated
&& i < info->item_list.count()
i < info->item_list.count()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
252 const QDockAreaLayoutItem &item = info->item_list.at(i);-
253 if (item.skip()
item.skip()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
254 continue;
never executed: continue;
0
255 if (!item.widgetItem
!item.widgetItemDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
256 continue;
never executed: continue;
0
257 dw = qobject_cast<QDockWidget *>(item.widgetItem->widget());-
258 }
never executed: end of block
0
259 }
never executed: end of block
0
260 return
never executed: return dw;
dw;
never executed: return dw;
0
261}-
262-
263-
264-
265-
266-
267void QDockWidgetGroupWindow::destroyOrHideIfEmpty()-
268{-
269 if (!layoutInfo()->isEmpty()
!layoutInfo()->isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
270 show();-
271 return;
never executed: return;
0
272 }-
273-
274 if (!layoutInfo()->item_list.isEmpty()
!layoutInfo()-...list.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
275 hide();-
276 return;
never executed: return;
0
277 }-
278-
279-
280 for (QForeachContainer<typename QtPrivate::remove_reference<decltype(findChildren<QDockWidget *>(QString(), Qt::FindDirectChildrenOnly))>::type> _container_((findChildren<QDockWidget *>(QString(), Qt::FindDirectChildrenOnly))); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QDockWidget *dw = *_container_.i; _container_.control; _container_.control = 0) {-
281 bool wasFloating = dw->isFloating();-
282 bool wasHidden = dw->isHidden();-
283 dw->setParent(parentWidget());-
284 if (wasFloating
wasFloatingDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
285 dw->setFloating(true);-
286 }
never executed: end of block
else {
0
287-
288 QMainWindowLayout *ml =-
289 qt_mainwindow_layout(static_cast<QMainWindow *>(parentWidget()));-
290 Qt::DockWidgetArea area = ml->dockWidgetArea(this);-
291 if (area == Qt::NoDockWidgetArea
area == Qt::NoDockWidgetAreaDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
292 area = Qt::LeftDockWidgetArea;
never executed: area = Qt::LeftDockWidgetArea;
0
293 static_cast<QMainWindow *>(parentWidget())->addDockWidget(area, dw);-
294 }
never executed: end of block
0
295 if (!wasHidden
!wasHiddenDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
296 dw->show();
never executed: dw->show();
0
297 }
never executed: end of block
0
298 for (QForeachContainer<typename QtPrivate::remove_reference<decltype(findChildren<QTabBar *>(QString(), Qt::FindDirectChildrenOnly))>::type> _container_((findChildren<QTabBar *>(QString(), Qt::FindDirectChildrenOnly))); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QTabBar *tb = *_container_.i; _container_.control; _container_.control = 0)-
299 tb->setParent(parentWidget());
never executed: tb->setParent(parentWidget());
0
300 deleteLater();-
301}
never executed: end of block
0
302-
303-
304-
305-
306void QDockWidgetGroupWindow::adjustFlags()-
307{-
308 QDockWidget *top = topDockWidget();-
309 if (!top
!topDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
310 return;
never executed: return;
0
311 const bool nativeDeco = static_cast<QDockWidgetGroupLayout *>(layout())->nativeWindowDeco();-
312-
313 Qt::WindowFlags oldFlags = windowFlags();-
314 Qt::WindowFlags flags = oldFlags;-
315 if (nativeDeco
nativeDecoDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
316 flags |= Qt::CustomizeWindowHint | Qt::WindowTitleHint;-
317 flags.setFlag(Qt::WindowCloseButtonHint, top->features() & QDockWidget::DockWidgetClosable);-
318 flags &= ~Qt::FramelessWindowHint;-
319 }
never executed: end of block
else {
0
320 flags |= Qt::FramelessWindowHint;-
321 }
never executed: end of block
0
322 if (oldFlags != flags
oldFlags != flagsDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
323 setWindowFlags(flags);-
324 show();-
325 }
never executed: end of block
0
326-
327 setWindowTitle(top->windowTitle());-
328 setWindowIcon(top->windowIcon());-
329}
never executed: end of block
0
330QMainWindowLayoutState::QMainWindowLayoutState(QMainWindow *win)-
331 :-
332-
333 toolBarAreaLayout(win),-
334-
335-
336 dockAreaLayout(win)-
337-
338-
339-
340-
341{-
342 mainWindow = win;-
343}
never executed: end of block
0
344-
345QSize QMainWindowLayoutState::sizeHint() const-
346{-
347-
348 QSize result(0, 0);-
349-
350-
351 result = dockAreaLayout.sizeHint();-
352-
353-
354-
355-
356-
357-
358 result = toolBarAreaLayout.sizeHint(result);-
359-
360-
361 return
never executed: return result;
result;
never executed: return result;
0
362}-
363-
364QSize QMainWindowLayoutState::minimumSize() const-
365{-
366 QSize result(0, 0);-
367-
368-
369 result = dockAreaLayout.minimumSize();-
370-
371-
372-
373-
374-
375-
376 result = toolBarAreaLayout.minimumSize(result);-
377-
378-
379 return
never executed: return result;
result;
never executed: return result;
0
380}-
381-
382void QMainWindowLayoutState::apply(bool animated)-
383{-
384-
385 toolBarAreaLayout.apply(animated);-
386-
387-
388-
389-
390 dockAreaLayout.apply(animated);-
391-
392-
393-
394-
395-
396-
397-
398}
never executed: end of block
0
399-
400void QMainWindowLayoutState::fitLayout()-
401{-
402 QRect r;-
403-
404-
405-
406 toolBarAreaLayout.rect = rect;-
407 r = toolBarAreaLayout.fitLayout();-
408-
409-
410-
411 dockAreaLayout.rect = r;-
412 dockAreaLayout.fitLayout();-
413-
414-
415-
416}
never executed: end of block
0
417-
418void QMainWindowLayoutState::deleteAllLayoutItems()-
419{-
420-
421 toolBarAreaLayout.deleteAllLayoutItems();-
422-
423-
424-
425 dockAreaLayout.deleteAllLayoutItems();-
426-
427}
never executed: end of block
0
428-
429void QMainWindowLayoutState::deleteCentralWidgetItem()-
430{-
431-
432 delete dockAreaLayout.centralWidgetItem;-
433 dockAreaLayout.centralWidgetItem = 0;-
434-
435-
436-
437-
438}
never executed: end of block
0
439-
440QLayoutItem *QMainWindowLayoutState::itemAt(int index, int *x) const-
441{-
442-
443 if (QLayoutItem *ret = toolBarAreaLayout.itemAt(x, index)
QLayoutItem *r...emAt(x, index)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
444 return
never executed: return ret;
ret;
never executed: return ret;
0
445-
446-
447-
448 if (QLayoutItem *ret = dockAreaLayout.itemAt(x, index)
QLayoutItem *r...emAt(x, index)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
449 return
never executed: return ret;
ret;
never executed: return ret;
0
450-
451-
452-
453-
454-
455 return
never executed: return 0;
0;
never executed: return 0;
0
456}-
457-
458QLayoutItem *QMainWindowLayoutState::takeAt(int index, int *x)-
459{-
460-
461 if (QLayoutItem *ret = toolBarAreaLayout.takeAt(x, index)
QLayoutItem *r...keAt(x, index)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
462 return
never executed: return ret;
ret;
never executed: return ret;
0
463-
464-
465-
466 if (QLayoutItem *ret = dockAreaLayout.takeAt(x, index)
QLayoutItem *r...keAt(x, index)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
467 return
never executed: return ret;
ret;
never executed: return ret;
0
468 return
never executed: return 0;
0;
never executed: return 0;
0
469}-
470-
471QList<int> QMainWindowLayoutState::indexOf(QWidget *widget) const-
472{-
473 QList<int> result;-
474-
475-
476-
477 if (QToolBar *toolBar = qobject_cast<QToolBar*>(widget)
QToolBar *tool...lBar*>(widget)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
478 result = toolBarAreaLayout.indexOf(toolBar);-
479 if (!result.isEmpty()
!result.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
480 result.prepend(0);
never executed: result.prepend(0);
0
481 return
never executed: return result;
result;
never executed: return result;
0
482 }-
483-
484-
485-
486-
487 if (qobject_cast<QDockWidget *>(widget)
qobject_cast<Q...get *>(widget)Description
TRUEnever evaluated
FALSEnever evaluated
|| qobject_cast<QDockWidgetGroupWindow *>(widget)
qobject_cast<Q...dow *>(widget)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
488 result = dockAreaLayout.indexOf(widget);-
489 if (!result.isEmpty()
!result.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
490 result.prepend(1);
never executed: result.prepend(1);
0
491 return
never executed: return result;
result;
never executed: return result;
0
492 }-
493-
494-
495 return
never executed: return result;
result;
never executed: return result;
0
496}-
497-
498bool QMainWindowLayoutState::contains(QWidget *widget) const-
499{-
500-
501 if (dockAreaLayout.centralWidgetItem != 0
dockAreaLayout...idgetItem != 0Description
TRUEnever evaluated
FALSEnever evaluated
&& dockAreaLayout.centralWidgetItem->widget() == widget
dockAreaLayout...et() == widgetDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
502 return
never executed: return true;
true;
never executed: return true;
0
503 if (!dockAreaLayout.indexOf(widget).isEmpty()
!dockAreaLayou...get).isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
504 return
never executed: return true;
true;
never executed: return true;
0
505-
506-
507-
508-
509-
510-
511 if (!toolBarAreaLayout.indexOf(widget).isEmpty()
!toolBarAreaLa...get).isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
512 return
never executed: return true;
true;
never executed: return true;
0
513-
514 return
never executed: return false;
false;
never executed: return false;
0
515}-
516-
517void QMainWindowLayoutState::setCentralWidget(QWidget *widget)-
518{-
519 QLayoutItem *item = 0;-
520-
521 deleteCentralWidgetItem();-
522-
523 if (widget != 0
widget != 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
524 item = new QWidgetItemV2(widget);
never executed: item = new QWidgetItemV2(widget);
0
525-
526-
527 dockAreaLayout.centralWidgetItem = item;-
528-
529-
530-
531}
never executed: end of block
0
532-
533QWidget *QMainWindowLayoutState::centralWidget() const-
534{-
535 QLayoutItem *item = 0;-
536-
537-
538 item = dockAreaLayout.centralWidgetItem;-
539-
540-
541-
542-
543 if (item != 0
item != 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
544 return
never executed: return item->widget();
item->widget();
never executed: return item->widget();
0
545 return
never executed: return 0;
0;
never executed: return 0;
0
546}-
547-
548QList<int> QMainWindowLayoutState::gapIndex(QWidget *widget,-
549 const QPoint &pos) const-
550{-
551 QList<int> result;-
552-
553-
554-
555 if (qobject_cast<QToolBar*>(widget) != 0
qobject_cast<Q...>(widget) != 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
556 result = toolBarAreaLayout.gapIndex(pos);-
557 if (!result.isEmpty()
!result.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
558 result.prepend(0);
never executed: result.prepend(0);
0
559 return
never executed: return result;
result;
never executed: return result;
0
560 }-
561-
562-
563-
564-
565 if (qobject_cast<QDockWidget *>(widget) != 0
qobject_cast<Q...>(widget) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
566 || qobject_cast<QDockWidgetGroupWindow *>(widget)
qobject_cast<Q...dow *>(widget)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
567 result = dockAreaLayout.gapIndex(pos);-
568 if (!result.isEmpty()
!result.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
569 result.prepend(1);
never executed: result.prepend(1);
0
570 return
never executed: return result;
result;
never executed: return result;
0
571 }-
572-
573-
574 return
never executed: return result;
result;
never executed: return result;
0
575}-
576-
577bool QMainWindowLayoutState::insertGap(const QList<int> &path, QLayoutItem *item)-
578{-
579 if (path.isEmpty()
path.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
580 return
never executed: return false;
false;
never executed: return false;
0
581-
582 int i = path.first();-
583-
584-
585 if (i == 0
i == 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
586 ((!(qobject_cast<QToolBar*>(item->widget()) != 0)) ? qt_assert("qobject_cast<QToolBar*>(item->widget()) != 0",__FILE__,675) : qt_noop());-
587 return
never executed: return toolBarAreaLayout.insertGap(path.mid(1), item);
toolBarAreaLayout.insertGap(path.mid(1), item);
never executed: return toolBarAreaLayout.insertGap(path.mid(1), item);
0
588 }-
589-
590-
591-
592 if (i == 1
i == 1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
593 ((!(qobject_cast<QDockWidget*>(item->widget()) || qobject_cast<QDockWidgetGroupWindow*>(item->widget()))) ? qt_assert("qobject_cast<QDockWidget*>(item->widget()) || qobject_cast<QDockWidgetGroupWindow*>(item->widget())",__FILE__,682) : qt_noop());-
594 return
never executed: return dockAreaLayout.insertGap(path.mid(1), item);
dockAreaLayout.insertGap(path.mid(1), item);
never executed: return dockAreaLayout.insertGap(path.mid(1), item);
0
595 }-
596-
597-
598 return
never executed: return false;
false;
never executed: return false;
0
599}-
600-
601void QMainWindowLayoutState::remove(const QList<int> &path)-
602{-
603 int i = path.first();-
604-
605-
606 if (i == 0
i == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
607 toolBarAreaLayout.remove(path.mid(1));
never executed: toolBarAreaLayout.remove(path.mid(1));
0
608-
609-
610-
611 if (i == 1
i == 1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
612 dockAreaLayout.remove(path.mid(1));
never executed: dockAreaLayout.remove(path.mid(1));
0
613-
614}
never executed: end of block
0
615-
616void QMainWindowLayoutState::remove(QLayoutItem *item)-
617{-
618-
619 toolBarAreaLayout.remove(item);-
620-
621-
622-
623-
624 if (QDockWidget *dockWidget = qobject_cast<QDockWidget *>(item->widget())
QDockWidget *d...tem->widget())Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
625 QList<int> path = dockAreaLayout.indexOf(dockWidget);-
626 if (!path.isEmpty()
!path.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
627 dockAreaLayout.remove(path);
never executed: dockAreaLayout.remove(path);
0
628 }
never executed: end of block
0
629-
630}
never executed: end of block
0
631-
632void QMainWindowLayoutState::clear()-
633{-
634-
635 toolBarAreaLayout.clear();-
636-
637-
638-
639 dockAreaLayout.clear();-
640-
641-
642-
643-
644 rect = QRect();-
645}
never executed: end of block
0
646-
647bool QMainWindowLayoutState::isValid() const-
648{-
649 return
never executed: return rect.isValid();
rect.isValid();
never executed: return rect.isValid();
0
650}-
651-
652QLayoutItem *QMainWindowLayoutState::item(const QList<int> &path)-
653{-
654 int i = path.first();-
655-
656-
657 if (i == 0
i == 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
658 const QToolBarAreaLayoutItem *tbItem = toolBarAreaLayout.item(path.mid(1));-
659 ((!(tbItem)) ? qt_assert("tbItem",__FILE__,748) : qt_noop());-
660 return
never executed: return tbItem->widgetItem;
tbItem->widgetItem;
never executed: return tbItem->widgetItem;
0
661 }-
662-
663-
664-
665 if (i == 1
i == 1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
666 return
never executed: return dockAreaLayout.item(path.mid(1)).widgetItem;
dockAreaLayout.item(path.mid(1)).widgetItem;
never executed: return dockAreaLayout.item(path.mid(1)).widgetItem;
0
667-
668-
669 return
never executed: return 0;
0;
never executed: return 0;
0
670}-
671-
672QRect QMainWindowLayoutState::itemRect(const QList<int> &path) const-
673{-
674 int i = path.first();-
675-
676-
677 if (i == 0
i == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
678 return
never executed: return toolBarAreaLayout.itemRect(path.mid(1));
toolBarAreaLayout.itemRect(path.mid(1));
never executed: return toolBarAreaLayout.itemRect(path.mid(1));
0
679-
680-
681-
682 if (i == 1
i == 1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
683 return
never executed: return dockAreaLayout.itemRect(path.mid(1));
dockAreaLayout.itemRect(path.mid(1));
never executed: return dockAreaLayout.itemRect(path.mid(1));
0
684-
685-
686 return
never executed: return QRect();
QRect();
never executed: return QRect();
0
687}-
688-
689QRect QMainWindowLayoutState::gapRect(const QList<int> &path) const-
690{-
691 int i = path.first();-
692-
693-
694 if (i == 0
i == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
695 return
never executed: return toolBarAreaLayout.itemRect(path.mid(1));
toolBarAreaLayout.itemRect(path.mid(1));
never executed: return toolBarAreaLayout.itemRect(path.mid(1));
0
696-
697-
698-
699 if (i == 1
i == 1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
700 return
never executed: return dockAreaLayout.gapRect(path.mid(1));
dockAreaLayout.gapRect(path.mid(1));
never executed: return dockAreaLayout.gapRect(path.mid(1));
0
701-
702-
703 return
never executed: return QRect();
QRect();
never executed: return QRect();
0
704}-
705-
706QLayoutItem *QMainWindowLayoutState::plug(const QList<int> &path)-
707{-
708 int i = path.first();-
709-
710-
711 if (i == 0
i == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
712 return
never executed: return toolBarAreaLayout.plug(path.mid(1));
toolBarAreaLayout.plug(path.mid(1));
never executed: return toolBarAreaLayout.plug(path.mid(1));
0
713-
714-
715-
716 if (i == 1
i == 1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
717 return
never executed: return dockAreaLayout.plug(path.mid(1));
dockAreaLayout.plug(path.mid(1));
never executed: return dockAreaLayout.plug(path.mid(1));
0
718-
719-
720 return
never executed: return 0;
0;
never executed: return 0;
0
721}-
722-
723QLayoutItem *QMainWindowLayoutState::unplug(const QList<int> &path, QMainWindowLayoutState *other)-
724{-
725 int i = path.first();-
726-
727-
728-
729-
730 if (i == 0
i == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
731 return
never executed: return toolBarAreaLayout.unplug(path.mid(1), other ? &other->toolBarAreaLayout : 0);
toolBarAreaLayout.unplug(path.mid(1), other ? &other->toolBarAreaLayout : 0);
never executed: return toolBarAreaLayout.unplug(path.mid(1), other ? &other->toolBarAreaLayout : 0);
0
732-
733-
734-
735 if (i == 1
i == 1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
736 return
never executed: return dockAreaLayout.unplug(path.mid(1));
dockAreaLayout.unplug(path.mid(1));
never executed: return dockAreaLayout.unplug(path.mid(1));
0
737-
738-
739 return
never executed: return 0;
0;
never executed: return 0;
0
740}-
741-
742void QMainWindowLayoutState::saveState(QDataStream &stream) const-
743{-
744-
745 dockAreaLayout.saveState(stream);-
746-
747 QList<QDockWidgetGroupWindow *> floatingTabs =-
748 mainWindow->findChildren<QDockWidgetGroupWindow *>(QString(), Qt::FindDirectChildrenOnly);-
749-
750 for (QForeachContainer<typename QtPrivate::remove_reference<decltype(floatingTabs)>::type> _container_((floatingTabs)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QDockWidgetGroupWindow *floating = *_container_.i; _container_.control; _container_.control = 0) {-
751 if (floating->layoutInfo()->isEmpty()
floating->layo...o()->isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
752 continue;
never executed: continue;
0
753 stream << uchar(QDockAreaLayout::FloatingDockWidgetTabMarker) << floating->geometry();-
754 floating->layoutInfo()->saveState(stream);-
755 }
never executed: end of block
0
756-
757-
758-
759 toolBarAreaLayout.saveState(stream);-
760-
761}
never executed: end of block
0
762-
763template <typename T>-
764static QList<T> findChildrenHelper(const QObject *o)-
765{-
766 const QObjectList &list = o->children();-
767 QList<T> result;-
768-
769 for (int i=0; i < list.size()
i < list.size()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
770 if (T t = qobject_cast<T>(list[i])
T t = qobject_cast<T>(list[i])Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
771 result.append(t);-
772 }
never executed: end of block
0
773 }
never executed: end of block
0
774-
775 return
never executed: return result;
result;
never executed: return result;
0
776}-
777-
778-
779static QList<QDockWidget*> allMyDockWidgets(const QWidget *mainWindow)-
780{-
781 QList<QDockWidget*> result;-
782 for (QObject *c : mainWindow->children()) {-
783 if (auto *dw = qobject_cast<QDockWidget*>(c)
auto *dw = qob...ockWidget*>(c)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
784 result.append(dw);-
785 }
never executed: end of block
else if (auto *gw = qobject_cast<QDockWidgetGroupWindow*>(c)
auto *gw = qob...oupWindow*>(c)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
786 for (QObject *c : gw->children()) {-
787 if (auto *dw = qobject_cast<QDockWidget*>(c)
auto *dw = qob...ockWidget*>(c)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
788 result.append(dw);
never executed: result.append(dw);
0
789 }
never executed: end of block
0
790 }
never executed: end of block
0
791 }
never executed: end of block
0
792-
793 return
never executed: return result;
result;
never executed: return result;
0
794}-
795-
796-
797-
798bool QMainWindowLayoutState::checkFormat(QDataStream &stream)-
799{-
800 while (!stream.atEnd()
!stream.atEnd()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
801 uchar marker;-
802 stream >> marker;-
803 switch(marker)-
804 {-
805-
806 case
never executed: case QToolBarAreaLayout::ToolBarStateMarker:
QToolBarAreaLayout::ToolBarStateMarker:
never executed: case QToolBarAreaLayout::ToolBarStateMarker:
0
807 case
never executed: case QToolBarAreaLayout::ToolBarStateMarkerEx:
QToolBarAreaLayout::ToolBarStateMarkerEx:
never executed: case QToolBarAreaLayout::ToolBarStateMarkerEx:
0
808 {-
809 QList<QToolBar *> toolBars = findChildrenHelper<QToolBar*>(mainWindow);-
810 if (!toolBarAreaLayout.restoreState(stream, toolBars, marker, true )
!toolBarAreaLa...marker, true )Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
811 return
never executed: return false;
false;
never executed: return false;
0
812 }-
813 }-
814 break;
never executed: break;
0
815-
816-
817-
818 case
never executed: case QDockAreaLayout::DockWidgetStateMarker:
QDockAreaLayout::DockWidgetStateMarker:
never executed: case QDockAreaLayout::DockWidgetStateMarker:
0
819 {-
820 const auto dockWidgets = allMyDockWidgets(mainWindow);-
821 if (!dockAreaLayout.restoreState(stream, dockWidgets, true )
!dockAreaLayou...idgets, true )Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
822 return
never executed: return false;
false;
never executed: return false;
0
823 }-
824 }-
825 break;
never executed: break;
0
826-
827 case
never executed: case QDockAreaLayout::FloatingDockWidgetTabMarker:
QDockAreaLayout::FloatingDockWidgetTabMarker:
never executed: case QDockAreaLayout::FloatingDockWidgetTabMarker:
0
828 {-
829 QRect geom;-
830 stream >> geom;-
831 QDockAreaLayoutInfo info;-
832 auto dockWidgets = allMyDockWidgets(mainWindow);-
833 if (!info.restoreState(stream, dockWidgets, true )
!info.restoreS...idgets, true )Description
TRUEnever evaluated
FALSEnever evaluated
)
0
834 return
never executed: return false;
false;
never executed: return false;
0
835 }-
836 break;
never executed: break;
0
837-
838-
839 default
never executed: default:
:
never executed: default:
0
840-
841 return
never executed: return false;
false;
never executed: return false;
0
842 }-
843 }-
844-
845-
846 return
never executed: return true;
true;
never executed: return true;
0
847}-
848-
849bool QMainWindowLayoutState::restoreState(QDataStream &_stream,-
850 const QMainWindowLayoutState &oldState)-
851{-
852-
853 QByteArray copy;-
854 while(!_stream.atEnd()
!_stream.atEnd()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
855 int length = 1024;-
856 QByteArray ba(length, '\0');-
857 length = _stream.readRawData(ba.data(), ba.size());-
858 ba.resize(length);-
859 copy += ba;-
860 }
never executed: end of block
0
861-
862 QDataStream ds(copy);-
863 if (!checkFormat(ds)
!checkFormat(ds)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
864 return
never executed: return false;
false;
never executed: return false;
0
865-
866 QDataStream stream(copy);-
867-
868 while (!stream.atEnd()
!stream.atEnd()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
869 uchar marker;-
870 stream >> marker;-
871 switch(marker)-
872 {-
873-
874 case
never executed: case QDockAreaLayout::DockWidgetStateMarker:
QDockAreaLayout::DockWidgetStateMarker:
never executed: case QDockAreaLayout::DockWidgetStateMarker:
0
875 {-
876 const auto dockWidgets = allMyDockWidgets(mainWindow);-
877 if (!dockAreaLayout.restoreState(stream, dockWidgets)
!dockAreaLayou..., dockWidgets)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
878 return
never executed: return false;
false;
never executed: return false;
0
879-
880 for (int i = 0; i < dockWidgets.size()
i < dockWidgets.size()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
881 QDockWidget *w = dockWidgets.at(i);-
882 QList<int> path = dockAreaLayout.indexOf(w);-
883 if (path.isEmpty()
path.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
884 QList<int> oldPath = oldState.dockAreaLayout.indexOf(w);-
885 if (oldPath.isEmpty()
oldPath.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
886 continue;
never executed: continue;
0
887 }-
888 QDockAreaLayoutInfo *info = dockAreaLayout.info(oldPath);-
889 if (info == 0
info == 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
890 continue;
never executed: continue;
0
891 }-
892 info->item_list.append(QDockAreaLayoutItem(new QDockWidgetItem(w)));-
893 }
never executed: end of block
0
894 }
never executed: end of block
0
895 }-
896 break;
never executed: break;
0
897-
898 case
never executed: case QDockAreaLayout::FloatingDockWidgetTabMarker:
QDockAreaLayout::FloatingDockWidgetTabMarker:
never executed: case QDockAreaLayout::FloatingDockWidgetTabMarker:
0
899 {-
900 auto dockWidgets = allMyDockWidgets(mainWindow);-
901 QDockWidgetGroupWindow* floatingTab = qt_mainwindow_layout(mainWindow)->createTabbedDockWindow();-
902 *floatingTab->layoutInfo() = QDockAreaLayoutInfo(&dockAreaLayout.sep, QInternal::LeftDock,-
903 Qt::Horizontal, QTabBar::RoundedSouth, mainWindow);-
904 QRect geometry;-
905 stream >> geometry;-
906 if (!floatingTab->layoutInfo()->restoreState(stream, dockWidgets, false)
!floatingTab->...idgets, false)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
907 return
never executed: return false;
false;
never executed: return false;
0
908 geometry = QDockAreaLayout::constrainedRect(geometry, floatingTab);-
909 floatingTab->move(geometry.topLeft());-
910 floatingTab->resize(geometry.size());-
911 floatingTab->show();-
912 }-
913 break;
never executed: break;
0
914-
915-
916-
917-
918 case
never executed: case QToolBarAreaLayout::ToolBarStateMarker:
QToolBarAreaLayout::ToolBarStateMarker:
never executed: case QToolBarAreaLayout::ToolBarStateMarker:
0
919 case
never executed: case QToolBarAreaLayout::ToolBarStateMarkerEx:
QToolBarAreaLayout::ToolBarStateMarkerEx:
never executed: case QToolBarAreaLayout::ToolBarStateMarkerEx:
0
920 {-
921 QList<QToolBar *> toolBars = findChildrenHelper<QToolBar*>(mainWindow);-
922 if (!toolBarAreaLayout.restoreState(stream, toolBars, marker)
!toolBarAreaLa...lBars, marker)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
923 return
never executed: return false;
false;
never executed: return false;
0
924-
925 for (int i = 0; i < toolBars.size()
i < toolBars.size()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
926 QToolBar *w = toolBars.at(i);-
927 QList<int> path = toolBarAreaLayout.indexOf(w);-
928 if (path.isEmpty()
path.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
929 QList<int> oldPath = oldState.toolBarAreaLayout.indexOf(w);-
930 if (oldPath.isEmpty()
oldPath.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
931 continue;
never executed: continue;
0
932 }-
933 toolBarAreaLayout.docks[oldPath.at(0)].insertToolBar(0, w);-
934 }
never executed: end of block
0
935 }
never executed: end of block
0
936 }-
937 break;
never executed: break;
0
938-
939 default
never executed: default:
:
never executed: default:
0
940 return
never executed: return false;
false;
never executed: return false;
0
941 }-
942 }-
943-
944-
945 return
never executed: return true;
true;
never executed: return true;
0
946}-
947-
948-
949-
950-
951-
952-
953-
954static inline void validateToolBarArea(Qt::ToolBarArea &area)-
955{-
956 switch (area) {-
957 case
never executed: case Qt::LeftToolBarArea:
Qt::LeftToolBarArea:
never executed: case Qt::LeftToolBarArea:
0
958 case
never executed: case Qt::RightToolBarArea:
Qt::RightToolBarArea:
never executed: case Qt::RightToolBarArea:
0
959 case
never executed: case Qt::TopToolBarArea:
Qt::TopToolBarArea:
never executed: case Qt::TopToolBarArea:
0
960 case
never executed: case Qt::BottomToolBarArea:
Qt::BottomToolBarArea:
never executed: case Qt::BottomToolBarArea:
0
961 break;
never executed: break;
0
962 default
never executed: default:
:
never executed: default:
0
963 area = Qt::TopToolBarArea;-
964 }
never executed: end of block
0
965}-
966-
967static QInternal::DockPosition toDockPos(Qt::ToolBarArea area)-
968{-
969 switch (area) {-
970 case
never executed: case Qt::LeftToolBarArea:
Qt::LeftToolBarArea:
never executed: case Qt::LeftToolBarArea:
return
never executed: return QInternal::LeftDock;
QInternal::LeftDock;
never executed: return QInternal::LeftDock;
0
971 case
never executed: case Qt::RightToolBarArea:
Qt::RightToolBarArea:
never executed: case Qt::RightToolBarArea:
return
never executed: return QInternal::RightDock;
QInternal::RightDock;
never executed: return QInternal::RightDock;
0
972 case
never executed: case Qt::TopToolBarArea:
Qt::TopToolBarArea:
never executed: case Qt::TopToolBarArea:
return
never executed: return QInternal::TopDock;
QInternal::TopDock;
never executed: return QInternal::TopDock;
0
973 case
never executed: case Qt::BottomToolBarArea:
Qt::BottomToolBarArea:
never executed: case Qt::BottomToolBarArea:
return
never executed: return QInternal::BottomDock;
QInternal::BottomDock;
never executed: return QInternal::BottomDock;
0
974 default
never executed: default:
:
never executed: default:
0
975 break;
never executed: break;
0
976 }-
977-
978 return
never executed: return QInternal::DockCount;
QInternal::DockCount;
never executed: return QInternal::DockCount;
0
979}-
980-
981static Qt::ToolBarArea toToolBarArea(QInternal::DockPosition pos)-
982{-
983 switch (pos) {-
984 case
never executed: case QInternal::LeftDock:
QInternal::LeftDock:
never executed: case QInternal::LeftDock:
return
never executed: return Qt::LeftToolBarArea;
Qt::LeftToolBarArea;
never executed: return Qt::LeftToolBarArea;
0
985 case
never executed: case QInternal::RightDock:
QInternal::RightDock:
never executed: case QInternal::RightDock:
return
never executed: return Qt::RightToolBarArea;
Qt::RightToolBarArea;
never executed: return Qt::RightToolBarArea;
0
986 case
never executed: case QInternal::TopDock:
QInternal::TopDock:
never executed: case QInternal::TopDock:
return
never executed: return Qt::TopToolBarArea;
Qt::TopToolBarArea;
never executed: return Qt::TopToolBarArea;
0
987 case
never executed: case QInternal::BottomDock:
QInternal::BottomDock:
never executed: case QInternal::BottomDock:
return
never executed: return Qt::BottomToolBarArea;
Qt::BottomToolBarArea;
never executed: return Qt::BottomToolBarArea;
0
988 default
never executed: default:
:
never executed: default:
break;
never executed: break;
0
989 }-
990 return
never executed: return Qt::NoToolBarArea;
Qt::NoToolBarArea;
never executed: return Qt::NoToolBarArea;
0
991}-
992-
993static inline Qt::ToolBarArea toToolBarArea(int pos)-
994{-
995 return
never executed: return toToolBarArea(static_cast<QInternal::DockPosition>(pos));
toToolBarArea(static_cast<QInternal::DockPosition>(pos));
never executed: return toToolBarArea(static_cast<QInternal::DockPosition>(pos));
0
996}-
997-
998void QMainWindowLayout::addToolBarBreak(Qt::ToolBarArea area)-
999{-
1000 validateToolBarArea(area);-
1001-
1002 layoutState.toolBarAreaLayout.addToolBarBreak(toDockPos(area));-
1003 if (savedState.isValid()
savedState.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1004 savedState.toolBarAreaLayout.addToolBarBreak(toDockPos(area));
never executed: savedState.toolBarAreaLayout.addToolBarBreak(toDockPos(area));
0
1005-
1006 invalidate();-
1007}
never executed: end of block
0
1008-
1009void QMainWindowLayout::insertToolBarBreak(QToolBar *before)-
1010{-
1011 layoutState.toolBarAreaLayout.insertToolBarBreak(before);-
1012 if (savedState.isValid()
savedState.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1013 savedState.toolBarAreaLayout.insertToolBarBreak(before);
never executed: savedState.toolBarAreaLayout.insertToolBarBreak(before);
0
1014 invalidate();-
1015}
never executed: end of block
0
1016-
1017void QMainWindowLayout::removeToolBarBreak(QToolBar *before)-
1018{-
1019 layoutState.toolBarAreaLayout.removeToolBarBreak(before);-
1020 if (savedState.isValid()
savedState.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1021 savedState.toolBarAreaLayout.removeToolBarBreak(before);
never executed: savedState.toolBarAreaLayout.removeToolBarBreak(before);
0
1022 invalidate();-
1023}
never executed: end of block
0
1024-
1025void QMainWindowLayout::moveToolBar(QToolBar *toolbar, int pos)-
1026{-
1027 layoutState.toolBarAreaLayout.moveToolBar(toolbar, pos);-
1028 if (savedState.isValid()
savedState.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1029 savedState.toolBarAreaLayout.moveToolBar(toolbar, pos);
never executed: savedState.toolBarAreaLayout.moveToolBar(toolbar, pos);
0
1030 invalidate();-
1031}
never executed: end of block
0
1032-
1033-
1034-
1035void QMainWindowLayout::removeToolBar(QToolBar *toolbar)-
1036{-
1037 if (toolbar
toolbarDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1038 QObject::disconnect(parentWidget(), qFlagLocation("2""iconSizeChanged(QSize)" "\0" __FILE__ ":" "1127"),-
1039 toolbar, qFlagLocation("1""_q_updateIconSize(QSize)" "\0" __FILE__ ":" "1128"));-
1040 QObject::disconnect(parentWidget(), qFlagLocation("2""toolButtonStyleChanged(Qt::ToolButtonStyle)" "\0" __FILE__ ":" "1129"),-
1041 toolbar, qFlagLocation("1""_q_updateToolButtonStyle(Qt::ToolButtonStyle)" "\0" __FILE__ ":" "1130"));-
1042-
1043-
1044-
1045-
1046-
1047-
1048 {-
1049 removeWidget(toolbar);-
1050 }-
1051 }
never executed: end of block
0
1052}
never executed: end of block
0
1053-
1054-
1055-
1056-
1057void QMainWindowLayout::addToolBar(Qt::ToolBarArea area,-
1058 QToolBar *toolbar,-
1059 bool)-
1060{-
1061 validateToolBarArea(area);-
1062-
1063-
1064-
1065-
1066-
1067-
1068 {-
1069-
1070 addChildWidget(toolbar);-
1071 QLayoutItem * item = layoutState.toolBarAreaLayout.addToolBar(toDockPos(area), toolbar);-
1072 if (savedState.isValid()
savedState.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
&& item
itemDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1073-
1074 savedState.toolBarAreaLayout.insertItem(toDockPos(area), item);-
1075 }
never executed: end of block
0
1076 invalidate();-
1077-
1078-
1079 toolbar->d_func()->updateWindowFlags(false );-
1080 }-
1081}
never executed: end of block
0
1082-
1083-
1084-
1085-
1086void QMainWindowLayout::insertToolBar(QToolBar *before, QToolBar *toolbar)-
1087{-
1088-
1089-
1090-
1091-
1092-
1093 {-
1094 addChildWidget(toolbar);-
1095 QLayoutItem * item = layoutState.toolBarAreaLayout.insertToolBar(before, toolbar);-
1096 if (savedState.isValid()
savedState.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
&& item
itemDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1097-
1098 savedState.toolBarAreaLayout.insertItem(before, item);-
1099 }
never executed: end of block
0
1100 if (!currentGapPos.isEmpty()
!currentGapPos.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
&& currentGapPos.constFirst() == 0
currentGapPos....stFirst() == 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1101 currentGapPos = layoutState.toolBarAreaLayout.currentGapIndex();-
1102 if (!currentGapPos.isEmpty()
!currentGapPos.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1103 currentGapPos.prepend(0);-
1104 currentGapRect = layoutState.itemRect(currentGapPos);-
1105 }
never executed: end of block
0
1106 }
never executed: end of block
0
1107 invalidate();-
1108 }-
1109}
never executed: end of block
0
1110-
1111Qt::ToolBarArea QMainWindowLayout::toolBarArea(QToolBar *toolbar) const-
1112{-
1113 QInternal::DockPosition pos = layoutState.toolBarAreaLayout.findToolBar(toolbar);-
1114 switch (pos) {-
1115 case
never executed: case QInternal::LeftDock:
QInternal::LeftDock:
never executed: case QInternal::LeftDock:
return
never executed: return Qt::LeftToolBarArea;
Qt::LeftToolBarArea;
never executed: return Qt::LeftToolBarArea;
0
1116 case
never executed: case QInternal::RightDock:
QInternal::RightDock:
never executed: case QInternal::RightDock:
return
never executed: return Qt::RightToolBarArea;
Qt::RightToolBarArea;
never executed: return Qt::RightToolBarArea;
0
1117 case
never executed: case QInternal::TopDock:
QInternal::TopDock:
never executed: case QInternal::TopDock:
return
never executed: return Qt::TopToolBarArea;
Qt::TopToolBarArea;
never executed: return Qt::TopToolBarArea;
0
1118 case
never executed: case QInternal::BottomDock:
QInternal::BottomDock:
never executed: case QInternal::BottomDock:
return
never executed: return Qt::BottomToolBarArea;
Qt::BottomToolBarArea;
never executed: return Qt::BottomToolBarArea;
0
1119 default
never executed: default:
:
never executed: default:
break;
never executed: break;
0
1120 }-
1121-
1122-
1123-
1124-
1125-
1126-
1127 return
never executed: return Qt::NoToolBarArea;
Qt::NoToolBarArea;
never executed: return Qt::NoToolBarArea;
0
1128}-
1129-
1130bool QMainWindowLayout::toolBarBreak(QToolBar *toolBar) const-
1131{-
1132 return
never executed: return layoutState.toolBarAreaLayout.toolBarBreak(toolBar);
layoutState.toolBarAreaLayout.toolBarBreak(toolBar);
never executed: return layoutState.toolBarAreaLayout.toolBarBreak(toolBar);
0
1133}-
1134-
1135void QMainWindowLayout::getStyleOptionInfo(QStyleOptionToolBar *option, QToolBar *toolBar) const-
1136{-
1137 option->toolBarArea = toolBarArea(toolBar);-
1138 layoutState.toolBarAreaLayout.getStyleOptionInfo(option, toolBar);-
1139}
never executed: end of block
0
1140-
1141void QMainWindowLayout::toggleToolBarsVisible()-
1142{-
1143 bool updateNonUnifiedParts = true;-
1144 if (updateNonUnifiedParts
updateNonUnifiedPartsDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1145 layoutState.toolBarAreaLayout.visible = !layoutState.toolBarAreaLayout.visible;-
1146 if (!layoutState.mainWindow->isMaximized()
!layoutState.m...>isMaximized()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1147 QPoint topLeft = parentWidget()->geometry().topLeft();-
1148 QRect r = parentWidget()->geometry();-
1149 r = layoutState.toolBarAreaLayout.rectHint(r);-
1150 r.moveTo(topLeft);-
1151 parentWidget()->setGeometry(r);-
1152 }
never executed: end of block
else {
0
1153 update();-
1154 }
never executed: end of block
0
1155 }-
1156}
never executed: end of block
0
1157static QInternal::DockPosition toDockPos(Qt::DockWidgetArea area)-
1158{-
1159 switch (area) {-
1160 case
never executed: case Qt::LeftDockWidgetArea:
Qt::LeftDockWidgetArea:
never executed: case Qt::LeftDockWidgetArea:
return
never executed: return QInternal::LeftDock;
QInternal::LeftDock;
never executed: return QInternal::LeftDock;
0
1161 case
never executed: case Qt::RightDockWidgetArea:
Qt::RightDockWidgetArea:
never executed: case Qt::RightDockWidgetArea:
return
never executed: return QInternal::RightDock;
QInternal::RightDock;
never executed: return QInternal::RightDock;
0
1162 case
never executed: case Qt::TopDockWidgetArea:
Qt::TopDockWidgetArea:
never executed: case Qt::TopDockWidgetArea:
return
never executed: return QInternal::TopDock;
QInternal::TopDock;
never executed: return QInternal::TopDock;
0
1163 case
never executed: case Qt::BottomDockWidgetArea:
Qt::BottomDockWidgetArea:
never executed: case Qt::BottomDockWidgetArea:
return
never executed: return QInternal::BottomDock;
QInternal::BottomDock;
never executed: return QInternal::BottomDock;
0
1164 default
never executed: default:
:
never executed: default:
0
1165 break;
never executed: break;
0
1166 }-
1167-
1168 return
never executed: return QInternal::DockCount;
QInternal::DockCount;
never executed: return QInternal::DockCount;
0
1169}-
1170-
1171static Qt::DockWidgetArea toDockWidgetArea(QInternal::DockPosition pos)-
1172{-
1173 switch (pos) {-
1174 case
never executed: case QInternal::LeftDock :
QInternal::LeftDock :
never executed: case QInternal::LeftDock :
return
never executed: return Qt::LeftDockWidgetArea;
Qt::LeftDockWidgetArea;
never executed: return Qt::LeftDockWidgetArea;
0
1175 case
never executed: case QInternal::RightDock :
QInternal::RightDock :
never executed: case QInternal::RightDock :
return
never executed: return Qt::RightDockWidgetArea;
Qt::RightDockWidgetArea;
never executed: return Qt::RightDockWidgetArea;
0
1176 case
never executed: case QInternal::TopDock :
QInternal::TopDock :
never executed: case QInternal::TopDock :
return
never executed: return Qt::TopDockWidgetArea;
Qt::TopDockWidgetArea;
never executed: return Qt::TopDockWidgetArea;
0
1177 case
never executed: case QInternal::BottomDock :
QInternal::BottomDock :
never executed: case QInternal::BottomDock :
return
never executed: return Qt::BottomDockWidgetArea;
Qt::BottomDockWidgetArea;
never executed: return Qt::BottomDockWidgetArea;
0
1178 default
never executed: default:
:
never executed: default:
0
1179 break;
never executed: break;
0
1180 }-
1181-
1182 return
never executed: return Qt::NoDockWidgetArea;
Qt::NoDockWidgetArea;
never executed: return Qt::NoDockWidgetArea;
0
1183}-
1184-
1185inline static Qt::DockWidgetArea toDockWidgetArea(int pos)-
1186{-
1187 return
never executed: return toDockWidgetArea(static_cast<QInternal::DockPosition>(pos));
toDockWidgetArea(static_cast<QInternal::DockPosition>(pos));
never executed: return toDockWidgetArea(static_cast<QInternal::DockPosition>(pos));
0
1188}-
1189-
1190void QMainWindowLayout::setCorner(Qt::Corner corner, Qt::DockWidgetArea area)-
1191{-
1192 if (layoutState.dockAreaLayout.corners[corner] == area
layoutState.do...orner] == areaDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1193 return;
never executed: return;
0
1194 layoutState.dockAreaLayout.corners[corner] = area;-
1195 if (savedState.isValid()
savedState.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1196 savedState.dockAreaLayout.corners[corner] = area;
never executed: savedState.dockAreaLayout.corners[corner] = area;
0
1197 invalidate();-
1198}
never executed: end of block
0
1199-
1200Qt::DockWidgetArea QMainWindowLayout::corner(Qt::Corner corner) const-
1201{-
1202 return
never executed: return layoutState.dockAreaLayout.corners[corner];
layoutState.dockAreaLayout.corners[corner];
never executed: return layoutState.dockAreaLayout.corners[corner];
0
1203}-
1204-
1205void QMainWindowLayout::addDockWidget(Qt::DockWidgetArea area,-
1206 QDockWidget *dockwidget,-
1207 Qt::Orientation orientation)-
1208{-
1209 addChildWidget(dockwidget);-
1210-
1211-
1212-
1213 if (!movingSeparator.isEmpty()
!movingSeparator.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1214 endSeparatorMove(movingSeparatorPos);
never executed: endSeparatorMove(movingSeparatorPos);
0
1215-
1216 layoutState.dockAreaLayout.addDockWidget(toDockPos(area), dockwidget, orientation);-
1217 dockwidget->dockLocationChanged(area);-
1218 invalidate();-
1219}
never executed: end of block
0
1220-
1221void QMainWindowLayout::tabifyDockWidget(QDockWidget *first, QDockWidget *second)-
1222{-
1223 addChildWidget(second);-
1224 layoutState.dockAreaLayout.tabifyDockWidget(first, second);-
1225 second->dockLocationChanged(dockWidgetArea(first));-
1226 invalidate();-
1227}
never executed: end of block
0
1228-
1229bool QMainWindowLayout::restoreDockWidget(QDockWidget *dockwidget)-
1230{-
1231 addChildWidget(dockwidget);-
1232 if (!layoutState.dockAreaLayout.restoreDockWidget(dockwidget)
!layoutState.d...et(dockwidget)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1233 return
never executed: return false;
false;
never executed: return false;
0
1234 dockwidget->dockLocationChanged(dockWidgetArea(dockwidget));-
1235 invalidate();-
1236 return
never executed: return true;
true;
never executed: return true;
0
1237}-
1238-
1239-
1240bool QMainWindowLayout::documentMode() const-
1241{-
1242 return
never executed: return _documentMode;
_documentMode;
never executed: return _documentMode;
0
1243}-
1244-
1245void QMainWindowLayout::setDocumentMode(bool enabled)-
1246{-
1247 if (_documentMode == enabled
_documentMode == enabledDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1248 return;
never executed: return;
0
1249-
1250 _documentMode = enabled;-
1251-
1252-
1253 for (QForeachContainer<typename QtPrivate::remove_reference<decltype(usedTabBars)>::type> _container_((usedTabBars)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QTabBar *bar = *_container_.i; _container_.control; _container_.control = 0)-
1254 bar->setDocumentMode(_documentMode);
never executed: bar->setDocumentMode(_documentMode);
0
1255 for (QForeachContainer<typename QtPrivate::remove_reference<decltype(unusedTabBars)>::type> _container_((unusedTabBars)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QTabBar *bar = *_container_.i; _container_.control; _container_.control = 0)-
1256 bar->setDocumentMode(_documentMode);
never executed: bar->setDocumentMode(_documentMode);
0
1257}
never executed: end of block
0
1258-
1259-
1260void QMainWindowLayout::setVerticalTabsEnabled(bool enabled)-
1261{-
1262-
1263-
1264-
1265 if (verticalTabsEnabled == enabled
verticalTabsEnabled == enabledDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1266 return;
never executed: return;
0
1267-
1268 verticalTabsEnabled = enabled;-
1269-
1270 updateTabBarShapes();-
1271-
1272}
never executed: end of block
0
1273-
1274-
1275QTabWidget::TabShape QMainWindowLayout::tabShape() const-
1276{-
1277 return
never executed: return _tabShape;
_tabShape;
never executed: return _tabShape;
0
1278}-
1279-
1280void QMainWindowLayout::setTabShape(QTabWidget::TabShape tabShape)-
1281{-
1282 if (_tabShape == tabShape
_tabShape == tabShapeDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1283 return;
never executed: return;
0
1284-
1285 _tabShape = tabShape;-
1286-
1287 updateTabBarShapes();-
1288}
never executed: end of block
0
1289-
1290QTabWidget::TabPosition QMainWindowLayout::tabPosition(Qt::DockWidgetArea area) const-
1291{-
1292 return
never executed: return tabPositions[toDockPos(area)];
tabPositions[toDockPos(area)];
never executed: return tabPositions[toDockPos(area)];
0
1293}-
1294-
1295void QMainWindowLayout::setTabPosition(Qt::DockWidgetAreas areas, QTabWidget::TabPosition tabPosition)-
1296{-
1297 const Qt::DockWidgetArea dockWidgetAreas[] = {-
1298 Qt::TopDockWidgetArea,-
1299 Qt::LeftDockWidgetArea,-
1300 Qt::BottomDockWidgetArea,-
1301 Qt::RightDockWidgetArea-
1302 };-
1303 const QInternal::DockPosition dockPositions[] = {-
1304 QInternal::TopDock,-
1305 QInternal::LeftDock,-
1306 QInternal::BottomDock,-
1307 QInternal::RightDock-
1308 };-
1309-
1310 for (int i = 0; i < QInternal::DockCount
i < QInternal::DockCountDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i)
0
1311 if (areas & dockWidgetAreas[i]
areas & dockWidgetAreas[i]Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1312 tabPositions[dockPositions[i]] = tabPosition;
never executed: tabPositions[dockPositions[i]] = tabPosition;
0
1313-
1314 updateTabBarShapes();-
1315}
never executed: end of block
0
1316-
1317static inline QTabBar::Shape tabBarShapeFrom(QTabWidget::TabShape shape, QTabWidget::TabPosition position)-
1318{-
1319 const bool rounded = (shape == QTabWidget::Rounded);-
1320 if (position == QTabWidget::North
position == QTabWidget::NorthDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1321 return
never executed: return rounded ? QTabBar::RoundedNorth : QTabBar::TriangularNorth;
rounded ? QTabBar::RoundedNorth : QTabBar::TriangularNorth;
never executed: return rounded ? QTabBar::RoundedNorth : QTabBar::TriangularNorth;
0
1322 if (position == QTabWidget::South
position == QTabWidget::SouthDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1323 return
never executed: return rounded ? QTabBar::RoundedSouth : QTabBar::TriangularSouth;
rounded ? QTabBar::RoundedSouth : QTabBar::TriangularSouth;
never executed: return rounded ? QTabBar::RoundedSouth : QTabBar::TriangularSouth;
0
1324 if (position == QTabWidget::East
position == QTabWidget::EastDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1325 return
never executed: return rounded ? QTabBar::RoundedEast : QTabBar::TriangularEast;
rounded ? QTabBar::RoundedEast : QTabBar::TriangularEast;
never executed: return rounded ? QTabBar::RoundedEast : QTabBar::TriangularEast;
0
1326 if (position == QTabWidget::West
position == QTabWidget::WestDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1327 return
never executed: return rounded ? QTabBar::RoundedWest : QTabBar::TriangularWest;
rounded ? QTabBar::RoundedWest : QTabBar::TriangularWest;
never executed: return rounded ? QTabBar::RoundedWest : QTabBar::TriangularWest;
0
1328 return
never executed: return QTabBar::RoundedNorth;
QTabBar::RoundedNorth;
never executed: return QTabBar::RoundedNorth;
0
1329}-
1330-
1331-
1332-
1333void QMainWindowLayout::updateTabBarShapes()-
1334{-
1335-
1336 const QTabWidget::TabPosition vertical[] = {-
1337 QTabWidget::West,-
1338 QTabWidget::East,-
1339 QTabWidget::North,-
1340 QTabWidget::South-
1341 };-
1342 QDockAreaLayout &layout = layoutState.dockAreaLayout;-
1343-
1344 for (int i = 0; i < QInternal::DockCount
i < QInternal::DockCountDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
1345-
1346 QTabWidget::TabPosition pos = verticalTabsEnabled
verticalTabsEnabledDescription
TRUEnever evaluated
FALSEnever evaluated
? vertical[i] : tabPositions[i];
0
1347 QTabBar::Shape shape = tabBarShapeFrom(_tabShape, pos);-
1348-
1349-
1350-
1351 layout.docks[i].setTabBarShape(shape);-
1352 }
never executed: end of block
0
1353}
never executed: end of block
0
1354-
1355-
1356void QMainWindowLayout::splitDockWidget(QDockWidget *after,-
1357 QDockWidget *dockwidget,-
1358 Qt::Orientation orientation)-
1359{-
1360 addChildWidget(dockwidget);-
1361 layoutState.dockAreaLayout.splitDockWidget(after, dockwidget, orientation);-
1362 dockwidget->dockLocationChanged(dockWidgetArea(after));-
1363 invalidate();-
1364}
never executed: end of block
0
1365-
1366Qt::DockWidgetArea QMainWindowLayout::dockWidgetArea(QWidget *widget) const-
1367{-
1368 const QList<int> pathToWidget = layoutState.dockAreaLayout.indexOf(widget);-
1369 if (pathToWidget.isEmpty()
pathToWidget.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1370 return
never executed: return Qt::NoDockWidgetArea;
Qt::NoDockWidgetArea;
never executed: return Qt::NoDockWidgetArea;
0
1371 return
never executed: return toDockWidgetArea(pathToWidget.first());
toDockWidgetArea(pathToWidget.first());
never executed: return toDockWidgetArea(pathToWidget.first());
0
1372}-
1373-
1374void QMainWindowLayout::keepSize(QDockWidget *w)-
1375{-
1376 layoutState.dockAreaLayout.keepSize(w);-
1377}
never executed: end of block
0
1378-
1379-
1380-
1381-
1382class QMainWindowTabBar : public QTabBar-
1383{-
1384 QMainWindow *mainWindow;-
1385 QDockWidget *draggingDock;-
1386public:-
1387 QMainWindowTabBar(QMainWindow *parent);-
1388protected:-
1389 bool event(QEvent *e) override;-
1390 void mouseReleaseEvent(QMouseEvent*) override;-
1391 void mouseMoveEvent(QMouseEvent*) override;-
1392-
1393};-
1394-
1395QMainWindowTabBar::QMainWindowTabBar(QMainWindow *parent)-
1396 : QTabBar(parent), mainWindow(parent), draggingDock(0)-
1397{-
1398 setExpanding(false);-
1399}
never executed: end of block
0
1400-
1401void QMainWindowTabBar::mouseMoveEvent(QMouseEvent *e)-
1402{-
1403-
1404-
1405-
1406-
1407-
1408 QTabBarPrivate *d = static_cast<QTabBarPrivate*>(d_ptr.data());-
1409 if (!draggingDock
!draggingDockDescription
TRUEnever evaluated
FALSEnever evaluated
&& (
(mainWindow->d...oupedDragging)Description
TRUEnever evaluated
FALSEnever evaluated
mainWindow->dockOptions() & QMainWindow::GroupedDragging)
(mainWindow->d...oupedDragging)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1410 int offset = QApplication::startDragDistance() + 1;-
1411 offset *= 3;-
1412 QRect r = rect().adjusted(-offset, -offset, offset, offset);-
1413 if (d->dragInProgress
d->dragInProgressDescription
TRUEnever evaluated
FALSEnever evaluated
&& !r.contains(e->pos())
!r.contains(e->pos())Description
TRUEnever evaluated
FALSEnever evaluated
&& d->validIndex(d->pressedIndex)
d->validIndex(d->pressedIndex)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1414 QMainWindowLayout* mlayout = qt_mainwindow_layout(mainWindow);-
1415 QDockAreaLayoutInfo *info = mlayout->dockInfo(this);-
1416 ((!(info)) ? qt_assert("info",__FILE__,1575) : qt_noop());-
1417 int idx = info->tabIndexToListIndex(d->pressedIndex);-
1418 const QDockAreaLayoutItem &item = info->item_list.at(idx);-
1419 if (item.widgetItem
item.widgetItemDescription
TRUEnever evaluated
FALSEnever evaluated
0
1420 && (
(draggingDock ...em->widget()))Description
TRUEnever evaluated
FALSEnever evaluated
draggingDock = qobject_cast<QDockWidget *>(item.widgetItem->widget()))
(draggingDock ...em->widget()))Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1421-
1422-
1423 d->moveTabFinished(d->pressedIndex);-
1424 d->pressedIndex = -1;-
1425 if (d->movingTab
d->movingTabDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1426 d->movingTab->setVisible(false);
never executed: d->movingTab->setVisible(false);
0
1427 d->dragStartPosition = QPoint();-
1428-
1429-
1430 QDockWidgetPrivate *dockPriv = static_cast<QDockWidgetPrivate *>(QObjectPrivate::get(draggingDock));-
1431 QDockWidgetLayout *dwlayout = static_cast<QDockWidgetLayout *>(draggingDock->layout());-
1432 dockPriv->initDrag(dwlayout->titleArea().center(), true);-
1433 dockPriv->startDrag(false);-
1434 if (dockPriv->state
dockPriv->stateDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1435 dockPriv->state->ctrlDrag = e->modifiers() & Qt::ControlModifier;
never executed: dockPriv->state->ctrlDrag = e->modifiers() & Qt::ControlModifier;
0
1436 }
never executed: end of block
0
1437 }
never executed: end of block
0
1438 }
never executed: end of block
0
1439-
1440 if (draggingDock
draggingDockDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1441 QDockWidgetPrivate *dockPriv = static_cast<QDockWidgetPrivate *>(QObjectPrivate::get(draggingDock));-
1442 if (dockPriv->state
dockPriv->stateDescription
TRUEnever evaluated
FALSEnever evaluated
&& dockPriv->state->dragging
dockPriv->state->draggingDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1443 QPoint pos = e->globalPos() - dockPriv->state->pressPos;-
1444 draggingDock->move(pos);-
1445-
1446 }
never executed: end of block
0
1447 }
never executed: end of block
0
1448 QTabBar::mouseMoveEvent(e);-
1449}
never executed: end of block
0
1450-
1451void QMainWindowTabBar::mouseReleaseEvent(QMouseEvent *e)-
1452{-
1453 if (draggingDock
draggingDockDescription
TRUEnever evaluated
FALSEnever evaluated
&& e->button() == Qt::LeftButton
e->button() == Qt::LeftButtonDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1454 QDockWidgetPrivate *dockPriv = static_cast<QDockWidgetPrivate *>(QObjectPrivate::get(draggingDock));-
1455 if (dockPriv->state
dockPriv->stateDescription
TRUEnever evaluated
FALSEnever evaluated
&& dockPriv->state->dragging
dockPriv->state->draggingDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1456 dockPriv->endDrag();-
1457 }
never executed: end of block
0
1458 draggingDock = 0;-
1459 }
never executed: end of block
0
1460 QTabBar::mouseReleaseEvent(e);-
1461}
never executed: end of block
0
1462-
1463bool QMainWindowTabBar::event(QEvent *e)-
1464{-
1465-
1466-
1467 if (e->type() != QEvent::ToolTip
e->type() != QEvent::ToolTipDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1468 return
never executed: return QTabBar::event(e);
QTabBar::event(e);
never executed: return QTabBar::event(e);
0
1469 QSize size = this->size();-
1470 QSize hint = sizeHint();-
1471 if (shape() == QTabBar::RoundedWest
shape() == QTa...r::RoundedWestDescription
TRUEnever evaluated
FALSEnever evaluated
|| shape() == QTabBar::RoundedEast
shape() == QTa...r::RoundedEastDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1472 size = size.transposed();-
1473 hint = hint.transposed();-
1474 }
never executed: end of block
0
1475 if (size.width() < hint.width()
size.width() < hint.width()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1476 return
never executed: return QTabBar::event(e);
QTabBar::event(e);
never executed: return QTabBar::event(e);
0
1477 e->accept();-
1478 return
never executed: return true;
true;
never executed: return true;
0
1479}-
1480-
1481QTabBar *QMainWindowLayout::getTabBar()-
1482{-
1483 QTabBar *result = 0;-
1484 if (!unusedTabBars.isEmpty()
!unusedTabBars.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1485 result = unusedTabBars.takeLast();-
1486 }
never executed: end of block
else {
0
1487 result = new QMainWindowTabBar(static_cast<QMainWindow *>(parentWidget()));-
1488 result->setDrawBase(true);-
1489 result->setElideMode(Qt::ElideRight);-
1490 result->setDocumentMode(_documentMode);-
1491 result->setMovable(true);-
1492 connect(result, qFlagLocation("2""currentChanged(int)" "\0" __FILE__ ":" "1651"), this, qFlagLocation("1""tabChanged()" "\0" __FILE__ ":" "1651"));-
1493 connect(result, &QTabBar::tabMoved, this, &QMainWindowLayout::tabMoved);-
1494 }
never executed: end of block
0
1495-
1496 usedTabBars.insert(result);-
1497 return
never executed: return result;
result;
never executed: return result;
0
1498}-
1499-
1500-
1501QWidget *QMainWindowLayout::getSeparatorWidget()-
1502{-
1503 QWidget *result = 0;-
1504 if (!unusedSeparatorWidgets.isEmpty()
!unusedSeparat...gets.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1505 result = unusedSeparatorWidgets.takeLast();-
1506 }
never executed: end of block
else {
0
1507 result = new QWidget(parentWidget());-
1508 result->setAttribute(Qt::WA_MouseNoMask, true);-
1509 result->setAutoFillBackground(false);-
1510 result->setObjectName(QLatin1String("qt_qmainwindow_extended_splitter"));-
1511 }
never executed: end of block
0
1512 usedSeparatorWidgets.insert(result);-
1513 return
never executed: return result;
result;
never executed: return result;
0
1514}-
1515-
1516-
1517-
1518-
1519-
1520QDockAreaLayoutInfo *QMainWindowLayout::dockInfo(QWidget *widget)-
1521{-
1522 QDockAreaLayoutInfo *info = layoutState.dockAreaLayout.info(widget);-
1523 if (info
infoDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1524 return
never executed: return info;
info;
never executed: return info;
0
1525 for (QForeachContainer<typename QtPrivate::remove_reference<decltype(parent()->findChildren<QDockWidgetGroupWindow*>(QString(), Qt::FindDirectChildrenOnly))>::type> _container_((parent()->findChildren<QDockWidgetGroupWindow*>(QString(), Qt::FindDirectChildrenOnly))); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QDockWidgetGroupWindow *dwgw = *_container_.i; _container_.control; _container_.control = 0)-
1526 {-
1527 info = dwgw->layoutInfo()->info(widget);-
1528 if (info
infoDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1529 return
never executed: return info;
info;
never executed: return info;
0
1530 }
never executed: end of block
0
1531 return
never executed: return 0;
0;
never executed: return 0;
0
1532}-
1533-
1534void QMainWindowLayout::tabChanged()-
1535{-
1536 QTabBar *tb = qobject_cast<QTabBar*>(sender());-
1537 if (tb == 0
tb == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1538 return;
never executed: return;
0
1539 QDockAreaLayoutInfo *info = dockInfo(tb);-
1540 if (info == 0
info == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1541 return;
never executed: return;
0
1542 info->apply(false);-
1543-
1544 if (QWidget *w = centralWidget()
QWidget *w = centralWidget()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1545 w->raise();
never executed: w->raise();
0
1546}
never executed: end of block
0
1547-
1548void QMainWindowLayout::tabMoved(int from, int to)-
1549{-
1550 QTabBar *tb = qobject_cast<QTabBar*>(sender());-
1551 ((!(tb)) ? qt_assert("tb",__FILE__,1710) : qt_noop());-
1552 QDockAreaLayoutInfo *info = dockInfo(tb);-
1553 ((!(info)) ? qt_assert("info",__FILE__,1712) : qt_noop());-
1554-
1555 info->moveTab(from, to);-
1556}
never executed: end of block
0
1557-
1558-
1559bool QMainWindowLayout::startSeparatorMove(const QPoint &pos)-
1560{-
1561 movingSeparator = layoutState.dockAreaLayout.findSeparator(pos);-
1562-
1563 if (movingSeparator.isEmpty()
movingSeparator.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1564 return
never executed: return false;
false;
never executed: return false;
0
1565-
1566 layoutState.dockAreaLayout.fallbackToSizeHints = false;-
1567-
1568 savedState = layoutState;-
1569 movingSeparatorPos = movingSeparatorOrigin = pos;-
1570-
1571 return
never executed: return true;
true;
never executed: return true;
0
1572}-
1573-
1574bool QMainWindowLayout::separatorMove(const QPoint &pos)-
1575{-
1576 if (movingSeparator.isEmpty()
movingSeparator.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1577 return
never executed: return false;
false;
never executed: return false;
0
1578 movingSeparatorPos = pos;-
1579 separatorMoveTimer.start(0, this);-
1580 return
never executed: return true;
true;
never executed: return true;
0
1581}-
1582-
1583bool QMainWindowLayout::endSeparatorMove(const QPoint&)-
1584{-
1585 if (movingSeparator.isEmpty()
movingSeparator.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1586 return
never executed: return false;
false;
never executed: return false;
0
1587 movingSeparator.clear();-
1588 savedState.clear();-
1589 return
never executed: return true;
true;
never executed: return true;
0
1590}-
1591-
1592void QMainWindowLayout::raise(QDockWidget *widget)-
1593{-
1594 QDockAreaLayoutInfo *info = dockInfo(widget);-
1595 if (info == 0
info == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1596 return;
never executed: return;
0
1597-
1598 if (!info->tabbed
!info->tabbedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1599 return;
never executed: return;
0
1600 info->setCurrentTab(widget);-
1601-
1602}
never executed: end of block
0
1603int QMainWindowLayout::count() const-
1604{-
1605 QMessageLogger(__FILE__, 1772, __PRETTY_FUNCTION__).warning("QMainWindowLayout::count: ?");-
1606 return
never executed: return 0;
0;
never executed: return 0;
0
1607}-
1608-
1609QLayoutItem *QMainWindowLayout::itemAt(int index) const-
1610{-
1611 int x = 0;-
1612-
1613 if (QLayoutItem *ret = layoutState.itemAt(index, &x)
QLayoutItem *r...mAt(index, &x)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1614 return
never executed: return ret;
ret;
never executed: return ret;
0
1615-
1616 if (statusbar
statusbarDescription
TRUEnever evaluated
FALSEnever evaluated
&& x++ == index
x++ == indexDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1617 return
never executed: return statusbar;
statusbar;
never executed: return statusbar;
0
1618-
1619 return
never executed: return 0;
0;
never executed: return 0;
0
1620}-
1621-
1622QLayoutItem *QMainWindowLayout::takeAt(int index)-
1623{-
1624 int x = 0;-
1625-
1626 if (QLayoutItem *ret = layoutState.takeAt(index, &x)
QLayoutItem *r...eAt(index, &x)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1627-
1628 if (QWidget *w = ret->widget()
QWidget *w = ret->widget()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1629 widgetAnimator.abort(w);-
1630 if (w == pluggingWidget
w == pluggingWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1631 pluggingWidget = 0;
never executed: pluggingWidget = 0;
0
1632 }
never executed: end of block
0
1633-
1634 if (savedState.isValid()
savedState.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1635-
1636 savedState.remove(ret);-
1637-
1638 layoutState.remove(ret);-
1639 }
never executed: end of block
0
1640-
1641-
1642 if (!currentGapPos.isEmpty()
!currentGapPos.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
&& currentGapPos.constFirst() == 0
currentGapPos....stFirst() == 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1643 currentGapPos = layoutState.toolBarAreaLayout.currentGapIndex();-
1644 if (!currentGapPos.isEmpty()
!currentGapPos.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1645 currentGapPos.prepend(0);-
1646 currentGapRect = layoutState.itemRect(currentGapPos);-
1647 }
never executed: end of block
0
1648 }
never executed: end of block
0
1649-
1650-
1651 return
never executed: return ret;
ret;
never executed: return ret;
0
1652 }-
1653-
1654 if (statusbar
statusbarDescription
TRUEnever evaluated
FALSEnever evaluated
&& x++ == index
x++ == indexDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1655 QLayoutItem *ret = statusbar;-
1656 statusbar = 0;-
1657 return
never executed: return ret;
ret;
never executed: return ret;
0
1658 }-
1659-
1660 return
never executed: return 0;
0;
never executed: return 0;
0
1661}-
1662-
1663void QMainWindowLayout::setGeometry(const QRect &_r)-
1664{-
1665 if (savedState.isValid()
savedState.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1666 return;
never executed: return;
0
1667-
1668 QRect r = _r;-
1669-
1670 QLayout::setGeometry(r);-
1671-
1672 if (statusbar
statusbarDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1673 QRect sbr(QPoint(r.left(), 0),-
1674 QSize(r.width(), statusbar->heightForWidth(r.width()))-
1675 .expandedTo(statusbar->minimumSize()));-
1676 sbr.moveBottom(r.bottom());-
1677 QRect vr = QStyle::visualRect(parentWidget()->layoutDirection(), _r, sbr);-
1678 statusbar->setGeometry(vr);-
1679 r.setBottom(sbr.top() - 1);-
1680 }
never executed: end of block
0
1681-
1682 layoutState.rect = r;-
1683 layoutState.fitLayout();-
1684 applyState(layoutState, false);-
1685}
never executed: end of block
0
1686-
1687void QMainWindowLayout::addItem(QLayoutItem *)-
1688{ QMessageLogger(__FILE__, 1855, __PRETTY_FUNCTION__).warning("QMainWindowLayout::addItem: Please use the public QMainWindow API instead"); }
never executed: end of block
0
1689-
1690QSize QMainWindowLayout::sizeHint() const-
1691{-
1692 if (!szHint.isValid()
!szHint.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1693 szHint = layoutState.sizeHint();-
1694 const QSize sbHint = statusbar
statusbarDescription
TRUEnever evaluated
FALSEnever evaluated
? statusbar->sizeHint() : QSize(0, 0);
0
1695 szHint = QSize(qMax(sbHint.width(), szHint.width()),-
1696 sbHint.height() + szHint.height());-
1697 }
never executed: end of block
0
1698 return
never executed: return szHint;
szHint;
never executed: return szHint;
0
1699}-
1700-
1701QSize QMainWindowLayout::minimumSize() const-
1702{-
1703 if (!minSize.isValid()
!minSize.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1704 minSize = layoutState.minimumSize();-
1705 const QSize sbMin = statusbar
statusbarDescription
TRUEnever evaluated
FALSEnever evaluated
? statusbar->minimumSize() : QSize(0, 0);
0
1706 minSize = QSize(qMax(sbMin.width(), minSize.width()),-
1707 sbMin.height() + minSize.height());-
1708 }
never executed: end of block
0
1709 return
never executed: return minSize;
minSize;
never executed: return minSize;
0
1710}-
1711-
1712void QMainWindowLayout::invalidate()-
1713{-
1714 QLayout::invalidate();-
1715 minSize = szHint = QSize();-
1716}
never executed: end of block
0
1717-
1718-
1719-
1720-
1721-
1722static void fixToolBarOrientation(QLayoutItem *item, int dockPos)-
1723{-
1724-
1725 QToolBar *toolBar = qobject_cast<QToolBar*>(item->widget());-
1726 if (toolBar == 0
toolBar == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1727 return;
never executed: return;
0
1728-
1729 QRect oldGeo = toolBar->geometry();-
1730-
1731 QInternal::DockPosition pos-
1732 = static_cast<QInternal::DockPosition>(dockPos);-
1733 Qt::Orientation o = pos == QInternal::TopDock
pos == QInternal::TopDockDescription
TRUEnever evaluated
FALSEnever evaluated
|| pos == QInternal::BottomDock
pos == QInternal::BottomDockDescription
TRUEnever evaluated
FALSEnever evaluated
0
1734 ? Qt::Horizontal : Qt::Vertical;-
1735 if (o != toolBar->orientation()
o != toolBar->orientation()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1736 toolBar->setOrientation(o);
never executed: toolBar->setOrientation(o);
0
1737-
1738 QSize hint = toolBar->sizeHint().boundedTo(toolBar->maximumSize())-
1739 .expandedTo(toolBar->minimumSize());-
1740-
1741 if (toolBar->size() != hint
toolBar->size() != hintDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1742 QRect newGeo(oldGeo.topLeft(), hint);-
1743 if (toolBar->layoutDirection() == Qt::RightToLeft
toolBar->layou...t::RightToLeftDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1744 newGeo.moveRight(oldGeo.right());
never executed: newGeo.moveRight(oldGeo.right());
0
1745 toolBar->setGeometry(newGeo);-
1746 }
never executed: end of block
0
1747-
1748-
1749-
1750-
1751-
1752}
never executed: end of block
0
1753-
1754void QMainWindowLayout::revert(QLayoutItem *widgetItem)-
1755{-
1756 if (!savedState.isValid()
!savedState.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1757 return;
never executed: return;
0
1758-
1759 QWidget *widget = widgetItem->widget();-
1760 layoutState = savedState;-
1761 currentGapPos = layoutState.indexOf(widget);-
1762 if (currentGapPos.isEmpty()
currentGapPos.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1763 return;
never executed: return;
0
1764 fixToolBarOrientation(widgetItem, currentGapPos.at(1));-
1765 layoutState.unplug(currentGapPos);-
1766 layoutState.fitLayout();-
1767 currentGapRect = layoutState.itemRect(currentGapPos);-
1768-
1769 plug(widgetItem);-
1770}
never executed: end of block
0
1771-
1772bool QMainWindowLayout::plug(QLayoutItem *widgetItem)-
1773{-
1774-
1775 if (currentHoveredFloat
currentHoveredFloatDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1776 QWidget *widget = widgetItem->widget();-
1777 QList<int> previousPath = layoutState.indexOf(widget);-
1778 if (!previousPath.isEmpty()
!previousPath.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1779 layoutState.remove(previousPath);
never executed: layoutState.remove(previousPath);
0
1780-
1781 for (QForeachContainer<typename QtPrivate::remove_reference<decltype(parent()->findChildren<QDockWidgetGroupWindow*>(QString(), Qt::FindDirectChildrenOnly))>::type> _container_((parent()->findChildren<QDockWidgetGroupWindow*>(QString(), Qt::FindDirectChildrenOnly))); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QDockWidgetGroupWindow *dwgw = *_container_.i; _container_.control; _container_.control = 0)-
1782 {-
1783 QList<int> path = dwgw->layoutInfo()->indexOf(widget);-
1784 if (!path.isEmpty()
!path.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1785 dwgw->layoutInfo()->remove(path);
never executed: dwgw->layoutInfo()->remove(path);
0
1786 }
never executed: end of block
0
1787 currentGapRect = QRect();-
1788-
1789 if (QDockWidget *dropTo = qobject_cast<QDockWidget*>(currentHoveredFloat)
QDockWidget *d...tHoveredFloat)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1790-
1791 QDockWidgetGroupWindow *floatingTabs = createTabbedDockWindow();-
1792 floatingTabs->setGeometry(dropTo->geometry());-
1793 QDockAreaLayoutInfo *info = floatingTabs->layoutInfo();-
1794 *info = QDockAreaLayoutInfo(&layoutState.dockAreaLayout.sep, QInternal::LeftDock,-
1795 Qt::Horizontal, QTabBar::RoundedSouth,-
1796 static_cast<QMainWindow*>(parentWidget()));-
1797 info->tabbed = true;-
1798 QLayout *parentLayout = currentHoveredFloat->parentWidget()->layout();-
1799 info->item_list.append(QDockAreaLayoutItem(parentLayout->takeAt(parentLayout->indexOf(currentHoveredFloat))));-
1800-
1801 dropTo->setParent(floatingTabs);-
1802 dropTo->show();-
1803 dropTo->d_func()->plug(QRect());-
1804 currentHoveredFloat = floatingTabs;-
1805 }
never executed: end of block
0
1806-
1807 QDockWidgetGroupWindow *dwgw = qobject_cast<QDockWidgetGroupWindow *>(currentHoveredFloat);-
1808 ((!(dwgw)) ? qt_assert("dwgw",__FILE__,1983) : qt_noop());-
1809 ((!(dwgw->layoutInfo()->tabbed)) ? qt_assert("dwgw->layoutInfo()->tabbed",__FILE__,1984) : qt_noop());-
1810 previousPath = dwgw->layoutInfo()->indexOf(widget);-
1811 if (!previousPath.isEmpty()
!previousPath.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1812 dwgw->layoutInfo()->remove(previousPath);
never executed: dwgw->layoutInfo()->remove(previousPath);
0
1813 dwgw->layoutInfo()->tab(0, widgetItem);-
1814 QRect globalRect = dwgw->layoutInfo()->tabContentRect();-
1815 globalRect.moveTopLeft(dwgw->mapToGlobal(globalRect.topLeft()));-
1816 pluggingWidget = widget;-
1817 widgetAnimator.animate(widget, globalRect, dockOptions & QMainWindow::AnimatedDocks);-
1818 return
never executed: return true;
true;
never executed: return true;
0
1819 }-
1820-
1821-
1822 if (!parentWidget()->isVisible()
!parentWidget()->isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
|| parentWidget()->isMinimized()
parentWidget()->isMinimized()Description
TRUEnever evaluated
FALSEnever evaluated
|| currentGapPos.isEmpty()
currentGapPos.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1823 return
never executed: return false;
false;
never executed: return false;
0
1824-
1825 fixToolBarOrientation(widgetItem, currentGapPos.at(1));-
1826-
1827 QWidget *widget = widgetItem->widget();-
1828-
1829-
1830-
1831 for (QForeachContainer<typename QtPrivate::remove_reference<decltype(parent()->findChildren<QDockWidgetGroupWindow*>(QString(), Qt::FindDirectChildrenOnly))>::type> _container_((parent()->findChildren<QDockWidgetGroupWindow*>(QString(), Qt::FindDirectChildrenOnly))); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QDockWidgetGroupWindow *dwgw = *_container_.i; _container_.control; _container_.control = 0)-
1832 {-
1833 QList<int> path = dwgw->layoutInfo()->indexOf(widget);-
1834 if (!path.isEmpty()
!path.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1835 dwgw->layoutInfo()->remove(path);
never executed: dwgw->layoutInfo()->remove(path);
0
1836 }
never executed: end of block
0
1837-
1838-
1839 QList<int> previousPath = layoutState.indexOf(widget);-
1840-
1841 const QLayoutItem *it = layoutState.plug(currentGapPos);-
1842 if (!it
!itDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1843 return
never executed: return false;
false;
never executed: return false;
0
1844 ((!(it == widgetItem)) ? qt_assert("it == widgetItem",__FILE__,2019) : qt_noop());-
1845 if (!previousPath.isEmpty()
!previousPath.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1846 layoutState.remove(previousPath);
never executed: layoutState.remove(previousPath);
0
1847-
1848 pluggingWidget = widget;-
1849 QRect globalRect = currentGapRect;-
1850 globalRect.moveTopLeft(parentWidget()->mapToGlobal(globalRect.topLeft()));-
1851-
1852 if (qobject_cast<QDockWidget*>(widget) != 0
qobject_cast<Q...>(widget) != 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1853 QDockWidgetLayout *layout = qobject_cast<QDockWidgetLayout*>(widget->layout());-
1854 if (layout->nativeWindowDeco()
layout->nativeWindowDeco()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1855 globalRect.adjust(0, layout->titleHeight(), 0, 0);-
1856 }
never executed: end of block
else {
0
1857 int fw = widget->style()->pixelMetric(QStyle::PM_DockWidgetFrameWidth, 0, widget);-
1858 globalRect.adjust(-fw, -fw, fw, fw);-
1859 }
never executed: end of block
0
1860 }-
1861-
1862 widgetAnimator.animate(widget, globalRect, dockOptions & QMainWindow::AnimatedDocks);-
1863-
1864 return
never executed: return true;
true;
never executed: return true;
0
1865}-
1866-
1867void QMainWindowLayout::animationFinished(QWidget *widget)-
1868{-
1869-
1870-
1871-
1872 if (QToolBar *tb = qobject_cast<QToolBar*>(widget)
QToolBar *tb =...lBar*>(widget)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1873 QToolBarLayout *tbl = qobject_cast<QToolBarLayout*>(tb->layout());-
1874 if (tbl->animating
tbl->animatingDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1875 tbl->animating = false;-
1876 if (tbl->expanded
tbl->expandedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1877 tbl->layoutActions(tb->size());
never executed: tbl->layoutActions(tb->size());
0
1878 tb->update();-
1879 }
never executed: end of block
0
1880 }
never executed: end of block
0
1881-
1882-
1883 if (widget == pluggingWidget
widget == pluggingWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1884-
1885-
1886 if (QDockWidgetGroupWindow *dwgw = qobject_cast<QDockWidgetGroupWindow *>(widget)
QDockWidgetGro...dow *>(widget)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1887-
1888-
1889 savedState.clear();-
1890 QDockAreaLayoutInfo* info = dwgw->layoutInfo();-
1891 QDockAreaLayoutInfo* parentInfo;-
1892 QList<int> path;-
1893-
1894 if (QDockWidgetGroupWindow *dropTo = qobject_cast<QDockWidgetGroupWindow *>(currentHoveredFloat)
QDockWidgetGro...tHoveredFloat)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1895 parentInfo = dropTo->layoutInfo();-
1896 ((!(parentInfo->tabbed)) ? qt_assert("parentInfo->tabbed",__FILE__,2071) : qt_noop());-
1897 path = parentInfo->indexOf(widget);-
1898 ((!(path.size() == 1)) ? qt_assert("path.size() == 1",__FILE__,2073) : qt_noop());-
1899 }
never executed: end of block
else {
0
1900 path = layoutState.dockAreaLayout.indexOf(widget);-
1901 ((!(path.size() >= 2)) ? qt_assert("path.size() >= 2",__FILE__,2076) : qt_noop());-
1902 parentInfo = layoutState.dockAreaLayout.info(path);-
1903 ((!(parentInfo)) ? qt_assert("parentInfo",__FILE__,2078) : qt_noop());-
1904 }
never executed: end of block
0
1905-
1906 if (parentInfo->tabbed
parentInfo->tabbedDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1907-
1908 int idx = path.constLast();-
1909 ((!(parentInfo->item_list[idx].widgetItem->widget() == dwgw)) ? qt_assert("parentInfo->item_list[idx].widgetItem->widget() == dwgw",__FILE__,2084) : qt_noop());-
1910 delete parentInfo->item_list[idx].widgetItem;-
1911 parentInfo->item_list.removeAt(idx);-
1912 std::copy(info->item_list.cbegin(), info->item_list.cend(),-
1913 std::inserter(parentInfo->item_list, parentInfo->item_list.begin() + idx));-
1914 quintptr currentId = info->currentTabId();-
1915 *info = QDockAreaLayoutInfo();-
1916 parentInfo->reparentWidgets(currentHoveredFloat ? currentHoveredFloat.data() : parentWidget());-
1917 parentInfo->updateTabBar();-
1918 parentInfo->setCurrentTabId(currentId);-
1919 }
never executed: end of block
else {
0
1920 QDockAreaLayoutItem &item = layoutState.dockAreaLayout.item(path);-
1921 ((!(item.widgetItem->widget() == dwgw)) ? qt_assert("item.widgetItem->widget() == dwgw",__FILE__,2096) : qt_noop());-
1922 delete item.widgetItem;-
1923 item.widgetItem = 0;-
1924 item.subinfo = new QDockAreaLayoutInfo(std::move(*info));-
1925 *info = QDockAreaLayoutInfo();-
1926 item.subinfo->reparentWidgets(parentWidget());-
1927 item.subinfo->setTabBarShape(parentInfo->tabBarShape);-
1928 }
never executed: end of block
0
1929 dwgw->destroyOrHideIfEmpty();-
1930 }
never executed: end of block
0
1931-
1932 if (QDockWidget *dw = qobject_cast<QDockWidget*>(widget)
QDockWidget *d...dget*>(widget)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1933 if (currentHoveredFloat
currentHoveredFloatDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1934 dw->setParent(currentHoveredFloat);-
1935 dw->show();-
1936 }
never executed: end of block
0
1937 dw->d_func()->plug(currentGapRect);-
1938 }
never executed: end of block
0
1939-
1940-
1941 if (QToolBar *tb = qobject_cast<QToolBar*>(widget)
QToolBar *tb =...lBar*>(widget)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1942 tb->d_func()->plug(currentGapRect);
never executed: tb->d_func()->plug(currentGapRect);
0
1943-
1944-
1945 savedState.clear();-
1946 currentGapPos.clear();-
1947 pluggingWidget = 0;-
1948 currentHoveredFloat = nullptr;-
1949-
1950-
1951 layoutState.apply(false);-
1952-
1953-
1954-
1955 if (qobject_cast<QDockWidget*>(widget) != 0
qobject_cast<Q...>(widget) != 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1956-
1957-
1958 if (QDockAreaLayoutInfo *info = dockInfo(widget)
QDockAreaLayou...ckInfo(widget)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1959 info->setCurrentTab(widget);
never executed: info->setCurrentTab(widget);
0
1960 }
never executed: end of block
0
1961-
1962-
1963 }
never executed: end of block
0
1964-
1965 if (!widgetAnimator.animating()
!widgetAnimator.animating()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1966-
1967-
1968 parentWidget()->update(layoutState.dockAreaLayout.separatorRegion());-
1969-
1970 for (QForeachContainer<typename QtPrivate::remove_reference<decltype(usedTabBars)>::type> _container_((usedTabBars)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QTabBar *tab_bar = *_container_.i; _container_.control; _container_.control = 0)-
1971 tab_bar->show();
never executed: tab_bar->show();
0
1972-
1973-
1974 }
never executed: end of block
0
1975-
1976 updateGapIndicator();-
1977}
never executed: end of block
0
1978-
1979void QMainWindowLayout::restore(bool keepSavedState)-
1980{-
1981 if (!savedState.isValid()
!savedState.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1982 return;
never executed: return;
0
1983-
1984 layoutState = savedState;-
1985 applyState(layoutState);-
1986 if (!keepSavedState
!keepSavedStateDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1987 savedState.clear();
never executed: savedState.clear();
0
1988 currentGapPos.clear();-
1989 pluggingWidget = 0;-
1990 updateGapIndicator();-
1991}
never executed: end of block
0
1992-
1993QMainWindowLayout::QMainWindowLayout(QMainWindow *mainwindow, QLayout *parentLayout)-
1994 : QLayout(parentLayout ? static_cast<QWidget *>(0) : mainwindow)-
1995 , layoutState(mainwindow)-
1996 , savedState(mainwindow)-
1997 , dockOptions(QMainWindow::AnimatedDocks | QMainWindow::AllowTabbedDocks)-
1998 , statusbar(0)-
1999-
2000-
2001 , _documentMode(false)-
2002 , verticalTabsEnabled(false)-
2003-
2004 , _tabShape(QTabWidget::Rounded)-
2005-
2006-
2007-
2008 , widgetAnimator(this)-
2009 , pluggingWidget(0)-
2010-
2011-
2012-
2013{-
2014 if (parentLayout
parentLayoutDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2015 setParent(parentLayout);
never executed: setParent(parentLayout);
0
2016-
2017-
2018-
2019 sep = mainwindow->style()->pixelMetric(QStyle::PM_DockWidgetSeparatorExtent, 0, mainwindow);-
2020-
2021-
2022-
2023 for (int i = 0; i < QInternal::DockCount
i < QInternal::DockCountDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i)
0
2024 tabPositions[i] = QTabWidget::South;
never executed: tabPositions[i] = QTabWidget::South;
0
2025-
2026-
2027 pluggingWidget = 0;-
2028-
2029 setObjectName(mainwindow->objectName() + QLatin1String("_layout"));-
2030}
never executed: end of block
0
2031-
2032QMainWindowLayout::~QMainWindowLayout()-
2033{-
2034 layoutState.deleteAllLayoutItems();-
2035 layoutState.deleteCentralWidgetItem();-
2036-
2037-
2038-
2039-
2040-
2041 delete statusbar;-
2042}
never executed: end of block
0
2043-
2044void QMainWindowLayout::setDockOptions(QMainWindow::DockOptions opts)-
2045{-
2046 if (opts == dockOptions
opts == dockOptionsDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2047 return;
never executed: return;
0
2048-
2049 dockOptions = opts;-
2050-
2051-
2052 setVerticalTabsEnabled(opts & QMainWindow::VerticalTabs);-
2053-
2054-
2055 invalidate();-
2056}
never executed: end of block
0
2057-
2058-
2059QStatusBar *QMainWindowLayout::statusBar() const-
2060{ return
never executed: return statusbar ? qobject_cast<QStatusBar *>(statusbar->widget()) : 0;
statusbar ? qobject_cast<QStatusBar *>(statusbar->widget()) : 0;
never executed: return statusbar ? qobject_cast<QStatusBar *>(statusbar->widget()) : 0;
}
0
2061-
2062void QMainWindowLayout::setStatusBar(QStatusBar *sb)-
2063{-
2064 if (sb
sbDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2065 addChildWidget(sb);
never executed: addChildWidget(sb);
0
2066 delete statusbar;-
2067 statusbar = sb
sbDescription
TRUEnever evaluated
FALSEnever evaluated
? new QWidgetItemV2(sb) : 0;
0
2068 invalidate();-
2069}
never executed: end of block
0
2070-
2071-
2072QWidget *QMainWindowLayout::centralWidget() const-
2073{-
2074 return
never executed: return layoutState.centralWidget();
layoutState.centralWidget();
never executed: return layoutState.centralWidget();
0
2075}-
2076-
2077void QMainWindowLayout::setCentralWidget(QWidget *widget)-
2078{-
2079 if (widget != 0
widget != 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2080 addChildWidget(widget);
never executed: addChildWidget(widget);
0
2081 layoutState.setCentralWidget(widget);-
2082 if (savedState.isValid()
savedState.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2083-
2084 savedState.dockAreaLayout.centralWidgetItem = layoutState.dockAreaLayout.centralWidgetItem;-
2085 savedState.dockAreaLayout.fallbackToSizeHints = true;-
2086-
2087-
2088-
2089 }
never executed: end of block
0
2090 invalidate();-
2091}
never executed: end of block
0
2092QLayoutItem *QMainWindowLayout::unplug(QWidget *widget, bool group)-
2093{-
2094-
2095 if (!widget->isWindow()
!widget->isWindow()Description
TRUEnever evaluated
FALSEnever evaluated
&& qobject_cast<const QDockWidgetGroupWindow *>(widget->parentWidget())
qobject_cast<c...arentWidget())Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2096 if (group
groupDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2097-
2098-
2099 QList<int> tabbedWindowPath = layoutState.indexOf(widget->parentWidget());-
2100 return
never executed: return tabbedWindowPath.isEmpty() ? 0 : layoutState.item(tabbedWindowPath);
tabbedWindowPath.isEmpty() ? 0 : layoutState.item(tabbedWindowPath);
never executed: return tabbedWindowPath.isEmpty() ? 0 : layoutState.item(tabbedWindowPath);
0
2101 } else {-
2102-
2103 if (QDockWidget *dw = qobject_cast<QDockWidget*>(widget)
QDockWidget *d...dget*>(widget)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2104 dw->d_func()->unplug(widget->geometry());-
2105 return
never executed: return 0;
0;
never executed: return 0;
0
2106 }-
2107 }
never executed: end of block
0
2108 }-
2109-
2110 QList<int> path = layoutState.indexOf(widget);-
2111 if (path.isEmpty()
path.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2112 return
never executed: return 0;
0;
never executed: return 0;
0
2113-
2114 QLayoutItem *item = layoutState.item(path);-
2115 if (widget->isWindow()
widget->isWindow()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2116 return
never executed: return item;
item;
never executed: return item;
0
2117-
2118 QRect r = layoutState.itemRect(path);-
2119 savedState = layoutState;-
2120-
2121-
2122 if (QDockWidget *dw = qobject_cast<QDockWidget*>(widget)
QDockWidget *d...dget*>(widget)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2123 ((!(path.constFirst() == 1)) ? qt_assert("path.constFirst() == 1",__FILE__,2309) : qt_noop());-
2124 bool actualGroup = false;-
2125-
2126 if (group
groupDescription
TRUEnever evaluated
FALSEnever evaluated
&& (
(dockOptions &...oupedDragging)Description
TRUEnever evaluated
FALSEnever evaluated
dockOptions & QMainWindow::GroupedDragging)
(dockOptions &...oupedDragging)Description
TRUEnever evaluated
FALSEnever evaluated
&& path.size() > 3
path.size() > 3Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2127 QDockAreaLayoutItem &parentItem = layoutState.dockAreaLayout.item(path.mid(1, path.size() - 2));-
2128 if (parentItem.subinfo
parentItem.subinfoDescription
TRUEnever evaluated
FALSEnever evaluated
&& parentItem.subinfo->tabbed
parentItem.subinfo->tabbedDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2129-
2130 actualGroup = true;-
2131 path.removeLast();-
2132-
2133 QDockWidgetGroupWindow* floatingTabs = createTabbedDockWindow();-
2134 QDockAreaLayoutInfo* info = floatingTabs->layoutInfo();-
2135 *info = std::move(*parentItem.subinfo);-
2136 delete parentItem.subinfo;-
2137 parentItem.subinfo = 0;-
2138 floatingTabs->setGeometry(info->rect.translated(parentWidget()->pos()));-
2139 floatingTabs->show();-
2140 floatingTabs->raise();-
2141 item = new QDockWidgetGroupWindowItem(floatingTabs);-
2142 parentItem.widgetItem = item;-
2143 savedState = layoutState;-
2144 }
never executed: end of block
0
2145 }
never executed: end of block
0
2146-
2147 if (!actualGroup
!actualGroupDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2148 dw->d_func()->unplug(r);-
2149 }
never executed: end of block
0
2150 }
never executed: end of block
0
2151-
2152-
2153 if (QToolBar *tb = qobject_cast<QToolBar*>(widget)
QToolBar *tb =...lBar*>(widget)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2154 tb->d_func()->unplug(r);-
2155 }
never executed: end of block
0
2156-
2157-
2158-
2159 layoutState.unplug(path ,&savedState);-
2160 savedState.fitLayout();-
2161 currentGapPos = path;-
2162 currentGapRect = r;-
2163 updateGapIndicator();-
2164-
2165 fixToolBarOrientation(item, currentGapPos.at(1));-
2166-
2167 return
never executed: return item;
item;
never executed: return item;
0
2168}-
2169-
2170void QMainWindowLayout::updateGapIndicator()-
2171{-
2172-
2173 if ((!widgetAnimator.animating()
!widgetAnimator.animating()Description
TRUEnever evaluated
FALSEnever evaluated
&& !currentGapPos.isEmpty()
!currentGapPos.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) || currentHoveredFloat
currentHoveredFloatDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2174 QWidget *expectedParent = currentHoveredFloat
currentHoveredFloatDescription
TRUEnever evaluated
FALSEnever evaluated
? currentHoveredFloat.data() : parentWidget();
0
2175 if (!gapIndicator
!gapIndicatorDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2176 gapIndicator = new QRubberBand(QRubberBand::Rectangle, expectedParent);-
2177-
2178 gapIndicator->setObjectName(QLatin1String("qt_rubberband"));-
2179 }
never executed: end of block
else if (gapIndicator->parent() != expectedParent
gapIndicator->...expectedParentDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2180 gapIndicator->setParent(expectedParent);-
2181 }
never executed: end of block
0
2182 gapIndicator->setGeometry(currentHoveredFloat ? currentHoveredFloat->rect() : currentGapRect);-
2183 gapIndicator->show();-
2184 gapIndicator->raise();-
2185 }
never executed: end of block
else if (gapIndicator
gapIndicatorDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2186 gapIndicator->hide();-
2187 }
never executed: end of block
0
2188-
2189}
never executed: end of block
0
2190-
2191void QMainWindowLayout::hover(QLayoutItem *widgetItem, const QPoint &mousePos)-
2192{-
2193 if (!parentWidget()->isVisible()
!parentWidget()->isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
|| parentWidget()->isMinimized()
parentWidget()->isMinimized()Description
TRUEnever evaluated
FALSEnever evaluated
0
2194 || pluggingWidget != 0
pluggingWidget != 0Description
TRUEnever evaluated
FALSEnever evaluated
|| widgetItem == 0
widgetItem == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2195 return;
never executed: return;
0
2196-
2197 QWidget *widget = widgetItem->widget();-
2198-
2199-
2200 if ((
(dockOptions &...oupedDragging)Description
TRUEnever evaluated
FALSEnever evaluated
dockOptions & QMainWindow::GroupedDragging)
(dockOptions &...oupedDragging)Description
TRUEnever evaluated
FALSEnever evaluated
&& (qobject_cast<QDockWidget*>(widget)
qobject_cast<Q...dget*>(widget)Description
TRUEnever evaluated
FALSEnever evaluated
0
2201 || qobject_cast<QDockWidgetGroupWindow *>(widget)
qobject_cast<Q...dow *>(widget)Description
TRUEnever evaluated
FALSEnever evaluated
)) {
0
2202-
2203-
2204 QVarLengthArray<QWidget *, 10> candidates;-
2205 for (QForeachContainer<typename QtPrivate::remove_reference<decltype(parentWidget()->children())>::type> _container_((parentWidget()->children())); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QObject *c = *_container_.i; _container_.control; _container_.control = 0) {-
2206 QWidget *w = qobject_cast<QWidget*>(c);-
2207 if (!w
!wDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2208 continue;
never executed: continue;
0
2209 if (!qobject_cast<QDockWidget*>(w)
!qobject_cast<QDockWidget*>(w)Description
TRUEnever evaluated
FALSEnever evaluated
&& !qobject_cast<QDockWidgetGroupWindow *>(w)
!qobject_cast<...upWindow *>(w)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2210 continue;
never executed: continue;
0
2211 if (w != widget
w != widgetDescription
TRUEnever evaluated
FALSEnever evaluated
&& w->isTopLevel()
w->isTopLevel()Description
TRUEnever evaluated
FALSEnever evaluated
&& w->isVisible()
w->isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
&& !w->isMinimized()
!w->isMinimized()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2212 candidates << w;
never executed: candidates << w;
0
2213 if (QDockWidgetGroupWindow *group = qobject_cast<QDockWidgetGroupWindow *>(w)
QDockWidgetGro...upWindow *>(w)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2214-
2215 for (QForeachContainer<typename QtPrivate::remove_reference<decltype(group->children())>::type> _container_((group->children())); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QObject *c = *_container_.i; _container_.control; _container_.control = 0) {-
2216 if (QDockWidget *dw = qobject_cast<QDockWidget*>(c)
QDockWidget *d...ockWidget*>(c)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2217 if (dw != widget
dw != widgetDescription
TRUEnever evaluated
FALSEnever evaluated
&& dw->isFloating()
dw->isFloating()Description
TRUEnever evaluated
FALSEnever evaluated
&& dw->isVisible()
dw->isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
&& !dw->isMinimized()
!dw->isMinimized()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2218 candidates << dw;
never executed: candidates << dw;
0
2219 }
never executed: end of block
0
2220 }
never executed: end of block
0
2221 }
never executed: end of block
0
2222 }
never executed: end of block
0
2223 for (QWidget *w : candidates) {-
2224 QWindow *handle1 = widget->windowHandle();-
2225 QWindow *handle2 = w->windowHandle();-
2226 if (handle1
handle1Description
TRUEnever evaluated
FALSEnever evaluated
&& handle2
handle2Description
TRUEnever evaluated
FALSEnever evaluated
&& handle1->screen() != handle2->screen()
handle1->scree...dle2->screen()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2227 continue;
never executed: continue;
0
2228 if (!w->geometry().contains(mousePos)
!w->geometry()...ains(mousePos)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2229 continue;
never executed: continue;
0
2230-
2231 currentHoveredFloat = w;-
2232 restore(true);-
2233 return;
never executed: return;
0
2234 }-
2235 }
never executed: end of block
0
2236 currentHoveredFloat = nullptr;-
2237-
2238-
2239 QPoint pos = parentWidget()->mapFromGlobal(mousePos);-
2240-
2241 if (!savedState.isValid()
!savedState.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2242 savedState = layoutState;
never executed: savedState = layoutState;
0
2243-
2244 QList<int> path = savedState.gapIndex(widget, pos);-
2245-
2246 if (!path.isEmpty()
!path.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2247 bool allowed = false;-
2248-
2249-
2250 if (QDockWidget *dw = qobject_cast<QDockWidget*>(widget)
QDockWidget *d...dget*>(widget)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2251 allowed = dw->isAreaAllowed(toDockWidgetArea(path.at(1)));
never executed: allowed = dw->isAreaAllowed(toDockWidgetArea(path.at(1)));
0
2252-
2253 if (qobject_cast<QDockWidgetGroupWindow *>(widget)
qobject_cast<Q...dow *>(widget)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2254 allowed = true;
never executed: allowed = true;
0
2255-
2256-
2257 if (QToolBar *tb = qobject_cast<QToolBar*>(widget)
QToolBar *tb =...lBar*>(widget)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2258 allowed = tb->isAreaAllowed(toToolBarArea(path.at(1)));
never executed: allowed = tb->isAreaAllowed(toToolBarArea(path.at(1)));
0
2259-
2260-
2261 if (!allowed
!allowedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2262 path.clear();
never executed: path.clear();
0
2263 }
never executed: end of block
0
2264-
2265 if (path == currentGapPos
path == currentGapPosDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2266 return;
never executed: return;
0
2267-
2268 currentGapPos = path;-
2269 if (path.isEmpty()
path.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2270 fixToolBarOrientation(widgetItem, 2);-
2271 restore(true);-
2272 return;
never executed: return;
0
2273 }-
2274-
2275 fixToolBarOrientation(widgetItem, currentGapPos.at(1));-
2276-
2277 QMainWindowLayoutState newState = savedState;-
2278-
2279 if (!newState.insertGap(path, widgetItem)
!newState.inse...h, widgetItem)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2280 restore(true);-
2281 return;
never executed: return;
0
2282 }-
2283-
2284 QSize min = newState.minimumSize();-
2285 QSize size = newState.rect.size();-
2286-
2287 if (min.width() > size.width()
min.width() > size.width()Description
TRUEnever evaluated
FALSEnever evaluated
|| min.height() > size.height()
min.height() > size.height()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2288 restore(true);-
2289 return;
never executed: return;
0
2290 }-
2291-
2292 newState.fitLayout();-
2293-
2294 currentGapRect = newState.gapRect(currentGapPos);-
2295-
2296-
2297 parentWidget()->update(layoutState.dockAreaLayout.separatorRegion());-
2298-
2299 layoutState = newState;-
2300 applyState(layoutState);-
2301-
2302 updateGapIndicator();-
2303}
never executed: end of block
0
2304-
2305QDockWidgetGroupWindow *QMainWindowLayout::createTabbedDockWindow()-
2306{-
2307 QDockWidgetGroupWindow* f = new QDockWidgetGroupWindow(parentWidget(), Qt::Tool);-
2308 new QDockWidgetGroupLayout(f);-
2309 return
never executed: return f;
f;
never executed: return f;
0
2310}-
2311-
2312void QMainWindowLayout::applyState(QMainWindowLayoutState &newState, bool animate)-
2313{-
2314-
2315-
2316 QSet<QTabBar*> used = newState.dockAreaLayout.usedTabBars();-
2317 for (QForeachContainer<typename QtPrivate::remove_reference<decltype(parent()->findChildren<QDockWidgetGroupWindow*>(QString(), Qt::FindDirectChildrenOnly))>::type> _container_((parent()->findChildren<QDockWidgetGroupWindow*>(QString(), Qt::FindDirectChildrenOnly))); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QDockWidgetGroupWindow *dwgw = *_container_.i; _container_.control; _container_.control = 0)-
2318 {-
2319 used += dwgw->layoutInfo()->usedTabBars();-
2320 }
never executed: end of block
0
2321-
2322 QSet<QTabBar*> retired = usedTabBars - used;-
2323 usedTabBars = used;-
2324 for (QForeachContainer<typename QtPrivate::remove_reference<decltype(retired)>::type> _container_((retired)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QTabBar *tab_bar = *_container_.i; _container_.control; _container_.control = 0) {-
2325 tab_bar->hide();-
2326 while (tab_bar->count() > 0
tab_bar->count() > 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2327 tab_bar->removeTab(0);
never executed: tab_bar->removeTab(0);
0
2328 unusedTabBars.append(tab_bar);-
2329 }
never executed: end of block
0
2330-
2331 if (sep == 1
sep == 1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2332 QSet<QWidget*> usedSeps = newState.dockAreaLayout.usedSeparatorWidgets();-
2333 QSet<QWidget*> retiredSeps = usedSeparatorWidgets - usedSeps;-
2334 usedSeparatorWidgets = usedSeps;-
2335 for (QForeachContainer<typename QtPrivate::remove_reference<decltype(retiredSeps)>::type> _container_((retiredSeps)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QWidget *sepWidget = *_container_.i; _container_.control; _container_.control = 0) {-
2336 unusedSeparatorWidgets.append(sepWidget);-
2337 }
never executed: end of block
0
2338 }
never executed: end of block
0
2339-
2340 for (int i = 0; i < QInternal::DockCount
i < QInternal::DockCountDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i)
0
2341 newState.dockAreaLayout.docks[i].reparentWidgets(parentWidget());
never executed: newState.dockAreaLayout.docks[i].reparentWidgets(parentWidget());
0
2342-
2343-
2344-
2345 newState.apply(dockOptions & QMainWindow::AnimatedDocks && animate);-
2346}
never executed: end of block
0
2347-
2348void QMainWindowLayout::saveState(QDataStream &stream) const-
2349{-
2350 layoutState.saveState(stream);-
2351}
never executed: end of block
0
2352-
2353bool QMainWindowLayout::restoreState(QDataStream &stream)-
2354{-
2355 savedState = layoutState;-
2356 layoutState.clear();-
2357 layoutState.rect = savedState.rect;-
2358-
2359 if (!layoutState.restoreState(stream, savedState)
!layoutState.r...m, savedState)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2360 layoutState.deleteAllLayoutItems();-
2361 layoutState = savedState;-
2362 if (parentWidget()->isVisible()
parentWidget()->isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2363 applyState(layoutState, false);
never executed: applyState(layoutState, false);
0
2364 return
never executed: return false;
false;
never executed: return false;
0
2365 }-
2366-
2367 if (parentWidget()->isVisible()
parentWidget()->isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2368 layoutState.fitLayout();-
2369 applyState(layoutState, false);-
2370 }
never executed: end of block
0
2371-
2372 savedState.deleteAllLayoutItems();-
2373 savedState.clear();-
2374-
2375-
2376 if (parentWidget()->isVisible()
parentWidget()->isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2377-
2378 for (QForeachContainer<typename QtPrivate::remove_reference<decltype(usedTabBars)>::type> _container_((usedTabBars)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QTabBar *tab_bar = *_container_.i; _container_.control; _container_.control = 0)-
2379 tab_bar->show();
never executed: tab_bar->show();
0
2380-
2381-
2382 }
never executed: end of block
0
2383-
2384-
2385 return
never executed: return true;
true;
never executed: return true;
0
2386}-
2387-
2388-
2389-
2390-
2391-
2392bool QMainWindowLayout::usesHIToolBar(QToolBar *toolbar) const-
2393{-
2394-
2395 (void)toolbar;;-
2396 return
never executed: return false;
false;
never executed: return false;
0
2397-
2398-
2399-
2400-
2401-
2402}-
2403-
2404void QMainWindowLayout::timerEvent(QTimerEvent *e)-
2405{-
2406-
2407 if (e->timerId() == separatorMoveTimer.timerId()
e->timerId() =...imer.timerId()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2408-
2409 separatorMoveTimer.stop();-
2410 if (movingSeparator.isEmpty()
movingSeparator.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2411 return;
never executed: return;
0
2412 if (movingSeparatorOrigin == movingSeparatorPos
movingSeparato...ngSeparatorPosDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2413 return;
never executed: return;
0
2414-
2415-
2416 parentWidget()->update(layoutState.dockAreaLayout.separatorRegion());-
2417-
2418 layoutState = savedState;-
2419 layoutState.dockAreaLayout.separatorMove(movingSeparator, movingSeparatorOrigin,-
2420 movingSeparatorPos);-
2421 movingSeparatorPos = movingSeparatorOrigin;-
2422 }
never executed: end of block
0
2423-
2424 QLayout::timerEvent(e);-
2425}
never executed: end of block
0
2426-
2427-
2428-
2429-
Switch to Source codePreprocessed file

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