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