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