widgets/qtoolbararealayout.cpp

Source codeSwitch to Preprocessed file
LineSource CodeCoverage
1/**************************************************************************** -
2** -
3** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -
4** Contact: http://www.qt-project.org/legal -
5** -
6** This file is part of the QtGui module of the Qt Toolkit. -
7** -
8** $QT_BEGIN_LICENSE:LGPL$ -
9** Commercial License Usage -
10** Licensees holding valid commercial Qt licenses may use this file in -
11** accordance with the commercial license agreement provided with the -
12** Software or, alternatively, in accordance with the terms contained in -
13** a written agreement between you and Digia. For licensing terms and -
14** conditions see http://qt.digia.com/licensing. For further information -
15** use the contact form at http://qt.digia.com/contact-us. -
16** -
17** GNU Lesser General Public License Usage -
18** Alternatively, this file may be used under the terms of the GNU Lesser -
19** General Public License version 2.1 as published by the Free Software -
20** Foundation and appearing in the file LICENSE.LGPL included in the -
21** packaging of this file. Please review the following information to -
22** ensure the GNU Lesser General Public License version 2.1 requirements -
23** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -
24** -
25** In addition, as a special exception, Digia gives you certain additional -
26** rights. These rights are described in the Digia Qt LGPL Exception -
27** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -
28** -
29** GNU General Public License Usage -
30** Alternatively, this file may be used under the terms of the GNU -
31** General Public License version 3.0 as published by the Free Software -
32** Foundation and appearing in the file LICENSE.GPL included in the -
33** packaging of this file. Please review the following information to -
34** ensure the GNU General Public License version 3.0 requirements will be -
35** met: http://www.gnu.org/copyleft/gpl.html. -
36** -
37** -
38** $QT_END_LICENSE$ -
39** -
40****************************************************************************/ -
41 -
42#include <QWidgetItem> -
43#include <QToolBar> -
44#include <QStyleOption> -
45#include <QApplication> -
46#include <qdebug.h> -
47 -
48#include "qtoolbararealayout_p.h" -
49#include "qmainwindowlayout_p.h" -
50#include "qwidgetanimator_p.h" -
51#include "qtoolbarlayout_p.h" -
52#include "qtoolbar_p.h" -
53 -
54/****************************************************************************** -
55** QToolBarAreaLayoutItem -
56*/ -
57 -
58#ifndef QT_NO_TOOLBAR -
59 -
60QT_BEGIN_NAMESPACE -
61 -
62// qmainwindow.cpp -
63extern QMainWindowLayout *qt_mainwindow_layout(const QMainWindow *mainWindow); -
64 -
65QSize QToolBarAreaLayoutItem::minimumSize() const -
66{ -
67 if (skip())
partially evaluated: skip()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:26
0-26
68 return QSize(0, 0);
never executed: return QSize(0, 0);
0
69 return qSmartMinSize(static_cast<QWidgetItem*>(widgetItem));
executed: return qSmartMinSize(static_cast<QWidgetItem*>(widgetItem));
Execution Count:26
26
70} -
71 -
72QSize QToolBarAreaLayoutItem::sizeHint() const -
73{ -
74 if (skip())
partially evaluated: skip()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:32
0-32
75 return QSize(0, 0);
never executed: return QSize(0, 0);
0
76 -
77 return realSizeHint();
executed: return realSizeHint();
Execution Count:32
32
78} -
79 -
80//returns the real size hint not taking into account the visibility of the widget -
81QSize QToolBarAreaLayoutItem::realSizeHint() const -
82{ -
83 QWidget *wid = widgetItem->widget();
executed (the execution status of this line is deduced): QWidget *wid = widgetItem->widget();
-
84 QSize s = wid->sizeHint().expandedTo(wid->minimumSizeHint());
executed (the execution status of this line is deduced): QSize s = wid->sizeHint().expandedTo(wid->minimumSizeHint());
-
85 if (wid->sizePolicy().horizontalPolicy() == QSizePolicy::Ignored)
partially evaluated: wid->sizePolicy().horizontalPolicy() == QSizePolicy::Ignored
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:32
0-32
86 s.setWidth(0);
never executed: s.setWidth(0);
0
87 if (wid->sizePolicy().verticalPolicy() == QSizePolicy::Ignored)
partially evaluated: wid->sizePolicy().verticalPolicy() == QSizePolicy::Ignored
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:32
0-32
88 s.setHeight(0);
never executed: s.setHeight(0);
0
89 s = s.boundedTo(wid->maximumSize())
executed (the execution status of this line is deduced): s = s.boundedTo(wid->maximumSize())
-
90 .expandedTo(wid->minimumSize());
executed (the execution status of this line is deduced): .expandedTo(wid->minimumSize());
-
91 return s;
executed: return s;
Execution Count:32
32
92} -
93 -
94bool QToolBarAreaLayoutItem::skip() const -
95{ -
96 if (gap)
partially evaluated: gap
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:164
0-164
97 return false;
never executed: return false;
0
98 return widgetItem == 0 || widgetItem->isEmpty();
executed: return widgetItem == 0 || widgetItem->isEmpty();
Execution Count:164
164
99} -
100 -
101/****************************************************************************** -
102** QToolBarAreaLayoutLine -
103*/ -
104 -
105QToolBarAreaLayoutLine::QToolBarAreaLayoutLine(Qt::Orientation orientation) -
106 : o(orientation) -
107{ -
108}
executed: }
Execution Count:2
2
109 -
110QSize QToolBarAreaLayoutLine::sizeHint() const -
111{ -
112 int a = 0, b = 0;
executed (the execution status of this line is deduced): int a = 0, b = 0;
-
113 for (int i = 0; i < toolBarItems.count(); ++i) {
evaluated: i < toolBarItems.count()
TRUEFALSE
yes
Evaluation Count:22
yes
Evaluation Count:22
22
114 const QToolBarAreaLayoutItem &item = toolBarItems.at(i);
executed (the execution status of this line is deduced): const QToolBarAreaLayoutItem &item = toolBarItems.at(i);
-
115 if (item.skip())
partially evaluated: item.skip()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:22
0-22
116 continue;
never executed: continue;
0
117 -
118 QSize sh = item.sizeHint();
executed (the execution status of this line is deduced): QSize sh = item.sizeHint();
-
119 a += item.preferredSize > 0 ? item.preferredSize : pick(o, sh);
partially evaluated: item.preferredSize > 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:22
0-22
120 b = qMax(b, perp(o, sh));
executed (the execution status of this line is deduced): b = qMax(b, perp(o, sh));
-
121 }
executed: }
Execution Count:22
22
122 -
123 QSize result;
executed (the execution status of this line is deduced): QSize result;
-
124 rpick(o, result) = a;
executed (the execution status of this line is deduced): rpick(o, result) = a;
-
125 rperp(o, result) = b;
executed (the execution status of this line is deduced): rperp(o, result) = b;
-
126 -
127 return result;
executed: return result;
Execution Count:22
22
128} -
129 -
130QSize QToolBarAreaLayoutLine::minimumSize() const -
131{ -
132 int a = 0, b = 0;
executed (the execution status of this line is deduced): int a = 0, b = 0;
-
133 for (int i = 0; i < toolBarItems.count(); ++i) {
evaluated: i < toolBarItems.count()
TRUEFALSE
yes
Evaluation Count:16
yes
Evaluation Count:16
16
134 const QToolBarAreaLayoutItem &item = toolBarItems[i];
executed (the execution status of this line is deduced): const QToolBarAreaLayoutItem &item = toolBarItems[i];
-
135 if (item.skip())
partially evaluated: item.skip()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:16
0-16
136 continue;
never executed: continue;
0
137 -
138 QSize ms = item.minimumSize();
executed (the execution status of this line is deduced): QSize ms = item.minimumSize();
-
139 a += pick(o, ms);
executed (the execution status of this line is deduced): a += pick(o, ms);
-
140 b = qMax(b, perp(o, ms));
executed (the execution status of this line is deduced): b = qMax(b, perp(o, ms));
-
141 }
executed: }
Execution Count:16
16
142 -
143 QSize result;
executed (the execution status of this line is deduced): QSize result;
-
144 rpick(o, result) = a;
executed (the execution status of this line is deduced): rpick(o, result) = a;
-
145 rperp(o, result) = b;
executed (the execution status of this line is deduced): rperp(o, result) = b;
-
146 -
147 return result;
executed: return result;
Execution Count:16
16
148} -
149 -
150void QToolBarAreaLayoutLine::fitLayout() -
151{ -
152 int last = -1;
executed (the execution status of this line is deduced): int last = -1;
-
153 int min = pick(o, minimumSize());
executed (the execution status of this line is deduced): int min = pick(o, minimumSize());
-
154 int space = pick(o, rect.size());
executed (the execution status of this line is deduced): int space = pick(o, rect.size());
-
155 int extra = qMax(0, space - min);
executed (the execution status of this line is deduced): int extra = qMax(0, space - min);
-
156 -
157 for (int i = 0; i < toolBarItems.count(); ++i) {
evaluated: i < toolBarItems.count()
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:10
10
158 QToolBarAreaLayoutItem &item = toolBarItems[i];
executed (the execution status of this line is deduced): QToolBarAreaLayoutItem &item = toolBarItems[i];
-
159 if (item.skip())
partially evaluated: item.skip()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:10
0-10
160 continue;
never executed: continue;
0
161 -
162 if (QToolBarLayout *tblayout = qobject_cast<QToolBarLayout*>(item.widgetItem->widget()->layout()))
partially evaluated: QToolBarLayout *tblayout = qobject_cast<QToolBarLayout*>(item.widgetItem->widget()->layout())
TRUEFALSE
yes
Evaluation Count:10
no
Evaluation Count:0
0-10
163 tblayout->checkUsePopupMenu();
executed: tblayout->checkUsePopupMenu();
Execution Count:10
10
164 -
165 const int itemMin = pick(o, item.minimumSize());
executed (the execution status of this line is deduced): const int itemMin = pick(o, item.minimumSize());
-
166 //preferredSize is the default if it is set, otherwise, we take the sizehint -
167 item.size = item.preferredSize > 0 ? item.preferredSize : pick(o, item.sizeHint());
partially evaluated: item.preferredSize > 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:10
0-10
168 -
169 //the extraspace is the space above the item minimum sizehint -
170 const int extraSpace = qMin(item.size - itemMin, extra);
executed (the execution status of this line is deduced): const int extraSpace = qMin(item.size - itemMin, extra);
-
171 item.size = itemMin + extraSpace; //that is the real size
executed (the execution status of this line is deduced): item.size = itemMin + extraSpace;
-
172 -
173 extra -= extraSpace;
executed (the execution status of this line is deduced): extra -= extraSpace;
-
174 -
175 last = i;
executed (the execution status of this line is deduced): last = i;
-
176 }
executed: }
Execution Count:10
10
177 -
178 // calculate the positions from the sizes -
179 int pos = 0;
executed (the execution status of this line is deduced): int pos = 0;
-
180 for (int i = 0; i < toolBarItems.count(); ++i) {
evaluated: i < toolBarItems.count()
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:10
10
181 QToolBarAreaLayoutItem &item = toolBarItems[i];
executed (the execution status of this line is deduced): QToolBarAreaLayoutItem &item = toolBarItems[i];
-
182 if (item.skip())
partially evaluated: item.skip()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:10
0-10
183 continue;
never executed: continue;
0
184 -
185 item.pos = pos;
executed (the execution status of this line is deduced): item.pos = pos;
-
186 if (i == last) // stretch the last item to the end of the line
partially evaluated: i == last
TRUEFALSE
yes
Evaluation Count:10
no
Evaluation Count:0
0-10
187 item.size = qMax(0, pick(o, rect.size()) - item.pos);
executed: item.size = qMax(0, pick(o, rect.size()) - item.pos);
Execution Count:10
10
188 pos += item.size;
executed (the execution status of this line is deduced): pos += item.size;
-
189 }
executed: }
Execution Count:10
10
190}
executed: }
Execution Count:10
10
191 -
192bool QToolBarAreaLayoutLine::skip() const -
193{ -
194 for (int i = 0; i < toolBarItems.count(); ++i) {
partially evaluated: i < toolBarItems.count()
TRUEFALSE
yes
Evaluation Count:38
no
Evaluation Count:0
0-38
195 if (!toolBarItems.at(i).skip())
partially evaluated: !toolBarItems.at(i).skip()
TRUEFALSE
yes
Evaluation Count:38
no
Evaluation Count:0
0-38
196 return false;
executed: return false;
Execution Count:38
38
197 }
never executed: }
0
198 return true;
never executed: return true;
0
199} -
200 -
201/****************************************************************************** -
202** QToolBarAreaLayoutInfo -
203*/ -
204 -
205QToolBarAreaLayoutInfo::QToolBarAreaLayoutInfo(QInternal::DockPosition pos) -
206 : dockPos(pos), dirty(false) -
207{ -
208 switch (pos) { -
209 case QInternal::LeftDock: -
210 case QInternal::RightDock: -
211 o = Qt::Vertical;
executed (the execution status of this line is deduced): o = Qt::Vertical;
-
212 break;
executed: break;
Execution Count:176
176
213 case QInternal::TopDock: -
214 case QInternal::BottomDock: -
215 o = Qt::Horizontal;
executed (the execution status of this line is deduced): o = Qt::Horizontal;
-
216 break;
executed: break;
Execution Count:528
528
217 default: -
218 o = Qt::Horizontal;
never executed (the execution status of this line is deduced): o = Qt::Horizontal;
-
219 break;
never executed: break;
0
220 } -
221}
executed: }
Execution Count:704
704
222 -
223QSize QToolBarAreaLayoutInfo::sizeHint() const -
224{ -
225 int a = 0, b = 0;
executed (the execution status of this line is deduced): int a = 0, b = 0;
-
226 for (int i = 0; i < lines.count(); ++i) {
evaluated: i < lines.count()
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:1068
12-1068
227 const QToolBarAreaLayoutLine &l = lines.at(i);
executed (the execution status of this line is deduced): const QToolBarAreaLayoutLine &l = lines.at(i);
-
228 if (l.skip())
partially evaluated: l.skip()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:12
0-12
229 continue;
never executed: continue;
0
230 -
231 QSize hint = l.sizeHint();
executed (the execution status of this line is deduced): QSize hint = l.sizeHint();
-
232 a = qMax(a, pick(o, hint));
executed (the execution status of this line is deduced): a = qMax(a, pick(o, hint));
-
233 b += perp(o, hint);
executed (the execution status of this line is deduced): b += perp(o, hint);
-
234 }
executed: }
Execution Count:12
12
235 -
236 QSize result;
executed (the execution status of this line is deduced): QSize result;
-
237 rpick(o, result) = a;
executed (the execution status of this line is deduced): rpick(o, result) = a;
-
238 rperp(o, result) = b;
executed (the execution status of this line is deduced): rperp(o, result) = b;
-
239 -
240 return result;
executed: return result;
Execution Count:1068
1068
241} -
242 -
243QSize QToolBarAreaLayoutInfo::minimumSize() const -
244{ -
245 int a = 0, b = 0;
executed (the execution status of this line is deduced): int a = 0, b = 0;
-
246 for (int i = 0; i < lines.count(); ++i) {
evaluated: i < lines.count()
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:668
6-668
247 const QToolBarAreaLayoutLine &l = lines.at(i);
executed (the execution status of this line is deduced): const QToolBarAreaLayoutLine &l = lines.at(i);
-
248 if (l.skip())
partially evaluated: l.skip()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6
0-6
249 continue;
never executed: continue;
0
250 -
251 QSize m = l.minimumSize();
executed (the execution status of this line is deduced): QSize m = l.minimumSize();
-
252 a = qMax(a, pick(o, m));
executed (the execution status of this line is deduced): a = qMax(a, pick(o, m));
-
253 b += perp(o, m);
executed (the execution status of this line is deduced): b += perp(o, m);
-
254 }
executed: }
Execution Count:6
6
255 -
256 QSize result;
executed (the execution status of this line is deduced): QSize result;
-
257 rpick(o, result) = a;
executed (the execution status of this line is deduced): rpick(o, result) = a;
-
258 rperp(o, result) = b;
executed (the execution status of this line is deduced): rperp(o, result) = b;
-
259 -
260 return result;
executed: return result;
Execution Count:668
668
261} -
262 -
263void QToolBarAreaLayoutInfo::fitLayout() -
264{ -
265 dirty = false;
executed (the execution status of this line is deduced): dirty = false;
-
266 -
267 int b = 0;
executed (the execution status of this line is deduced): int b = 0;
-
268 -
269 bool reverse = dockPos == QInternal::RightDock || dockPos == QInternal::BottomDock;
evaluated: dockPos == QInternal::RightDock
TRUEFALSE
yes
Evaluation Count:237
yes
Evaluation Count:711
evaluated: dockPos == QInternal::BottomDock
TRUEFALSE
yes
Evaluation Count:237
yes
Evaluation Count:474
237-711
270 -
271 int i = reverse ? lines.count() - 1 : 0;
evaluated: reverse
TRUEFALSE
yes
Evaluation Count:474
yes
Evaluation Count:474
474
272 for (;;) {
executed (the execution status of this line is deduced): for (;;) {
-
273 if ((reverse && i < 0) || (!reverse && i == lines.count()))
evaluated: reverse
TRUEFALSE
yes
Evaluation Count:474
yes
Evaluation Count:484
partially evaluated: i < 0
TRUEFALSE
yes
Evaluation Count:474
no
Evaluation Count:0
partially evaluated: !reverse
TRUEFALSE
yes
Evaluation Count:484
no
Evaluation Count:0
evaluated: i == lines.count()
TRUEFALSE
yes
Evaluation Count:474
yes
Evaluation Count:10
0-484
274 break;
executed: break;
Execution Count:948
948
275 -
276 QToolBarAreaLayoutLine &l = lines[i];
executed (the execution status of this line is deduced): QToolBarAreaLayoutLine &l = lines[i];
-
277 if (!l.skip()) {
partially evaluated: !l.skip()
TRUEFALSE
yes
Evaluation Count:10
no
Evaluation Count:0
0-10
278 if (o == Qt::Horizontal) {
partially evaluated: o == Qt::Horizontal
TRUEFALSE
yes
Evaluation Count:10
no
Evaluation Count:0
0-10
279 l.rect.setLeft(rect.left());
executed (the execution status of this line is deduced): l.rect.setLeft(rect.left());
-
280 l.rect.setRight(rect.right());
executed (the execution status of this line is deduced): l.rect.setRight(rect.right());
-
281 l.rect.setTop(b + rect.top());
executed (the execution status of this line is deduced): l.rect.setTop(b + rect.top());
-
282 b += l.sizeHint().height();
executed (the execution status of this line is deduced): b += l.sizeHint().height();
-
283 l.rect.setBottom(b - 1 + rect.top());
executed (the execution status of this line is deduced): l.rect.setBottom(b - 1 + rect.top());
-
284 } else {
executed: }
Execution Count:10
10
285 l.rect.setTop(rect.top());
never executed (the execution status of this line is deduced): l.rect.setTop(rect.top());
-
286 l.rect.setBottom(rect.bottom());
never executed (the execution status of this line is deduced): l.rect.setBottom(rect.bottom());
-
287 l.rect.setLeft(b + rect.left());
never executed (the execution status of this line is deduced): l.rect.setLeft(b + rect.left());
-
288 b += l.sizeHint().width();
never executed (the execution status of this line is deduced): b += l.sizeHint().width();
-
289 l.rect.setRight(b - 1 + rect.left());
never executed (the execution status of this line is deduced): l.rect.setRight(b - 1 + rect.left());
-
290 }
never executed: }
0
291 -
292 l.fitLayout();
executed (the execution status of this line is deduced): l.fitLayout();
-
293 }
executed: }
Execution Count:10
10
294 -
295 i += reverse ? -1 : 1;
partially evaluated: reverse
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:10
0-10
296 }
executed: }
Execution Count:10
10
297}
executed: }
Execution Count:948
948
298 -
299QLayoutItem *QToolBarAreaLayoutInfo::insertToolBar(QToolBar *before, QToolBar *toolBar) -
300{ -
301 toolBar->setOrientation(o);
executed (the execution status of this line is deduced): toolBar->setOrientation(o);
-
302 QLayoutItem *item = new QWidgetItemV2(toolBar);
executed (the execution status of this line is deduced): QLayoutItem *item = new QWidgetItemV2(toolBar);
-
303 insertItem(before, item);
executed (the execution status of this line is deduced): insertItem(before, item);
-
304 return item;
executed: return item;
Execution Count:2
2
305} -
306 -
307void QToolBarAreaLayoutInfo::insertItem(QToolBar *before, QLayoutItem *item) -
308{ -
309 if (before == 0) {
partially evaluated: before == 0
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
310 if (lines.isEmpty())
partially evaluated: lines.isEmpty()
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
311 lines.append(QToolBarAreaLayoutLine(o));
executed: lines.append(QToolBarAreaLayoutLine(o));
Execution Count:2
2
312 lines.last().toolBarItems.append(item);
executed (the execution status of this line is deduced): lines.last().toolBarItems.append(item);
-
313 return;
executed: return;
Execution Count:2
2
314 } -
315 -
316 for (int j = 0; j < lines.count(); ++j) {
never evaluated: j < lines.count()
0
317 QToolBarAreaLayoutLine &line = lines[j];
never executed (the execution status of this line is deduced): QToolBarAreaLayoutLine &line = lines[j];
-
318 -
319 for (int k = 0; k < line.toolBarItems.count(); ++k) {
never evaluated: k < line.toolBarItems.count()
0
320 if (line.toolBarItems.at(k).widgetItem->widget() == before) {
never evaluated: line.toolBarItems.at(k).widgetItem->widget() == before
0
321 line.toolBarItems.insert(k, item);
never executed (the execution status of this line is deduced): line.toolBarItems.insert(k, item);
-
322 return;
never executed: return;
0
323 } -
324 }
never executed: }
0
325 }
never executed: }
0
326}
never executed: }
0
327 -
328void QToolBarAreaLayoutInfo::removeToolBar(QToolBar *toolBar) -
329{ -
330 for (int j = 0; j < lines.count(); ++j) {
never evaluated: j < lines.count()
0
331 QToolBarAreaLayoutLine &line = lines[j];
never executed (the execution status of this line is deduced): QToolBarAreaLayoutLine &line = lines[j];
-
332 -
333 for (int k = 0; k < line.toolBarItems.count(); ++k) {
never evaluated: k < line.toolBarItems.count()
0
334 QToolBarAreaLayoutItem &item = line.toolBarItems[k];
never executed (the execution status of this line is deduced): QToolBarAreaLayoutItem &item = line.toolBarItems[k];
-
335 if (item.widgetItem->widget() == toolBar) {
never evaluated: item.widgetItem->widget() == toolBar
0
336 delete item.widgetItem;
never executed (the execution status of this line is deduced): delete item.widgetItem;
-
337 item.widgetItem = 0;
never executed (the execution status of this line is deduced): item.widgetItem = 0;
-
338 line.toolBarItems.removeAt(k);
never executed (the execution status of this line is deduced): line.toolBarItems.removeAt(k);
-
339 -
340 if (line.toolBarItems.isEmpty() && j < lines.count() - 1)
never evaluated: line.toolBarItems.isEmpty()
never evaluated: j < lines.count() - 1
0
341 lines.removeAt(j);
never executed: lines.removeAt(j);
0
342 -
343 return;
never executed: return;
0
344 } -
345 }
never executed: }
0
346 }
never executed: }
0
347}
never executed: }
0
348 -
349void QToolBarAreaLayoutInfo::insertToolBarBreak(QToolBar *before) -
350{ -
351 if (before == 0) {
never evaluated: before == 0
0
352 if (!lines.isEmpty() && lines.last().toolBarItems.isEmpty())
never evaluated: !lines.isEmpty()
never evaluated: lines.last().toolBarItems.isEmpty()
0
353 return;
never executed: return;
0
354 lines.append(QToolBarAreaLayoutLine(o));
never executed (the execution status of this line is deduced): lines.append(QToolBarAreaLayoutLine(o));
-
355 return;
never executed: return;
0
356 } -
357 -
358 for (int j = 0; j < lines.count(); ++j) {
never evaluated: j < lines.count()
0
359 QToolBarAreaLayoutLine &line = lines[j];
never executed (the execution status of this line is deduced): QToolBarAreaLayoutLine &line = lines[j];
-
360 -
361 for (int k = 0; k < line.toolBarItems.count(); ++k) {
never evaluated: k < line.toolBarItems.count()
0
362 if (line.toolBarItems.at(k).widgetItem->widget() == before) {
never evaluated: line.toolBarItems.at(k).widgetItem->widget() == before
0
363 if (k == 0)
never evaluated: k == 0
0
364 return;
never executed: return;
0
365 -
366 QToolBarAreaLayoutLine newLine(o);
never executed (the execution status of this line is deduced): QToolBarAreaLayoutLine newLine(o);
-
367 newLine.toolBarItems = line.toolBarItems.mid(k);
never executed (the execution status of this line is deduced): newLine.toolBarItems = line.toolBarItems.mid(k);
-
368 line.toolBarItems = line.toolBarItems.mid(0, k);
never executed (the execution status of this line is deduced): line.toolBarItems = line.toolBarItems.mid(0, k);
-
369 lines.insert(j + 1, newLine);
never executed (the execution status of this line is deduced): lines.insert(j + 1, newLine);
-
370 -
371 return;
never executed: return;
0
372 } -
373 }
never executed: }
0
374 }
never executed: }
0
375}
never executed: }
0
376 -
377void QToolBarAreaLayoutInfo::removeToolBarBreak(QToolBar *before) -
378{ -
379 for (int j = 0; j < lines.count(); ++j) {
never evaluated: j < lines.count()
0
380 const QToolBarAreaLayoutLine &line = lines.at(j);
never executed (the execution status of this line is deduced): const QToolBarAreaLayoutLine &line = lines.at(j);
-
381 -
382 for (int k = 0; k < line.toolBarItems.count(); ++k) {
never evaluated: k < line.toolBarItems.count()
0
383 if (line.toolBarItems.at(k).widgetItem->widget() == before) {
never evaluated: line.toolBarItems.at(k).widgetItem->widget() == before
0
384 if (k != 0)
never evaluated: k != 0
0
385 return;
never executed: return;
0
386 if (j == 0)
never evaluated: j == 0
0
387 return;
never executed: return;
0
388 -
389 lines[j - 1].toolBarItems += lines[j].toolBarItems;
never executed (the execution status of this line is deduced): lines[j - 1].toolBarItems += lines[j].toolBarItems;
-
390 lines.removeAt(j);
never executed (the execution status of this line is deduced): lines.removeAt(j);
-
391 -
392 return;
never executed: return;
0
393 } -
394 }
never executed: }
0
395 }
never executed: }
0
396}
never executed: }
0
397 -
398void QToolBarAreaLayoutInfo::moveToolBar(QToolBar *toolbar, int pos) -
399{ -
400 if (dirty)
never evaluated: dirty
0
401 fitLayout();
never executed: fitLayout();
0
402 -
403 dirty = true;
never executed (the execution status of this line is deduced): dirty = true;
-
404 -
405 if (o == Qt::Vertical)
never evaluated: o == Qt::Vertical
0
406 pos -= rect.top();
never executed: pos -= rect.top();
0
407 -
408 //here we actually update the preferredSize for the line containing the toolbar so that we move it -
409 for (int j = 0; j < lines.count(); ++j) {
never evaluated: j < lines.count()
0
410 QToolBarAreaLayoutLine &line = lines[j];
never executed (the execution status of this line is deduced): QToolBarAreaLayoutLine &line = lines[j];
-
411 -
412 int previousIndex = -1;
never executed (the execution status of this line is deduced): int previousIndex = -1;
-
413 int minPos = 0;
never executed (the execution status of this line is deduced): int minPos = 0;
-
414 for (int k = 0; k < line.toolBarItems.count(); ++k) {
never evaluated: k < line.toolBarItems.count()
0
415 QToolBarAreaLayoutItem &current = line.toolBarItems[k];
never executed (the execution status of this line is deduced): QToolBarAreaLayoutItem &current = line.toolBarItems[k];
-
416 if (current.widgetItem->widget() == toolbar) {
never evaluated: current.widgetItem->widget() == toolbar
0
417 int newPos = current.pos;
never executed (the execution status of this line is deduced): int newPos = current.pos;
-
418 -
419 if (previousIndex >= 0) {
never evaluated: previousIndex >= 0
0
420 QToolBarAreaLayoutItem &previous = line.toolBarItems[previousIndex];
never executed (the execution status of this line is deduced): QToolBarAreaLayoutItem &previous = line.toolBarItems[previousIndex];
-
421 if (pos < current.pos) {
never evaluated: pos < current.pos
0
422 newPos = qMax(pos, minPos);
never executed (the execution status of this line is deduced): newPos = qMax(pos, minPos);
-
423 } else {
never executed: }
0
424 //we check the max value for the position (until everything at the right is "compressed") -
425 int maxPos = pick(o, rect.size());
never executed (the execution status of this line is deduced): int maxPos = pick(o, rect.size());
-
426 for(int l = k; l < line.toolBarItems.count(); ++l) {
never evaluated: l < line.toolBarItems.count()
0
427 const QToolBarAreaLayoutItem &item = line.toolBarItems.at(l);
never executed (the execution status of this line is deduced): const QToolBarAreaLayoutItem &item = line.toolBarItems.at(l);
-
428 if (!item.skip()) {
never evaluated: !item.skip()
0
429 maxPos -= pick(o, item.minimumSize());
never executed (the execution status of this line is deduced): maxPos -= pick(o, item.minimumSize());
-
430 }
never executed: }
0
431 }
never executed: }
0
432 newPos = qMin(pos, maxPos);
never executed (the execution status of this line is deduced): newPos = qMin(pos, maxPos);
-
433 }
never executed: }
0
434 -
435 //extra is the number of pixels to add to the previous toolbar -
436 int extra = newPos - current.pos;
never executed (the execution status of this line is deduced): int extra = newPos - current.pos;
-
437 -
438 //we check if the previous is near its size hint -
439 //in which case we try to stick to it -
440 const int diff = pick(o, previous.sizeHint()) - (previous.size + extra);
never executed (the execution status of this line is deduced): const int diff = pick(o, previous.sizeHint()) - (previous.size + extra);
-
441 if (qAbs(diff) < QApplication::startDragDistance()) {
never evaluated: qAbs(diff) < QApplication::startDragDistance()
0
442 //we stick to the default place and size -
443 extra += diff;
never executed (the execution status of this line is deduced): extra += diff;
-
444 }
never executed: }
0
445 -
446 //update for the current item -
447 current.extendSize(line.o, -extra);
never executed (the execution status of this line is deduced): current.extendSize(line.o, -extra);
-
448 -
449 if (extra >= 0) {
never evaluated: extra >= 0
0
450 previous.extendSize(line.o, extra);
never executed (the execution status of this line is deduced): previous.extendSize(line.o, extra);
-
451 } else {
never executed: }
0
452 //we need to push the toolbars on the left starting with previous -
453 extra = -extra; // we just need to know the number of pixels
never executed (the execution status of this line is deduced): extra = -extra;
-
454 ///at this point we need to get extra pixels from the toolbars at the left -
455 for(int l = previousIndex; l >=0; --l) {
never evaluated: l >=0
0
456 QToolBarAreaLayoutItem &item = line.toolBarItems[l];
never executed (the execution status of this line is deduced): QToolBarAreaLayoutItem &item = line.toolBarItems[l];
-
457 if (!item.skip()) {
never evaluated: !item.skip()
0
458 const int minPreferredSize = pick(o, item.minimumSize());
never executed (the execution status of this line is deduced): const int minPreferredSize = pick(o, item.minimumSize());
-
459 const int margin = item.size - minPreferredSize;
never executed (the execution status of this line is deduced): const int margin = item.size - minPreferredSize;
-
460 if (margin < extra) {
never evaluated: margin < extra
0
461 item.resize(line.o, minPreferredSize);
never executed (the execution status of this line is deduced): item.resize(line.o, minPreferredSize);
-
462 extra -= margin;
never executed (the execution status of this line is deduced): extra -= margin;
-
463 } else {
never executed: }
0
464 item.extendSize(line.o, -extra);
never executed (the execution status of this line is deduced): item.extendSize(line.o, -extra);
-
465 extra = 0;
never executed (the execution status of this line is deduced): extra = 0;
-
466 }
never executed: }
0
467 } -
468 }
never executed: }
0
469 Q_ASSERT(extra == 0);
never executed (the execution status of this line is deduced): qt_noop();
-
470 }
never executed: }
0
471 } else { -
472 //the item is the first one, it should be at position 0 -
473 }
never executed: }
0
474 -
475 return;
never executed: return;
0
476 -
477 } else if (!current.skip()) {
never evaluated: !current.skip()
0
478 previousIndex = k;
never executed (the execution status of this line is deduced): previousIndex = k;
-
479 minPos += pick(o, current.minimumSize());
never executed (the execution status of this line is deduced): minPos += pick(o, current.minimumSize());
-
480 }
never executed: }
0
481 } -
482 }
never executed: }
0
483}
never executed: }
0
484 -
485 -
486QList<int> QToolBarAreaLayoutInfo::gapIndex(const QPoint &pos, int *minDistance) const -
487{ -
488 int p = pick(o, pos);
never executed (the execution status of this line is deduced): int p = pick(o, pos);
-
489 -
490 if (rect.contains(pos)) {
never evaluated: rect.contains(pos)
0
491 for (int j = 0; j < lines.count(); ++j) {
never evaluated: j < lines.count()
0
492 const QToolBarAreaLayoutLine &line = lines.at(j);
never executed (the execution status of this line is deduced): const QToolBarAreaLayoutLine &line = lines.at(j);
-
493 if (line.skip())
never evaluated: line.skip()
0
494 continue;
never executed: continue;
0
495 if (!line.rect.contains(pos))
never evaluated: !line.rect.contains(pos)
0
496 continue;
never executed: continue;
0
497 -
498 int k = 0;
never executed (the execution status of this line is deduced): int k = 0;
-
499 for (; k < line.toolBarItems.count(); ++k) {
never evaluated: k < line.toolBarItems.count()
0
500 const QToolBarAreaLayoutItem &item = line.toolBarItems.at(k);
never executed (the execution status of this line is deduced): const QToolBarAreaLayoutItem &item = line.toolBarItems.at(k);
-
501 if (item.skip())
never evaluated: item.skip()
0
502 continue;
never executed: continue;
0
503 -
504 int size = qMin(item.size, pick(o, item.sizeHint()));
never executed (the execution status of this line is deduced): int size = qMin(item.size, pick(o, item.sizeHint()));
-
505 -
506 if (p > item.pos + size)
never evaluated: p > item.pos + size
0
507 continue;
never executed: continue;
0
508 if (p > item.pos + size/2)
never evaluated: p > item.pos + size/2
0
509 ++k;
never executed: ++k;
0
510 break;
never executed: break;
0
511 } -
512 -
513 QList<int> result;
never executed (the execution status of this line is deduced): QList<int> result;
-
514 result << j << k;
never executed (the execution status of this line is deduced): result << j << k;
-
515 *minDistance = 0; //we found a perfect match
never executed (the execution status of this line is deduced): *minDistance = 0;
-
516 return result;
never executed: return result;
0
517 } -
518 } else {
never executed: }
0
519 const int dist = distance(pos);
never executed (the execution status of this line is deduced): const int dist = distance(pos);
-
520 //it will only return a path if the minDistance is higher than the current distance -
521 if (dist >= 0 && *minDistance > dist) {
never evaluated: dist >= 0
never evaluated: *minDistance > dist
0
522 *minDistance = dist;
never executed (the execution status of this line is deduced): *minDistance = dist;
-
523 -
524 QList<int> result;
never executed (the execution status of this line is deduced): QList<int> result;
-
525 result << lines.count() << 0;
never executed (the execution status of this line is deduced): result << lines.count() << 0;
-
526 return result;
never executed: return result;
0
527 } -
528 }
never executed: }
0
529 -
530 return QList<int>();
never executed: return QList<int>();
0
531} -
532 -
533bool QToolBarAreaLayoutInfo::insertGap(const QList<int> &path, QLayoutItem *item) -
534{ -
535 Q_ASSERT(path.count() == 2);
never executed (the execution status of this line is deduced): qt_noop();
-
536 int j = path.first();
never executed (the execution status of this line is deduced): int j = path.first();
-
537 if (j == lines.count())
never evaluated: j == lines.count()
0
538 lines.append(QToolBarAreaLayoutLine(o));
never executed: lines.append(QToolBarAreaLayoutLine(o));
0
539 -
540 QToolBarAreaLayoutLine &line = lines[j];
never executed (the execution status of this line is deduced): QToolBarAreaLayoutLine &line = lines[j];
-
541 const int k = path.at(1);
never executed (the execution status of this line is deduced): const int k = path.at(1);
-
542 -
543 QToolBarAreaLayoutItem gap_item;
never executed (the execution status of this line is deduced): QToolBarAreaLayoutItem gap_item;
-
544 gap_item.gap = true;
never executed (the execution status of this line is deduced): gap_item.gap = true;
-
545 gap_item.widgetItem = item;
never executed (the execution status of this line is deduced): gap_item.widgetItem = item;
-
546 -
547 //update the previous item's preferred size -
548 for(int p = k - 1 ; p >= 0; --p) {
never evaluated: p >= 0
0
549 QToolBarAreaLayoutItem &previous = line.toolBarItems[p];
never executed (the execution status of this line is deduced): QToolBarAreaLayoutItem &previous = line.toolBarItems[p];
-
550 if (!previous.skip()) {
never evaluated: !previous.skip()
0
551 //we found the previous one -
552 int previousSizeHint = pick(line.o, previous.sizeHint());
never executed (the execution status of this line is deduced): int previousSizeHint = pick(line.o, previous.sizeHint());
-
553 int previousExtraSpace = previous.size - previousSizeHint;
never executed (the execution status of this line is deduced): int previousExtraSpace = previous.size - previousSizeHint;
-
554 -
555 if (previousExtraSpace > 0) {
never evaluated: previousExtraSpace > 0
0
556 //in this case we reset the space -
557 previous.preferredSize = -1;
never executed (the execution status of this line is deduced): previous.preferredSize = -1;
-
558 previous.size = previousSizeHint;
never executed (the execution status of this line is deduced): previous.size = previousSizeHint;
-
559 -
560 gap_item.resize(o, previousExtraSpace);
never executed (the execution status of this line is deduced): gap_item.resize(o, previousExtraSpace);
-
561 }
never executed: }
0
562 -
563 break;
never executed: break;
0
564 } -
565 }
never executed: }
0
566 -
567 line.toolBarItems.insert(k, gap_item);
never executed (the execution status of this line is deduced): line.toolBarItems.insert(k, gap_item);
-
568 return true;
never executed: return true;
0
569 -
570} -
571 -
572void QToolBarAreaLayoutInfo::clear() -
573{ -
574 lines.clear();
executed (the execution status of this line is deduced): lines.clear();
-
575 rect = QRect();
executed (the execution status of this line is deduced): rect = QRect();
-
576}
executed: }
Execution Count:16
16
577 -
578QRect QToolBarAreaLayoutInfo::itemRect(const QList<int> &path) const -
579{ -
580 Q_ASSERT(path.count() == 2);
never executed (the execution status of this line is deduced): qt_noop();
-
581 int j = path.at(0);
never executed (the execution status of this line is deduced): int j = path.at(0);
-
582 int k = path.at(1);
never executed (the execution status of this line is deduced): int k = path.at(1);
-
583 -
584 const QToolBarAreaLayoutLine &line = lines.at(j);
never executed (the execution status of this line is deduced): const QToolBarAreaLayoutLine &line = lines.at(j);
-
585 const QToolBarAreaLayoutItem &item = line.toolBarItems.at(k);
never executed (the execution status of this line is deduced): const QToolBarAreaLayoutItem &item = line.toolBarItems.at(k);
-
586 -
587 QRect result = line.rect;
never executed (the execution status of this line is deduced): QRect result = line.rect;
-
588 -
589 if (o == Qt::Horizontal) {
never evaluated: o == Qt::Horizontal
0
590 result.setLeft(item.pos + line.rect.left());
never executed (the execution status of this line is deduced): result.setLeft(item.pos + line.rect.left());
-
591 result.setWidth(item.size);
never executed (the execution status of this line is deduced): result.setWidth(item.size);
-
592 } else {
never executed: }
0
593 result.setTop(item.pos + line.rect.top());
never executed (the execution status of this line is deduced): result.setTop(item.pos + line.rect.top());
-
594 result.setHeight(item.size);
never executed (the execution status of this line is deduced): result.setHeight(item.size);
-
595 }
never executed: }
0
596 -
597 return result;
never executed: return result;
0
598} -
599 -
600int QToolBarAreaLayoutInfo::distance(const QPoint &pos) const -
601{ -
602 switch (dockPos) { -
603 case QInternal::LeftDock: -
604 if (pos.y() < rect.bottom())
never evaluated: pos.y() < rect.bottom()
0
605 return pos.x() - rect.right();
never executed: return pos.x() - rect.right();
0
606 case QInternal::RightDock:
code before this statement never executed: case QInternal::RightDock:
0
607 if (pos.y() < rect.bottom())
never evaluated: pos.y() < rect.bottom()
0
608 return rect.left() - pos.x();
never executed: return rect.left() - pos.x();
0
609 case QInternal::TopDock:
code before this statement never executed: case QInternal::TopDock:
0
610 if (pos.x() < rect.right())
never evaluated: pos.x() < rect.right()
0
611 return pos.y() - rect.bottom();
never executed: return pos.y() - rect.bottom();
0
612 case QInternal::BottomDock:
code before this statement never executed: case QInternal::BottomDock:
0
613 if (pos.x() < rect.right())
never evaluated: pos.x() < rect.right()
0
614 return rect.top() - pos.y();
never executed: return rect.top() - pos.y();
0
615 default: -
616 break;
never executed: break;
0
617 } -
618 return -1;
never executed: return -1;
0
619} -
620 -
621/****************************************************************************** -
622** QToolBarAreaLayout -
623*/ -
624 -
625QToolBarAreaLayout::QToolBarAreaLayout(const QMainWindow *win) : mainWindow(win), visible(true) -
626{ -
627 for (int i = 0; i < QInternal::DockCount; ++i) {
evaluated: i < QInternal::DockCount
TRUEFALSE
yes
Evaluation Count:352
yes
Evaluation Count:88
88-352
628 QInternal::DockPosition pos = static_cast<QInternal::DockPosition>(i);
executed (the execution status of this line is deduced): QInternal::DockPosition pos = static_cast<QInternal::DockPosition>(i);
-
629 docks[i] = QToolBarAreaLayoutInfo(pos);
executed (the execution status of this line is deduced): docks[i] = QToolBarAreaLayoutInfo(pos);
-
630 }
executed: }
Execution Count:352
352
631}
executed: }
Execution Count:88
88
632 -
633QRect QToolBarAreaLayout::fitLayout() -
634{ -
635 if (!visible)
partially evaluated: !visible
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:237
0-237
636 return rect;
never executed: return rect;
0
637 -
638 QSize left_hint = docks[QInternal::LeftDock].sizeHint();
executed (the execution status of this line is deduced): QSize left_hint = docks[QInternal::LeftDock].sizeHint();
-
639 QSize right_hint = docks[QInternal::RightDock].sizeHint();
executed (the execution status of this line is deduced): QSize right_hint = docks[QInternal::RightDock].sizeHint();
-
640 QSize top_hint = docks[QInternal::TopDock].sizeHint();
executed (the execution status of this line is deduced): QSize top_hint = docks[QInternal::TopDock].sizeHint();
-
641 QSize bottom_hint = docks[QInternal::BottomDock].sizeHint();
executed (the execution status of this line is deduced): QSize bottom_hint = docks[QInternal::BottomDock].sizeHint();
-
642 -
643 QRect center = rect.adjusted(left_hint.width(), top_hint.height(),
executed (the execution status of this line is deduced): QRect center = rect.adjusted(left_hint.width(), top_hint.height(),
-
644 -right_hint.width(), -bottom_hint.height());
executed (the execution status of this line is deduced): -right_hint.width(), -bottom_hint.height());
-
645 -
646 docks[QInternal::TopDock].rect = QRect(rect.left(), rect.top(),
executed (the execution status of this line is deduced): docks[QInternal::TopDock].rect = QRect(rect.left(), rect.top(),
-
647 rect.width(), top_hint.height());
executed (the execution status of this line is deduced): rect.width(), top_hint.height());
-
648 docks[QInternal::LeftDock].rect = QRect(rect.left(), center.top(),
executed (the execution status of this line is deduced): docks[QInternal::LeftDock].rect = QRect(rect.left(), center.top(),
-
649 left_hint.width(), center.height());
executed (the execution status of this line is deduced): left_hint.width(), center.height());
-
650 docks[QInternal::RightDock].rect = QRect(center.right() + 1, center.top(),
executed (the execution status of this line is deduced): docks[QInternal::RightDock].rect = QRect(center.right() + 1, center.top(),
-
651 right_hint.width(), center.height());
executed (the execution status of this line is deduced): right_hint.width(), center.height());
-
652 docks[QInternal::BottomDock].rect = QRect(rect.left(), center.bottom() + 1,
executed (the execution status of this line is deduced): docks[QInternal::BottomDock].rect = QRect(rect.left(), center.bottom() + 1,
-
653 rect.width(), bottom_hint.height());
executed (the execution status of this line is deduced): rect.width(), bottom_hint.height());
-
654 -
655 if (!mainWindow->unifiedTitleAndToolBarOnMac()) {
partially evaluated: !mainWindow->unifiedTitleAndToolBarOnMac()
TRUEFALSE
yes
Evaluation Count:237
no
Evaluation Count:0
0-237
656 docks[QInternal::TopDock].fitLayout();
executed (the execution status of this line is deduced): docks[QInternal::TopDock].fitLayout();
-
657 }
executed: }
Execution Count:237
237
658 docks[QInternal::LeftDock].fitLayout();
executed (the execution status of this line is deduced): docks[QInternal::LeftDock].fitLayout();
-
659 docks[QInternal::RightDock].fitLayout();
executed (the execution status of this line is deduced): docks[QInternal::RightDock].fitLayout();
-
660 docks[QInternal::BottomDock].fitLayout();
executed (the execution status of this line is deduced): docks[QInternal::BottomDock].fitLayout();
-
661 -
662 return center;
executed: return center;
Execution Count:237
237
663} -
664 -
665QSize QToolBarAreaLayout::minimumSize(const QSize &centerMin) const -
666{ -
667 if (!visible)
partially evaluated: !visible
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:167
0-167
668 return centerMin;
never executed: return centerMin;
0
669 -
670 QSize result = centerMin;
executed (the execution status of this line is deduced): QSize result = centerMin;
-
671 -
672 QSize left_min = docks[QInternal::LeftDock].minimumSize();
executed (the execution status of this line is deduced): QSize left_min = docks[QInternal::LeftDock].minimumSize();
-
673 QSize right_min = docks[QInternal::RightDock].minimumSize();
executed (the execution status of this line is deduced): QSize right_min = docks[QInternal::RightDock].minimumSize();
-
674 QSize top_min = docks[QInternal::TopDock].minimumSize();
executed (the execution status of this line is deduced): QSize top_min = docks[QInternal::TopDock].minimumSize();
-
675 QSize bottom_min = docks[QInternal::BottomDock].minimumSize();
executed (the execution status of this line is deduced): QSize bottom_min = docks[QInternal::BottomDock].minimumSize();
-
676 -
677 result.setWidth(qMax(top_min.width(), result.width()));
executed (the execution status of this line is deduced): result.setWidth(qMax(top_min.width(), result.width()));
-
678 result.setWidth(qMax(bottom_min.width(), result.width()));
executed (the execution status of this line is deduced): result.setWidth(qMax(bottom_min.width(), result.width()));
-
679 result.setHeight(qMax(left_min.height(), result.height()));
executed (the execution status of this line is deduced): result.setHeight(qMax(left_min.height(), result.height()));
-
680 result.setHeight(qMax(right_min.height(), result.height()));
executed (the execution status of this line is deduced): result.setHeight(qMax(right_min.height(), result.height()));
-
681 -
682 result.rwidth() += left_min.width() + right_min.width();
executed (the execution status of this line is deduced): result.rwidth() += left_min.width() + right_min.width();
-
683 result.rheight() += top_min.height() + bottom_min.height();
executed (the execution status of this line is deduced): result.rheight() += top_min.height() + bottom_min.height();
-
684 -
685 return result;
executed: return result;
Execution Count:167
167
686} -
687 -
688QSize QToolBarAreaLayout::sizeHint(const QSize &centerHint) const -
689{ -
690 if (!visible)
partially evaluated: !visible
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:30
0-30
691 return centerHint;
never executed: return centerHint;
0
692 -
693 QSize result = centerHint;
executed (the execution status of this line is deduced): QSize result = centerHint;
-
694 -
695 QSize left_hint = docks[QInternal::LeftDock].sizeHint();
executed (the execution status of this line is deduced): QSize left_hint = docks[QInternal::LeftDock].sizeHint();
-
696 QSize right_hint = docks[QInternal::RightDock].sizeHint();
executed (the execution status of this line is deduced): QSize right_hint = docks[QInternal::RightDock].sizeHint();
-
697 QSize top_hint = docks[QInternal::TopDock].sizeHint();
executed (the execution status of this line is deduced): QSize top_hint = docks[QInternal::TopDock].sizeHint();
-
698 QSize bottom_hint = docks[QInternal::BottomDock].sizeHint();
executed (the execution status of this line is deduced): QSize bottom_hint = docks[QInternal::BottomDock].sizeHint();
-
699 -
700 result.setWidth(qMax(top_hint.width(), result.width()));
executed (the execution status of this line is deduced): result.setWidth(qMax(top_hint.width(), result.width()));
-
701 result.setWidth(qMax(bottom_hint.width(), result.width()));
executed (the execution status of this line is deduced): result.setWidth(qMax(bottom_hint.width(), result.width()));
-
702 result.setHeight(qMax(left_hint.height(), result.height()));
executed (the execution status of this line is deduced): result.setHeight(qMax(left_hint.height(), result.height()));
-
703 result.setHeight(qMax(right_hint.height(), result.height()));
executed (the execution status of this line is deduced): result.setHeight(qMax(right_hint.height(), result.height()));
-
704 -
705 result.rwidth() += left_hint.width() + right_hint.width();
executed (the execution status of this line is deduced): result.rwidth() += left_hint.width() + right_hint.width();
-
706 result.rheight() += top_hint.height() + bottom_hint.height();
executed (the execution status of this line is deduced): result.rheight() += top_hint.height() + bottom_hint.height();
-
707 -
708 return result;
executed: return result;
Execution Count:30
30
709} -
710 -
711QRect QToolBarAreaLayout::rectHint(const QRect &r) const -
712{ -
713 int coef = visible ? 1 : -1;
never evaluated: visible
0
714 -
715 QRect result = r;
never executed (the execution status of this line is deduced): QRect result = r;
-
716 -
717 QSize left_hint = docks[QInternal::LeftDock].sizeHint();
never executed (the execution status of this line is deduced): QSize left_hint = docks[QInternal::LeftDock].sizeHint();
-
718 QSize right_hint = docks[QInternal::RightDock].sizeHint();
never executed (the execution status of this line is deduced): QSize right_hint = docks[QInternal::RightDock].sizeHint();
-
719 QSize top_hint = docks[QInternal::TopDock].sizeHint();
never executed (the execution status of this line is deduced): QSize top_hint = docks[QInternal::TopDock].sizeHint();
-
720 QSize bottom_hint = docks[QInternal::BottomDock].sizeHint();
never executed (the execution status of this line is deduced): QSize bottom_hint = docks[QInternal::BottomDock].sizeHint();
-
721 -
722 result.adjust(-left_hint.width()*coef, -top_hint.height()*coef,
never executed (the execution status of this line is deduced): result.adjust(-left_hint.width()*coef, -top_hint.height()*coef,
-
723 right_hint.width()*coef, bottom_hint.height()*coef);
never executed (the execution status of this line is deduced): right_hint.width()*coef, bottom_hint.height()*coef);
-
724 -
725 return result;
never executed: return result;
0
726} -
727 -
728QLayoutItem *QToolBarAreaLayout::itemAt(int *x, int index) const -
729{ -
730 Q_ASSERT(x != 0);
executed (the execution status of this line is deduced): qt_noop();
-
731 -
732 for (int i = 0; i < QInternal::DockCount; ++i) {
evaluated: i < QInternal::DockCount
TRUEFALSE
yes
Evaluation Count:1661
yes
Evaluation Count:410
410-1661
733 const QToolBarAreaLayoutInfo &dock = docks[i];
executed (the execution status of this line is deduced): const QToolBarAreaLayoutInfo &dock = docks[i];
-
734 -
735 for (int j = 0; j < dock.lines.count(); ++j) {
evaluated: j < dock.lines.count()
TRUEFALSE
yes
Evaluation Count:19
yes
Evaluation Count:1654
19-1654
736 const QToolBarAreaLayoutLine &line = dock.lines.at(j);
executed (the execution status of this line is deduced): const QToolBarAreaLayoutLine &line = dock.lines.at(j);
-
737 -
738 for (int k = 0; k < line.toolBarItems.count(); ++k) {
evaluated: k < line.toolBarItems.count()
TRUEFALSE
yes
Evaluation Count:19
yes
Evaluation Count:12
12-19
739 if ((*x)++ == index)
evaluated: (*x)++ == index
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:12
7-12
740 return line.toolBarItems.at(k).widgetItem;
executed: return line.toolBarItems.at(k).widgetItem;
Execution Count:7
7
741 }
executed: }
Execution Count:12
12
742 }
executed: }
Execution Count:12
12
743 }
executed: }
Execution Count:1654
1654
744 -
745 return 0;
executed: return 0;
Execution Count:410
410
746} -
747 -
748QLayoutItem *QToolBarAreaLayout::takeAt(int *x, int index) -
749{ -
750 Q_ASSERT(x != 0);
executed (the execution status of this line is deduced): qt_noop();
-
751 -
752 for (int i = 0; i < QInternal::DockCount; ++i) {
evaluated: i < QInternal::DockCount
TRUEFALSE
yes
Evaluation Count:91
yes
Evaluation Count:22
22-91
753 QToolBarAreaLayoutInfo &dock = docks[i];
executed (the execution status of this line is deduced): QToolBarAreaLayoutInfo &dock = docks[i];
-
754 -
755 for (int j = 0; j < dock.lines.count(); ++j) {
evaluated: j < dock.lines.count()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:90
1-90
756 QToolBarAreaLayoutLine &line = dock.lines[j];
executed (the execution status of this line is deduced): QToolBarAreaLayoutLine &line = dock.lines[j];
-
757 -
758 for (int k = 0; k < line.toolBarItems.count(); ++k) {
partially evaluated: k < line.toolBarItems.count()
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
759 if ((*x)++ == index) {
partially evaluated: (*x)++ == index
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
760 QLayoutItem *result = line.toolBarItems.takeAt(k).widgetItem;
executed (the execution status of this line is deduced): QLayoutItem *result = line.toolBarItems.takeAt(k).widgetItem;
-
761 if (line.toolBarItems.isEmpty())
partially evaluated: line.toolBarItems.isEmpty()
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
762 dock.lines.removeAt(j);
executed: dock.lines.removeAt(j);
Execution Count:1
1
763 return result;
executed: return result;
Execution Count:1
1
764 } -
765 }
never executed: }
0
766 }
never executed: }
0
767 }
executed: }
Execution Count:90
90
768 -
769 return 0;
executed: return 0;
Execution Count:22
22
770} -
771 -
772void QToolBarAreaLayout::deleteAllLayoutItems() -
773{ -
774 for (int i = 0; i < QInternal::DockCount; ++i) {
evaluated: i < QInternal::DockCount
TRUEFALSE
yes
Evaluation Count:180
yes
Evaluation Count:45
45-180
775 QToolBarAreaLayoutInfo &dock = docks[i];
executed (the execution status of this line is deduced): QToolBarAreaLayoutInfo &dock = docks[i];
-
776 -
777 for (int j = 0; j < dock.lines.count(); ++j) {
evaluated: j < dock.lines.count()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:180
1-180
778 QToolBarAreaLayoutLine &line = dock.lines[j];
executed (the execution status of this line is deduced): QToolBarAreaLayoutLine &line = dock.lines[j];
-
779 -
780 for (int k = 0; k < line.toolBarItems.count(); ++k) {
evaluated: k < line.toolBarItems.count()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
1
781 QToolBarAreaLayoutItem &item = line.toolBarItems[k];
executed (the execution status of this line is deduced): QToolBarAreaLayoutItem &item = line.toolBarItems[k];
-
782 if (!item.gap)
partially evaluated: !item.gap
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
783 delete item.widgetItem;
executed: delete item.widgetItem;
Execution Count:1
1
784 item.widgetItem = 0;
executed (the execution status of this line is deduced): item.widgetItem = 0;
-
785 }
executed: }
Execution Count:1
1
786 }
executed: }
Execution Count:1
1
787 }
executed: }
Execution Count:180
180
788}
executed: }
Execution Count:45
45
789 -
790QInternal::DockPosition QToolBarAreaLayout::findToolBar(QToolBar *toolBar) const -
791{ -
792 for (int i = 0; i < QInternal::DockCount; ++i) {
evaluated: i < QInternal::DockCount
TRUEFALSE
yes
Evaluation Count:102
yes
Evaluation Count:3
3-102
793 const QToolBarAreaLayoutInfo &dock = docks[i];
executed (the execution status of this line is deduced): const QToolBarAreaLayoutInfo &dock = docks[i];
-
794 -
795 for (int j = 0; j < dock.lines.count(); ++j) {
evaluated: j < dock.lines.count()
TRUEFALSE
yes
Evaluation Count:30
yes
Evaluation Count:72
30-72
796 const QToolBarAreaLayoutLine &line = dock.lines.at(j);
executed (the execution status of this line is deduced): const QToolBarAreaLayoutLine &line = dock.lines.at(j);
-
797 -
798 for (int k = 0; k < line.toolBarItems.count(); ++k) {
partially evaluated: k < line.toolBarItems.count()
TRUEFALSE
yes
Evaluation Count:30
no
Evaluation Count:0
0-30
799 if (line.toolBarItems.at(k).widgetItem->widget() == toolBar)
partially evaluated: line.toolBarItems.at(k).widgetItem->widget() == toolBar
TRUEFALSE
yes
Evaluation Count:30
no
Evaluation Count:0
0-30
800 return static_cast<QInternal::DockPosition>(i);
executed: return static_cast<QInternal::DockPosition>(i);
Execution Count:30
30
801 }
never executed: }
0
802 }
never executed: }
0
803 }
executed: }
Execution Count:72
72
804 -
805 return QInternal::DockCount;
executed: return QInternal::DockCount;
Execution Count:3
3
806} -
807 -
808QLayoutItem *QToolBarAreaLayout::insertToolBar(QToolBar *before, QToolBar *toolBar) -
809{ -
810 QInternal::DockPosition pos = findToolBar(before);
never executed (the execution status of this line is deduced): QInternal::DockPosition pos = findToolBar(before);
-
811 if (pos == QInternal::DockCount)
never evaluated: pos == QInternal::DockCount
0
812 return 0;
never executed: return 0;
0
813 -
814 return docks[pos].insertToolBar(before, toolBar);
never executed: return docks[pos].insertToolBar(before, toolBar);
0
815} -
816 -
817void QToolBarAreaLayout::removeToolBar(QToolBar *toolBar) -
818{ -
819 QInternal::DockPosition pos = findToolBar(toolBar);
never executed (the execution status of this line is deduced): QInternal::DockPosition pos = findToolBar(toolBar);
-
820 if (pos == QInternal::DockCount)
never evaluated: pos == QInternal::DockCount
0
821 return;
never executed: return;
0
822 docks[pos].removeToolBar(toolBar);
never executed (the execution status of this line is deduced): docks[pos].removeToolBar(toolBar);
-
823}
never executed: }
0
824 -
825QLayoutItem *QToolBarAreaLayout::addToolBar(QInternal::DockPosition pos, QToolBar *toolBar) -
826{ -
827 return docks[pos].insertToolBar(0, toolBar);
executed: return docks[pos].insertToolBar(0, toolBar);
Execution Count:2
2
828} -
829 -
830void QToolBarAreaLayout::insertToolBarBreak(QToolBar *before) -
831{ -
832 QInternal::DockPosition pos = findToolBar(before);
never executed (the execution status of this line is deduced): QInternal::DockPosition pos = findToolBar(before);
-
833 if (pos == QInternal::DockCount)
never evaluated: pos == QInternal::DockCount
0
834 return;
never executed: return;
0
835 docks[pos].insertToolBarBreak(before);
never executed (the execution status of this line is deduced): docks[pos].insertToolBarBreak(before);
-
836}
never executed: }
0
837 -
838void QToolBarAreaLayout::removeToolBarBreak(QToolBar *before) -
839{ -
840 QInternal::DockPosition pos = findToolBar(before);
never executed (the execution status of this line is deduced): QInternal::DockPosition pos = findToolBar(before);
-
841 if (pos == QInternal::DockCount)
never evaluated: pos == QInternal::DockCount
0
842 return;
never executed: return;
0
843 docks[pos].removeToolBarBreak(before);
never executed (the execution status of this line is deduced): docks[pos].removeToolBarBreak(before);
-
844}
never executed: }
0
845 -
846void QToolBarAreaLayout::addToolBarBreak(QInternal::DockPosition pos) -
847{ -
848 docks[pos].insertToolBarBreak(0);
never executed (the execution status of this line is deduced): docks[pos].insertToolBarBreak(0);
-
849}
never executed: }
0
850 -
851void QToolBarAreaLayout::moveToolBar(QToolBar *toolbar, int p) -
852{ -
853 QInternal::DockPosition pos = findToolBar(toolbar);
never executed (the execution status of this line is deduced): QInternal::DockPosition pos = findToolBar(toolbar);
-
854 if (pos == QInternal::DockCount)
never evaluated: pos == QInternal::DockCount
0
855 return;
never executed: return;
0
856 docks[pos].moveToolBar(toolbar, p);
never executed (the execution status of this line is deduced): docks[pos].moveToolBar(toolbar, p);
-
857}
never executed: }
0
858 -
859 -
860void QToolBarAreaLayout::insertItem(QInternal::DockPosition pos, QLayoutItem *item) -
861{ -
862 if (docks[pos].lines.isEmpty())
never evaluated: docks[pos].lines.isEmpty()
0
863 docks[pos].lines.append(QToolBarAreaLayoutLine(docks[pos].o));
never executed: docks[pos].lines.append(QToolBarAreaLayoutLine(docks[pos].o));
0
864 docks[pos].lines.last().toolBarItems.append(item);
never executed (the execution status of this line is deduced): docks[pos].lines.last().toolBarItems.append(item);
-
865}
never executed: }
0
866 -
867void QToolBarAreaLayout::insertItem(QToolBar *before, QLayoutItem *item) -
868{ -
869 QInternal::DockPosition pos = findToolBar(before);
never executed (the execution status of this line is deduced): QInternal::DockPosition pos = findToolBar(before);
-
870 if (pos == QInternal::DockCount)
never evaluated: pos == QInternal::DockCount
0
871 return;
never executed: return;
0
872 -
873 docks[pos].insertItem(before, item);
never executed (the execution status of this line is deduced): docks[pos].insertItem(before, item);
-
874}
never executed: }
0
875 -
876void QToolBarAreaLayout::apply(bool animate) -
877{ -
878 QMainWindowLayout *layout = qt_mainwindow_layout(mainWindow);
executed (the execution status of this line is deduced): QMainWindowLayout *layout = qt_mainwindow_layout(mainWindow);
-
879 Q_ASSERT(layout != 0);
executed (the execution status of this line is deduced): qt_noop();
-
880 -
881 Qt::LayoutDirection dir = mainWindow->layoutDirection();
executed (the execution status of this line is deduced): Qt::LayoutDirection dir = mainWindow->layoutDirection();
-
882 -
883 for (int i = 0; i < QInternal::DockCount; ++i) {
evaluated: i < QInternal::DockCount
TRUEFALSE
yes
Evaluation Count:948
yes
Evaluation Count:237
237-948
884 const QToolBarAreaLayoutInfo &dock = docks[i];
executed (the execution status of this line is deduced): const QToolBarAreaLayoutInfo &dock = docks[i];
-
885 -
886 for (int j = 0; j < dock.lines.count(); ++j) {
evaluated: j < dock.lines.count()
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:948
10-948
887 const QToolBarAreaLayoutLine &line = dock.lines.at(j);
executed (the execution status of this line is deduced): const QToolBarAreaLayoutLine &line = dock.lines.at(j);
-
888 if (line.skip())
partially evaluated: line.skip()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:10
0-10
889 continue;
never executed: continue;
0
890 -
891 for (int k = 0; k < line.toolBarItems.count(); ++k) {
evaluated: k < line.toolBarItems.count()
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:10
10
892 const QToolBarAreaLayoutItem &item = line.toolBarItems.at(k);
executed (the execution status of this line is deduced): const QToolBarAreaLayoutItem &item = line.toolBarItems.at(k);
-
893 if (item.skip() || item.gap)
partially evaluated: item.skip()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:10
partially evaluated: item.gap
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:10
0-10
894 continue;
never executed: continue;
0
895 -
896 QRect geo;
executed (the execution status of this line is deduced): QRect geo;
-
897 if (visible) {
partially evaluated: visible
TRUEFALSE
yes
Evaluation Count:10
no
Evaluation Count:0
0-10
898 if (line.o == Qt::Horizontal) {
partially evaluated: line.o == Qt::Horizontal
TRUEFALSE
yes
Evaluation Count:10
no
Evaluation Count:0
0-10
899 geo.setTop(line.rect.top());
executed (the execution status of this line is deduced): geo.setTop(line.rect.top());
-
900 geo.setBottom(line.rect.bottom());
executed (the execution status of this line is deduced): geo.setBottom(line.rect.bottom());
-
901 geo.setLeft(line.rect.left() + item.pos);
executed (the execution status of this line is deduced): geo.setLeft(line.rect.left() + item.pos);
-
902 geo.setRight(line.rect.left() + item.pos + item.size - 1);
executed (the execution status of this line is deduced): geo.setRight(line.rect.left() + item.pos + item.size - 1);
-
903 } else {
executed: }
Execution Count:10
10
904 geo.setLeft(line.rect.left());
never executed (the execution status of this line is deduced): geo.setLeft(line.rect.left());
-
905 geo.setRight(line.rect.right());
never executed (the execution status of this line is deduced): geo.setRight(line.rect.right());
-
906 geo.setTop(line.rect.top() + item.pos);
never executed (the execution status of this line is deduced): geo.setTop(line.rect.top() + item.pos);
-
907 geo.setBottom(line.rect.top() + item.pos + item.size - 1);
never executed (the execution status of this line is deduced): geo.setBottom(line.rect.top() + item.pos + item.size - 1);
-
908 }
never executed: }
0
909 } -
910 -
911 QWidget *widget = item.widgetItem->widget();
executed (the execution status of this line is deduced): QWidget *widget = item.widgetItem->widget();
-
912 if (QToolBar *toolBar = qobject_cast<QToolBar*>(widget)) {
partially evaluated: QToolBar *toolBar = qobject_cast<QToolBar*>(widget)
TRUEFALSE
yes
Evaluation Count:10
no
Evaluation Count:0
0-10
913 QToolBarLayout *tbl = qobject_cast<QToolBarLayout*>(toolBar->layout());
executed (the execution status of this line is deduced): QToolBarLayout *tbl = qobject_cast<QToolBarLayout*>(toolBar->layout());
-
914 if (tbl->expanded) {
partially evaluated: tbl->expanded
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:10
0-10
915 QPoint tr = geo.topRight();
never executed (the execution status of this line is deduced): QPoint tr = geo.topRight();
-
916 QSize size = tbl->expandedSize(geo.size());
never executed (the execution status of this line is deduced): QSize size = tbl->expandedSize(geo.size());
-
917 geo.setSize(size);
never executed (the execution status of this line is deduced): geo.setSize(size);
-
918 geo.moveTopRight(tr);
never executed (the execution status of this line is deduced): geo.moveTopRight(tr);
-
919 if (geo.bottom() > rect.bottom())
never evaluated: geo.bottom() > rect.bottom()
0
920 geo.moveBottom(rect.bottom());
never executed: geo.moveBottom(rect.bottom());
0
921 if (geo.right() > rect.right())
never evaluated: geo.right() > rect.right()
0
922 geo.moveRight(rect.right());
never executed: geo.moveRight(rect.right());
0
923 if (geo.left() < 0)
never evaluated: geo.left() < 0
0
924 geo.moveLeft(0);
never executed: geo.moveLeft(0);
0
925 if (geo.top() < 0)
never evaluated: geo.top() < 0
0
926 geo.moveTop(0);
never executed: geo.moveTop(0);
0
927 }
never executed: }
0
928 }
executed: }
Execution Count:10
10
929 -
930 if (visible && dock.o == Qt::Horizontal)
partially evaluated: visible
TRUEFALSE
yes
Evaluation Count:10
no
Evaluation Count:0
partially evaluated: dock.o == Qt::Horizontal
TRUEFALSE
yes
Evaluation Count:10
no
Evaluation Count:0
0-10
931 geo = QStyle::visualRect(dir, line.rect, geo);
executed: geo = QStyle::visualRect(dir, line.rect, geo);
Execution Count:10
10
932 -
933 layout->widgetAnimator.animate(widget, geo, animate);
executed (the execution status of this line is deduced): layout->widgetAnimator.animate(widget, geo, animate);
-
934 }
executed: }
Execution Count:10
10
935 }
executed: }
Execution Count:10
10
936 }
executed: }
Execution Count:948
948
937}
executed: }
Execution Count:237
237
938 -
939bool QToolBarAreaLayout::toolBarBreak(QToolBar *toolBar) const -
940{ -
941 for (int i = 0; i < QInternal::DockCount; ++i) {
never evaluated: i < QInternal::DockCount
0
942 const QToolBarAreaLayoutInfo &dock = docks[i];
never executed (the execution status of this line is deduced): const QToolBarAreaLayoutInfo &dock = docks[i];
-
943 -
944 for (int j = 0; j < dock.lines.count(); ++j) {
never evaluated: j < dock.lines.count()
0
945 const QToolBarAreaLayoutLine &line = dock.lines.at(j);
never executed (the execution status of this line is deduced): const QToolBarAreaLayoutLine &line = dock.lines.at(j);
-
946 -
947 for (int k = 0; k < line.toolBarItems.count(); ++k) {
never evaluated: k < line.toolBarItems.count()
0
948 if (line.toolBarItems.at(k).widgetItem->widget() == toolBar)
never evaluated: line.toolBarItems.at(k).widgetItem->widget() == toolBar
0
949 return j > 0 && k == 0;
never executed: return j > 0 && k == 0;
0
950 }
never executed: }
0
951 }
never executed: }
0
952 }
never executed: }
0
953 -
954 return false;
never executed: return false;
0
955} -
956 -
957void QToolBarAreaLayout::getStyleOptionInfo(QStyleOptionToolBar *option, QToolBar *toolBar) const -
958{ -
959 for (int i = 0; i < QInternal::DockCount; ++i) {
evaluated: i < QInternal::DockCount
TRUEFALSE
yes
Evaluation Count:102
yes
Evaluation Count:3
3-102
960 const QToolBarAreaLayoutInfo &dock = docks[i];
executed (the execution status of this line is deduced): const QToolBarAreaLayoutInfo &dock = docks[i];
-
961 -
962 for (int j = 0; j < dock.lines.count(); ++j) {
evaluated: j < dock.lines.count()
TRUEFALSE
yes
Evaluation Count:30
yes
Evaluation Count:72
30-72
963 const QToolBarAreaLayoutLine &line = dock.lines.at(j);
executed (the execution status of this line is deduced): const QToolBarAreaLayoutLine &line = dock.lines.at(j);
-
964 -
965 for (int k = 0; k < line.toolBarItems.count(); ++k) {
partially evaluated: k < line.toolBarItems.count()
TRUEFALSE
yes
Evaluation Count:30
no
Evaluation Count:0
0-30
966 if (line.toolBarItems.at(k).widgetItem->widget() == toolBar) {
partially evaluated: line.toolBarItems.at(k).widgetItem->widget() == toolBar
TRUEFALSE
yes
Evaluation Count:30
no
Evaluation Count:0
0-30
967 if (line.toolBarItems.count() == 1)
partially evaluated: line.toolBarItems.count() == 1
TRUEFALSE
yes
Evaluation Count:30
no
Evaluation Count:0
0-30
968 option->positionWithinLine = QStyleOptionToolBar::OnlyOne;
executed: option->positionWithinLine = QStyleOptionToolBar::OnlyOne;
Execution Count:30
30
969 else if (k == 0)
never evaluated: k == 0
0
970 option->positionWithinLine = QStyleOptionToolBar::Beginning;
never executed: option->positionWithinLine = QStyleOptionToolBar::Beginning;
0
971 else if (k == line.toolBarItems.count() - 1)
never evaluated: k == line.toolBarItems.count() - 1
0
972 option->positionWithinLine = QStyleOptionToolBar::End;
never executed: option->positionWithinLine = QStyleOptionToolBar::End;
0
973 else -
974 option->positionWithinLine = QStyleOptionToolBar::Middle;
never executed: option->positionWithinLine = QStyleOptionToolBar::Middle;
0
975 -
976 if (dock.lines.count() == 1)
partially evaluated: dock.lines.count() == 1
TRUEFALSE
yes
Evaluation Count:30
no
Evaluation Count:0
0-30
977 option->positionOfLine = QStyleOptionToolBar::OnlyOne;
executed: option->positionOfLine = QStyleOptionToolBar::OnlyOne;
Execution Count:30
30
978 else if (j == 0)
never evaluated: j == 0
0
979 option->positionOfLine = QStyleOptionToolBar::Beginning;
never executed: option->positionOfLine = QStyleOptionToolBar::Beginning;
0
980 else if (j == dock.lines.count() - 1)
never evaluated: j == dock.lines.count() - 1
0
981 option->positionOfLine = QStyleOptionToolBar::End;
never executed: option->positionOfLine = QStyleOptionToolBar::End;
0
982 else -
983 option->positionOfLine = QStyleOptionToolBar::Middle;
never executed: option->positionOfLine = QStyleOptionToolBar::Middle;
0
984 -
985 return;
executed: return;
Execution Count:30
30
986 } -
987 }
never executed: }
0
988 }
never executed: }
0
989 }
executed: }
Execution Count:72
72
990}
executed: }
Execution Count:3
3
991 -
992QList<int> QToolBarAreaLayout::indexOf(QWidget *toolBar) const -
993{ -
994 QList<int> result;
never executed (the execution status of this line is deduced): QList<int> result;
-
995 -
996 bool found = false;
never executed (the execution status of this line is deduced): bool found = false;
-
997 -
998 for (int i = 0; i < QInternal::DockCount; ++i) {
never evaluated: i < QInternal::DockCount
0
999 const QToolBarAreaLayoutInfo &dock = docks[i];
never executed (the execution status of this line is deduced): const QToolBarAreaLayoutInfo &dock = docks[i];
-
1000 -
1001 for (int j = 0; j < dock.lines.count(); ++j) {
never evaluated: j < dock.lines.count()
0
1002 const QToolBarAreaLayoutLine &line = dock.lines.at(j);
never executed (the execution status of this line is deduced): const QToolBarAreaLayoutLine &line = dock.lines.at(j);
-
1003 -
1004 for (int k = 0; k < line.toolBarItems.count(); ++k) {
never evaluated: k < line.toolBarItems.count()
0
1005 const QToolBarAreaLayoutItem &item = line.toolBarItems.at(k);
never executed (the execution status of this line is deduced): const QToolBarAreaLayoutItem &item = line.toolBarItems.at(k);
-
1006 if (!item.gap && item.widgetItem->widget() == toolBar) {
never evaluated: !item.gap
never evaluated: item.widgetItem->widget() == toolBar
0
1007 found = true;
never executed (the execution status of this line is deduced): found = true;
-
1008 result.prepend(k);
never executed (the execution status of this line is deduced): result.prepend(k);
-
1009 break;
never executed: break;
0
1010 } -
1011 }
never executed: }
0
1012 -
1013 if (found) {
never evaluated: found
0
1014 result.prepend(j);
never executed (the execution status of this line is deduced): result.prepend(j);
-
1015 break;
never executed: break;
0
1016 } -
1017 }
never executed: }
0
1018 -
1019 if (found) {
never evaluated: found
0
1020 result.prepend(i);
never executed (the execution status of this line is deduced): result.prepend(i);
-
1021 break;
never executed: break;
0
1022 } -
1023 }
never executed: }
0
1024 -
1025 return result;
never executed: return result;
0
1026} -
1027 -
1028//this functions returns the path to the possible gapindex for the position pos -
1029QList<int> QToolBarAreaLayout::gapIndex(const QPoint &pos) const -
1030{ -
1031 Qt::LayoutDirection dir = mainWindow->layoutDirection();
never executed (the execution status of this line is deduced): Qt::LayoutDirection dir = mainWindow->layoutDirection();
-
1032 int minDistance = 80; // when a dock area is empty, how "wide" is it?
never executed (the execution status of this line is deduced): int minDistance = 80;
-
1033 QList<int> ret; //return value
never executed (the execution status of this line is deduced): QList<int> ret;
-
1034 for (int i = 0; i < QInternal::DockCount; ++i) {
never evaluated: i < QInternal::DockCount
0
1035 QPoint p = pos;
never executed (the execution status of this line is deduced): QPoint p = pos;
-
1036 if (docks[i].o == Qt::Horizontal)
never evaluated: docks[i].o == Qt::Horizontal
0
1037 p = QStyle::visualPos(dir, docks[i].rect, p);
never executed: p = QStyle::visualPos(dir, docks[i].rect, p);
0
1038 QList<int> result = docks[i].gapIndex(p, &minDistance);
never executed (the execution status of this line is deduced): QList<int> result = docks[i].gapIndex(p, &minDistance);
-
1039 if (!result.isEmpty()) {
never evaluated: !result.isEmpty()
0
1040 result.prepend(i);
never executed (the execution status of this line is deduced): result.prepend(i);
-
1041 ret = result;
never executed (the execution status of this line is deduced): ret = result;
-
1042 }
never executed: }
0
1043 }
never executed: }
0
1044 -
1045 return ret;
never executed: return ret;
0
1046} -
1047 -
1048QList<int> QToolBarAreaLayout::currentGapIndex() const -
1049{ -
1050 for (int i = 0; i < QInternal::DockCount; ++i) {
never evaluated: i < QInternal::DockCount
0
1051 const QToolBarAreaLayoutInfo &dock = docks[i];
never executed (the execution status of this line is deduced): const QToolBarAreaLayoutInfo &dock = docks[i];
-
1052 -
1053 for (int j = 0; j < dock.lines.count(); ++j) {
never evaluated: j < dock.lines.count()
0
1054 const QToolBarAreaLayoutLine &line = dock.lines[j];
never executed (the execution status of this line is deduced): const QToolBarAreaLayoutLine &line = dock.lines[j];
-
1055 -
1056 for (int k = 0; k < line.toolBarItems.count(); k++) {
never evaluated: k < line.toolBarItems.count()
0
1057 if (line.toolBarItems[k].gap) {
never evaluated: line.toolBarItems[k].gap
0
1058 QList<int> result;
never executed (the execution status of this line is deduced): QList<int> result;
-
1059 result << i << j << k;
never executed (the execution status of this line is deduced): result << i << j << k;
-
1060 return result;
never executed: return result;
0
1061 } -
1062 }
never executed: }
0
1063 }
never executed: }
0
1064 }
never executed: }
0
1065 return QList<int>();
never executed: return QList<int>();
0
1066} -
1067 -
1068bool QToolBarAreaLayout::insertGap(const QList<int> &path, QLayoutItem *item) -
1069{ -
1070 Q_ASSERT(path.count() == 3);
never executed (the execution status of this line is deduced): qt_noop();
-
1071 const int i = path.first();
never executed (the execution status of this line is deduced): const int i = path.first();
-
1072 Q_ASSERT(i >= 0 && i < QInternal::DockCount);
never executed (the execution status of this line is deduced): qt_noop();
-
1073 return docks[i].insertGap(path.mid(1), item);
never executed: return docks[i].insertGap(path.mid(1), item);
0
1074} -
1075 -
1076void QToolBarAreaLayout::remove(const QList<int> &path) -
1077{ -
1078 Q_ASSERT(path.count() == 3);
never executed (the execution status of this line is deduced): qt_noop();
-
1079 docks[path.at(0)].lines[path.at(1)].toolBarItems.removeAt(path.at(2));
never executed (the execution status of this line is deduced): docks[path.at(0)].lines[path.at(1)].toolBarItems.removeAt(path.at(2));
-
1080}
never executed: }
0
1081 -
1082void QToolBarAreaLayout::remove(QLayoutItem *item) -
1083{ -
1084 for (int i = 0; i < QInternal::DockCount; ++i) {
never evaluated: i < QInternal::DockCount
0
1085 QToolBarAreaLayoutInfo &dock = docks[i];
never executed (the execution status of this line is deduced): QToolBarAreaLayoutInfo &dock = docks[i];
-
1086 -
1087 for (int j = 0; j < dock.lines.count(); ++j) {
never evaluated: j < dock.lines.count()
0
1088 QToolBarAreaLayoutLine &line = dock.lines[j];
never executed (the execution status of this line is deduced): QToolBarAreaLayoutLine &line = dock.lines[j];
-
1089 -
1090 for (int k = 0; k < line.toolBarItems.count(); k++) {
never evaluated: k < line.toolBarItems.count()
0
1091 if (line.toolBarItems[k].widgetItem == item) {
never evaluated: line.toolBarItems[k].widgetItem == item
0
1092 line.toolBarItems.removeAt(k);
never executed (the execution status of this line is deduced): line.toolBarItems.removeAt(k);
-
1093 if (line.toolBarItems.isEmpty())
never evaluated: line.toolBarItems.isEmpty()
0
1094 dock.lines.removeAt(j);
never executed: dock.lines.removeAt(j);
0
1095 return;
never executed: return;
0
1096 } -
1097 }
never executed: }
0
1098 }
never executed: }
0
1099 }
never executed: }
0
1100}
never executed: }
0
1101 -
1102void QToolBarAreaLayout::clear() -
1103{ -
1104 for (int i = 0; i < QInternal::DockCount; ++i)
evaluated: i < QInternal::DockCount
TRUEFALSE
yes
Evaluation Count:16
yes
Evaluation Count:4
4-16
1105 docks[i].clear();
executed: docks[i].clear();
Execution Count:16
16
1106 rect = QRect();
executed (the execution status of this line is deduced): rect = QRect();
-
1107}
executed: }
Execution Count:4
4
1108 -
1109QToolBarAreaLayoutItem &QToolBarAreaLayout::item(const QList<int> &path) -
1110{ -
1111 Q_ASSERT(path.count() == 3);
never executed (the execution status of this line is deduced): qt_noop();
-
1112 -
1113 Q_ASSERT(path.at(0) >= 0 && path.at(0) < QInternal::DockCount);
never executed (the execution status of this line is deduced): qt_noop();
-
1114 QToolBarAreaLayoutInfo &info = docks[path.at(0)];
never executed (the execution status of this line is deduced): QToolBarAreaLayoutInfo &info = docks[path.at(0)];
-
1115 Q_ASSERT(path.at(1) >= 0 && path.at(1) < info.lines.count());
never executed (the execution status of this line is deduced): qt_noop();
-
1116 QToolBarAreaLayoutLine &line = info.lines[path.at(1)];
never executed (the execution status of this line is deduced): QToolBarAreaLayoutLine &line = info.lines[path.at(1)];
-
1117 Q_ASSERT(path.at(2) >= 0 && path.at(2) < line.toolBarItems.count());
never executed (the execution status of this line is deduced): qt_noop();
-
1118 return line.toolBarItems[path.at(2)];
never executed: return line.toolBarItems[path.at(2)];
0
1119} -
1120 -
1121QRect QToolBarAreaLayout::itemRect(const QList<int> &path) const -
1122{ -
1123 const int i = path.first();
never executed (the execution status of this line is deduced): const int i = path.first();
-
1124 -
1125 QRect r = docks[i].itemRect(path.mid(1));
never executed (the execution status of this line is deduced): QRect r = docks[i].itemRect(path.mid(1));
-
1126 if (docks[i].o == Qt::Horizontal)
never evaluated: docks[i].o == Qt::Horizontal
0
1127 r = QStyle::visualRect(mainWindow->layoutDirection(),
never executed: r = QStyle::visualRect(mainWindow->layoutDirection(), docks[i].rect, r);
0
1128 docks[i].rect, r);
never executed: r = QStyle::visualRect(mainWindow->layoutDirection(), docks[i].rect, r);
0
1129 return r;
never executed: return r;
0
1130} -
1131 -
1132QLayoutItem *QToolBarAreaLayout::plug(const QList<int> &path) -
1133{ -
1134 QToolBarAreaLayoutItem &item = this->item(path);
never executed (the execution status of this line is deduced): QToolBarAreaLayoutItem &item = this->item(path);
-
1135 Q_ASSERT(item.gap);
never executed (the execution status of this line is deduced): qt_noop();
-
1136 Q_ASSERT(item.widgetItem != 0);
never executed (the execution status of this line is deduced): qt_noop();
-
1137 item.gap = false;
never executed (the execution status of this line is deduced): item.gap = false;
-
1138 return item.widgetItem;
never executed: return item.widgetItem;
0
1139} -
1140 -
1141QLayoutItem *QToolBarAreaLayout::unplug(const QList<int> &path, QToolBarAreaLayout *other) -
1142{ -
1143 //other needs to be update as well -
1144 Q_ASSERT(path.count() == 3);
never executed (the execution status of this line is deduced): qt_noop();
-
1145 QToolBarAreaLayoutItem &item = this->item(path);
never executed (the execution status of this line is deduced): QToolBarAreaLayoutItem &item = this->item(path);
-
1146 -
1147 //update the leading space here -
1148 QToolBarAreaLayoutInfo &info = docks[path.at(0)];
never executed (the execution status of this line is deduced): QToolBarAreaLayoutInfo &info = docks[path.at(0)];
-
1149 QToolBarAreaLayoutLine &line = info.lines[path.at(1)];
never executed (the execution status of this line is deduced): QToolBarAreaLayoutLine &line = info.lines[path.at(1)];
-
1150 if (item.size != pick(line.o, item.realSizeHint())) {
never evaluated: item.size != pick(line.o, item.realSizeHint())
0
1151 //the item doesn't have its default size -
1152 //so we'll give this to the next item -
1153 int newExtraSpace = 0;
never executed (the execution status of this line is deduced): int newExtraSpace = 0;
-
1154 //let's iterate over the siblings of the current item that pare placed before it -
1155 //we need to find just the one before -
1156 for (int i = path.at(2) - 1; i >= 0; --i) {
never evaluated: i >= 0
0
1157 QToolBarAreaLayoutItem &previous = line.toolBarItems[i];
never executed (the execution status of this line is deduced): QToolBarAreaLayoutItem &previous = line.toolBarItems[i];
-
1158 if (!previous.skip()) {
never evaluated: !previous.skip()
0
1159 //we need to check if it has a previous element and a next one -
1160 //the previous will get its size changed -
1161 for (int j = path.at(2) + 1; j < line.toolBarItems.count(); ++j) {
never evaluated: j < line.toolBarItems.count()
0
1162 const QToolBarAreaLayoutItem &next = line.toolBarItems.at(j);
never executed (the execution status of this line is deduced): const QToolBarAreaLayoutItem &next = line.toolBarItems.at(j);
-
1163 if (!next.skip()) {
never evaluated: !next.skip()
0
1164 newExtraSpace = next.pos - previous.pos - pick(line.o, previous.sizeHint());
never executed (the execution status of this line is deduced): newExtraSpace = next.pos - previous.pos - pick(line.o, previous.sizeHint());
-
1165 previous.resize(line.o, next.pos - previous.pos);
never executed (the execution status of this line is deduced): previous.resize(line.o, next.pos - previous.pos);
-
1166 break;
never executed: break;
0
1167 } -
1168 }
never executed: }
0
1169 break;
never executed: break;
0
1170 } -
1171 }
never executed: }
0
1172 -
1173 if (other) {
never evaluated: other
0
1174 QToolBarAreaLayoutInfo &info = other->docks[path.at(0)];
never executed (the execution status of this line is deduced): QToolBarAreaLayoutInfo &info = other->docks[path.at(0)];
-
1175 QToolBarAreaLayoutLine &line = info.lines[path.at(1)];
never executed (the execution status of this line is deduced): QToolBarAreaLayoutLine &line = info.lines[path.at(1)];
-
1176 for (int i = path.at(2) - 1; i >= 0; --i) {
never evaluated: i >= 0
0
1177 QToolBarAreaLayoutItem &previous = line.toolBarItems[i];
never executed (the execution status of this line is deduced): QToolBarAreaLayoutItem &previous = line.toolBarItems[i];
-
1178 if (!previous.skip()) {
never evaluated: !previous.skip()
0
1179 previous.resize(line.o, pick(line.o, previous.sizeHint()) + newExtraSpace);
never executed (the execution status of this line is deduced): previous.resize(line.o, pick(line.o, previous.sizeHint()) + newExtraSpace);
-
1180 break;
never executed: break;
0
1181 } -
1182 }
never executed: }
0
1183 -
1184 }
never executed: }
0
1185 }
never executed: }
0
1186 -
1187 Q_ASSERT(!item.gap);
never executed (the execution status of this line is deduced): qt_noop();
-
1188 item.gap = true;
never executed (the execution status of this line is deduced): item.gap = true;
-
1189 return item.widgetItem;
never executed: return item.widgetItem;
0
1190} -
1191 -
1192static QRect unpackRect(uint geom0, uint geom1, bool *floating) -
1193{ -
1194 *floating = geom0 & 1;
never executed (the execution status of this line is deduced): *floating = geom0 & 1;
-
1195 if (!*floating)
never evaluated: !*floating
0
1196 return QRect();
never executed: return QRect();
0
1197 -
1198 geom0 >>= 1;
never executed (the execution status of this line is deduced): geom0 >>= 1;
-
1199 -
1200 int x = (int)(geom0 & 0x0000ffff) - 0x7FFF;
never executed (the execution status of this line is deduced): int x = (int)(geom0 & 0x0000ffff) - 0x7FFF;
-
1201 int y = (int)(geom1 & 0x0000ffff) - 0x7FFF;
never executed (the execution status of this line is deduced): int y = (int)(geom1 & 0x0000ffff) - 0x7FFF;
-
1202 -
1203 geom0 >>= 16;
never executed (the execution status of this line is deduced): geom0 >>= 16;
-
1204 geom1 >>= 16;
never executed (the execution status of this line is deduced): geom1 >>= 16;
-
1205 -
1206 int w = geom0 & 0x0000ffff;
never executed (the execution status of this line is deduced): int w = geom0 & 0x0000ffff;
-
1207 int h = geom1 & 0x0000ffff;
never executed (the execution status of this line is deduced): int h = geom1 & 0x0000ffff;
-
1208 -
1209 return QRect(x, y, w, h);
never executed: return QRect(x, y, w, h);
0
1210} -
1211 -
1212static void packRect(uint *geom0, uint *geom1, const QRect &rect, bool floating) -
1213{ -
1214 *geom0 = 0;
never executed (the execution status of this line is deduced): *geom0 = 0;
-
1215 *geom1 = 0;
never executed (the execution status of this line is deduced): *geom1 = 0;
-
1216 -
1217 if (!floating)
never evaluated: !floating
0
1218 return;
never executed: return;
0
1219 -
1220 // The 0x7FFF is half of 0xFFFF. We add it so we can handle negative coordinates on -
1221 // dual monitors. It's subtracted when unpacking. -
1222 -
1223 *geom0 |= qMax(0, rect.width()) & 0x0000ffff;
never executed (the execution status of this line is deduced): *geom0 |= qMax(0, rect.width()) & 0x0000ffff;
-
1224 *geom1 |= qMax(0, rect.height()) & 0x0000ffff;
never executed (the execution status of this line is deduced): *geom1 |= qMax(0, rect.height()) & 0x0000ffff;
-
1225 -
1226 *geom0 <<= 16;
never executed (the execution status of this line is deduced): *geom0 <<= 16;
-
1227 *geom1 <<= 16;
never executed (the execution status of this line is deduced): *geom1 <<= 16;
-
1228 -
1229 *geom0 |= qMax(0, rect.x() + 0x7FFF) & 0x0000ffff;
never executed (the execution status of this line is deduced): *geom0 |= qMax(0, rect.x() + 0x7FFF) & 0x0000ffff;
-
1230 *geom1 |= qMax(0, rect.y() + 0x7FFF) & 0x0000ffff;
never executed (the execution status of this line is deduced): *geom1 |= qMax(0, rect.y() + 0x7FFF) & 0x0000ffff;
-
1231 -
1232 // yeah, we chop one bit off the width, but it still has a range up to 32512 -
1233 -
1234 *geom0 <<= 1;
never executed (the execution status of this line is deduced): *geom0 <<= 1;
-
1235 *geom0 |= 1;
never executed (the execution status of this line is deduced): *geom0 |= 1;
-
1236}
never executed: }
0
1237 -
1238 -
1239void QToolBarAreaLayout::saveState(QDataStream &stream) const -
1240{ -
1241 // save toolbar state -
1242 stream << (uchar) ToolBarStateMarkerEx;
executed (the execution status of this line is deduced): stream << (uchar) ToolBarStateMarkerEx;
-
1243 -
1244 int lineCount = 0;
executed (the execution status of this line is deduced): int lineCount = 0;
-
1245 for (int i = 0; i < QInternal::DockCount; ++i)
evaluated: i < QInternal::DockCount
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:2
2-8
1246 lineCount += docks[i].lines.count();
executed: lineCount += docks[i].lines.count();
Execution Count:8
8
1247 -
1248 stream << lineCount;
executed (the execution status of this line is deduced): stream << lineCount;
-
1249 -
1250 for (int i = 0; i < QInternal::DockCount; ++i) {
evaluated: i < QInternal::DockCount
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:2
2-8
1251 const QToolBarAreaLayoutInfo &dock = docks[i];
executed (the execution status of this line is deduced): const QToolBarAreaLayoutInfo &dock = docks[i];
-
1252 -
1253 for (int j = 0; j < dock.lines.count(); ++j) {
partially evaluated: j < dock.lines.count()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
1254 const QToolBarAreaLayoutLine &line = dock.lines.at(j);
never executed (the execution status of this line is deduced): const QToolBarAreaLayoutLine &line = dock.lines.at(j);
-
1255 -
1256 stream << i << line.toolBarItems.count();
never executed (the execution status of this line is deduced): stream << i << line.toolBarItems.count();
-
1257 -
1258 for (int k = 0; k < line.toolBarItems.count(); ++k) {
never evaluated: k < line.toolBarItems.count()
0
1259 const QToolBarAreaLayoutItem &item = line.toolBarItems.at(k);
never executed (the execution status of this line is deduced): const QToolBarAreaLayoutItem &item = line.toolBarItems.at(k);
-
1260 QWidget *widget = const_cast<QLayoutItem*>(item.widgetItem)->widget();
never executed (the execution status of this line is deduced): QWidget *widget = const_cast<QLayoutItem*>(item.widgetItem)->widget();
-
1261 QString objectName = widget->objectName();
never executed (the execution status of this line is deduced): QString objectName = widget->objectName();
-
1262 if (objectName.isEmpty()) {
never evaluated: objectName.isEmpty()
0
1263 qWarning("QMainWindow::saveState(): 'objectName' not set for QToolBar %p '%s'",
never executed (the execution status of this line is deduced): QMessageLogger("widgets/qtoolbararealayout.cpp", 1263, __PRETTY_FUNCTION__).warning("QMainWindow::saveState(): 'objectName' not set for QToolBar %p '%s'",
-
1264 widget, widget->windowTitle().toLocal8Bit().constData());
never executed (the execution status of this line is deduced): widget, widget->windowTitle().toLocal8Bit().constData());
-
1265 }
never executed: }
0
1266 stream << objectName;
never executed (the execution status of this line is deduced): stream << objectName;
-
1267 // we store information as: -
1268 // 1st bit: 1 if shown -
1269 // 2nd bit: 1 if orientation is vertical (default is horizontal) -
1270 uchar shownOrientation = (uchar)!widget->isHidden();
never executed (the execution status of this line is deduced): uchar shownOrientation = (uchar)!widget->isHidden();
-
1271 if (QToolBar * tb= qobject_cast<QToolBar*>(widget)) {
never evaluated: QToolBar * tb= qobject_cast<QToolBar*>(widget)
0
1272 if (tb->orientation() == Qt::Vertical)
never evaluated: tb->orientation() == Qt::Vertical
0
1273 shownOrientation |= 2;
never executed: shownOrientation |= 2;
0
1274 }
never executed: }
0
1275 stream << shownOrientation;
never executed (the execution status of this line is deduced): stream << shownOrientation;
-
1276 stream << item.pos;
never executed (the execution status of this line is deduced): stream << item.pos;
-
1277 //we store the preferred size. If the use rdidn't resize the toolbars it will be -1 -
1278 stream << item.preferredSize;
never executed (the execution status of this line is deduced): stream << item.preferredSize;
-
1279 -
1280 uint geom0, geom1;
never executed (the execution status of this line is deduced): uint geom0, geom1;
-
1281 packRect(&geom0, &geom1, widget->geometry(), widget->isWindow());
never executed (the execution status of this line is deduced): packRect(&geom0, &geom1, widget->geometry(), widget->isWindow());
-
1282 stream << geom0 << geom1;
never executed (the execution status of this line is deduced): stream << geom0 << geom1;
-
1283 }
never executed: }
0
1284 }
never executed: }
0
1285 }
executed: }
Execution Count:8
8
1286}
executed: }
Execution Count:2
2
1287 -
1288static inline int getInt(QDataStream &stream, Qt::Orientation o, bool pre43) -
1289{ -
1290 if (pre43) {
never evaluated: pre43
0
1291 QPoint p;
never executed (the execution status of this line is deduced): QPoint p;
-
1292 stream >> p;
never executed (the execution status of this line is deduced): stream >> p;
-
1293 return pick(o, p);
never executed: return pick(o, p);
0
1294 } else { -
1295 int x;
never executed (the execution status of this line is deduced): int x;
-
1296 stream >> x;
never executed (the execution status of this line is deduced): stream >> x;
-
1297 return x;
never executed: return x;
0
1298 } -
1299} -
1300 -
1301 -
1302bool QToolBarAreaLayout::restoreState(QDataStream &stream, const QList<QToolBar*> &_toolBars, uchar tmarker, bool pre43, bool testing) -
1303{ -
1304 QList<QToolBar*> toolBars = _toolBars;
executed (the execution status of this line is deduced): QList<QToolBar*> toolBars = _toolBars;
-
1305 int lines;
executed (the execution status of this line is deduced): int lines;
-
1306 stream >> lines;
executed (the execution status of this line is deduced): stream >> lines;
-
1307 if (!testing)
evaluated: !testing
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2
2
1308 testing = mainWindow->unifiedTitleAndToolBarOnMac();
executed: testing = mainWindow->unifiedTitleAndToolBarOnMac();
Execution Count:2
2
1309 -
1310 for (int j = 0; j < lines; ++j) {
partially evaluated: j < lines
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
1311 int pos;
never executed (the execution status of this line is deduced): int pos;
-
1312 stream >> pos;
never executed (the execution status of this line is deduced): stream >> pos;
-
1313 if (pos < 0 || pos >= QInternal::DockCount)
never evaluated: pos < 0
never evaluated: pos >= QInternal::DockCount
0
1314 return false;
never executed: return false;
0
1315 int cnt;
never executed (the execution status of this line is deduced): int cnt;
-
1316 stream >> cnt;
never executed (the execution status of this line is deduced): stream >> cnt;
-
1317 -
1318 QToolBarAreaLayoutInfo &dock = docks[pos];
never executed (the execution status of this line is deduced): QToolBarAreaLayoutInfo &dock = docks[pos];
-
1319 const bool applyingLayout = !testing && !(pos == QInternal::TopDock && mainWindow->unifiedTitleAndToolBarOnMac());
never evaluated: !testing
never evaluated: pos == QInternal::TopDock
never evaluated: mainWindow->unifiedTitleAndToolBarOnMac()
0
1320 QToolBarAreaLayoutLine line(dock.o);
never executed (the execution status of this line is deduced): QToolBarAreaLayoutLine line(dock.o);
-
1321 -
1322 for (int k = 0; k < cnt; ++k) {
never evaluated: k < cnt
0
1323 QToolBarAreaLayoutItem item;
never executed (the execution status of this line is deduced): QToolBarAreaLayoutItem item;
-
1324 -
1325 QString objectName;
never executed (the execution status of this line is deduced): QString objectName;
-
1326 stream >> objectName;
never executed (the execution status of this line is deduced): stream >> objectName;
-
1327 uchar shown;
never executed (the execution status of this line is deduced): uchar shown;
-
1328 stream >> shown;
never executed (the execution status of this line is deduced): stream >> shown;
-
1329 item.pos = getInt(stream, dock.o, pre43);
never executed (the execution status of this line is deduced): item.pos = getInt(stream, dock.o, pre43);
-
1330 item.size = getInt(stream, dock.o, pre43);
never executed (the execution status of this line is deduced): item.size = getInt(stream, dock.o, pre43);
-
1331 -
1332 /* -
1333 4.3.0 added floating toolbars, but failed to add the ability to restore them. -
1334 We need to store there geometry (four ints). We cannot change the format in a -
1335 patch release (4.3.1) by adding ToolBarStateMarkerEx2 to signal extra data. So -
1336 for now we'll pack it in the two legacy ints we no longer used in Qt4.3.0. -
1337 In 4.4, we should add ToolBarStateMarkerEx2 and fix this properly. -
1338 */ -
1339 -
1340 QRect rect;
never executed (the execution status of this line is deduced): QRect rect;
-
1341 bool floating = false;
never executed (the execution status of this line is deduced): bool floating = false;
-
1342 uint geom0, geom1;
never executed (the execution status of this line is deduced): uint geom0, geom1;
-
1343 geom0 = getInt(stream, dock.o, pre43);
never executed (the execution status of this line is deduced): geom0 = getInt(stream, dock.o, pre43);
-
1344 if (tmarker == ToolBarStateMarkerEx) {
never evaluated: tmarker == ToolBarStateMarkerEx
0
1345 geom1 = getInt(stream, dock.o, pre43);
never executed (the execution status of this line is deduced): geom1 = getInt(stream, dock.o, pre43);
-
1346 rect = unpackRect(geom0, geom1, &floating);
never executed (the execution status of this line is deduced): rect = unpackRect(geom0, geom1, &floating);
-
1347 }
never executed: }
0
1348 -
1349 QToolBar *toolBar = 0;
never executed (the execution status of this line is deduced): QToolBar *toolBar = 0;
-
1350 for (int x = 0; x < toolBars.count(); ++x) {
never evaluated: x < toolBars.count()
0
1351 if (toolBars.at(x)->objectName() == objectName) {
never evaluated: toolBars.at(x)->objectName() == objectName
0
1352 toolBar = toolBars.takeAt(x);
never executed (the execution status of this line is deduced): toolBar = toolBars.takeAt(x);
-
1353 break;
never executed: break;
0
1354 } -
1355 }
never executed: }
0
1356 if (toolBar == 0) {
never evaluated: toolBar == 0
0
1357 continue;
never executed: continue;
0
1358 } -
1359 -
1360 if (applyingLayout) {
never evaluated: applyingLayout
0
1361 item.widgetItem = new QWidgetItemV2(toolBar);
never executed (the execution status of this line is deduced): item.widgetItem = new QWidgetItemV2(toolBar);
-
1362 toolBar->setOrientation(floating ? ((shown & 2) ? Qt::Vertical : Qt::Horizontal) : dock.o);
never executed (the execution status of this line is deduced): toolBar->setOrientation(floating ? ((shown & 2) ? Qt::Vertical : Qt::Horizontal) : dock.o);
-
1363 toolBar->setVisible(shown & 1);
never executed (the execution status of this line is deduced): toolBar->setVisible(shown & 1);
-
1364 toolBar->d_func()->setWindowState(floating, true, rect);
never executed (the execution status of this line is deduced): toolBar->d_func()->setWindowState(floating, true, rect);
-
1365 -
1366 item.preferredSize = item.size;
never executed (the execution status of this line is deduced): item.preferredSize = item.size;
-
1367 line.toolBarItems.append(item);
never executed (the execution status of this line is deduced): line.toolBarItems.append(item);
-
1368 }
never executed: }
0
1369 }
never executed: }
0
1370 -
1371 if (applyingLayout) {
never evaluated: applyingLayout
0
1372 dock.lines.append(line);
never executed (the execution status of this line is deduced): dock.lines.append(line);
-
1373 }
never executed: }
0
1374 }
never executed: }
0
1375 -
1376 -
1377 return stream.status() == QDataStream::Ok;
executed: return stream.status() == QDataStream::Ok;
Execution Count:4
4
1378} -
1379 -
1380bool QToolBarAreaLayout::isEmpty() const -
1381{ -
1382 for (int i = 0; i < QInternal::DockCount; ++i) {
never evaluated: i < QInternal::DockCount
0
1383 if (!docks[i].lines.isEmpty())
never evaluated: !docks[i].lines.isEmpty()
0
1384 return false;
never executed: return false;
0
1385 }
never executed: }
0
1386 return true;
never executed: return true;
0
1387} -
1388 -
1389QT_END_NAMESPACE -
1390 -
1391#endif // QT_NO_TOOLBAR -
1392 -
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial