qmdiarea.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/widgets/widgets/qmdiarea.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8-
9-
10-
11-
12using namespace QMdi;-
13-
14-
15static bool sanityCheck(const QMdiSubWindow * const child, const char *where)-
16{-
17 if (__builtin_expect(!!(!child), false)
__builtin_expe...child), false)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
18 const char error[] = "null pointer";-
19 ((!(false)) ? qt_assert_x(where, error,__FILE__,189) : qt_noop());-
20 QMessageLogger(__FILE__, 190, __PRETTY_FUNCTION__).warning("%s:%s", where, error);-
21 return
never executed: return false;
false;
never executed: return false;
0
22 }-
23 return
never executed: return true;
true;
never executed: return true;
0
24}-
25-
26static bool sanityCheck(const QList<QWidget *> &widgets, const int index, const char *where)-
27{-
28 if (__builtin_expect(!!(index < 0 || index >= widgets.size()), false)
__builtin_expe...ize()), false)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
29 const char error[] = "index out of range";-
30 ((!(false)) ? qt_assert_x(where, error,__FILE__,200) : qt_noop());-
31 QMessageLogger(__FILE__, 201, __PRETTY_FUNCTION__).warning("%s:%s", where, error);-
32 return
never executed: return false;
false;
never executed: return false;
0
33 }-
34 if (__builtin_expect(!!(!widgets.at(index)), false)
__builtin_expe...ndex)), false)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
35 const char error[] = "null pointer";-
36 ((!(false)) ? qt_assert_x(where, error,__FILE__,206) : qt_noop());-
37 QMessageLogger(__FILE__, 207, __PRETTY_FUNCTION__).warning("%s:%s", where, error);-
38 return
never executed: return false;
false;
never executed: return false;
0
39 }-
40 return
never executed: return true;
true;
never executed: return true;
0
41}-
42-
43static void setIndex(int *index, int candidate, int min, int max, bool isIncreasing)-
44{-
45 if (!index
!indexDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
46 return;
never executed: return;
0
47-
48 if (isIncreasing
isIncreasingDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
49 if (candidate > max
candidate > maxDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
50 *
never executed: *index = min;
index = min;
never executed: *index = min;
0
51 else-
52 *
never executed: *index = qMax(candidate, min);
index = qMax(candidate, min);
never executed: *index = qMax(candidate, min);
0
53 } else {-
54 if (candidate < min
candidate < minDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
55 *
never executed: *index = max;
index = max;
never executed: *index = max;
0
56 else-
57 *
never executed: *index = qMin(candidate, max);
index = qMin(candidate, max);
never executed: *index = qMin(candidate, max);
0
58 }-
59 ((!(*index >= min && *index <= max)) ? qt_assert("*index >= min && *index <= max",__FILE__,229) : qt_noop());-
60}
never executed: end of block
0
61-
62static inline bool useScrollBar(const QRect &childrenRect, const QSize &maxViewportSize,-
63 Qt::Orientation orientation)-
64{-
65 if (orientation == Qt::Horizontal
orientation == Qt::HorizontalDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
66 return
never executed: return childrenRect.width() > maxViewportSize.width() || childrenRect.left() < 0 || childrenRect.right() >= maxViewportSize.width();
childrenRect.width() > maxViewportSize.width()
never executed: return childrenRect.width() > maxViewportSize.width() || childrenRect.left() < 0 || childrenRect.right() >= maxViewportSize.width();
0
67 || childrenRect.left() < 0
never executed: return childrenRect.width() > maxViewportSize.width() || childrenRect.left() < 0 || childrenRect.right() >= maxViewportSize.width();
0
68 || childrenRect.right() >= maxViewportSize.width();
never executed: return childrenRect.width() > maxViewportSize.width() || childrenRect.left() < 0 || childrenRect.right() >= maxViewportSize.width();
0
69 else-
70 return
never executed: return childrenRect.height() > maxViewportSize.height() || childrenRect.top() < 0 || childrenRect.bottom() >= maxViewportSize.height();
childrenRect.height() > maxViewportSize.height()
never executed: return childrenRect.height() > maxViewportSize.height() || childrenRect.top() < 0 || childrenRect.bottom() >= maxViewportSize.height();
0
71 || childrenRect.top() < 0
never executed: return childrenRect.height() > maxViewportSize.height() || childrenRect.top() < 0 || childrenRect.bottom() >= maxViewportSize.height();
0
72 || childrenRect.bottom() >= maxViewportSize.height();
never executed: return childrenRect.height() > maxViewportSize.height() || childrenRect.top() < 0 || childrenRect.bottom() >= maxViewportSize.height();
0
73}-
74-
75-
76static inline QMdiArea *mdiAreaParent(QWidget *widget)-
77{-
78 if (!widget
!widgetDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
79 return
never executed: return 0;
0;
never executed: return 0;
0
80-
81 QWidget *parent = widget->parentWidget();-
82 while (parent
parentDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
83 if (QMdiArea *area = qobject_cast<QMdiArea *>(parent)
QMdiArea *area...rea *>(parent)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
84 return
never executed: return area;
area;
never executed: return area;
0
85 parent = parent->parentWidget();-
86 }
never executed: end of block
0
87 return
never executed: return 0;
0;
never executed: return 0;
0
88}-
89-
90-
91static inline QTabBar::Shape tabBarShapeFrom(QTabWidget::TabShape shape, QTabWidget::TabPosition position)-
92{-
93 const bool rounded = (shape == QTabWidget::Rounded);-
94 if (position == QTabWidget::North
position == QTabWidget::NorthDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
95 return
never executed: return rounded ? QTabBar::RoundedNorth : QTabBar::TriangularNorth;
rounded ? QTabBar::RoundedNorth : QTabBar::TriangularNorth;
never executed: return rounded ? QTabBar::RoundedNorth : QTabBar::TriangularNorth;
0
96 if (position == QTabWidget::South
position == QTabWidget::SouthDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
97 return
never executed: return rounded ? QTabBar::RoundedSouth : QTabBar::TriangularSouth;
rounded ? QTabBar::RoundedSouth : QTabBar::TriangularSouth;
never executed: return rounded ? QTabBar::RoundedSouth : QTabBar::TriangularSouth;
0
98 if (position == QTabWidget::East
position == QTabWidget::EastDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
99 return
never executed: return rounded ? QTabBar::RoundedEast : QTabBar::TriangularEast;
rounded ? QTabBar::RoundedEast : QTabBar::TriangularEast;
never executed: return rounded ? QTabBar::RoundedEast : QTabBar::TriangularEast;
0
100 if (position == QTabWidget::West
position == QTabWidget::WestDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
101 return
never executed: return rounded ? QTabBar::RoundedWest : QTabBar::TriangularWest;
rounded ? QTabBar::RoundedWest : QTabBar::TriangularWest;
never executed: return rounded ? QTabBar::RoundedWest : QTabBar::TriangularWest;
0
102 return
never executed: return QTabBar::RoundedNorth;
QTabBar::RoundedNorth;
never executed: return QTabBar::RoundedNorth;
0
103}-
104-
105-
106static inline QString tabTextFor(QMdiSubWindow *subWindow)-
107{-
108 if (!subWindow
!subWindowDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
109 return
never executed: return QString();
QString();
never executed: return QString();
0
110-
111 QString title = subWindow->windowTitle();-
112 if (subWindow->isWindowModified()
subWindow->isWindowModified()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
113 title.replace(QLatin1String("[*]"), QLatin1String("*"));-
114 }
never executed: end of block
else {
0
115 extern QString qt_setWindowTitle_helperHelper(const QString&, const QWidget*);-
116 title = qt_setWindowTitle_helperHelper(title, subWindow);-
117 }
never executed: end of block
0
118-
119 return
never executed: return title.isEmpty() ? QMdiArea::tr("(Untitled)") : title;
title.isEmpty() ? QMdiArea::tr("(Untitled)") : title;
never executed: return title.isEmpty() ? QMdiArea::tr("(Untitled)") : title;
0
120}-
121-
122-
123-
124-
125void RegularTiler::rearrange(QList<QWidget *> &widgets, const QRect &domain) const-
126{-
127 if (widgets.isEmpty()
widgets.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
128 return;
never executed: return;
0
129-
130 const int n = widgets.size();-
131 const int ncols = qMax(qCeil(qSqrt(qreal(n))), 1);-
132 const int nrows = qMax((n % ncols) ? (n / ncols + 1) : (n / ncols), 1);-
133 const int nspecial = (
(n % ncols)Description
TRUEnever evaluated
FALSEnever evaluated
n % ncols)
(n % ncols)Description
TRUEnever evaluated
FALSEnever evaluated
? (ncols - n % ncols) : 0;
0
134 const int dx = domain.width() / ncols;-
135 const int dy = domain.height() / nrows;-
136-
137 int i = 0;-
138 for (int row = 0; row < nrows
row < nrowsDescription
TRUEnever evaluated
FALSEnever evaluated
; ++row) {
0
139 const int y1 = int(row * (dy + 1));-
140 for (int col = 0; col < ncols
col < ncolsDescription
TRUEnever evaluated
FALSEnever evaluated
; ++col) {
0
141 if (row == 1
row == 1Description
TRUEnever evaluated
FALSEnever evaluated
&& col < nspecial
col < nspecialDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
142 continue;
never executed: continue;
0
143 const int x1 = int(col * (dx + 1));-
144 int x2 = int(x1 + dx);-
145 int y2 = int(y1 + dy);-
146 if (row == 0
row == 0Description
TRUEnever evaluated
FALSEnever evaluated
&& col < nspecial
col < nspecialDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
147 y2 *= 2;-
148 if (nrows != 2
nrows != 2Description
TRUEnever evaluated
FALSEnever evaluated
)
0
149 y2 += 1;
never executed: y2 += 1;
0
150 else-
151 y2 = domain.bottom();
never executed: y2 = domain.bottom();
0
152 }-
153 if (col == ncols - 1
col == ncols - 1Description
TRUEnever evaluated
FALSEnever evaluated
&& x2 != domain.right()
x2 != domain.right()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
154 x2 = domain.right();
never executed: x2 = domain.right();
0
155 if (row == nrows - 1
row == nrows - 1Description
TRUEnever evaluated
FALSEnever evaluated
&& y2 != domain.bottom()
y2 != domain.bottom()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
156 y2 = domain.bottom();
never executed: y2 = domain.bottom();
0
157 if (!sanityCheck(widgets, i, "RegularTiler")
!sanityCheck(w...RegularTiler")Description
TRUEnever evaluated
FALSEnever evaluated
)
0
158 continue;
never executed: continue;
0
159 QWidget *widget = widgets.at(i++);-
160 QRect newGeometry = QRect(QPoint(x1, y1), QPoint(x2, y2));-
161 widget->setGeometry(QStyle::visualRect(widget->layoutDirection(), domain, newGeometry));-
162 }
never executed: end of block
0
163 }
never executed: end of block
0
164}
never executed: end of block
0
165-
166-
167-
168-
169void SimpleCascader::rearrange(QList<QWidget *> &widgets, const QRect &domain) const-
170{-
171 if (widgets.isEmpty()
widgets.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
172 return;
never executed: return;
0
173-
174-
175 const int topOffset = 0;-
176 const int bottomOffset = 50;-
177 const int leftOffset = 0;-
178 const int rightOffset = 100;-
179 const int dx = 10;-
180-
181 QStyleOptionTitleBar options;-
182 options.initFrom(widgets.at(0));-
183 int titleBarHeight = widgets.at(0)->style()->pixelMetric(QStyle::PM_TitleBarHeight, &options, widgets.at(0));-
184 const QFontMetrics fontMetrics = QFontMetrics(QApplication::font("QMdiSubWindowTitleBar"));-
185 const int dy = qMax(titleBarHeight - (titleBarHeight - fontMetrics.height()) / 2, 1)-
186 + widgets.at(0)->style()->pixelMetric(QStyle::PM_FocusFrameVMargin, 0, widgets.at(0));-
187-
188 const int n = widgets.size();-
189 const int nrows = qMax((domain.height() - (topOffset + bottomOffset)) / dy, 1);-
190 const int ncols = qMax(n / nrows + ((n % nrows) ? 1 : 0), 1);-
191 const int dcol = (domain.width() - (leftOffset + rightOffset)) / ncols;-
192-
193 int i = 0;-
194 for (int row = 0; row < nrows
row < nrowsDescription
TRUEnever evaluated
FALSEnever evaluated
; ++row) {
0
195 for (int col = 0; col < ncols
col < ncolsDescription
TRUEnever evaluated
FALSEnever evaluated
; ++col) {
0
196 const int x = leftOffset + row * dx + col * dcol;-
197 const int y = topOffset + row * dy;-
198 if (!sanityCheck(widgets, i, "SimpleCascader")
!sanityCheck(w...mpleCascader")Description
TRUEnever evaluated
FALSEnever evaluated
)
0
199 continue;
never executed: continue;
0
200 QWidget *widget = widgets.at(i++);-
201 QRect newGeometry = QRect(QPoint(x, y), widget->sizeHint());-
202 widget->setGeometry(QStyle::visualRect(widget->layoutDirection(), domain, newGeometry));-
203 if (i == n
i == nDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
204 return;
never executed: return;
0
205 }
never executed: end of block
0
206 }
never executed: end of block
0
207}
never executed: end of block
0
208-
209-
210-
211-
212void IconTiler::rearrange(QList<QWidget *> &widgets, const QRect &domain) const-
213{-
214 if (widgets.isEmpty()
widgets.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
|| !sanityCheck(widgets, 0, "IconTiler")
!sanityCheck(w..., "IconTiler")Description
TRUEnever evaluated
FALSEnever evaluated
)
0
215 return;
never executed: return;
0
216-
217 const int n = widgets.size();-
218 const int width = qMax(widgets.at(0)->width(), 1);-
219 const int height = widgets.at(0)->height();-
220 const int ncols = qMax(domain.width() / width, 1);-
221 const int nrows = n / ncols + ((
(n % ncols)Description
TRUEnever evaluated
FALSEnever evaluated
n % ncols)
(n % ncols)Description
TRUEnever evaluated
FALSEnever evaluated
? 1 : 0);
0
222-
223 int i = 0;-
224 for (int row = 0; row < nrows
row < nrowsDescription
TRUEnever evaluated
FALSEnever evaluated
; ++row) {
0
225 for (int col = 0; col < ncols
col < ncolsDescription
TRUEnever evaluated
FALSEnever evaluated
; ++col) {
0
226 const int x = col * width;-
227 const int y = domain.height() - height - row * height;-
228 if (!sanityCheck(widgets, i, "IconTiler")
!sanityCheck(w..., "IconTiler")Description
TRUEnever evaluated
FALSEnever evaluated
)
0
229 continue;
never executed: continue;
0
230 QWidget *widget = widgets.at(i++);-
231 QPoint newPos(x, y);-
232 QRect newGeometry = QRect(newPos.x(), newPos.y(), widget->width(), widget->height());-
233 widget->setGeometry(QStyle::visualRect(widget->layoutDirection(), domain, newGeometry));-
234 if (i == n
i == nDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
235 return;
never executed: return;
0
236 }
never executed: end of block
0
237 }
never executed: end of block
0
238}
never executed: end of block
0
239-
240-
241-
242-
243-
244int MinOverlapPlacer::accumulatedOverlap(const QRect &source, const QVector<QRect> &rects)-
245{-
246 int accOverlap = 0;-
247 for (const QRect &rect : rects) {-
248 QRect intersection = source.intersected(rect);-
249 accOverlap += intersection.width() * intersection.height();-
250 }
never executed: end of block
0
251 return
never executed: return accOverlap;
accOverlap;
never executed: return accOverlap;
0
252}-
253-
254-
255-
256-
257-
258-
259-
260QRect MinOverlapPlacer::findMinOverlapRect(const QVector<QRect> &source, const QVector<QRect> &rects)-
261{-
262 int minAccOverlap = -1;-
263 QRect minAccOverlapRect;-
264 for (const QRect &srcRect : source) {-
265 const int accOverlap = accumulatedOverlap(srcRect, rects);-
266 if (accOverlap < minAccOverlap
accOverlap < minAccOverlapDescription
TRUEnever evaluated
FALSEnever evaluated
|| minAccOverlap == -1
minAccOverlap == -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
267 minAccOverlap = accOverlap;-
268 minAccOverlapRect = srcRect;-
269 }
never executed: end of block
0
270 }
never executed: end of block
0
271 return
never executed: return minAccOverlapRect;
minAccOverlapRect;
never executed: return minAccOverlapRect;
0
272}-
273-
274-
275-
276-
277-
278QVector<QRect> MinOverlapPlacer::getCandidatePlacements(const QSize &size, const QVector<QRect> &rects,-
279 const QRect &domain)-
280{-
281 QVector<QRect> result;-
282-
283 QVector<int> xlist;-
284 xlist.reserve(2 + rects.size());-
285 xlist << domain.left() << domain.right() - size.width() + 1;-
286-
287 QVector<int> ylist;-
288 ylist.reserve(2 + rects.size());-
289 ylist << domain.top();-
290 if (domain.bottom() - size.height() + 1 >= 0
domain.bottom(...ght() + 1 >= 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
291 ylist << domain.bottom() - size.height() + 1;
never executed: ylist << domain.bottom() - size.height() + 1;
0
292-
293 for (const QRect &rect : rects) {-
294 xlist << rect.right() + 1;-
295 ylist << rect.bottom() + 1;-
296 }
never executed: end of block
0
297-
298 std::sort(xlist.begin(), xlist.end());-
299 xlist.erase(std::unique(xlist.begin(), xlist.end()), xlist.end());-
300-
301 std::sort(ylist.begin(), ylist.end());-
302 ylist.erase(std::unique(ylist.begin(), ylist.end()), ylist.end());-
303-
304 result.reserve(ylist.size() * xlist.size());-
305 for (QForeachContainer<typename QtPrivate::remove_reference<decltype(ylist)>::type> _container_((ylist)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (int y = *_container_.i; _container_.control; _container_.control = 0)-
306 for (QForeachContainer<typename QtPrivate::remove_reference<decltype(xlist)>::type> _container_((xlist)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (int x = *_container_.i; _container_.control; _container_.control = 0)-
307 result << QRect(QPoint(x, y), size);
never executed: result << QRect(QPoint(x, y), size);
0
308 return
never executed: return result;
result;
never executed: return result;
0
309}-
310-
311-
312-
313-
314-
315-
316QVector<QRect> MinOverlapPlacer::findNonInsiders(const QRect &domain, QVector<QRect> &source)-
317{-
318 const auto containedInDomain =-
319 [domain](const QRect &srcRect) { return
never executed: return domain.contains(srcRect);
domain.contains(srcRect);
never executed: return domain.contains(srcRect);
};
0
320-
321 const auto firstOut = std::stable_partition(source.begin(), source.end(), containedInDomain);-
322-
323 QVector<QRect> result;-
324 result.reserve(source.end() - firstOut);-
325 std::copy(firstOut, source.end(), std::back_inserter(result));-
326-
327 source.erase(firstOut, source.end());-
328-
329 return
never executed: return result;
result;
never executed: return result;
0
330}-
331-
332-
333-
334-
335-
336-
337QVector<QRect> MinOverlapPlacer::findMaxOverlappers(const QRect &domain, const QVector<QRect> &source)-
338{-
339 QVector<QRect> result;-
340 result.reserve(source.size());-
341-
342 int maxOverlap = -1;-
343 for (const QRect &srcRect : source) {-
344 QRect intersection = domain.intersected(srcRect);-
345 const int overlap = intersection.width() * intersection.height();-
346 if (overlap >= maxOverlap
overlap >= maxOverlapDescription
TRUEnever evaluated
FALSEnever evaluated
|| maxOverlap == -1
maxOverlap == -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
347 if (overlap > maxOverlap
overlap > maxOverlapDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
348 maxOverlap = overlap;-
349 result.clear();-
350 }
never executed: end of block
0
351 result << srcRect;-
352 }
never executed: end of block
0
353 }
never executed: end of block
0
354-
355 return
never executed: return result;
result;
never executed: return result;
0
356}-
357-
358-
359-
360-
361-
362-
363-
364QPoint MinOverlapPlacer::findBestPlacement(const QRect &domain, const QVector<QRect> &rects,-
365 QVector<QRect> &source)-
366{-
367 const QVector<QRect> nonInsiders = findNonInsiders(domain, source);-
368-
369 if (!source.empty()
!source.empty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
370 return
never executed: return findMinOverlapRect(source, rects).topLeft();
findMinOverlapRect(source, rects).topLeft();
never executed: return findMinOverlapRect(source, rects).topLeft();
0
371-
372 QVector<QRect> maxOverlappers = findMaxOverlappers(domain, nonInsiders);-
373 return
never executed: return findMinOverlapRect(maxOverlappers, rects).topLeft();
findMinOverlapRect(maxOverlappers, rects).topLeft();
never executed: return findMinOverlapRect(maxOverlappers, rects).topLeft();
0
374}-
375QPoint MinOverlapPlacer::place(const QSize &size, const QVector<QRect> &rects,-
376 const QRect &domain) const-
377{-
378 if (size.isEmpty()
size.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
|| !domain.isValid()
!domain.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
379 return
never executed: return QPoint();
QPoint();
never executed: return QPoint();
0
380 for (const QRect &rect : rects) {-
381 if (!rect.isValid()
!rect.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
382 return
never executed: return QPoint();
QPoint();
never executed: return QPoint();
0
383 }
never executed: end of block
0
384-
385 QVector<QRect> candidates = getCandidatePlacements(size, rects, domain);-
386 return
never executed: return findBestPlacement(domain, rects, candidates);
findBestPlacement(domain, rects, candidates);
never executed: return findBestPlacement(domain, rects, candidates);
0
387}-
388-
389-
390class QMdiAreaTabBar : public QTabBar-
391{-
392public:-
393 QMdiAreaTabBar(QWidget *parent) : QTabBar(parent) {}
never executed: end of block
0
394-
395protected:-
396 void mousePressEvent(QMouseEvent *event) override;-
397-
398 void contextMenuEvent(QContextMenuEvent *event) override;-
399-
400-
401private:-
402 QMdiSubWindow *subWindowFromIndex(int index) const;-
403};-
404-
405-
406-
407-
408void QMdiAreaTabBar::mousePressEvent(QMouseEvent *event)-
409{-
410 if (event->button() != Qt::MidButton
event->button(... Qt::MidButtonDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
411 QTabBar::mousePressEvent(event);-
412 return;
never executed: return;
0
413 }-
414-
415 QMdiSubWindow *subWindow = subWindowFromIndex(tabAt(event->pos()));-
416 if (!subWindow
!subWindowDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
417 event->ignore();-
418 return;
never executed: return;
0
419 }-
420-
421 subWindow->close();-
422}
never executed: end of block
0
423-
424-
425-
426-
427-
428void QMdiAreaTabBar::contextMenuEvent(QContextMenuEvent *event)-
429{-
430 QPointer<QMdiSubWindow> subWindow = subWindowFromIndex(tabAt(event->pos()));-
431 if (!subWindow
!subWindowDescription
TRUEnever evaluated
FALSEnever evaluated
|| subWindow->isHidden()
subWindow->isHidden()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
432 event->ignore();-
433 return;
never executed: return;
0
434 }-
435-
436-
437 QMdiSubWindowPrivate *subWindowPrivate = subWindow->d_func();-
438 if (!subWindowPrivate->systemMenu
!subWindowPrivate->systemMenuDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
439 event->ignore();-
440 return;
never executed: return;
0
441 }-
442-
443 QMdiSubWindow *currentSubWindow = subWindowFromIndex(currentIndex());-
444 ((!(currentSubWindow)) ? qt_assert("currentSubWindow",__FILE__,622) : qt_noop());-
445-
446-
447-
448 if (currentSubWindow->isMaximized()
currentSubWind...>isMaximized()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
449 subWindowPrivate->setVisible(QMdiSubWindowPrivate::MoveAction, false);-
450 subWindowPrivate->setVisible(QMdiSubWindowPrivate::ResizeAction, false);-
451 subWindowPrivate->setVisible(QMdiSubWindowPrivate::MinimizeAction, false);-
452 subWindowPrivate->setVisible(QMdiSubWindowPrivate::MaximizeAction, false);-
453 subWindowPrivate->setVisible(QMdiSubWindowPrivate::RestoreAction, false);-
454 subWindowPrivate->setVisible(QMdiSubWindowPrivate::StayOnTopAction, false);-
455 }
never executed: end of block
0
456-
457-
458 subWindowPrivate->systemMenu->exec(event->globalPos());-
459 if (!subWindow
!subWindowDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
460 return;
never executed: return;
0
461-
462-
463 subWindowPrivate->updateActions();-
464-
465}
never executed: end of block
0
466-
467-
468-
469-
470-
471QMdiSubWindow *QMdiAreaTabBar::subWindowFromIndex(int index) const-
472{-
473 if (index < 0
index < 0Description
TRUEnever evaluated
FALSEnever evaluated
|| index >= count()
index >= count()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
474 return
never executed: return 0;
0;
never executed: return 0;
0
475-
476 QMdiArea *mdiArea = qobject_cast<QMdiArea *>(parentWidget());-
477 ((!(mdiArea)) ? qt_assert("mdiArea",__FILE__,655) : qt_noop());-
478-
479 const QList<QMdiSubWindow *> subWindows = mdiArea->subWindowList();-
480 ((!(index < subWindows.size())) ? qt_assert("index < subWindows.size()",__FILE__,658) : qt_noop());-
481-
482 QMdiSubWindow *subWindow = mdiArea->subWindowList().at(index);-
483 ((!(subWindow)) ? qt_assert("subWindow",__FILE__,661) : qt_noop());-
484-
485 return
never executed: return subWindow;
subWindow;
never executed: return subWindow;
0
486}-
487-
488-
489-
490-
491-
492QMdiAreaPrivate::QMdiAreaPrivate()-
493 : cascader(0),-
494 regularTiler(0),-
495 iconTiler(0),-
496 placer(0),-
497-
498 rubberBand(0),-
499-
500-
501 tabBar(0),-
502-
503 activationOrder(QMdiArea::CreationOrder),-
504 viewMode(QMdiArea::SubWindowView),-
505-
506 documentMode(false),-
507 tabsClosable(false),-
508 tabsMovable(false),-
509-
510-
511 tabShape(QTabWidget::Rounded),-
512 tabPosition(QTabWidget::North),-
513-
514 ignoreGeometryChange(false),-
515 ignoreWindowStateChange(false),-
516 isActivated(false),-
517 isSubWindowsTiled(false),-
518 showActiveWindowMaximized(false),-
519 tileCalledFromResizeEvent(false),-
520 updatesDisabledByUs(false),-
521 inViewModeChange(false),-
522 indexToNextWindow(-1),-
523 indexToPreviousWindow(-1),-
524 indexToHighlighted(-1),-
525 indexToLastActiveTab(-1),-
526 resizeTimerId(-1),-
527 tabToPreviousTimerId(-1)-
528{-
529}
never executed: end of block
0
530-
531-
532-
533-
534void QMdiAreaPrivate::_q_deactivateAllWindows(QMdiSubWindow *aboutToActivate)-
535{-
536 if (ignoreWindowStateChange
ignoreWindowStateChangeDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
537 return;
never executed: return;
0
538-
539 QMdiArea * const q = q_func();-
540 if (!aboutToActivate
!aboutToActivateDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
541 aboutToBecomeActive = qobject_cast<QMdiSubWindow *>(q->sender());
never executed: aboutToBecomeActive = qobject_cast<QMdiSubWindow *>(q->sender());
0
542 else-
543 aboutToBecomeActive = aboutToActivate;
never executed: aboutToBecomeActive = aboutToActivate;
0
544 ((!(aboutToBecomeActive)) ? qt_assert("aboutToBecomeActive",__FILE__,722) : qt_noop());-
545-
546 for (QForeachContainer<typename QtPrivate::remove_reference<decltype(childWindows)>::type> _container_((childWindows)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QMdiSubWindow *child = *_container_.i; _container_.control; _container_.control = 0) {-
547 if (!sanityCheck(child, "QMdiArea::deactivateAllWindows")
!sanityCheck(c...teAllWindows")Description
TRUEnever evaluated
FALSEnever evaluated
|| aboutToBecomeActive == child
aboutToBecomeActive == childDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
548 continue;
never executed: continue;
0
549-
550 ignoreWindowStateChange = true;-
551 if(!(options & QMdiArea::DontMaximizeSubWindowOnActivation)
!(options & QM...wOnActivation)Description
TRUEnever evaluated
FALSEnever evaluated
&& !showActiveWindowMaximized
!showActiveWindowMaximizedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
552 showActiveWindowMaximized = child->isMaximized()
child->isMaximized()Description
TRUEnever evaluated
FALSEnever evaluated
&& child->isVisible()
child->isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
;
never executed: showActiveWindowMaximized = child->isMaximized() && child->isVisible();
0
553 if (showActiveWindowMaximized
showActiveWindowMaximizedDescription
TRUEnever evaluated
FALSEnever evaluated
&& child->isMaximized()
child->isMaximized()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
554 if (q->updatesEnabled()
q->updatesEnabled()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
555 updatesDisabledByUs = true;-
556 q->setUpdatesEnabled(false);-
557 }
never executed: end of block
0
558 child->showNormal();-
559 }
never executed: end of block
0
560 if (child->isMinimized()
child->isMinimized()Description
TRUEnever evaluated
FALSEnever evaluated
&& !child->isShaded()
!child->isShaded()Description
TRUEnever evaluated
FALSEnever evaluated
&& !windowStaysOnTop(child)
!windowStaysOnTop(child)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
561 child->lower();
never executed: child->lower();
0
562 ignoreWindowStateChange = false;-
563 child->d_func()->setActive(false);-
564 }
never executed: end of block
0
565}
never executed: end of block
0
566-
567-
568-
569-
570void QMdiAreaPrivate::_q_processWindowStateChanged(Qt::WindowStates oldState,-
571 Qt::WindowStates newState)-
572{-
573 if (ignoreWindowStateChange
ignoreWindowStateChangeDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
574 return;
never executed: return;
0
575-
576 QMdiArea * const q = q_func();-
577 QMdiSubWindow *child = qobject_cast<QMdiSubWindow *>(q->sender());-
578 if (!child
!childDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
579 return;
never executed: return;
0
580-
581-
582 if (!(oldState & Qt::WindowActive)
!(oldState & Qt::WindowActive)Description
TRUEnever evaluated
FALSEnever evaluated
&& (
(newState & Qt::WindowActive)Description
TRUEnever evaluated
FALSEnever evaluated
newState & Qt::WindowActive)
(newState & Qt::WindowActive)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
583 emitWindowActivated(child);
never executed: emitWindowActivated(child);
0
584-
585 else if ((
(oldState & Qt::WindowActive)Description
TRUEnever evaluated
FALSEnever evaluated
oldState & Qt::WindowActive)
(oldState & Qt::WindowActive)Description
TRUEnever evaluated
FALSEnever evaluated
&& !(newState & Qt::WindowActive)
!(newState & Qt::WindowActive)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
586 resetActiveWindow(child);
never executed: resetActiveWindow(child);
0
587-
588-
589 if (!(oldState & Qt::WindowMinimized)
!(oldState & Q...ndowMinimized)Description
TRUEnever evaluated
FALSEnever evaluated
&& (
(newState & Qt...ndowMinimized)Description
TRUEnever evaluated
FALSEnever evaluated
newState & Qt::WindowMinimized)
(newState & Qt...ndowMinimized)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
590 isSubWindowsTiled = false;-
591 arrangeMinimizedSubWindows();-
592-
593 }
never executed: end of block
else if (!(oldState & Qt::WindowMaximized)
!(oldState & Q...ndowMaximized)Description
TRUEnever evaluated
FALSEnever evaluated
&& (
(newState & Qt...ndowMaximized)Description
TRUEnever evaluated
FALSEnever evaluated
newState & Qt::WindowMaximized)
(newState & Qt...ndowMaximized)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
594 internalRaise(child);-
595-
596 }
never executed: end of block
else if (!(newState & (Qt::WindowMaximized | Qt::WindowMinimized))
!(newState & (...dowMinimized))Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
597 internalRaise(child);-
598 if (oldState & Qt::WindowMinimized
oldState & Qt::WindowMinimizedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
599 arrangeMinimizedSubWindows();
never executed: arrangeMinimizedSubWindows();
0
600 }
never executed: end of block
0
601}
never executed: end of block
0
602-
603void QMdiAreaPrivate::_q_currentTabChanged(int index)-
604{-
605-
606-
607-
608 if (!tabBar
!tabBarDescription
TRUEnever evaluated
FALSEnever evaluated
|| index < 0
index < 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
609 return;
never executed: return;
0
610-
611-
612 if (indexToLastActiveTab >= 0
indexToLastActiveTab >= 0Description
TRUEnever evaluated
FALSEnever evaluated
&& indexToLastActiveTab < tabBar->count()
indexToLastAct...abBar->count()Description
TRUEnever evaluated
FALSEnever evaluated
0
613 && indexToLastActiveTab < childWindows.count()
indexToLastAct...indows.count()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
614 QMdiSubWindow *lastActive = childWindows.at(indexToLastActiveTab);-
615 if (lastActive
lastActiveDescription
TRUEnever evaluated
FALSEnever evaluated
&& lastActive->isHidden()
lastActive->isHidden()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
616 tabBar->setTabEnabled(indexToLastActiveTab, false);
never executed: tabBar->setTabEnabled(indexToLastActiveTab, false);
0
617 }
never executed: end of block
0
618-
619 indexToLastActiveTab = index;-
620 ((!(childWindows.size() > index)) ? qt_assert("childWindows.size() > index",__FILE__,798) : qt_noop());-
621 QMdiSubWindow *subWindow = childWindows.at(index);-
622 ((!(subWindow)) ? qt_assert("subWindow",__FILE__,800) : qt_noop());-
623 activateWindow(subWindow);-
624-
625}
never executed: end of block
0
626-
627void QMdiAreaPrivate::_q_closeTab(int index)-
628{-
629-
630-
631-
632 QMdiSubWindow *subWindow = childWindows.at(index);-
633 ((!(subWindow)) ? qt_assert("subWindow",__FILE__,811) : qt_noop());-
634 subWindow->close();-
635-
636}
never executed: end of block
0
637-
638void QMdiAreaPrivate::_q_moveTab(int from, int to)-
639{-
640-
641-
642-
643-
644 childWindows.move(from, to);-
645-
646}
never executed: end of block
0
647-
648-
649-
650-
651void QMdiAreaPrivate::appendChild(QMdiSubWindow *child)-
652{-
653 QMdiArea * const q = q_func();-
654 ((!(child && childWindows.indexOf(child) == -1)) ? qt_assert("child && childWindows.indexOf(child) == -1",__FILE__,832) : qt_noop());-
655-
656 if (child->parent() != viewport
child->parent() != viewportDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
657 child->setParent(viewport, child->windowFlags());
never executed: child->setParent(viewport, child->windowFlags());
0
658 childWindows.append(QPointer<QMdiSubWindow>(child));-
659-
660 if (!child->testAttribute(Qt::WA_Resized)
!child->testAt...t::WA_Resized)Description
TRUEnever evaluated
FALSEnever evaluated
&& q->isVisible()
q->isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
661 QSize newSize(child->sizeHint().boundedTo(viewport->size()));-
662 child->resize(newSize.expandedTo(qSmartMinSize(child)));-
663 }
never executed: end of block
0
664-
665 if (!placer
!placerDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
666 placer = new MinOverlapPlacer;
never executed: placer = new MinOverlapPlacer;
0
667 place(placer, child);-
668-
669 if (hbarpolicy != Qt::ScrollBarAlwaysOff
hbarpolicy != ...llBarAlwaysOffDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
670 child->setOption(QMdiSubWindow::AllowOutsideAreaHorizontally, true);
never executed: child->setOption(QMdiSubWindow::AllowOutsideAreaHorizontally, true);
0
671 else-
672 child->setOption(QMdiSubWindow::AllowOutsideAreaHorizontally, false);
never executed: child->setOption(QMdiSubWindow::AllowOutsideAreaHorizontally, false);
0
673-
674 if (vbarpolicy != Qt::ScrollBarAlwaysOff
vbarpolicy != ...llBarAlwaysOffDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
675 child->setOption(QMdiSubWindow::AllowOutsideAreaVertically, true);
never executed: child->setOption(QMdiSubWindow::AllowOutsideAreaVertically, true);
0
676 else-
677 child->setOption(QMdiSubWindow::AllowOutsideAreaVertically, false);
never executed: child->setOption(QMdiSubWindow::AllowOutsideAreaVertically, false);
0
678-
679 internalRaise(child);-
680 indicesToActivatedChildren.prepend(childWindows.size() - 1);-
681 ((!(indicesToActivatedChildren.size() == childWindows.size())) ? qt_assert("indicesToActivatedChildren.size() == childWindows.size()",__FILE__,859) : qt_noop());-
682-
683-
684 if (tabBar
tabBarDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
685 tabBar->addTab(child->windowIcon(), tabTextFor(child));-
686 updateTabBarGeometry();-
687 if (childWindows.count() == 1
childWindows.count() == 1Description
TRUEnever evaluated
FALSEnever evaluated
&& !(options & QMdiArea::DontMaximizeSubWindowOnActivation)
!(options & QM...wOnActivation)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
688 showActiveWindowMaximized = true;
never executed: showActiveWindowMaximized = true;
0
689 }
never executed: end of block
0
690-
691-
692 if (!(child->windowFlags() & Qt::SubWindow)
!(child->windo...Qt::SubWindow)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
693 child->setWindowFlags(Qt::SubWindow);
never executed: child->setWindowFlags(Qt::SubWindow);
0
694 child->installEventFilter(q);-
695-
696 QObject::connect(child, qFlagLocation("2""aboutToActivate()" "\0" __FILE__ ":" "874"), q, qFlagLocation("1""_q_deactivateAllWindows()" "\0" __FILE__ ":" "874"));-
697 QObject::connect(child, qFlagLocation("2""windowStateChanged(Qt::WindowStates,Qt::WindowStates)" "\0" __FILE__ ":" "875"),-
698 q, qFlagLocation("1""_q_processWindowStateChanged(Qt::WindowStates,Qt::WindowStates)" "\0" __FILE__ ":" "876"));-
699}
never executed: end of block
0
700-
701-
702-
703-
704void QMdiAreaPrivate::place(Placer *placer, QMdiSubWindow *child)-
705{-
706 if (!placer
!placerDescription
TRUEnever evaluated
FALSEnever evaluated
|| !child
!childDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
707 return;
never executed: return;
0
708-
709 QMdiArea * const q = q_func();-
710 if (!q->isVisible()
!q->isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
711-
712-
713-
714 pendingPlacements.append(child);-
715 return;
never executed: return;
0
716 }-
717-
718 QVector<QRect> rects;-
719 rects.reserve(childWindows.size());-
720 QRect parentRect = q->rect();-
721 for (QForeachContainer<typename QtPrivate::remove_reference<decltype(childWindows)>::type> _container_((childWindows)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QMdiSubWindow *window = *_container_.i; _container_.control; _container_.control = 0) {-
722 if (!sanityCheck(window, "QMdiArea::place")
!sanityCheck(w...iArea::place")Description
TRUEnever evaluated
FALSEnever evaluated
|| window == child
window == childDescription
TRUEnever evaluated
FALSEnever evaluated
|| !window->isVisibleTo(q)
!window->isVisibleTo(q)Description
TRUEnever evaluated
FALSEnever evaluated
0
723 || !window->testAttribute(Qt::WA_Moved)
!window->testA...(Qt::WA_Moved)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
724 continue;
never executed: continue;
0
725 }-
726 QRect occupiedGeometry;-
727 if (window->isMaximized()
window->isMaximized()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
728 occupiedGeometry = QRect(window->d_func()->oldGeometry.topLeft(),-
729 window->d_func()->restoreSize);-
730 }
never executed: end of block
else {
0
731 occupiedGeometry = window->geometry();-
732 }
never executed: end of block
0
733 rects.append(QStyle::visualRect(child->layoutDirection(), parentRect, occupiedGeometry));-
734 }
never executed: end of block
0
735 QPoint newPos = placer->place(child->size(), rects, parentRect);-
736 QRect newGeometry = QRect(newPos.x(), newPos.y(), child->width(), child->height());-
737 child->setGeometry(QStyle::visualRect(child->layoutDirection(), parentRect, newGeometry));-
738}
never executed: end of block
0
739-
740-
741-
742-
743void QMdiAreaPrivate::rearrange(Rearranger *rearranger)-
744{-
745 if (!rearranger
!rearrangerDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
746 return;
never executed: return;
0
747-
748 QMdiArea * const q = q_func();-
749 if (!q->isVisible()
!q->isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
750-
751 int index = pendingRearrangements.indexOf(rearranger);-
752 if (index != -1
index != -1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
753 pendingRearrangements.move(index, pendingRearrangements.size() - 1);
never executed: pendingRearrangements.move(index, pendingRearrangements.size() - 1);
0
754 else-
755 pendingRearrangements.append(rearranger);
never executed: pendingRearrangements.append(rearranger);
0
756 return;
never executed: return;
0
757 }-
758-
759 QList<QWidget *> widgets;-
760 const bool reverseList = rearranger->type() == Rearranger::RegularTiler;-
761 const QList<QMdiSubWindow *> subWindows = subWindowList(activationOrder, reverseList);-
762 QSize minSubWindowSize;-
763 for (QForeachContainer<typename QtPrivate::remove_reference<decltype(subWindows)>::type> _container_((subWindows)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QMdiSubWindow *child = *_container_.i; _container_.control; _container_.control = 0) {-
764 if (!sanityCheck(child, "QMdiArea::rearrange")
!sanityCheck(c...a::rearrange")Description
TRUEnever evaluated
FALSEnever evaluated
|| !child->isVisible()
!child->isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
765 continue;
never executed: continue;
0
766 if (rearranger->type() == Rearranger::IconTiler
rearranger->ty...ger::IconTilerDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
767 if (child->isMinimized()
child->isMinimized()Description
TRUEnever evaluated
FALSEnever evaluated
&& !child->isShaded()
!child->isShaded()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
768 widgets.append(child);
never executed: widgets.append(child);
0
769 }
never executed: end of block
else {
0
770 if (child->isMinimized()
child->isMinimized()Description
TRUEnever evaluated
FALSEnever evaluated
&& !child->isShaded()
!child->isShaded()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
771 continue;
never executed: continue;
0
772 if (child->isMaximized()
child->isMaximized()Description
TRUEnever evaluated
FALSEnever evaluated
|| child->isShaded()
child->isShaded()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
773 child->showNormal();
never executed: child->showNormal();
0
774 minSubWindowSize = minSubWindowSize.expandedTo(child->minimumSize())-
775 .expandedTo(child->d_func()->internalMinimumSize);-
776 widgets.append(child);-
777 }
never executed: end of block
0
778 }-
779-
780 if (active
activeDescription
TRUEnever evaluated
FALSEnever evaluated
&& rearranger->type() == Rearranger::RegularTiler
rearranger->ty...::RegularTilerDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
781-
782-
783 int indexToActive = widgets.indexOf((QWidget *)active);-
784 if (indexToActive > 0
indexToActive > 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
785 widgets.move(indexToActive, 0);
never executed: widgets.move(indexToActive, 0);
0
786 }
never executed: end of block
0
787-
788 QRect domain = viewport->rect();-
789 if (rearranger->type() == Rearranger::RegularTiler
rearranger->ty...::RegularTilerDescription
TRUEnever evaluated
FALSEnever evaluated
&& !widgets.isEmpty()
!widgets.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
790 domain = resizeToMinimumTileSize(minSubWindowSize, widgets.count());
never executed: domain = resizeToMinimumTileSize(minSubWindowSize, widgets.count());
0
791-
792 rearranger->rearrange(widgets, domain);-
793-
794 if (rearranger->type() == Rearranger::RegularTiler
rearranger->ty...::RegularTilerDescription
TRUEnever evaluated
FALSEnever evaluated
&& !widgets.isEmpty()
!widgets.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
795 isSubWindowsTiled = true;-
796 updateScrollBars();-
797 }
never executed: end of block
else if (rearranger->type() == Rearranger::SimpleCascader
rearranger->ty...SimpleCascaderDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
798 isSubWindowsTiled = false;-
799 }
never executed: end of block
0
800}
never executed: end of block
0
801-
802-
803-
804-
805-
806-
807void QMdiAreaPrivate::arrangeMinimizedSubWindows()-
808{-
809 if (!iconTiler
!iconTilerDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
810 iconTiler = new IconTiler;
never executed: iconTiler = new IconTiler;
0
811 rearrange(iconTiler);-
812}
never executed: end of block
0
813-
814-
815-
816-
817void QMdiAreaPrivate::activateWindow(QMdiSubWindow *child)-
818{-
819 if (childWindows.isEmpty()
childWindows.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
820 ((!(!child)) ? qt_assert("!child",__FILE__,998) : qt_noop());-
821 ((!(!active)) ? qt_assert("!active",__FILE__,999) : qt_noop());-
822 return;
never executed: return;
0
823 }-
824-
825 if (!child
!childDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
826 if (active
activeDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
827 ((!(active->d_func()->isActive)) ? qt_assert("active->d_func()->isActive",__FILE__,1005) : qt_noop());-
828 active->d_func()->setActive(false);-
829 resetActiveWindow();-
830 }
never executed: end of block
0
831 return;
never executed: return;
0
832 }-
833-
834 if (child->isHidden()
child->isHidden()Description
TRUEnever evaluated
FALSEnever evaluated
|| child == active
child == activeDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
835 return;
never executed: return;
0
836 child->d_func()->setActive(true);-
837}
never executed: end of block
0
838-
839-
840-
841-
842void QMdiAreaPrivate::activateCurrentWindow()-
843{-
844 QMdiSubWindow *current = q_func()->currentSubWindow();-
845 if (current
currentDescription
TRUEnever evaluated
FALSEnever evaluated
&& !isExplicitlyDeactivated(current)
!isExplicitlyD...vated(current)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
846 current->d_func()->activationEnabled = true;-
847 current->d_func()->setActive(true, false);-
848 }
never executed: end of block
0
849}
never executed: end of block
0
850-
851void QMdiAreaPrivate::activateHighlightedWindow()-
852{-
853 if (indexToHighlighted < 0
indexToHighlighted < 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
854 return;
never executed: return;
0
855-
856 ((!(indexToHighlighted < childWindows.size())) ? qt_assert("indexToHighlighted < childWindows.size()",__FILE__,1034) : qt_noop());-
857 if (tabToPreviousTimerId != -1
tabToPreviousTimerId != -1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
858 activateWindow(nextVisibleSubWindow(-1, QMdiArea::ActivationHistoryOrder));
never executed: activateWindow(nextVisibleSubWindow(-1, QMdiArea::ActivationHistoryOrder));
0
859 else-
860 activateWindow(childWindows.at(indexToHighlighted));
never executed: activateWindow(childWindows.at(indexToHighlighted));
0
861-
862 hideRubberBand();-
863-
864}
never executed: end of block
0
865-
866-
867-
868-
869void QMdiAreaPrivate::emitWindowActivated(QMdiSubWindow *activeWindow)-
870{-
871 QMdiArea * const q = q_func();-
872 ((!(activeWindow)) ? qt_assert("activeWindow",__FILE__,1050) : qt_noop());-
873 if (activeWindow == active
activeWindow == activeDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
874 return;
never executed: return;
0
875 ((!(activeWindow->d_func()->isActive)) ? qt_assert("activeWindow->d_func()->isActive",__FILE__,1053) : qt_noop());-
876-
877 if (!aboutToBecomeActive
!aboutToBecomeActiveDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
878 _q_deactivateAllWindows(activeWindow);
never executed: _q_deactivateAllWindows(activeWindow);
0
879 ((!(aboutToBecomeActive)) ? qt_assert("aboutToBecomeActive",__FILE__,1057) : qt_noop());-
880-
881-
882-
883 if (showActiveWindowMaximized
showActiveWindowMaximizedDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
884 if (!activeWindow->isMaximized()
!activeWindow->isMaximized()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
885 activeWindow->showMaximized();
never executed: activeWindow->showMaximized();
0
886 showActiveWindowMaximized = false;-
887 }
never executed: end of block
0
888-
889-
890 const int indexToActiveWindow = childWindows.indexOf(activeWindow);-
891 ((!(indexToActiveWindow != -1)) ? qt_assert("indexToActiveWindow != -1",__FILE__,1069) : qt_noop());-
892 const int index = indicesToActivatedChildren.indexOf(indexToActiveWindow);-
893 ((!(index != -1)) ? qt_assert("index != -1",__FILE__,1071) : qt_noop());-
894 indicesToActivatedChildren.move(index, 0);-
895 internalRaise(activeWindow);-
896-
897 if (updatesDisabledByUs
updatesDisabledByUsDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
898 q->setUpdatesEnabled(true);-
899 updatesDisabledByUs = false;-
900 }
never executed: end of block
0
901-
902 ((!(aboutToBecomeActive == activeWindow)) ? qt_assert("aboutToBecomeActive == activeWindow",__FILE__,1080) : qt_noop());-
903 active = activeWindow;-
904 aboutToBecomeActive = 0;-
905 ((!(active->d_func()->isActive)) ? qt_assert("active->d_func()->isActive",__FILE__,1083) : qt_noop());-
906-
907-
908 if (tabBar
tabBarDescription
TRUEnever evaluated
FALSEnever evaluated
&& tabBar->currentIndex() != indexToActiveWindow
tabBar->curren...ToActiveWindowDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
909 tabBar->setCurrentIndex(indexToActiveWindow);
never executed: tabBar->setCurrentIndex(indexToActiveWindow);
0
910-
911-
912 if (active->isMaximized()
active->isMaximized()Description
TRUEnever evaluated
FALSEnever evaluated
&& scrollBarsEnabled()
scrollBarsEnabled()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
913 updateScrollBars();
never executed: updateScrollBars();
0
914-
915 q->subWindowActivated(active);-
916}
never executed: end of block
0
917-
918-
919-
920-
921void QMdiAreaPrivate::resetActiveWindow(QMdiSubWindow *deactivatedWindow)-
922{-
923 QMdiArea * const q = q_func();-
924 if (deactivatedWindow
deactivatedWindowDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
925 if (deactivatedWindow != active
deactivatedWindow != activeDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
926 return;
never executed: return;
0
927 active = 0;-
928 if ((aboutToBecomeActive
aboutToBecomeActiveDescription
TRUEnever evaluated
FALSEnever evaluated
|| isActivated
isActivatedDescription
TRUEnever evaluated
FALSEnever evaluated
|| lastWindowAboutToBeDestroyed()
lastWindowAboutToBeDestroyed()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
929 && !isExplicitlyDeactivated(deactivatedWindow)
!isExplicitlyD...tivatedWindow)Description
TRUEnever evaluated
FALSEnever evaluated
&& !q->window()->isMinimized()
!q->window()->isMinimized()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
930 return;
never executed: return;
0
931 }-
932 q->subWindowActivated(0);-
933 return;
never executed: return;
0
934 }-
935-
936 if (aboutToBecomeActive
aboutToBecomeActiveDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
937 return;
never executed: return;
0
938-
939 active = 0;-
940 q->subWindowActivated(0);-
941}
never executed: end of block
0
942-
943-
944-
945-
946void QMdiAreaPrivate::updateActiveWindow(int removedIndex, bool activeRemoved)-
947{-
948 ((!(indicesToActivatedChildren.size() == childWindows.size())) ? qt_assert("indicesToActivatedChildren.size() == childWindows.size()",__FILE__,1126) : qt_noop());-
949-
950-
951 if (tabBar
tabBarDescription
TRUEnever evaluated
FALSEnever evaluated
&& removedIndex >= 0
removedIndex >= 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
952 const QSignalBlocker blocker(tabBar);-
953 tabBar->removeTab(removedIndex);-
954 updateTabBarGeometry();-
955 }
never executed: end of block
0
956-
957-
958 if (childWindows.isEmpty()
childWindows.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
959 showActiveWindowMaximized = false;-
960 resetActiveWindow();-
961 return;
never executed: return;
0
962 }-
963-
964 if (indexToHighlighted >= 0
indexToHighlighted >= 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
965-
966-
967 if (indexToHighlighted == removedIndex
indexToHighlig...= removedIndexDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
968 hideRubberBand();
never executed: hideRubberBand();
0
969 else-
970-
971-
972 if (indexToHighlighted > removedIndex
indexToHighlig...> removedIndexDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
973 --
never executed: --indexToHighlighted;
indexToHighlighted;
never executed: --indexToHighlighted;
0
974 }
never executed: end of block
0
975-
976-
977 for (int i = 0; i < indicesToActivatedChildren.size()
i < indicesToA...hildren.size()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
978 int *index = &indicesToActivatedChildren[i];-
979 if (*
*index > removedIndexDescription
TRUEnever evaluated
FALSEnever evaluated
index > removedIndex
*index > removedIndexDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
980 --*
never executed: --*index;
index;
never executed: --*index;
0
981 }
never executed: end of block
0
982-
983 if (!activeRemoved
!activeRemovedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
984 return;
never executed: return;
0
985-
986-
987 QMdiSubWindow *next = nextVisibleSubWindow(0, activationOrder, removedIndex);-
988 if (next
nextDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
989 activateWindow(next);
never executed: activateWindow(next);
0
990}
never executed: end of block
0
991-
992-
993-
994-
995void QMdiAreaPrivate::updateScrollBars()-
996{-
997 if (ignoreGeometryChange
ignoreGeometryChangeDescription
TRUEnever evaluated
FALSEnever evaluated
|| !scrollBarsEnabled()
!scrollBarsEnabled()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
998 return;
never executed: return;
0
999-
1000 QMdiArea * const q = q_func();-
1001 QSize maxSize = q->maximumViewportSize();-
1002 QSize hbarExtent = hbar->sizeHint();-
1003 QSize vbarExtent = vbar->sizeHint();-
1004-
1005 if (q->style()->styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents, 0, q)
q->style()->st...ontents, 0, q)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1006 const int doubleFrameWidth = frameWidth * 2;-
1007 if (hbarpolicy == Qt::ScrollBarAlwaysOn
hbarpolicy == ...ollBarAlwaysOnDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1008 maxSize.rheight() -= doubleFrameWidth;
never executed: maxSize.rheight() -= doubleFrameWidth;
0
1009 if (vbarpolicy == Qt::ScrollBarAlwaysOn
vbarpolicy == ...ollBarAlwaysOnDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1010 maxSize.rwidth() -= doubleFrameWidth;
never executed: maxSize.rwidth() -= doubleFrameWidth;
0
1011 hbarExtent.rheight() += doubleFrameWidth;-
1012 vbarExtent.rwidth() += doubleFrameWidth;-
1013 }
never executed: end of block
0
1014-
1015 const QRect childrenRect = active
activeDescription
TRUEnever evaluated
FALSEnever evaluated
&& active->isMaximized()
active->isMaximized()Description
TRUEnever evaluated
FALSEnever evaluated
0
1016 ? active->geometry() : viewport->childrenRect();-
1017 bool useHorizontalScrollBar = useScrollBar(childrenRect, maxSize, Qt::Horizontal);-
1018 bool useVerticalScrollBar = useScrollBar(childrenRect, maxSize, Qt::Vertical);-
1019-
1020 if (useHorizontalScrollBar
useHorizontalScrollBarDescription
TRUEnever evaluated
FALSEnever evaluated
&& !useVerticalScrollBar
!useVerticalScrollBarDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1021 const QSize max = maxSize - QSize(0, hbarExtent.height());-
1022 useVerticalScrollBar = useScrollBar(childrenRect, max, Qt::Vertical);-
1023 }
never executed: end of block
0
1024-
1025 if (useVerticalScrollBar
useVerticalScrollBarDescription
TRUEnever evaluated
FALSEnever evaluated
&& !useHorizontalScrollBar
!useHorizontalScrollBarDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1026 const QSize max = maxSize - QSize(vbarExtent.width(), 0);-
1027 useHorizontalScrollBar = useScrollBar(childrenRect, max, Qt::Horizontal);-
1028 }
never executed: end of block
0
1029-
1030 if (useHorizontalScrollBar
useHorizontalScrollBarDescription
TRUEnever evaluated
FALSEnever evaluated
&& hbarpolicy != Qt::ScrollBarAlwaysOn
hbarpolicy != ...ollBarAlwaysOnDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1031 maxSize.rheight() -= hbarExtent.height();
never executed: maxSize.rheight() -= hbarExtent.height();
0
1032 if (useVerticalScrollBar
useVerticalScrollBarDescription
TRUEnever evaluated
FALSEnever evaluated
&& vbarpolicy != Qt::ScrollBarAlwaysOn
vbarpolicy != ...ollBarAlwaysOnDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1033 maxSize.rwidth() -= vbarExtent.width();
never executed: maxSize.rwidth() -= vbarExtent.width();
0
1034-
1035 QRect viewportRect(QPoint(0, 0), maxSize);-
1036 const int startX = q->isLeftToRight()
q->isLeftToRight()Description
TRUEnever evaluated
FALSEnever evaluated
? childrenRect.left() : viewportRect.right()
0
1037 - childrenRect.right();-
1038-
1039-
1040 if (isSubWindowsTiled
isSubWindowsTiledDescription
TRUEnever evaluated
FALSEnever evaluated
&& hbar->value() != 0
hbar->value() != 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1041 hbar->setValue(0);
never executed: hbar->setValue(0);
0
1042 const int xOffset = startX + hbar->value();-
1043 hbar->setRange(qMin(0, xOffset),-
1044 qMax(0, xOffset + childrenRect.width() - viewportRect.width()));-
1045 hbar->setPageStep(childrenRect.width());-
1046 hbar->setSingleStep(childrenRect.width() / 20);-
1047-
1048-
1049 if (isSubWindowsTiled
isSubWindowsTiledDescription
TRUEnever evaluated
FALSEnever evaluated
&& vbar->value() != 0
vbar->value() != 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1050 vbar->setValue(0);
never executed: vbar->setValue(0);
0
1051 const int yOffset = childrenRect.top() + vbar->value();-
1052 vbar->setRange(qMin(0, yOffset),-
1053 qMax(0, yOffset + childrenRect.height() - viewportRect.height()));-
1054 vbar->setPageStep(childrenRect.height());-
1055 vbar->setSingleStep(childrenRect.height() / 20);-
1056}
never executed: end of block
0
1057-
1058-
1059-
1060-
1061void QMdiAreaPrivate::internalRaise(QMdiSubWindow *mdiChild) const-
1062{-
1063 if (!sanityCheck(mdiChild, "QMdiArea::internalRaise")
!sanityCheck(m...nternalRaise")Description
TRUEnever evaluated
FALSEnever evaluated
|| childWindows.size() < 2
childWindows.size() < 2Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1064 return;
never executed: return;
0
1065-
1066 QMdiSubWindow *stackUnderChild = 0;-
1067 if (!windowStaysOnTop(mdiChild)
!windowStaysOnTop(mdiChild)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1068 const auto children = viewport->children();-
1069 for (QObject *object : children) {-
1070 QMdiSubWindow *child = qobject_cast<QMdiSubWindow *>(object);-
1071 if (!child
!childDescription
TRUEnever evaluated
FALSEnever evaluated
|| !childWindows.contains(child)
!childWindows.contains(child)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1072 continue;
never executed: continue;
0
1073 if (!child->isHidden()
!child->isHidden()Description
TRUEnever evaluated
FALSEnever evaluated
&& windowStaysOnTop(child)
windowStaysOnTop(child)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1074 if (stackUnderChild
stackUnderChildDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1075 child->stackUnder(stackUnderChild);
never executed: child->stackUnder(stackUnderChild);
0
1076 else-
1077 child->raise();
never executed: child->raise();
0
1078 stackUnderChild = child;-
1079 }
never executed: end of block
0
1080 }
never executed: end of block
0
1081 }
never executed: end of block
0
1082-
1083 if (stackUnderChild
stackUnderChildDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1084 mdiChild->stackUnder(stackUnderChild);
never executed: mdiChild->stackUnder(stackUnderChild);
0
1085 else-
1086 mdiChild->raise();
never executed: mdiChild->raise();
0
1087}-
1088-
1089QRect QMdiAreaPrivate::resizeToMinimumTileSize(const QSize &minSubWindowSize, int subWindowCount)-
1090{-
1091 QMdiArea * const q = q_func();-
1092 if (!minSubWindowSize.isValid()
!minSubWindowSize.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
|| subWindowCount <= 0
subWindowCount <= 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1093 return
never executed: return viewport->rect();
viewport->rect();
never executed: return viewport->rect();
0
1094-
1095-
1096 const int columns = qMax(qCeil(qSqrt(qreal(subWindowCount))), 1);-
1097 const int rows = qMax((subWindowCount % columns) ? (subWindowCount / columns + 1)-
1098 : (subWindowCount / columns), 1);-
1099 const int minWidth = minSubWindowSize.width() * columns;-
1100 const int minHeight = minSubWindowSize.height() * rows;-
1101-
1102-
1103-
1104 if (!tileCalledFromResizeEvent
!tileCalledFromResizeEventDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1105 QWidget *topLevel = q;-
1106-
1107 while (topLevel
topLevelDescription
TRUEnever evaluated
FALSEnever evaluated
&& !topLevel->isWindow()
!topLevel->isWindow()Description
TRUEnever evaluated
FALSEnever evaluated
&& topLevel->windowType() != Qt::SubWindow
topLevel->wind... Qt::SubWindowDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1108 topLevel = topLevel->parentWidget();
never executed: topLevel = topLevel->parentWidget();
0
1109-
1110 int minAreaWidth = minWidth + left + right + 2;-
1111 int minAreaHeight = minHeight + top + bottom + 2;-
1112 if (hbar->isVisible()
hbar->isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1113 minAreaHeight += hbar->height();
never executed: minAreaHeight += hbar->height();
0
1114 if (vbar->isVisible()
vbar->isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1115 minAreaWidth += vbar->width();
never executed: minAreaWidth += vbar->width();
0
1116 if (q->style()->styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents, 0, q)
q->style()->st...ontents, 0, q)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1117 const int frame = q->style()->pixelMetric(QStyle::PM_DefaultFrameWidth, 0, q);-
1118 minAreaWidth += 2 * frame;-
1119 minAreaHeight += 2 * frame;-
1120 }
never executed: end of block
0
1121 const QSize diff = QSize(minAreaWidth, minAreaHeight).expandedTo(q->size()) - q->size();-
1122 topLevel->resize(topLevel->size() + diff);-
1123 }
never executed: end of block
0
1124-
1125 QRect domain = viewport->rect();-
1126-
1127-
1128 if (domain.width() < minWidth
domain.width() < minWidthDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1129 domain.setWidth(minWidth);-
1130 if (hbarpolicy == Qt::ScrollBarAlwaysOff
hbarpolicy == ...llBarAlwaysOffDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1131 q->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
never executed: q->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
0
1132 else-
1133 hbar->setValue(0);
never executed: hbar->setValue(0);
0
1134 }-
1135-
1136 if (domain.height() < minHeight
domain.height() < minHeightDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1137 domain.setHeight(minHeight);-
1138 if (vbarpolicy == Qt::ScrollBarAlwaysOff
vbarpolicy == ...llBarAlwaysOffDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1139 q->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
never executed: q->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
0
1140 else-
1141 vbar->setValue(0);
never executed: vbar->setValue(0);
0
1142 }-
1143 return
never executed: return domain;
domain;
never executed: return domain;
0
1144}-
1145-
1146-
1147-
1148-
1149bool QMdiAreaPrivate::scrollBarsEnabled() const-
1150{-
1151 return
never executed: return hbarpolicy != Qt::ScrollBarAlwaysOff || vbarpolicy != Qt::ScrollBarAlwaysOff;
hbarpolicy != Qt::ScrollBarAlwaysOff || vbarpolicy != Qt::ScrollBarAlwaysOff;
never executed: return hbarpolicy != Qt::ScrollBarAlwaysOff || vbarpolicy != Qt::ScrollBarAlwaysOff;
0
1152}-
1153-
1154-
1155-
1156-
1157bool QMdiAreaPrivate::lastWindowAboutToBeDestroyed() const-
1158{-
1159 if (childWindows.count() != 1
childWindows.count() != 1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1160 return
never executed: return false;
false;
never executed: return false;
0
1161-
1162 QMdiSubWindow *last = childWindows.at(0);-
1163 if (!last
!lastDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1164 return
never executed: return true;
true;
never executed: return true;
0
1165-
1166 if (!last->testAttribute(Qt::WA_DeleteOnClose)
!last->testAtt...DeleteOnClose)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1167 return
never executed: return false;
false;
never executed: return false;
0
1168-
1169 return
never executed: return last->d_func()->data.is_closing;
last->d_func()->data.is_closing;
never executed: return last->d_func()->data.is_closing;
0
1170}-
1171-
1172-
1173-
1174-
1175void QMdiAreaPrivate::setChildActivationEnabled(bool enable, bool onlyNextActivationEvent) const-
1176{-
1177 for (QForeachContainer<typename QtPrivate::remove_reference<decltype(childWindows)>::type> _container_((childWindows)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QMdiSubWindow *subWindow = *_container_.i; _container_.control; _container_.control = 0) {-
1178 if (!subWindow
!subWindowDescription
TRUEnever evaluated
FALSEnever evaluated
|| !subWindow->isVisible()
!subWindow->isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1179 continue;
never executed: continue;
0
1180 if (onlyNextActivationEvent
onlyNextActivationEventDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1181 subWindow->d_func()->ignoreNextActivationEvent = !enable;
never executed: subWindow->d_func()->ignoreNextActivationEvent = !enable;
0
1182 else-
1183 subWindow->d_func()->activationEnabled = enable;
never executed: subWindow->d_func()->activationEnabled = enable;
0
1184 }-
1185}
never executed: end of block
0
1186-
1187-
1188-
1189-
1190-
1191void QMdiAreaPrivate::scrollBarPolicyChanged(Qt::Orientation orientation, Qt::ScrollBarPolicy policy)-
1192{-
1193 if (childWindows.isEmpty()
childWindows.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1194 return;
never executed: return;
0
1195-
1196 const QMdiSubWindow::SubWindowOption option = orientation == Qt::Horizontal
orientation == Qt::HorizontalDescription
TRUEnever evaluated
FALSEnever evaluated
?
0
1197 QMdiSubWindow::AllowOutsideAreaHorizontally : QMdiSubWindow::AllowOutsideAreaVertically;-
1198 const bool enable = policy != Qt::ScrollBarAlwaysOff;-
1199 for (QForeachContainer<typename QtPrivate::remove_reference<decltype(childWindows)>::type> _container_((childWindows)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QMdiSubWindow *child = *_container_.i; _container_.control; _container_.control = 0) {-
1200 if (!sanityCheck(child, "QMdiArea::scrollBarPolicyChanged")
!sanityCheck(c...olicyChanged")Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1201 continue;
never executed: continue;
0
1202 child->setOption(option, enable);-
1203 }
never executed: end of block
0
1204 updateScrollBars();-
1205}
never executed: end of block
0
1206-
1207QList<QMdiSubWindow*>-
1208QMdiAreaPrivate::subWindowList(QMdiArea::WindowOrder order, bool reversed) const-
1209{-
1210 QList<QMdiSubWindow *> list;-
1211 if (childWindows.isEmpty()
childWindows.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1212 return
never executed: return list;
list;
never executed: return list;
0
1213-
1214 if (order == QMdiArea::CreationOrder
order == QMdiA...:CreationOrderDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1215 for (QForeachContainer<typename QtPrivate::remove_reference<decltype(childWindows)>::type> _container_((childWindows)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QMdiSubWindow *child = *_container_.i; _container_.control; _container_.control = 0) {-
1216 if (!child
!childDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1217 continue;
never executed: continue;
0
1218 if (!reversed
!reversedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1219 list.append(child);
never executed: list.append(child);
0
1220 else-
1221 list.prepend(child);
never executed: list.prepend(child);
0
1222 }-
1223 }
never executed: end of block
else if (order == QMdiArea::StackingOrder
order == QMdiA...:StackingOrderDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1224 for (QObject *object : viewport->children()) {-
1225 QMdiSubWindow *child = qobject_cast<QMdiSubWindow *>(object);-
1226 if (!child
!childDescription
TRUEnever evaluated
FALSEnever evaluated
|| !childWindows.contains(child)
!childWindows.contains(child)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1227 continue;
never executed: continue;
0
1228 if (!reversed
!reversedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1229 list.append(child);
never executed: list.append(child);
0
1230 else-
1231 list.prepend(child);
never executed: list.prepend(child);
0
1232 }-
1233 }
never executed: end of block
else {
0
1234 ((!(indicesToActivatedChildren.size() == childWindows.size())) ? qt_assert("indicesToActivatedChildren.size() == childWindows.size()",__FILE__,1412) : qt_noop());-
1235 for (int i = indicesToActivatedChildren.count() - 1; i >= 0
i >= 0Description
TRUEnever evaluated
FALSEnever evaluated
; --i) {
0
1236 QMdiSubWindow *child = childWindows.at(indicesToActivatedChildren.at(i));-
1237 if (!child
!childDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1238 continue;
never executed: continue;
0
1239 if (!reversed
!reversedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1240 list.append(child);
never executed: list.append(child);
0
1241 else-
1242 list.prepend(child);
never executed: list.prepend(child);
0
1243 }-
1244 }
never executed: end of block
0
1245 return
never executed: return list;
list;
never executed: return list;
0
1246}-
1247-
1248-
1249-
1250-
1251void QMdiAreaPrivate::disconnectSubWindow(QObject *subWindow)-
1252{-
1253 if (!subWindow
!subWindowDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1254 return;
never executed: return;
0
1255-
1256 QMdiArea * const q = q_func();-
1257 QObject::disconnect(subWindow, 0, q, 0);-
1258 subWindow->removeEventFilter(q);-
1259}
never executed: end of block
0
1260-
1261-
1262-
1263-
1264QMdiSubWindow *QMdiAreaPrivate::nextVisibleSubWindow(int increaseFactor, QMdiArea::WindowOrder order,-
1265 int removedIndex, int fromIndex) const-
1266{-
1267 if (childWindows.isEmpty()
childWindows.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1268 return
never executed: return 0;
0;
never executed: return 0;
0
1269-
1270 const QMdiArea * const q = q_func();-
1271 const QList<QMdiSubWindow *> subWindows = q->subWindowList(order);-
1272 QMdiSubWindow *current = 0;-
1273-
1274 if (removedIndex < 0
removedIndex < 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1275 if (fromIndex >= 0
fromIndex >= 0Description
TRUEnever evaluated
FALSEnever evaluated
&& fromIndex < subWindows.size()
fromIndex < subWindows.size()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1276 current = childWindows.at(fromIndex);
never executed: current = childWindows.at(fromIndex);
0
1277 else-
1278 current = q->currentSubWindow();
never executed: current = q->currentSubWindow();
0
1279 }-
1280-
1281-
1282-
1283 if (!current
!currentDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1284 if (removedIndex >= 0
removedIndex >= 0Description
TRUEnever evaluated
FALSEnever evaluated
&& order == QMdiArea::CreationOrder
order == QMdiA...:CreationOrderDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1285 int candidateIndex = -1;-
1286 setIndex(&candidateIndex, removedIndex, 0, subWindows.size() - 1, true);-
1287 current = childWindows.at(candidateIndex);-
1288 }
never executed: end of block
else {
0
1289 current = subWindows.back();-
1290 }
never executed: end of block
0
1291 }-
1292 ((!(current)) ? qt_assert("current",__FILE__,1470) : qt_noop());-
1293-
1294-
1295 const int indexToCurrent = subWindows.indexOf(current);-
1296 const bool increasing = increaseFactor > 0;-
1297-
1298-
1299 int index = -1;-
1300 setIndex(&index, indexToCurrent + increaseFactor, 0, subWindows.size() - 1, increasing);-
1301 ((!(index != -1)) ? qt_assert("index != -1",__FILE__,1479) : qt_noop());-
1302-
1303-
1304 while (subWindows.at(index)->isHidden()
subWindows.at(...x)->isHidden()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1305 setIndex(&index, index + increaseFactor, 0, subWindows.size() - 1, increasing);-
1306 if (index == indexToCurrent
index == indexToCurrentDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1307 break;
never executed: break;
0
1308 }
never executed: end of block
0
1309-
1310 if (!subWindows.at(index)->isHidden()
!subWindows.at...x)->isHidden()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1311 return
never executed: return subWindows.at(index);
subWindows.at(index);
never executed: return subWindows.at(index);
0
1312 return
never executed: return 0;
0;
never executed: return 0;
0
1313}-
1314-
1315-
1316-
1317-
1318void QMdiAreaPrivate::highlightNextSubWindow(int increaseFactor)-
1319{-
1320 if (childWindows.size() == 1
childWindows.size() == 1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1321 return;
never executed: return;
0
1322-
1323 QMdiArea * const q = q_func();-
1324-
1325 if (indexToHighlighted < 0
indexToHighlighted < 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1326 QMdiSubWindow *current = q->currentSubWindow();-
1327 if (!current
!currentDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1328 return;
never executed: return;
0
1329 indexToHighlighted = childWindows.indexOf(current);-
1330 }
never executed: end of block
0
1331-
1332 ((!(indexToHighlighted >= 0)) ? qt_assert("indexToHighlighted >= 0",__FILE__,1510) : qt_noop());-
1333 ((!(indexToHighlighted < childWindows.size())) ? qt_assert("indexToHighlighted < childWindows.size()",__FILE__,1511) : qt_noop());-
1334-
1335 QMdiSubWindow *highlight = nextVisibleSubWindow(increaseFactor, activationOrder, -1, indexToHighlighted);-
1336 if (!highlight
!highlightDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1337 return;
never executed: return;
0
1338-
1339-
1340 if (!rubberBand
!rubberBandDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1341 rubberBand = new QRubberBand(QRubberBand::Rectangle, q);-
1342-
1343 rubberBand->setObjectName(QLatin1String("qt_rubberband"));-
1344 rubberBand->setWindowFlags(rubberBand->windowFlags() | Qt::WindowStaysOnTopHint);-
1345 }
never executed: end of block
0
1346-
1347-
1348-
1349-
1350 if (tabToPreviousTimerId == -1
tabToPreviousTimerId == -1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1351 showRubberBandFor(highlight);
never executed: showRubberBandFor(highlight);
0
1352-
1353-
1354 indexToHighlighted = childWindows.indexOf(highlight);-
1355 ((!(indexToHighlighted >= 0)) ? qt_assert("indexToHighlighted >= 0",__FILE__,1533) : qt_noop());-
1356}
never executed: end of block
0
1357-
1358void QMdiAreaPrivate::showRubberBandFor(QMdiSubWindow *subWindow)-
1359{-
1360 if (!subWindow
!subWindowDescription
TRUEnever evaluated
FALSEnever evaluated
|| !rubberBand
!rubberBandDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1361 return;
never executed: return;
0
1362-
1363 if (viewMode == QMdiArea::TabbedView
viewMode == QM...ea::TabbedViewDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1364 rubberBand->setGeometry(tabBar->tabRect(childWindows.indexOf(subWindow)));
never executed: rubberBand->setGeometry(tabBar->tabRect(childWindows.indexOf(subWindow)));
0
1365 else-
1366 rubberBand->setGeometry(subWindow->geometry());
never executed: rubberBand->setGeometry(subWindow->geometry());
0
1367-
1368 rubberBand->raise();-
1369 rubberBand->show();-
1370}
never executed: end of block
0
1371-
1372-
1373-
1374-
1375-
1376void QMdiAreaPrivate::setViewMode(QMdiArea::ViewMode mode)-
1377{-
1378 QMdiArea * const q = q_func();-
1379 if (viewMode == mode
viewMode == modeDescription
TRUEnever evaluated
FALSEnever evaluated
|| inViewModeChange
inViewModeChangeDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1380 return;
never executed: return;
0
1381-
1382-
1383 inViewModeChange = true;-
1384-
1385-
1386 if (mode == QMdiArea::TabbedView
mode == QMdiArea::TabbedViewDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1387 ((!(!tabBar)) ? qt_assert("!tabBar",__FILE__,1565) : qt_noop());-
1388 tabBar = new QMdiAreaTabBar(q);-
1389 tabBar->setDocumentMode(documentMode);-
1390 tabBar->setTabsClosable(tabsClosable);-
1391 tabBar->setMovable(tabsMovable);-
1392-
1393 tabBar->setShape(tabBarShapeFrom(tabShape, tabPosition));-
1394-
1395-
1396 isSubWindowsTiled = false;-
1397-
1398 for (QForeachContainer<typename QtPrivate::remove_reference<decltype(childWindows)>::type> _container_((childWindows)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QMdiSubWindow *subWindow = *_container_.i; _container_.control; _container_.control = 0)-
1399 tabBar->addTab(subWindow->windowIcon(), tabTextFor(subWindow));
never executed: tabBar->addTab(subWindow->windowIcon(), tabTextFor(subWindow));
0
1400-
1401 QMdiSubWindow *current = q->currentSubWindow();-
1402 if (current
currentDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1403 tabBar->setCurrentIndex(childWindows.indexOf(current));-
1404-
1405 if (current->isMaximized()
current->isMaximized()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1406 current->showNormal();
never executed: current->showNormal();
0
1407-
1408 viewMode = mode;-
1409-
1410-
1411 if (!q->testOption(QMdiArea::DontMaximizeSubWindowOnActivation)
!q->testOption...wOnActivation)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1412 current->showMaximized();-
1413 }
never executed: end of block
0
1414 }
never executed: end of block
else {
0
1415 viewMode = mode;-
1416 }
never executed: end of block
0
1417-
1418 if (q->isVisible()
q->isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1419 tabBar->show();
never executed: tabBar->show();
0
1420 updateTabBarGeometry();-
1421-
1422 QObject::connect(tabBar, qFlagLocation("2""currentChanged(int)" "\0" __FILE__ ":" "1600"), q, qFlagLocation("1""_q_currentTabChanged(int)" "\0" __FILE__ ":" "1600"));-
1423 QObject::connect(tabBar, qFlagLocation("2""tabCloseRequested(int)" "\0" __FILE__ ":" "1601"), q, qFlagLocation("1""_q_closeTab(int)" "\0" __FILE__ ":" "1601"));-
1424 QObject::connect(tabBar, qFlagLocation("2""tabMoved(int,int)" "\0" __FILE__ ":" "1602"), q, qFlagLocation("1""_q_moveTab(int,int)" "\0" __FILE__ ":" "1602"));-
1425 }
never executed: end of block
else
0
1426-
1427 {-
1428-
1429 delete tabBar;-
1430 tabBar = 0;-
1431-
1432-
1433 viewMode = mode;-
1434 q->setViewportMargins(0, 0, 0, 0);-
1435 indexToLastActiveTab = -1;-
1436-
1437 QMdiSubWindow *current = q->currentSubWindow();-
1438 if (current
currentDescription
TRUEnever evaluated
FALSEnever evaluated
&& current->isMaximized()
current->isMaximized()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1439 current->showNormal();
never executed: current->showNormal();
0
1440 }
never executed: end of block
0
1441-
1442 ((!(viewMode == mode)) ? qt_assert("viewMode == mode",__FILE__,1620) : qt_noop());-
1443 inViewModeChange = false;-
1444}
never executed: end of block
0
1445-
1446-
1447-
1448-
1449-
1450void QMdiAreaPrivate::updateTabBarGeometry()-
1451{-
1452 if (!tabBar
!tabBarDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1453 return;
never executed: return;
0
1454-
1455 QMdiArea * const q = q_func();-
1456-
1457 ((!(tabBarShapeFrom(tabShape, tabPosition) == tabBar->shape())) ? qt_assert("tabBarShapeFrom(tabShape, tabPosition) == tabBar->shape()",__FILE__,1635) : qt_noop());-
1458-
1459 const QSize tabBarSizeHint = tabBar->sizeHint();-
1460-
1461 int areaHeight = q->height();-
1462 if (hbar
hbarDescription
TRUEnever evaluated
FALSEnever evaluated
&& hbar->isVisible()
hbar->isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1463 areaHeight -= hbar->height();
never executed: areaHeight -= hbar->height();
0
1464-
1465 int areaWidth = q->width();-
1466 if (vbar
vbarDescription
TRUEnever evaluated
FALSEnever evaluated
&& vbar->isVisible()
vbar->isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1467 areaWidth -= vbar->width();
never executed: areaWidth -= vbar->width();
0
1468-
1469 QRect tabBarRect;-
1470-
1471 switch (tabPosition) {-
1472 case
never executed: case QTabWidget::North:
QTabWidget::North:
never executed: case QTabWidget::North:
0
1473 q->setViewportMargins(0, tabBarSizeHint.height(), 0, 0);-
1474 tabBarRect = QRect(0, 0, areaWidth, tabBarSizeHint.height());-
1475 break;
never executed: break;
0
1476 case
never executed: case QTabWidget::South:
QTabWidget::South:
never executed: case QTabWidget::South:
0
1477 q->setViewportMargins(0, 0, 0, tabBarSizeHint.height());-
1478 tabBarRect = QRect(0, areaHeight - tabBarSizeHint.height(), areaWidth, tabBarSizeHint.height());-
1479 break;
never executed: break;
0
1480 case
never executed: case QTabWidget::East:
QTabWidget::East:
never executed: case QTabWidget::East:
0
1481 if (q->layoutDirection() == Qt::LeftToRight
q->layoutDirec...t::LeftToRightDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1482 q->setViewportMargins(0, 0, tabBarSizeHint.width(), 0);
never executed: q->setViewportMargins(0, 0, tabBarSizeHint.width(), 0);
0
1483 else-
1484 q->setViewportMargins(tabBarSizeHint.width(), 0, 0, 0);
never executed: q->setViewportMargins(tabBarSizeHint.width(), 0, 0, 0);
0
1485 tabBarRect = QRect(areaWidth - tabBarSizeHint.width(), 0, tabBarSizeHint.width(), areaHeight);-
1486 break;
never executed: break;
0
1487 case
never executed: case QTabWidget::West:
QTabWidget::West:
never executed: case QTabWidget::West:
0
1488 if (q->layoutDirection() == Qt::LeftToRight
q->layoutDirec...t::LeftToRightDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1489 q->setViewportMargins(tabBarSizeHint.width(), 0, 0, 0);
never executed: q->setViewportMargins(tabBarSizeHint.width(), 0, 0, 0);
0
1490 else-
1491 q->setViewportMargins(0, 0, tabBarSizeHint.width(), 0);
never executed: q->setViewportMargins(0, 0, tabBarSizeHint.width(), 0);
0
1492 tabBarRect = QRect(0, 0, tabBarSizeHint.width(), areaHeight);-
1493 break;
never executed: break;
0
1494 default
never executed: default:
:
never executed: default:
0
1495 break;
never executed: break;
0
1496 }-
1497-
1498-
1499 tabBar->setGeometry(QStyle::visualRect(q->layoutDirection(), q->contentsRect(), tabBarRect));-
1500}
never executed: end of block
0
1501-
1502-
1503-
1504-
1505void QMdiAreaPrivate::refreshTabBar()-
1506{-
1507 if (!tabBar
!tabBarDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1508 return;
never executed: return;
0
1509-
1510 tabBar->setDocumentMode(documentMode);-
1511 tabBar->setTabsClosable(tabsClosable);-
1512 tabBar->setMovable(tabsMovable);-
1513-
1514 tabBar->setShape(tabBarShapeFrom(tabShape, tabPosition));-
1515-
1516 updateTabBarGeometry();-
1517}
never executed: end of block
0
1518-
1519-
1520-
1521-
1522-
1523-
1524QMdiArea::QMdiArea(QWidget *parent)-
1525 : QAbstractScrollArea(*new QMdiAreaPrivate, parent)-
1526{-
1527 setBackground(palette().brush(QPalette::Dark));-
1528 setFrameStyle(QFrame::NoFrame);-
1529 setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);-
1530 setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);-
1531 setViewport(0);-
1532 setFocusPolicy(Qt::NoFocus);-
1533 QApplication::instance()->installEventFilter(this);-
1534}
never executed: end of block
0
1535-
1536-
1537-
1538-
1539QMdiArea::~QMdiArea()-
1540{-
1541 QMdiAreaPrivate * const d = d_func();-
1542 delete d->cascader;-
1543 d->cascader = 0;-
1544-
1545 delete d->regularTiler;-
1546 d->regularTiler = 0;-
1547-
1548 delete d->iconTiler;-
1549 d->iconTiler = 0;-
1550-
1551 delete d->placer;-
1552 d->placer = 0;-
1553}
never executed: end of block
0
1554-
1555-
1556-
1557-
1558QSize QMdiArea::sizeHint() const-
1559{-
1560-
1561-
1562 int nestedCount = 0;-
1563 QWidget *widget = this->parentWidget();-
1564 while (widget
widgetDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1565 if (qobject_cast<QMdiArea *>(widget)
qobject_cast<Q...rea *>(widget)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1566 ++
never executed: ++nestedCount;
nestedCount;
never executed: ++nestedCount;
0
1567 widget = widget->parentWidget();-
1568 }
never executed: end of block
0
1569 const int scaleFactor = 3 * (nestedCount + 1);-
1570-
1571 QSize desktopSize = QApplication::desktop()->size();-
1572 QSize size(desktopSize.width() * 2 / scaleFactor, desktopSize.height() * 2 / scaleFactor);-
1573 for (QMdiSubWindow *child : d_func()->childWindows) {-
1574 if (!sanityCheck(child, "QMdiArea::sizeHint")
!sanityCheck(c...ea::sizeHint")Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1575 continue;
never executed: continue;
0
1576 size = size.expandedTo(child->sizeHint());-
1577 }
never executed: end of block
0
1578 return
never executed: return size.expandedTo(QApplication::globalStrut());
size.expandedTo(QApplication::globalStrut());
never executed: return size.expandedTo(QApplication::globalStrut());
0
1579}-
1580-
1581-
1582-
1583-
1584QSize QMdiArea::minimumSizeHint() const-
1585{-
1586 const QMdiAreaPrivate * const d = d_func();-
1587 QSize size(style()->pixelMetric(QStyle::PM_MdiSubWindowMinimizedWidth, 0, this),-
1588 style()->pixelMetric(QStyle::PM_TitleBarHeight, 0, this));-
1589 size = size.expandedTo(QAbstractScrollArea::minimumSizeHint());-
1590 if (!d->scrollBarsEnabled()
!d->scrollBarsEnabled()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1591 for (QMdiSubWindow *child : d->childWindows) {-
1592 if (!sanityCheck(child, "QMdiArea::sizeHint")
!sanityCheck(c...ea::sizeHint")Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1593 continue;
never executed: continue;
0
1594 size = size.expandedTo(child->minimumSizeHint());-
1595 }
never executed: end of block
0
1596 }
never executed: end of block
0
1597 return
never executed: return size.expandedTo(QApplication::globalStrut());
size.expandedTo(QApplication::globalStrut());
never executed: return size.expandedTo(QApplication::globalStrut());
0
1598}-
1599QMdiSubWindow *QMdiArea::currentSubWindow() const-
1600{-
1601 const QMdiAreaPrivate * const d = d_func();-
1602 if (d->childWindows.isEmpty()
d->childWindows.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1603 return
never executed: return 0;
0;
never executed: return 0;
0
1604-
1605 if (d->active
d->activeDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1606 return
never executed: return d->active;
d->active;
never executed: return d->active;
0
1607-
1608 if (d->isActivated
d->isActivatedDescription
TRUEnever evaluated
FALSEnever evaluated
&& !window()->isMinimized()
!window()->isMinimized()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1609 return
never executed: return 0;
0;
never executed: return 0;
0
1610-
1611 ((!(d->indicesToActivatedChildren.count() > 0)) ? qt_assert("d->indicesToActivatedChildren.count() > 0",__FILE__,1799) : qt_noop());-
1612 int index = d->indicesToActivatedChildren.at(0);-
1613 ((!(index >= 0 && index < d->childWindows.size())) ? qt_assert("index >= 0 && index < d->childWindows.size()",__FILE__,1801) : qt_noop());-
1614 QMdiSubWindow *current = d->childWindows.at(index);-
1615 ((!(current)) ? qt_assert("current",__FILE__,1803) : qt_noop());-
1616 return
never executed: return current;
current;
never executed: return current;
0
1617}-
1618QMdiSubWindow *QMdiArea::activeSubWindow() const-
1619{-
1620 const QMdiAreaPrivate * const d = d_func();-
1621 return
never executed: return d->active;
d->active;
never executed: return d->active;
0
1622}-
1623-
1624-
1625-
1626-
1627-
1628-
1629-
1630void QMdiArea::setActiveSubWindow(QMdiSubWindow *window)-
1631{-
1632 QMdiAreaPrivate * const d = d_func();-
1633 if (!window
!windowDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1634 d->activateWindow(0);-
1635 return;
never executed: return;
0
1636 }-
1637-
1638 if (__builtin_expect(!!(d->childWindows.isEmpty()), false)
__builtin_expe...pty()), false)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1639 QMessageLogger(__FILE__, 1840, __PRETTY_FUNCTION__).warning("QMdiArea::setActiveSubWindow: workspace is empty");-
1640 return;
never executed: return;
0
1641 }-
1642-
1643 if (__builtin_expect(!!(d->childWindows.indexOf(window) == -1), false)
__builtin_expe...== -1), false)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1644 QMessageLogger(__FILE__, 1845, __PRETTY_FUNCTION__).warning("QMdiArea::setActiveSubWindow: window is not inside workspace");-
1645 return;
never executed: return;
0
1646 }-
1647-
1648 d->activateWindow(window);-
1649}
never executed: end of block
0
1650-
1651-
1652-
1653-
1654-
1655-
1656void QMdiArea::closeActiveSubWindow()-
1657{-
1658 QMdiAreaPrivate * const d = d_func();-
1659 if (d->active
d->activeDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1660 d->active->close();
never executed: d->active->close();
0
1661}
never executed: end of block
0
1662QList<QMdiSubWindow *> QMdiArea::subWindowList(WindowOrder order) const-
1663{-
1664 const QMdiAreaPrivate * const d = d_func();-
1665 return
never executed: return d->subWindowList(order, false);
d->subWindowList(order, false);
never executed: return d->subWindowList(order, false);
0
1666}-
1667void QMdiArea::closeAllSubWindows()-
1668{-
1669 QMdiAreaPrivate * const d = d_func();-
1670 if (d->childWindows.isEmpty()
d->childWindows.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1671 return;
never executed: return;
0
1672-
1673 d->isSubWindowsTiled = false;-
1674 for (QForeachContainer<typename QtPrivate::remove_reference<decltype(d->childWindows)>::type> _container_((d->childWindows)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QMdiSubWindow *child = *_container_.i; _container_.control; _container_.control = 0) {-
1675 if (!sanityCheck(child, "QMdiArea::closeAllSubWindows")
!sanityCheck(c...llSubWindows")Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1676 continue;
never executed: continue;
0
1677 child->close();-
1678 }
never executed: end of block
0
1679-
1680 d->updateScrollBars();-
1681}
never executed: end of block
0
1682void QMdiArea::activateNextSubWindow()-
1683{-
1684 QMdiAreaPrivate * const d = d_func();-
1685 if (d->childWindows.isEmpty()
d->childWindows.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1686 return;
never executed: return;
0
1687-
1688 QMdiSubWindow *next = d->nextVisibleSubWindow(1, d->activationOrder);-
1689 if (next
nextDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1690 d->activateWindow(next);
never executed: d->activateWindow(next);
0
1691}
never executed: end of block
0
1692void QMdiArea::activatePreviousSubWindow()-
1693{-
1694 QMdiAreaPrivate * const d = d_func();-
1695 if (d->childWindows.isEmpty()
d->childWindows.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1696 return;
never executed: return;
0
1697-
1698 QMdiSubWindow *previous = d->nextVisibleSubWindow(-1, d->activationOrder);-
1699 if (previous
previousDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1700 d->activateWindow(previous);
never executed: d->activateWindow(previous);
0
1701}
never executed: end of block
0
1702QMdiSubWindow *QMdiArea::addSubWindow(QWidget *widget, Qt::WindowFlags windowFlags)-
1703{-
1704 if (__builtin_expect(!!(!widget), false)
__builtin_expe...idget), false)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1705 QMessageLogger(__FILE__, 1969, __PRETTY_FUNCTION__).warning("QMdiArea::addSubWindow: null pointer to widget");-
1706 return
never executed: return 0;
0;
never executed: return 0;
0
1707 }-
1708-
1709 QMdiAreaPrivate * const d = d_func();-
1710-
1711 QWidget *childFocus = widget->focusWidget();-
1712 QMdiSubWindow *child = qobject_cast<QMdiSubWindow *>(widget);-
1713-
1714-
1715 if (child
childDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1716 if (__builtin_expect(!!(d->childWindows.indexOf(child) != -1), false)
__builtin_expe...!= -1), false)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1717 QMessageLogger(__FILE__, 1981, __PRETTY_FUNCTION__).warning("QMdiArea::addSubWindow: window is already added");-
1718 return
never executed: return child;
child;
never executed: return child;
0
1719 }-
1720 child->setParent(viewport(), windowFlags ? windowFlags : child->windowFlags());-
1721-
1722 }
never executed: end of block
else {
0
1723 child = new QMdiSubWindow(viewport(), windowFlags);-
1724 child->setAttribute(Qt::WA_DeleteOnClose);-
1725 child->setWidget(widget);-
1726 ((!(child->testAttribute(Qt::WA_DeleteOnClose))) ? qt_assert("child->testAttribute(Qt::WA_DeleteOnClose)",__FILE__,1990) : qt_noop());-
1727 }
never executed: end of block
0
1728-
1729 if (childFocus
childFocusDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1730 childFocus->setFocus();
never executed: childFocus->setFocus();
0
1731 d->appendChild(child);-
1732 return
never executed: return child;
child;
never executed: return child;
0
1733}-
1734void QMdiArea::removeSubWindow(QWidget *widget)-
1735{-
1736 if (__builtin_expect(!!(!widget), false)
__builtin_expe...idget), false)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1737 QMessageLogger(__FILE__, 2012, __PRETTY_FUNCTION__).warning("QMdiArea::removeSubWindow: null pointer to widget");-
1738 return;
never executed: return;
0
1739 }-
1740-
1741 QMdiAreaPrivate * const d = d_func();-
1742 if (d->childWindows.isEmpty()
d->childWindows.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1743 return;
never executed: return;
0
1744-
1745 if (QMdiSubWindow *child = qobject_cast<QMdiSubWindow *>(widget)
QMdiSubWindow ...dow *>(widget)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1746 int index = d->childWindows.indexOf(child);-
1747 if (__builtin_expect(!!(index == -1), false)
__builtin_expe...== -1), false)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1748 QMessageLogger(__FILE__, 2023, __PRETTY_FUNCTION__).warning("QMdiArea::removeSubWindow: window is not inside workspace");-
1749 return;
never executed: return;
0
1750 }-
1751 d->disconnectSubWindow(child);-
1752 d->childWindows.removeAll(child);-
1753 d->indicesToActivatedChildren.removeAll(index);-
1754 d->updateActiveWindow(index, d->active == child);-
1755 child->setParent(0);-
1756 return;
never executed: return;
0
1757 }-
1758-
1759 bool found = false;-
1760 for (QForeachContainer<typename QtPrivate::remove_reference<decltype(d->childWindows)>::type> _container_((d->childWindows)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QMdiSubWindow *child = *_container_.i; _container_.control; _container_.control = 0) {-
1761 if (!sanityCheck(child, "QMdiArea::removeSubWindow")
!sanityCheck(c...oveSubWindow")Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1762 continue;
never executed: continue;
0
1763 if (child->widget() == widget
child->widget() == widgetDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1764 child->setWidget(0);-
1765 ((!(!child->widget())) ? qt_assert("!child->widget()",__FILE__,2040) : qt_noop());-
1766 found = true;-
1767 break;
never executed: break;
0
1768 }-
1769 }
never executed: end of block
0
1770-
1771 if (__builtin_expect(!!(!found), false)
__builtin_expe...found), false)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1772 QMessageLogger(__FILE__, 2047, __PRETTY_FUNCTION__).warning("QMdiArea::removeSubWindow: widget is not child of any window inside QMdiArea");
never executed: QMessageLogger(__FILE__, 2047, __PRETTY_FUNCTION__).warning("QMdiArea::removeSubWindow: widget is not child of any window inside QMdiArea");
0
1773}
never executed: end of block
0
1774QBrush QMdiArea::background() const-
1775{-
1776 return
never executed: return d_func()->background;
d_func()->background;
never executed: return d_func()->background;
0
1777}-
1778-
1779void QMdiArea::setBackground(const QBrush &brush)-
1780{-
1781 QMdiAreaPrivate * const d = d_func();-
1782 if (d->background != brush
d->background != brushDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1783 d->background = brush;-
1784 d->viewport->setAttribute(Qt::WA_OpaquePaintEvent, brush.isOpaque());-
1785 d->viewport->update();-
1786 }
never executed: end of block
0
1787}
never executed: end of block
0
1788QMdiArea::WindowOrder QMdiArea::activationOrder() const-
1789{-
1790 const QMdiAreaPrivate * const d = d_func();-
1791 return
never executed: return d->activationOrder;
d->activationOrder;
never executed: return d->activationOrder;
0
1792}-
1793-
1794void QMdiArea::setActivationOrder(WindowOrder order)-
1795{-
1796 QMdiAreaPrivate * const d = d_func();-
1797 if (order != d->activationOrder
order != d->activationOrderDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1798 d->activationOrder = order;
never executed: d->activationOrder = order;
0
1799}
never executed: end of block
0
1800-
1801-
1802-
1803-
1804-
1805-
1806-
1807void QMdiArea::setOption(AreaOption option, bool on)-
1808{-
1809 QMdiAreaPrivate * const d = d_func();-
1810 d->options.setFlag(option, on);-
1811}
never executed: end of block
0
1812-
1813-
1814-
1815-
1816-
1817-
1818bool QMdiArea::testOption(AreaOption option) const-
1819{-
1820 return
never executed: return d_func()->options & option;
d_func()->options & option;
never executed: return d_func()->options & option;
0
1821}-
1822QMdiArea::ViewMode QMdiArea::viewMode() const-
1823{-
1824 const QMdiAreaPrivate * const d = d_func();-
1825 return
never executed: return d->viewMode;
d->viewMode;
never executed: return d->viewMode;
0
1826}-
1827-
1828void QMdiArea::setViewMode(ViewMode mode)-
1829{-
1830 QMdiAreaPrivate * const d = d_func();-
1831 d->setViewMode(mode);-
1832}
never executed: end of block
0
1833bool QMdiArea::documentMode() const-
1834{-
1835 const QMdiAreaPrivate * const d = d_func();-
1836 return
never executed: return d->documentMode;
d->documentMode;
never executed: return d->documentMode;
0
1837}-
1838-
1839void QMdiArea::setDocumentMode(bool enabled)-
1840{-
1841 QMdiAreaPrivate * const d = d_func();-
1842 if (d->documentMode == enabled
d->documentMode == enabledDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1843 return;
never executed: return;
0
1844-
1845 d->documentMode = enabled;-
1846 d->refreshTabBar();-
1847}
never executed: end of block
0
1848bool QMdiArea::tabsClosable() const-
1849{-
1850 const QMdiAreaPrivate * const d = d_func();-
1851 return
never executed: return d->tabsClosable;
d->tabsClosable;
never executed: return d->tabsClosable;
0
1852}-
1853-
1854void QMdiArea::setTabsClosable(bool closable)-
1855{-
1856 QMdiAreaPrivate * const d = d_func();-
1857 if (d->tabsClosable == closable
d->tabsClosable == closableDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1858 return;
never executed: return;
0
1859-
1860 d->tabsClosable = closable;-
1861 d->refreshTabBar();-
1862}
never executed: end of block
0
1863bool QMdiArea::tabsMovable() const-
1864{-
1865 const QMdiAreaPrivate * const d = d_func();-
1866 return
never executed: return d->tabsMovable;
d->tabsMovable;
never executed: return d->tabsMovable;
0
1867}-
1868-
1869void QMdiArea::setTabsMovable(bool movable)-
1870{-
1871 QMdiAreaPrivate * const d = d_func();-
1872 if (d->tabsMovable == movable
d->tabsMovable == movableDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1873 return;
never executed: return;
0
1874-
1875 d->tabsMovable = movable;-
1876 d->refreshTabBar();-
1877}
never executed: end of block
0
1878QTabWidget::TabShape QMdiArea::tabShape() const-
1879{-
1880 const QMdiAreaPrivate * const d = d_func();-
1881 return
never executed: return d->tabShape;
d->tabShape;
never executed: return d->tabShape;
0
1882}-
1883-
1884void QMdiArea::setTabShape(QTabWidget::TabShape shape)-
1885{-
1886 QMdiAreaPrivate * const d = d_func();-
1887 if (d->tabShape == shape
d->tabShape == shapeDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1888 return;
never executed: return;
0
1889-
1890 d->tabShape = shape;-
1891 d->refreshTabBar();-
1892}
never executed: end of block
0
1893QTabWidget::TabPosition QMdiArea::tabPosition() const-
1894{-
1895 const QMdiAreaPrivate * const d = d_func();-
1896 return
never executed: return d->tabPosition;
d->tabPosition;
never executed: return d->tabPosition;
0
1897}-
1898-
1899void QMdiArea::setTabPosition(QTabWidget::TabPosition position)-
1900{-
1901 QMdiAreaPrivate * const d = d_func();-
1902 if (d->tabPosition == position
d->tabPosition == positionDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1903 return;
never executed: return;
0
1904-
1905 d->tabPosition = position;-
1906 d->refreshTabBar();-
1907}
never executed: end of block
0
1908-
1909-
1910-
1911-
1912-
1913void QMdiArea::childEvent(QChildEvent *childEvent)-
1914{-
1915 QMdiAreaPrivate * const d = d_func();-
1916 if (childEvent->type() == QEvent::ChildPolished
childEvent->ty...:ChildPolishedDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1917 if (QMdiSubWindow *mdiChild = qobject_cast<QMdiSubWindow *>(childEvent->child())
QMdiSubWindow ...vent->child())Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1918 if (d->childWindows.indexOf(mdiChild) == -1
d->childWindow...diChild) == -1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1919 d->appendChild(mdiChild);
never executed: d->appendChild(mdiChild);
0
1920 }
never executed: end of block
0
1921 }
never executed: end of block
0
1922}
never executed: end of block
0
1923-
1924-
1925-
1926-
1927void QMdiArea::resizeEvent(QResizeEvent *resizeEvent)-
1928{-
1929 QMdiAreaPrivate * const d = d_func();-
1930 if (d->childWindows.isEmpty()
d->childWindows.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1931 resizeEvent->ignore();-
1932 return;
never executed: return;
0
1933 }-
1934-
1935-
1936 d->updateTabBarGeometry();-
1937-
1938-
1939-
1940-
1941-
1942 if (d->isSubWindowsTiled
d->isSubWindowsTiledDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1943 d->tileCalledFromResizeEvent = true;-
1944 tileSubWindows();-
1945 d->tileCalledFromResizeEvent = false;-
1946 d->isSubWindowsTiled = true;-
1947 d->startResizeTimer();-
1948-
1949 return;
never executed: return;
0
1950 }-
1951-
1952-
1953 bool hasMaximizedSubWindow = false;-
1954 for (QForeachContainer<typename QtPrivate::remove_reference<decltype(d->childWindows)>::type> _container_((d->childWindows)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QMdiSubWindow *child = *_container_.i; _container_.control; _container_.control = 0) {-
1955 if (sanityCheck(child, "QMdiArea::resizeEvent")
sanityCheck(ch...:resizeEvent")Description
TRUEnever evaluated
FALSEnever evaluated
&& child->isMaximized()
child->isMaximized()Description
TRUEnever evaluated
FALSEnever evaluated
0
1956 && child->size() != resizeEvent->size()
child->size() ...eEvent->size()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1957 child->resize(resizeEvent->size());-
1958 if (!hasMaximizedSubWindow
!hasMaximizedSubWindowDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1959 hasMaximizedSubWindow = true;
never executed: hasMaximizedSubWindow = true;
0
1960 }
never executed: end of block
0
1961 }
never executed: end of block
0
1962-
1963 d->updateScrollBars();-
1964-
1965-
1966-
1967-
1968 if (hasMaximizedSubWindow
hasMaximizedSubWindowDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1969 d->startResizeTimer();
never executed: d->startResizeTimer();
0
1970 else-
1971 d->arrangeMinimizedSubWindows();
never executed: d->arrangeMinimizedSubWindows();
0
1972}-
1973-
1974-
1975-
1976-
1977void QMdiArea::timerEvent(QTimerEvent *timerEvent)-
1978{-
1979 QMdiAreaPrivate * const d = d_func();-
1980 if (timerEvent->timerId() == d->resizeTimerId
timerEvent->ti...>resizeTimerIdDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1981 killTimer(d->resizeTimerId);-
1982 d->resizeTimerId = -1;-
1983 d->arrangeMinimizedSubWindows();-
1984 }
never executed: end of block
else if (timerEvent->timerId() == d->tabToPreviousTimerId
timerEvent->ti...reviousTimerIdDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1985 killTimer(d->tabToPreviousTimerId);-
1986 d->tabToPreviousTimerId = -1;-
1987 if (d->indexToHighlighted < 0
d->indexToHighlighted < 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1988 return;
never executed: return;
0
1989-
1990-
1991 ((!(d->indexToHighlighted < d->childWindows.size())) ? qt_assert("d->indexToHighlighted < d->childWindows.size()",__FILE__,2353) : qt_noop());-
1992 ((!(d->rubberBand)) ? qt_assert("d->rubberBand",__FILE__,2354) : qt_noop());-
1993 d->showRubberBandFor(d->childWindows.at(d->indexToHighlighted));-
1994-
1995 }
never executed: end of block
0
1996}
never executed: end of block
0
1997-
1998-
1999-
2000-
2001void QMdiArea::showEvent(QShowEvent *showEvent)-
2002{-
2003 QMdiAreaPrivate * const d = d_func();-
2004 if (!d->pendingRearrangements.isEmpty()
!d->pendingRea...ents.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2005 bool skipPlacement = false;-
2006 for (QForeachContainer<typename QtPrivate::remove_reference<decltype(d->pendingRearrangements)>::type> _container_((d->pendingRearrangements)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (Rearranger *rearranger = *_container_.i; _container_.control; _container_.control = 0) {-
2007-
2008-
2009 if (rearranger->type() != Rearranger::IconTiler
rearranger->ty...ger::IconTilerDescription
TRUEnever evaluated
FALSEnever evaluated
&& !skipPlacement
!skipPlacementDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2010 skipPlacement = true;
never executed: skipPlacement = true;
0
2011 d->rearrange(rearranger);-
2012 }
never executed: end of block
0
2013 d->pendingRearrangements.clear();-
2014-
2015 if (skipPlacement
skipPlacementDescription
TRUEnever evaluated
FALSEnever evaluated
&& !d->pendingPlacements.isEmpty()
!d->pendingPla...ents.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2016 d->pendingPlacements.clear();
never executed: d->pendingPlacements.clear();
0
2017 }
never executed: end of block
0
2018-
2019 if (!d->pendingPlacements.isEmpty()
!d->pendingPla...ents.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2020 for (QForeachContainer<typename QtPrivate::remove_reference<decltype(d->pendingPlacements)>::type> _container_((d->pendingPlacements)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QMdiSubWindow *window = *_container_.i; _container_.control; _container_.control = 0) {-
2021 if (!window
!windowDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2022 continue;
never executed: continue;
0
2023 if (!window->testAttribute(Qt::WA_Resized)
!window->testA...t::WA_Resized)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2024 QSize newSize(window->sizeHint().boundedTo(viewport()->size()));-
2025 window->resize(newSize.expandedTo(qSmartMinSize(window)));-
2026 }
never executed: end of block
0
2027 if (!window->testAttribute(Qt::WA_Moved)
!window->testA...(Qt::WA_Moved)Description
TRUEnever evaluated
FALSEnever evaluated
&& !window->isMinimized()
!window->isMinimized()Description
TRUEnever evaluated
FALSEnever evaluated
0
2028 && !window->isMaximized()
!window->isMaximized()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2029 d->place(d->placer, window);-
2030 }
never executed: end of block
0
2031 }
never executed: end of block
0
2032 d->pendingPlacements.clear();-
2033 }
never executed: end of block
0
2034-
2035 d->setChildActivationEnabled(true);-
2036 d->activateCurrentWindow();-
2037-
2038 QAbstractScrollArea::showEvent(showEvent);-
2039}
never executed: end of block
0
2040-
2041-
2042-
2043-
2044bool QMdiArea::viewportEvent(QEvent *event)-
2045{-
2046 QMdiAreaPrivate * const d = d_func();-
2047 switch (event->type()) {-
2048 case
never executed: case QEvent::ChildRemoved:
QEvent::ChildRemoved:
never executed: case QEvent::ChildRemoved:
{
0
2049 d->isSubWindowsTiled = false;-
2050 QObject *removedChild = static_cast<QChildEvent *>(event)->child();-
2051 for (int i = 0; i < d->childWindows.size()
i < d->childWindows.size()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
2052 QObject *child = d->childWindows.at(i);-
2053 if (!child
!childDescription
TRUEnever evaluated
FALSEnever evaluated
|| child == removedChild
child == removedChildDescription
TRUEnever evaluated
FALSEnever evaluated
|| !child->parent()
!child->parent()Description
TRUEnever evaluated
FALSEnever evaluated
0
2054 || child->parent() != viewport()
child->parent() != viewport()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2055 if (!testOption(DontMaximizeSubWindowOnActivation)
!testOption(Do...wOnActivation)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2056-
2057-
2058 QWidget *mdiChild = qobject_cast<QWidget *>(removedChild);-
2059 if (mdiChild
mdiChildDescription
TRUEnever evaluated
FALSEnever evaluated
&& mdiChild->isMaximized()
mdiChild->isMaximized()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2060 d->showActiveWindowMaximized = true;
never executed: d->showActiveWindowMaximized = true;
0
2061 }
never executed: end of block
0
2062 d->disconnectSubWindow(child);-
2063 const bool activeRemoved = i == d->indicesToActivatedChildren.at(0);-
2064 d->childWindows.removeAt(i);-
2065 d->indicesToActivatedChildren.removeAll(i);-
2066 d->updateActiveWindow(i, activeRemoved);-
2067 d->arrangeMinimizedSubWindows();-
2068 break;
never executed: break;
0
2069 }-
2070 }
never executed: end of block
0
2071 d->updateScrollBars();-
2072 break;
never executed: break;
0
2073 }-
2074 case
never executed: case QEvent::Destroy:
QEvent::Destroy:
never executed: case QEvent::Destroy:
0
2075 d->isSubWindowsTiled = false;-
2076 d->resetActiveWindow();-
2077 d->childWindows.clear();-
2078 QMessageLogger(__FILE__, 2440, __PRETTY_FUNCTION__).warning("QMdiArea: Deleting the view port is undefined, use setViewport instead.");-
2079 break;
never executed: break;
0
2080 default
never executed: default:
:
never executed: default:
0
2081 break;
never executed: break;
0
2082 }-
2083 return
never executed: return QAbstractScrollArea::viewportEvent(event);
QAbstractScrollArea::viewportEvent(event);
never executed: return QAbstractScrollArea::viewportEvent(event);
0
2084}-
2085-
2086-
2087-
2088-
2089void QMdiArea::scrollContentsBy(int dx, int dy)-
2090{-
2091 QMdiAreaPrivate * const d = d_func();-
2092 const bool wasSubWindowsTiled = d->isSubWindowsTiled;-
2093 d->ignoreGeometryChange = true;-
2094 viewport()->scroll(isLeftToRight() ? dx : -dx, dy);-
2095 d->arrangeMinimizedSubWindows();-
2096 d->ignoreGeometryChange = false;-
2097 if (wasSubWindowsTiled
wasSubWindowsTiledDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2098 d->isSubWindowsTiled = true;
never executed: d->isSubWindowsTiled = true;
0
2099}
never executed: end of block
0
2100-
2101-
2102-
2103-
2104-
2105-
2106void QMdiArea::tileSubWindows()-
2107{-
2108 QMdiAreaPrivate * const d = d_func();-
2109 if (!d->regularTiler
!d->regularTilerDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2110 d->regularTiler = new RegularTiler;
never executed: d->regularTiler = new RegularTiler;
0
2111 d->rearrange(d->regularTiler);-
2112}
never executed: end of block
0
2113-
2114-
2115-
2116-
2117-
2118-
2119void QMdiArea::cascadeSubWindows()-
2120{-
2121 QMdiAreaPrivate * const d = d_func();-
2122 if (!d->cascader
!d->cascaderDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2123 d->cascader = new SimpleCascader;
never executed: d->cascader = new SimpleCascader;
0
2124 d->rearrange(d->cascader);-
2125}
never executed: end of block
0
2126-
2127-
2128-
2129-
2130bool QMdiArea::event(QEvent *event)-
2131{-
2132 QMdiAreaPrivate * const d = d_func();-
2133 switch (event->type()) {-
2134-
2135-
2136-
2137-
2138-
2139-
2140-
2141 case
never executed: case QEvent::WindowActivate:
QEvent::WindowActivate:
never executed: case QEvent::WindowActivate:
{
0
2142 d->isActivated = true;-
2143 if (d->childWindows.isEmpty()
d->childWindows.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2144 break;
never executed: break;
0
2145 if (!d->active
!d->activeDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2146 d->activateCurrentWindow();
never executed: d->activateCurrentWindow();
0
2147 d->setChildActivationEnabled(false, true);-
2148 break;
never executed: break;
0
2149 }-
2150 case
never executed: case QEvent::WindowDeactivate:
QEvent::WindowDeactivate:
never executed: case QEvent::WindowDeactivate:
0
2151 d->isActivated = false;-
2152 d->setChildActivationEnabled(false, true);-
2153 break;
never executed: break;
0
2154 case
never executed: case QEvent::StyleChange:
QEvent::StyleChange:
never executed: case QEvent::StyleChange:
0
2155-
2156-
2157-
2158 if (d->isSubWindowsTiled
d->isSubWindowsTiledDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2159 tileSubWindows();-
2160 d->isSubWindowsTiled = true;-
2161 }
never executed: end of block
0
2162 break;
never executed: break;
0
2163 case
never executed: case QEvent::WindowIconChange:
QEvent::WindowIconChange:
never executed: case QEvent::WindowIconChange:
0
2164 for (QForeachContainer<typename QtPrivate::remove_reference<decltype(d->childWindows)>::type> _container_((d->childWindows)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QMdiSubWindow *window = *_container_.i; _container_.control; _container_.control = 0) {-
2165 if (sanityCheck(window, "QMdiArea::WindowIconChange")
sanityCheck(wi...owIconChange")Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2166 QApplication::sendEvent(window, event);
never executed: QApplication::sendEvent(window, event);
0
2167 }
never executed: end of block
0
2168 break;
never executed: break;
0
2169 case
never executed: case QEvent::Hide:
QEvent::Hide:
never executed: case QEvent::Hide:
0
2170 d->setActive(d->active, false, false);-
2171 d->setChildActivationEnabled(false);-
2172 break;
never executed: break;
0
2173-
2174 case
never executed: case QEvent::LayoutDirectionChange:
QEvent::LayoutDirectionChange:
never executed: case QEvent::LayoutDirectionChange:
0
2175 d->updateTabBarGeometry();-
2176 break;
never executed: break;
0
2177-
2178 default
never executed: default:
:
never executed: default:
0
2179 break;
never executed: break;
0
2180 }-
2181 return
never executed: return QAbstractScrollArea::event(event);
QAbstractScrollArea::event(event);
never executed: return QAbstractScrollArea::event(event);
0
2182}-
2183-
2184-
2185-
2186-
2187bool QMdiArea::eventFilter(QObject *object, QEvent *event)-
2188{-
2189 if (!object
!objectDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2190 return
never executed: return QAbstractScrollArea::eventFilter(object, event);
QAbstractScrollArea::eventFilter(object, event);
never executed: return QAbstractScrollArea::eventFilter(object, event);
0
2191-
2192 QMdiAreaPrivate * const d = d_func();-
2193-
2194 if (event->type() == QEvent::KeyPress
event->type() ...vent::KeyPressDescription
TRUEnever evaluated
FALSEnever evaluated
|| event->type() == QEvent::KeyRelease
event->type() ...nt::KeyReleaseDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2195-
2196 QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);-
2197-
2198-
2199-
2200-
2201 if (!(keyEvent->modifiers() & Qt::ControlModifier)
!(keyEvent->mo...ntrolModifier)Description
TRUEnever evaluated
FALSEnever evaluated
&& keyEvent->key() != Qt::Key_Control
keyEvent->key(...t::Key_ControlDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2202-
2203 return
never executed: return QAbstractScrollArea::eventFilter(object, event);
QAbstractScrollArea::eventFilter(object, event);
never executed: return QAbstractScrollArea::eventFilter(object, event);
0
2204-
2205-
2206 QMdiArea *area = mdiAreaParent(static_cast<QWidget *>(object));-
2207 if (!area
!areaDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2208 return
never executed: return QAbstractScrollArea::eventFilter(object, event);
QAbstractScrollArea::eventFilter(object, event);
never executed: return QAbstractScrollArea::eventFilter(object, event);
0
2209-
2210 const bool keyPress = (event->type() == QEvent::KeyPress);-
2211-
2212-
2213-
2214-
2215-
2216 switch (keyEvent->key()) {-
2217-
2218-
2219-
2220 case
never executed: case Qt::Key_Control:
Qt::Key_Control:
never executed: case Qt::Key_Control:
0
2221-
2222 if (keyPress
keyPressDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2223 area->d_func()->startTabToPreviousTimer();
never executed: area->d_func()->startTabToPreviousTimer();
0
2224 else-
2225 area->d_func()->activateHighlightedWindow();
never executed: area->d_func()->activateHighlightedWindow();
0
2226 break;
never executed: break;
0
2227 case
never executed: case Qt::Key_Tab:
Qt::Key_Tab:
never executed: case Qt::Key_Tab:
0
2228 case
never executed: case Qt::Key_Backtab:
Qt::Key_Backtab:
never executed: case Qt::Key_Backtab:
0
2229 if (keyPress
keyPressDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2230 area->d_func()->highlightNextSubWindow(keyEvent->key() == Qt::Key_Tab ? 1 : -1);
never executed: area->d_func()->highlightNextSubWindow(keyEvent->key() == Qt::Key_Tab ? 1 : -1);
0
2231 return
never executed: return true;
true;
never executed: return true;
0
2232-
2233 case
never executed: case Qt::Key_Escape:
Qt::Key_Escape:
never executed: case Qt::Key_Escape:
0
2234 area->d_func()->hideRubberBand();-
2235 break;
never executed: break;
0
2236-
2237 default
never executed: default:
:
never executed: default:
0
2238 break;
never executed: break;
0
2239 }-
2240 return
never executed: return QAbstractScrollArea::eventFilter(object, event);
QAbstractScrollArea::eventFilter(object, event);
never executed: return QAbstractScrollArea::eventFilter(object, event);
0
2241 }-
2242-
2243 QMdiSubWindow *subWindow = qobject_cast<QMdiSubWindow *>(object);-
2244-
2245 if (!subWindow
!subWindowDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2246-
2247 if (event->type() == QEvent::ApplicationActivate
event->type() ...cationActivateDescription
TRUEnever evaluated
FALSEnever evaluated
&& !d->active
!d->activeDescription
TRUEnever evaluated
FALSEnever evaluated
0
2248 && isVisible()
isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
&& !window()->isMinimized()
!window()->isMinimized()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2249 d->activateCurrentWindow();-
2250 }
never executed: end of block
else if (event->type() == QEvent::ApplicationDeactivate
event->type() ...tionDeactivateDescription
TRUEnever evaluated
FALSEnever evaluated
&& d->active
d->activeDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2251 d->setActive(d->active, false, false);-
2252 }
never executed: end of block
0
2253 return
never executed: return QAbstractScrollArea::eventFilter(object, event);
QAbstractScrollArea::eventFilter(object, event);
never executed: return QAbstractScrollArea::eventFilter(object, event);
0
2254 }-
2255-
2256 if (subWindow->mdiArea() != this
subWindow->mdiArea() != thisDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2257 return
never executed: return QAbstractScrollArea::eventFilter(object, event);
QAbstractScrollArea::eventFilter(object, event);
never executed: return QAbstractScrollArea::eventFilter(object, event);
0
2258-
2259-
2260 switch (event->type()) {-
2261 case
never executed: case QEvent::Move:
QEvent::Move:
never executed: case QEvent::Move:
0
2262 case
never executed: case QEvent::Resize:
QEvent::Resize:
never executed: case QEvent::Resize:
0
2263 if (d->tileCalledFromResizeEvent
d->tileCalledFromResizeEventDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2264 break;
never executed: break;
0
2265 d->updateScrollBars();-
2266 if (!subWindow->isMinimized()
!subWindow->isMinimized()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2267 d->isSubWindowsTiled = false;
never executed: d->isSubWindowsTiled = false;
0
2268 break;
never executed: break;
0
2269 case
never executed: case QEvent::Show:
QEvent::Show:
never executed: case QEvent::Show:
0
2270-
2271 if (d->tabBar
d->tabBarDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2272 const int tabIndex = d->childWindows.indexOf(subWindow);-
2273 if (!d->tabBar->isTabEnabled(tabIndex)
!d->tabBar->is...bled(tabIndex)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2274 d->tabBar->setTabEnabled(tabIndex, true);
never executed: d->tabBar->setTabEnabled(tabIndex, true);
0
2275 }
never executed: end of block
0
2276-
2277-
2278 case
never executed: case QEvent::Hide:
QEvent::Hide:
never executed: case QEvent::Hide:
code before this statement never executed: case QEvent::Hide:
0
2279 d->isSubWindowsTiled = false;-
2280 break;
never executed: break;
0
2281-
2282 case
never executed: case QEvent::Close:
QEvent::Close:
never executed: case QEvent::Close:
0
2283 if (d->childWindows.indexOf(subWindow) == d->indexToHighlighted
d->childWindow...xToHighlightedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2284 d->hideRubberBand();
never executed: d->hideRubberBand();
0
2285 break;
never executed: break;
0
2286-
2287-
2288 case
never executed: case QEvent::WindowTitleChange:
QEvent::WindowTitleChange:
never executed: case QEvent::WindowTitleChange:
0
2289 case
never executed: case QEvent::ModifiedChange:
QEvent::ModifiedChange:
never executed: case QEvent::ModifiedChange:
0
2290 if (d->tabBar
d->tabBarDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2291 d->tabBar->setTabText(d->childWindows.indexOf(subWindow), tabTextFor(subWindow));
never executed: d->tabBar->setTabText(d->childWindows.indexOf(subWindow), tabTextFor(subWindow));
0
2292 break;
never executed: break;
0
2293 case
never executed: case QEvent::WindowIconChange:
QEvent::WindowIconChange:
never executed: case QEvent::WindowIconChange:
0
2294 if (d->tabBar
d->tabBarDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2295 d->tabBar->setTabIcon(d->childWindows.indexOf(subWindow), subWindow->windowIcon());
never executed: d->tabBar->setTabIcon(d->childWindows.indexOf(subWindow), subWindow->windowIcon());
0
2296 break;
never executed: break;
0
2297-
2298 default
never executed: default:
:
never executed: default:
0
2299 break;
never executed: break;
0
2300 }-
2301 return
never executed: return QAbstractScrollArea::eventFilter(object, event);
QAbstractScrollArea::eventFilter(object, event);
never executed: return QAbstractScrollArea::eventFilter(object, event);
0
2302}-
2303-
2304-
2305-
2306-
2307void QMdiArea::paintEvent(QPaintEvent *paintEvent)-
2308{-
2309 QMdiAreaPrivate * const d = d_func();-
2310 QPainter painter(d->viewport);-
2311 const QVector<QRect> &exposedRects = paintEvent->region().rects();-
2312 for (int i = 0; i < exposedRects.size()
i < exposedRects.size()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i)
0
2313 painter.fillRect(exposedRects.at(i), d->background);
never executed: painter.fillRect(exposedRects.at(i), d->background);
0
2314}
never executed: end of block
0
2315void QMdiArea::setupViewport(QWidget *viewport)-
2316{-
2317 QMdiAreaPrivate * const d = d_func();-
2318 if (viewport
viewportDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2319 viewport->setAttribute(Qt::WA_OpaquePaintEvent, d->background.isOpaque());
never executed: viewport->setAttribute(Qt::WA_OpaquePaintEvent, d->background.isOpaque());
0
2320 for (QForeachContainer<typename QtPrivate::remove_reference<decltype(d->childWindows)>::type> _container_((d->childWindows)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QMdiSubWindow *child = *_container_.i; _container_.control; _container_.control = 0) {-
2321 if (!sanityCheck(child, "QMdiArea::setupViewport")
!sanityCheck(c...etupViewport")Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2322 continue;
never executed: continue;
0
2323 child->setParent(viewport, child->windowFlags());-
2324 }
never executed: end of block
0
2325}
never executed: end of block
0
2326-
2327-
2328-
Switch to Source codePreprocessed file

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