Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/widgets/widgets/qmdiarea.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||
2 | - | |||||||||||||||||||
3 | - | |||||||||||||||||||
4 | - | |||||||||||||||||||
5 | - | |||||||||||||||||||
6 | - | |||||||||||||||||||
7 | - | |||||||||||||||||||
8 | - | |||||||||||||||||||
9 | - | |||||||||||||||||||
10 | - | |||||||||||||||||||
11 | - | |||||||||||||||||||
12 | using namespace QMdi; | - | ||||||||||||||||||
13 | - | |||||||||||||||||||
14 | - | |||||||||||||||||||
15 | static bool sanityCheck(const QMdiSubWindow * const child, const char *where) | - | ||||||||||||||||||
16 | { | - | ||||||||||||||||||
17 | if (!child
| 0 | ||||||||||||||||||
18 | const char error[] = "null pointer"; | - | ||||||||||||||||||
19 | ((!(false)) ? qt_assert_x(where, error,__FILE__,184) : qt_noop()); | - | ||||||||||||||||||
20 | QMessageLogger(__FILE__, 185, __PRETTY_FUNCTION__).warning("%s:%s", where, error); | - | ||||||||||||||||||
21 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||
22 | } | - | ||||||||||||||||||
23 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||||||||
24 | } | - | ||||||||||||||||||
25 | - | |||||||||||||||||||
26 | static bool sanityCheck(const QList<QWidget *> &widgets, const int index, const char *where) | - | ||||||||||||||||||
27 | { | - | ||||||||||||||||||
28 | if (index < 0
| 0 | ||||||||||||||||||
29 | const char error[] = "index out of range"; | - | ||||||||||||||||||
30 | ((!(false)) ? qt_assert_x(where, error,__FILE__,195) : qt_noop()); | - | ||||||||||||||||||
31 | QMessageLogger(__FILE__, 196, __PRETTY_FUNCTION__).warning("%s:%s", where, error); | - | ||||||||||||||||||
32 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||
33 | } | - | ||||||||||||||||||
34 | if (!widgets.at(index)
| 0 | ||||||||||||||||||
35 | const char error[] = "null pointer"; | - | ||||||||||||||||||
36 | ((!(false)) ? qt_assert_x(where, error,__FILE__,201) : qt_noop()); | - | ||||||||||||||||||
37 | QMessageLogger(__FILE__, 202, __PRETTY_FUNCTION__).warning("%s:%s", where, error); | - | ||||||||||||||||||
38 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||
39 | } | - | ||||||||||||||||||
40 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||||||||
41 | } | - | ||||||||||||||||||
42 | - | |||||||||||||||||||
43 | static void setIndex(int *index, int candidate, int min, int max, bool isIncreasing) | - | ||||||||||||||||||
44 | { | - | ||||||||||||||||||
45 | if (!index
| 0 | ||||||||||||||||||
46 | return; never executed: return; | 0 | ||||||||||||||||||
47 | - | |||||||||||||||||||
48 | if (isIncreasing
| 0 | ||||||||||||||||||
49 | if (candidate > max
| 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
| 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__,224) : qt_noop()); | - | ||||||||||||||||||
60 | } never executed: end of block | 0 | ||||||||||||||||||
61 | - | |||||||||||||||||||
62 | static inline bool useScrollBar(const QRect &childrenRect, const QSize &maxViewportSize, | - | ||||||||||||||||||
63 | Qt::Orientation orientation) | - | ||||||||||||||||||
64 | { | - | ||||||||||||||||||
65 | if (orientation == Qt::Horizontal
| 0 | ||||||||||||||||||
66 | return never executed: childrenRect.width() > maxViewportSize.width()return childrenRect.width() > maxViewportSize.width() || childrenRect.left() < 0 || childrenRect.right() >= 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: childrenRect.height() > maxViewportSize.height()return childrenRect.height() > maxViewportSize.height() || childrenRect.top() < 0 || childrenRect.bottom() >= 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 | - | |||||||||||||||||||
76 | static inline QMdiArea *mdiAreaParent(QWidget *widget) | - | ||||||||||||||||||
77 | { | - | ||||||||||||||||||
78 | if (!widget
| 0 | ||||||||||||||||||
79 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||
80 | - | |||||||||||||||||||
81 | QWidget *parent = widget->parentWidget(); | - | ||||||||||||||||||
82 | while (parent
| 0 | ||||||||||||||||||
83 | if (QMdiArea *area = qobject_cast<QMdiArea *>(parent)
| 0 | ||||||||||||||||||
84 | return never executed: area;return area; never executed: return area; | 0 | ||||||||||||||||||
85 | parent = parent->parentWidget(); | - | ||||||||||||||||||
86 | } never executed: end of block | 0 | ||||||||||||||||||
87 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||
88 | } | - | ||||||||||||||||||
89 | - | |||||||||||||||||||
90 | - | |||||||||||||||||||
91 | static inline QTabBar::Shape tabBarShapeFrom(QTabWidget::TabShape shape, QTabWidget::TabPosition position) | - | ||||||||||||||||||
92 | { | - | ||||||||||||||||||
93 | const bool rounded = (shape == QTabWidget::Rounded); | - | ||||||||||||||||||
94 | if (position == QTabWidget::North
| 0 | ||||||||||||||||||
95 | return never executed: roundedreturn rounded ? QTabBar::RoundedNorth : QTabBar::TriangularNorth;
never executed: return rounded ? QTabBar::RoundedNorth : QTabBar::TriangularNorth; | 0 | ||||||||||||||||||
96 | if (position == QTabWidget::South
| 0 | ||||||||||||||||||
97 | return never executed: roundedreturn rounded ? QTabBar::RoundedSouth : QTabBar::TriangularSouth;
never executed: return rounded ? QTabBar::RoundedSouth : QTabBar::TriangularSouth; | 0 | ||||||||||||||||||
98 | if (position == QTabWidget::East
| 0 | ||||||||||||||||||
99 | return never executed: roundedreturn rounded ? QTabBar::RoundedEast : QTabBar::TriangularEast;
never executed: return rounded ? QTabBar::RoundedEast : QTabBar::TriangularEast; | 0 | ||||||||||||||||||
100 | if (position == QTabWidget::West
| 0 | ||||||||||||||||||
101 | return never executed: roundedreturn rounded ? QTabBar::RoundedWest : QTabBar::TriangularWest;
never executed: return rounded ? QTabBar::RoundedWest : QTabBar::TriangularWest; | 0 | ||||||||||||||||||
102 | return never executed: QTabBar::RoundedNorth;return QTabBar::RoundedNorth; never executed: return QTabBar::RoundedNorth; | 0 | ||||||||||||||||||
103 | } | - | ||||||||||||||||||
104 | - | |||||||||||||||||||
105 | - | |||||||||||||||||||
106 | static inline QString tabTextFor(QMdiSubWindow *subWindow) | - | ||||||||||||||||||
107 | { | - | ||||||||||||||||||
108 | if (!subWindow
| 0 | ||||||||||||||||||
109 | return never executed: QString();return QString(); never executed: return QString(); | 0 | ||||||||||||||||||
110 | - | |||||||||||||||||||
111 | QString title = subWindow->windowTitle(); | - | ||||||||||||||||||
112 | if (subWindow->isWindowModified()
| 0 | ||||||||||||||||||
113 | title.replace(QLatin1String("[*]"), QLatin1String("*")); | - | ||||||||||||||||||
114 | } never executed: else {end of block | 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: title.isEmpty()return title.isEmpty() ? QMdiArea::tr("(Untitled)") : title;
never executed: return title.isEmpty() ? QMdiArea::tr("(Untitled)") : title; | 0 | ||||||||||||||||||
120 | } | - | ||||||||||||||||||
121 | - | |||||||||||||||||||
122 | - | |||||||||||||||||||
123 | - | |||||||||||||||||||
124 | - | |||||||||||||||||||
125 | void RegularTiler::rearrange(QList<QWidget *> &widgets, const QRect &domain) const | - | ||||||||||||||||||
126 | { | - | ||||||||||||||||||
127 | if (widgets.isEmpty()
| 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 = (
| 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
| 0 | ||||||||||||||||||
139 | const int y1 = int(row * (dy + 1)); | - | ||||||||||||||||||
140 | for (int col = 0; col < ncols
| 0 | ||||||||||||||||||
141 | if (row == 1
| 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
| 0 | ||||||||||||||||||
147 | y2 *= 2; | - | ||||||||||||||||||
148 | if (nrows != 2
| 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
| 0 | ||||||||||||||||||
154 | x2 = domain.right(); never executed: x2 = domain.right(); | 0 | ||||||||||||||||||
155 | if (row == nrows - 1
| 0 | ||||||||||||||||||
156 | y2 = domain.bottom(); never executed: y2 = domain.bottom(); | 0 | ||||||||||||||||||
157 | if (!sanityCheck(widgets, i, "RegularTiler")
| 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 | - | |||||||||||||||||||
169 | void SimpleCascader::rearrange(QList<QWidget *> &widgets, const QRect &domain) const | - | ||||||||||||||||||
170 | { | - | ||||||||||||||||||
171 | if (widgets.isEmpty()
| 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
| 0 | ||||||||||||||||||
195 | for (int col = 0; col < ncols
| 0 | ||||||||||||||||||
196 | const int x = leftOffset + row * dx + col * dcol; | - | ||||||||||||||||||
197 | const int y = topOffset + row * dy; | - | ||||||||||||||||||
198 | if (!sanityCheck(widgets, i, "SimpleCascader")
| 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
| 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 | - | |||||||||||||||||||
212 | void IconTiler::rearrange(QList<QWidget *> &widgets, const QRect &domain) const | - | ||||||||||||||||||
213 | { | - | ||||||||||||||||||
214 | if (widgets.isEmpty()
| 0 | ||||||||||||||||||
215 | return; never executed: return; | 0 | ||||||||||||||||||
216 | - | |||||||||||||||||||
217 | const int n = widgets.size(); | - | ||||||||||||||||||
218 | const int width = widgets.at(0)->width(); | - | ||||||||||||||||||
219 | const int height = widgets.at(0)->height(); | - | ||||||||||||||||||
220 | const int ncols = qMax(domain.width() / width, 1); | - | ||||||||||||||||||
221 | const int nrows = n / ncols + ((
| 0 | ||||||||||||||||||
222 | - | |||||||||||||||||||
223 | int i = 0; | - | ||||||||||||||||||
224 | for (int row = 0; row < nrows
| 0 | ||||||||||||||||||
225 | for (int col = 0; col < ncols
| 0 | ||||||||||||||||||
226 | const int x = col * width; | - | ||||||||||||||||||
227 | const int y = domain.height() - height - row * height; | - | ||||||||||||||||||
228 | if (!sanityCheck(widgets, i, "IconTiler")
| 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
| 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 | - | |||||||||||||||||||
244 | int MinOverlapPlacer::accumulatedOverlap(const QRect &source, const QVector<QRect> &rects) | - | ||||||||||||||||||
245 | { | - | ||||||||||||||||||
246 | int accOverlap = 0; | - | ||||||||||||||||||
247 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(rects)>::type> _container_((rects)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (const QRect &rect = *_container_.i; _container_.control; _container_.control = 0) { | - | ||||||||||||||||||
248 | QRect intersection = source.intersected(rect); | - | ||||||||||||||||||
249 | accOverlap += intersection.width() * intersection.height(); | - | ||||||||||||||||||
250 | } never executed: end of block | 0 | ||||||||||||||||||
251 | return never executed: accOverlap;return accOverlap; never executed: return accOverlap; | 0 | ||||||||||||||||||
252 | } | - | ||||||||||||||||||
253 | - | |||||||||||||||||||
254 | - | |||||||||||||||||||
255 | - | |||||||||||||||||||
256 | - | |||||||||||||||||||
257 | - | |||||||||||||||||||
258 | - | |||||||||||||||||||
259 | - | |||||||||||||||||||
260 | QRect MinOverlapPlacer::findMinOverlapRect(const QVector<QRect> &source, const QVector<QRect> &rects) | - | ||||||||||||||||||
261 | { | - | ||||||||||||||||||
262 | int minAccOverlap = -1; | - | ||||||||||||||||||
263 | QRect minAccOverlapRect; | - | ||||||||||||||||||
264 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(source)>::type> _container_((source)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (const QRect &srcRect = *_container_.i; _container_.control; _container_.control = 0) { | - | ||||||||||||||||||
265 | const int accOverlap = accumulatedOverlap(srcRect, rects); | - | ||||||||||||||||||
266 | if (accOverlap < minAccOverlap
| 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: minAccOverlapRect;return minAccOverlapRect; never executed: return minAccOverlapRect; | 0 | ||||||||||||||||||
272 | } | - | ||||||||||||||||||
273 | - | |||||||||||||||||||
274 | - | |||||||||||||||||||
275 | - | |||||||||||||||||||
276 | - | |||||||||||||||||||
277 | - | |||||||||||||||||||
278 | QVector<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
| 0 | ||||||||||||||||||
291 | ylist << domain.bottom() - size.height() + 1; never executed: ylist << domain.bottom() - size.height() + 1; | 0 | ||||||||||||||||||
292 | - | |||||||||||||||||||
293 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(rects)>::type> _container_((rects)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (const QRect &rect = *_container_.i; _container_.control; _container_.control = 0) { | - | ||||||||||||||||||
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: result;return result; never executed: return result; | 0 | ||||||||||||||||||
309 | } | - | ||||||||||||||||||
310 | - | |||||||||||||||||||
311 | - | |||||||||||||||||||
312 | - | |||||||||||||||||||
313 | - | |||||||||||||||||||
314 | - | |||||||||||||||||||
315 | - | |||||||||||||||||||
316 | QVector<QRect> MinOverlapPlacer::findNonInsiders(const QRect &domain, QVector<QRect> &source) | - | ||||||||||||||||||
317 | { | - | ||||||||||||||||||
318 | QVector<QRect> result; | - | ||||||||||||||||||
319 | result.reserve(source.size()); | - | ||||||||||||||||||
320 | - | |||||||||||||||||||
321 | QMutableVectorIterator<QRect> it(source); | - | ||||||||||||||||||
322 | while (it.hasNext()
| 0 | ||||||||||||||||||
323 | const QRect srcRect = it.next(); | - | ||||||||||||||||||
324 | if (!domain.contains(srcRect)
| 0 | ||||||||||||||||||
325 | result << srcRect; | - | ||||||||||||||||||
326 | it.remove(); | - | ||||||||||||||||||
327 | } never executed: end of block | 0 | ||||||||||||||||||
328 | } never executed: end of block | 0 | ||||||||||||||||||
329 | - | |||||||||||||||||||
330 | return never executed: result;return result; never executed: return result; | 0 | ||||||||||||||||||
331 | } | - | ||||||||||||||||||
332 | - | |||||||||||||||||||
333 | - | |||||||||||||||||||
334 | - | |||||||||||||||||||
335 | - | |||||||||||||||||||
336 | - | |||||||||||||||||||
337 | - | |||||||||||||||||||
338 | QVector<QRect> MinOverlapPlacer::findMaxOverlappers(const QRect &domain, const QVector<QRect> &source) | - | ||||||||||||||||||
339 | { | - | ||||||||||||||||||
340 | QVector<QRect> result; | - | ||||||||||||||||||
341 | result.reserve(source.size()); | - | ||||||||||||||||||
342 | - | |||||||||||||||||||
343 | int maxOverlap = -1; | - | ||||||||||||||||||
344 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(source)>::type> _container_((source)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (const QRect &srcRect = *_container_.i; _container_.control; _container_.control = 0) { | - | ||||||||||||||||||
345 | QRect intersection = domain.intersected(srcRect); | - | ||||||||||||||||||
346 | const int overlap = intersection.width() * intersection.height(); | - | ||||||||||||||||||
347 | if (overlap >= maxOverlap
| 0 | ||||||||||||||||||
348 | if (overlap > maxOverlap
| 0 | ||||||||||||||||||
349 | maxOverlap = overlap; | - | ||||||||||||||||||
350 | result.clear(); | - | ||||||||||||||||||
351 | } never executed: end of block | 0 | ||||||||||||||||||
352 | result << srcRect; | - | ||||||||||||||||||
353 | } never executed: end of block | 0 | ||||||||||||||||||
354 | } never executed: end of block | 0 | ||||||||||||||||||
355 | - | |||||||||||||||||||
356 | return never executed: result;return result; never executed: return result; | 0 | ||||||||||||||||||
357 | } | - | ||||||||||||||||||
358 | - | |||||||||||||||||||
359 | - | |||||||||||||||||||
360 | - | |||||||||||||||||||
361 | - | |||||||||||||||||||
362 | - | |||||||||||||||||||
363 | - | |||||||||||||||||||
364 | - | |||||||||||||||||||
365 | QPoint MinOverlapPlacer::findBestPlacement(const QRect &domain, const QVector<QRect> &rects, | - | ||||||||||||||||||
366 | QVector<QRect> &source) | - | ||||||||||||||||||
367 | { | - | ||||||||||||||||||
368 | const QVector<QRect> nonInsiders = findNonInsiders(domain, source); | - | ||||||||||||||||||
369 | - | |||||||||||||||||||
370 | if (!source.empty()
| 0 | ||||||||||||||||||
371 | return never executed: findMinOverlapRect(source, rects).topLeft();return findMinOverlapRect(source, rects).topLeft(); never executed: return findMinOverlapRect(source, rects).topLeft(); | 0 | ||||||||||||||||||
372 | - | |||||||||||||||||||
373 | QVector<QRect> maxOverlappers = findMaxOverlappers(domain, nonInsiders); | - | ||||||||||||||||||
374 | return never executed: findMinOverlapRect(maxOverlappers, rects).topLeft();return findMinOverlapRect(maxOverlappers, rects).topLeft(); never executed: return findMinOverlapRect(maxOverlappers, rects).topLeft(); | 0 | ||||||||||||||||||
375 | } | - | ||||||||||||||||||
376 | QPoint MinOverlapPlacer::place(const QSize &size, const QVector<QRect> &rects, | - | ||||||||||||||||||
377 | const QRect &domain) const | - | ||||||||||||||||||
378 | { | - | ||||||||||||||||||
379 | if (size.isEmpty()
| 0 | ||||||||||||||||||
380 | return never executed: QPoint();return QPoint(); never executed: return QPoint(); | 0 | ||||||||||||||||||
381 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(rects)>::type> _container_((rects)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (const QRect &rect = *_container_.i; _container_.control; _container_.control = 0) { | - | ||||||||||||||||||
382 | if (!rect.isValid()
| 0 | ||||||||||||||||||
383 | return never executed: QPoint();return QPoint(); never executed: return QPoint(); | 0 | ||||||||||||||||||
384 | } never executed: end of block | 0 | ||||||||||||||||||
385 | - | |||||||||||||||||||
386 | QVector<QRect> candidates = getCandidatePlacements(size, rects, domain); | - | ||||||||||||||||||
387 | return never executed: findBestPlacement(domain, rects, candidates);return findBestPlacement(domain, rects, candidates); never executed: return findBestPlacement(domain, rects, candidates); | 0 | ||||||||||||||||||
388 | } | - | ||||||||||||||||||
389 | - | |||||||||||||||||||
390 | - | |||||||||||||||||||
391 | class QMdiAreaTabBar : public QTabBar | - | ||||||||||||||||||
392 | { | - | ||||||||||||||||||
393 | public: | - | ||||||||||||||||||
394 | QMdiAreaTabBar(QWidget *parent) : QTabBar(parent) {} never executed: end of block | 0 | ||||||||||||||||||
395 | - | |||||||||||||||||||
396 | protected: | - | ||||||||||||||||||
397 | void mousePressEvent(QMouseEvent *event) override; | - | ||||||||||||||||||
398 | - | |||||||||||||||||||
399 | void contextMenuEvent(QContextMenuEvent *event) override; | - | ||||||||||||||||||
400 | - | |||||||||||||||||||
401 | - | |||||||||||||||||||
402 | private: | - | ||||||||||||||||||
403 | QMdiSubWindow *subWindowFromIndex(int index) const; | - | ||||||||||||||||||
404 | }; | - | ||||||||||||||||||
405 | - | |||||||||||||||||||
406 | - | |||||||||||||||||||
407 | - | |||||||||||||||||||
408 | - | |||||||||||||||||||
409 | void QMdiAreaTabBar::mousePressEvent(QMouseEvent *event) | - | ||||||||||||||||||
410 | { | - | ||||||||||||||||||
411 | if (event->button() != Qt::MidButton
| 0 | ||||||||||||||||||
412 | QTabBar::mousePressEvent(event); | - | ||||||||||||||||||
413 | return; never executed: return; | 0 | ||||||||||||||||||
414 | } | - | ||||||||||||||||||
415 | - | |||||||||||||||||||
416 | QMdiSubWindow *subWindow = subWindowFromIndex(tabAt(event->pos())); | - | ||||||||||||||||||
417 | if (!subWindow
| 0 | ||||||||||||||||||
418 | event->ignore(); | - | ||||||||||||||||||
419 | return; never executed: return; | 0 | ||||||||||||||||||
420 | } | - | ||||||||||||||||||
421 | - | |||||||||||||||||||
422 | subWindow->close(); | - | ||||||||||||||||||
423 | } never executed: end of block | 0 | ||||||||||||||||||
424 | - | |||||||||||||||||||
425 | - | |||||||||||||||||||
426 | - | |||||||||||||||||||
427 | - | |||||||||||||||||||
428 | - | |||||||||||||||||||
429 | void QMdiAreaTabBar::contextMenuEvent(QContextMenuEvent *event) | - | ||||||||||||||||||
430 | { | - | ||||||||||||||||||
431 | QPointer<QMdiSubWindow> subWindow = subWindowFromIndex(tabAt(event->pos())); | - | ||||||||||||||||||
432 | if (!subWindow
| 0 | ||||||||||||||||||
433 | event->ignore(); | - | ||||||||||||||||||
434 | return; never executed: return; | 0 | ||||||||||||||||||
435 | } | - | ||||||||||||||||||
436 | - | |||||||||||||||||||
437 | - | |||||||||||||||||||
438 | QMdiSubWindowPrivate *subWindowPrivate = subWindow->d_func(); | - | ||||||||||||||||||
439 | if (!subWindowPrivate->systemMenu
| 0 | ||||||||||||||||||
440 | event->ignore(); | - | ||||||||||||||||||
441 | return; never executed: return; | 0 | ||||||||||||||||||
442 | } | - | ||||||||||||||||||
443 | - | |||||||||||||||||||
444 | QMdiSubWindow *currentSubWindow = subWindowFromIndex(currentIndex()); | - | ||||||||||||||||||
445 | ((!(currentSubWindow)) ? qt_assert("currentSubWindow",__FILE__,618) : qt_noop()); | - | ||||||||||||||||||
446 | - | |||||||||||||||||||
447 | - | |||||||||||||||||||
448 | - | |||||||||||||||||||
449 | if (currentSubWindow->isMaximized()
| 0 | ||||||||||||||||||
450 | subWindowPrivate->setVisible(QMdiSubWindowPrivate::MoveAction, false); | - | ||||||||||||||||||
451 | subWindowPrivate->setVisible(QMdiSubWindowPrivate::ResizeAction, false); | - | ||||||||||||||||||
452 | subWindowPrivate->setVisible(QMdiSubWindowPrivate::MinimizeAction, false); | - | ||||||||||||||||||
453 | subWindowPrivate->setVisible(QMdiSubWindowPrivate::MaximizeAction, false); | - | ||||||||||||||||||
454 | subWindowPrivate->setVisible(QMdiSubWindowPrivate::RestoreAction, false); | - | ||||||||||||||||||
455 | subWindowPrivate->setVisible(QMdiSubWindowPrivate::StayOnTopAction, false); | - | ||||||||||||||||||
456 | } never executed: end of block | 0 | ||||||||||||||||||
457 | - | |||||||||||||||||||
458 | - | |||||||||||||||||||
459 | subWindowPrivate->systemMenu->exec(event->globalPos()); | - | ||||||||||||||||||
460 | if (!subWindow
| 0 | ||||||||||||||||||
461 | return; never executed: return; | 0 | ||||||||||||||||||
462 | - | |||||||||||||||||||
463 | - | |||||||||||||||||||
464 | subWindowPrivate->updateActions(); | - | ||||||||||||||||||
465 | - | |||||||||||||||||||
466 | } never executed: end of block | 0 | ||||||||||||||||||
467 | - | |||||||||||||||||||
468 | - | |||||||||||||||||||
469 | - | |||||||||||||||||||
470 | - | |||||||||||||||||||
471 | - | |||||||||||||||||||
472 | QMdiSubWindow *QMdiAreaTabBar::subWindowFromIndex(int index) const | - | ||||||||||||||||||
473 | { | - | ||||||||||||||||||
474 | if (index < 0
| 0 | ||||||||||||||||||
475 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||
476 | - | |||||||||||||||||||
477 | QMdiArea *mdiArea = qobject_cast<QMdiArea *>(parentWidget()); | - | ||||||||||||||||||
478 | ((!(mdiArea)) ? qt_assert("mdiArea",__FILE__,651) : qt_noop()); | - | ||||||||||||||||||
479 | - | |||||||||||||||||||
480 | const QList<QMdiSubWindow *> subWindows = mdiArea->subWindowList(); | - | ||||||||||||||||||
481 | ((!(index < subWindows.size())) ? qt_assert("index < subWindows.size()",__FILE__,654) : qt_noop()); | - | ||||||||||||||||||
482 | - | |||||||||||||||||||
483 | QMdiSubWindow *subWindow = mdiArea->subWindowList().at(index); | - | ||||||||||||||||||
484 | ((!(subWindow)) ? qt_assert("subWindow",__FILE__,657) : qt_noop()); | - | ||||||||||||||||||
485 | - | |||||||||||||||||||
486 | return never executed: subWindow;return subWindow; never executed: return subWindow; | 0 | ||||||||||||||||||
487 | } | - | ||||||||||||||||||
488 | - | |||||||||||||||||||
489 | - | |||||||||||||||||||
490 | - | |||||||||||||||||||
491 | - | |||||||||||||||||||
492 | - | |||||||||||||||||||
493 | QMdiAreaPrivate::QMdiAreaPrivate() | - | ||||||||||||||||||
494 | : cascader(0), | - | ||||||||||||||||||
495 | regularTiler(0), | - | ||||||||||||||||||
496 | iconTiler(0), | - | ||||||||||||||||||
497 | placer(0), | - | ||||||||||||||||||
498 | - | |||||||||||||||||||
499 | rubberBand(0), | - | ||||||||||||||||||
500 | - | |||||||||||||||||||
501 | - | |||||||||||||||||||
502 | tabBar(0), | - | ||||||||||||||||||
503 | - | |||||||||||||||||||
504 | activationOrder(QMdiArea::CreationOrder), | - | ||||||||||||||||||
505 | viewMode(QMdiArea::SubWindowView), | - | ||||||||||||||||||
506 | - | |||||||||||||||||||
507 | documentMode(false), | - | ||||||||||||||||||
508 | tabsClosable(false), | - | ||||||||||||||||||
509 | tabsMovable(false), | - | ||||||||||||||||||
510 | - | |||||||||||||||||||
511 | - | |||||||||||||||||||
512 | tabShape(QTabWidget::Rounded), | - | ||||||||||||||||||
513 | tabPosition(QTabWidget::North), | - | ||||||||||||||||||
514 | - | |||||||||||||||||||
515 | ignoreGeometryChange(false), | - | ||||||||||||||||||
516 | ignoreWindowStateChange(false), | - | ||||||||||||||||||
517 | isActivated(false), | - | ||||||||||||||||||
518 | isSubWindowsTiled(false), | - | ||||||||||||||||||
519 | showActiveWindowMaximized(false), | - | ||||||||||||||||||
520 | tileCalledFromResizeEvent(false), | - | ||||||||||||||||||
521 | updatesDisabledByUs(false), | - | ||||||||||||||||||
522 | inViewModeChange(false), | - | ||||||||||||||||||
523 | indexToNextWindow(-1), | - | ||||||||||||||||||
524 | indexToPreviousWindow(-1), | - | ||||||||||||||||||
525 | indexToHighlighted(-1), | - | ||||||||||||||||||
526 | indexToLastActiveTab(-1), | - | ||||||||||||||||||
527 | resizeTimerId(-1), | - | ||||||||||||||||||
528 | tabToPreviousTimerId(-1) | - | ||||||||||||||||||
529 | { | - | ||||||||||||||||||
530 | } never executed: end of block | 0 | ||||||||||||||||||
531 | - | |||||||||||||||||||
532 | - | |||||||||||||||||||
533 | - | |||||||||||||||||||
534 | - | |||||||||||||||||||
535 | void QMdiAreaPrivate::_q_deactivateAllWindows(QMdiSubWindow *aboutToActivate) | - | ||||||||||||||||||
536 | { | - | ||||||||||||||||||
537 | if (ignoreWindowStateChange
| 0 | ||||||||||||||||||
538 | return; never executed: return; | 0 | ||||||||||||||||||
539 | - | |||||||||||||||||||
540 | QMdiArea * const q = q_func(); | - | ||||||||||||||||||
541 | if (!aboutToActivate
| 0 | ||||||||||||||||||
542 | aboutToBecomeActive = qobject_cast<QMdiSubWindow *>(q->sender()); never executed: aboutToBecomeActive = qobject_cast<QMdiSubWindow *>(q->sender()); | 0 | ||||||||||||||||||
543 | else | - | ||||||||||||||||||
544 | aboutToBecomeActive = aboutToActivate; never executed: aboutToBecomeActive = aboutToActivate; | 0 | ||||||||||||||||||
545 | ((!(aboutToBecomeActive)) ? qt_assert("aboutToBecomeActive",__FILE__,718) : qt_noop()); | - | ||||||||||||||||||
546 | - | |||||||||||||||||||
547 | 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) { | - | ||||||||||||||||||
548 | if (!sanityCheck(child, "QMdiArea::deactivateAllWindows")
| 0 | ||||||||||||||||||
549 | continue; never executed: continue; | 0 | ||||||||||||||||||
550 | - | |||||||||||||||||||
551 | ignoreWindowStateChange = true; | - | ||||||||||||||||||
552 | if(!(options & QMdiArea::DontMaximizeSubWindowOnActivation)
| 0 | ||||||||||||||||||
553 | showActiveWindowMaximized = child->isMaximized()
never executed: showActiveWindowMaximized = child->isMaximized() && child->isVisible(); | 0 | ||||||||||||||||||
554 | if (showActiveWindowMaximized
| 0 | ||||||||||||||||||
555 | if (q->updatesEnabled()
| 0 | ||||||||||||||||||
556 | updatesDisabledByUs = true; | - | ||||||||||||||||||
557 | q->setUpdatesEnabled(false); | - | ||||||||||||||||||
558 | } never executed: end of block | 0 | ||||||||||||||||||
559 | child->showNormal(); | - | ||||||||||||||||||
560 | } never executed: end of block | 0 | ||||||||||||||||||
561 | if (child->isMinimized()
| 0 | ||||||||||||||||||
562 | child->lower(); never executed: child->lower(); | 0 | ||||||||||||||||||
563 | ignoreWindowStateChange = false; | - | ||||||||||||||||||
564 | child->d_func()->setActive(false); | - | ||||||||||||||||||
565 | } never executed: end of block | 0 | ||||||||||||||||||
566 | } never executed: end of block | 0 | ||||||||||||||||||
567 | - | |||||||||||||||||||
568 | - | |||||||||||||||||||
569 | - | |||||||||||||||||||
570 | - | |||||||||||||||||||
571 | void QMdiAreaPrivate::_q_processWindowStateChanged(Qt::WindowStates oldState, | - | ||||||||||||||||||
572 | Qt::WindowStates newState) | - | ||||||||||||||||||
573 | { | - | ||||||||||||||||||
574 | if (ignoreWindowStateChange
| 0 | ||||||||||||||||||
575 | return; never executed: return; | 0 | ||||||||||||||||||
576 | - | |||||||||||||||||||
577 | QMdiArea * const q = q_func(); | - | ||||||||||||||||||
578 | QMdiSubWindow *child = qobject_cast<QMdiSubWindow *>(q->sender()); | - | ||||||||||||||||||
579 | if (!child
| 0 | ||||||||||||||||||
580 | return; never executed: return; | 0 | ||||||||||||||||||
581 | - | |||||||||||||||||||
582 | - | |||||||||||||||||||
583 | if (!(oldState & Qt::WindowActive)
| 0 | ||||||||||||||||||
584 | emitWindowActivated(child); never executed: emitWindowActivated(child); | 0 | ||||||||||||||||||
585 | - | |||||||||||||||||||
586 | else if ((
| 0 | ||||||||||||||||||
587 | resetActiveWindow(child); never executed: resetActiveWindow(child); | 0 | ||||||||||||||||||
588 | - | |||||||||||||||||||
589 | - | |||||||||||||||||||
590 | if (!(oldState & Qt::WindowMinimized)
| 0 | ||||||||||||||||||
591 | isSubWindowsTiled = false; | - | ||||||||||||||||||
592 | arrangeMinimizedSubWindows(); | - | ||||||||||||||||||
593 | - | |||||||||||||||||||
594 | } never executed: else if (!(oldState & Qt::WindowMaximized)end of block
| 0 | ||||||||||||||||||
595 | internalRaise(child); | - | ||||||||||||||||||
596 | - | |||||||||||||||||||
597 | } never executed: else if (!(newState & (Qt::WindowMaximized | Qt::WindowMinimized))end of block
| 0 | ||||||||||||||||||
598 | internalRaise(child); | - | ||||||||||||||||||
599 | if (oldState & Qt::WindowMinimized
| 0 | ||||||||||||||||||
600 | arrangeMinimizedSubWindows(); never executed: arrangeMinimizedSubWindows(); | 0 | ||||||||||||||||||
601 | } never executed: end of block | 0 | ||||||||||||||||||
602 | } never executed: end of block | 0 | ||||||||||||||||||
603 | - | |||||||||||||||||||
604 | void QMdiAreaPrivate::_q_currentTabChanged(int index) | - | ||||||||||||||||||
605 | { | - | ||||||||||||||||||
606 | - | |||||||||||||||||||
607 | - | |||||||||||||||||||
608 | - | |||||||||||||||||||
609 | if (!tabBar
| 0 | ||||||||||||||||||
610 | return; never executed: return; | 0 | ||||||||||||||||||
611 | - | |||||||||||||||||||
612 | - | |||||||||||||||||||
613 | if (indexToLastActiveTab >= 0
| 0 | ||||||||||||||||||
614 | && indexToLastActiveTab < childWindows.count()
| 0 | ||||||||||||||||||
615 | QMdiSubWindow *lastActive = childWindows.at(indexToLastActiveTab); | - | ||||||||||||||||||
616 | if (lastActive
| 0 | ||||||||||||||||||
617 | tabBar->setTabEnabled(indexToLastActiveTab, false); never executed: tabBar->setTabEnabled(indexToLastActiveTab, false); | 0 | ||||||||||||||||||
618 | } never executed: end of block | 0 | ||||||||||||||||||
619 | - | |||||||||||||||||||
620 | indexToLastActiveTab = index; | - | ||||||||||||||||||
621 | ((!(childWindows.size() > index)) ? qt_assert("childWindows.size() > index",__FILE__,794) : qt_noop()); | - | ||||||||||||||||||
622 | QMdiSubWindow *subWindow = childWindows.at(index); | - | ||||||||||||||||||
623 | ((!(subWindow)) ? qt_assert("subWindow",__FILE__,796) : qt_noop()); | - | ||||||||||||||||||
624 | activateWindow(subWindow); | - | ||||||||||||||||||
625 | - | |||||||||||||||||||
626 | } never executed: end of block | 0 | ||||||||||||||||||
627 | - | |||||||||||||||||||
628 | void QMdiAreaPrivate::_q_closeTab(int index) | - | ||||||||||||||||||
629 | { | - | ||||||||||||||||||
630 | - | |||||||||||||||||||
631 | - | |||||||||||||||||||
632 | - | |||||||||||||||||||
633 | QMdiSubWindow *subWindow = childWindows.at(index); | - | ||||||||||||||||||
634 | ((!(subWindow)) ? qt_assert("subWindow",__FILE__,807) : qt_noop()); | - | ||||||||||||||||||
635 | subWindow->close(); | - | ||||||||||||||||||
636 | - | |||||||||||||||||||
637 | } never executed: end of block | 0 | ||||||||||||||||||
638 | - | |||||||||||||||||||
639 | void QMdiAreaPrivate::_q_moveTab(int from, int to) | - | ||||||||||||||||||
640 | { | - | ||||||||||||||||||
641 | - | |||||||||||||||||||
642 | - | |||||||||||||||||||
643 | - | |||||||||||||||||||
644 | - | |||||||||||||||||||
645 | childWindows.move(from, to); | - | ||||||||||||||||||
646 | - | |||||||||||||||||||
647 | } never executed: end of block | 0 | ||||||||||||||||||
648 | - | |||||||||||||||||||
649 | - | |||||||||||||||||||
650 | - | |||||||||||||||||||
651 | - | |||||||||||||||||||
652 | void QMdiAreaPrivate::appendChild(QMdiSubWindow *child) | - | ||||||||||||||||||
653 | { | - | ||||||||||||||||||
654 | QMdiArea * const q = q_func(); | - | ||||||||||||||||||
655 | ((!(child && childWindows.indexOf(child) == -1)) ? qt_assert("child && childWindows.indexOf(child) == -1",__FILE__,828) : qt_noop()); | - | ||||||||||||||||||
656 | - | |||||||||||||||||||
657 | if (child->parent() != viewport
| 0 | ||||||||||||||||||
658 | child->setParent(viewport, child->windowFlags()); never executed: child->setParent(viewport, child->windowFlags()); | 0 | ||||||||||||||||||
659 | childWindows.append(QPointer<QMdiSubWindow>(child)); | - | ||||||||||||||||||
660 | - | |||||||||||||||||||
661 | if (!child->testAttribute(Qt::WA_Resized)
| 0 | ||||||||||||||||||
662 | QSize newSize(child->sizeHint().boundedTo(viewport->size())); | - | ||||||||||||||||||
663 | child->resize(newSize.expandedTo(qSmartMinSize(child))); | - | ||||||||||||||||||
664 | } never executed: end of block | 0 | ||||||||||||||||||
665 | - | |||||||||||||||||||
666 | if (!placer
| 0 | ||||||||||||||||||
667 | placer = new MinOverlapPlacer; never executed: placer = new MinOverlapPlacer; | 0 | ||||||||||||||||||
668 | place(placer, child); | - | ||||||||||||||||||
669 | - | |||||||||||||||||||
670 | if (hbarpolicy != Qt::ScrollBarAlwaysOff
| 0 | ||||||||||||||||||
671 | child->setOption(QMdiSubWindow::AllowOutsideAreaHorizontally, true); never executed: child->setOption(QMdiSubWindow::AllowOutsideAreaHorizontally, true); | 0 | ||||||||||||||||||
672 | else | - | ||||||||||||||||||
673 | child->setOption(QMdiSubWindow::AllowOutsideAreaHorizontally, false); never executed: child->setOption(QMdiSubWindow::AllowOutsideAreaHorizontally, false); | 0 | ||||||||||||||||||
674 | - | |||||||||||||||||||
675 | if (vbarpolicy != Qt::ScrollBarAlwaysOff
| 0 | ||||||||||||||||||
676 | child->setOption(QMdiSubWindow::AllowOutsideAreaVertically, true); never executed: child->setOption(QMdiSubWindow::AllowOutsideAreaVertically, true); | 0 | ||||||||||||||||||
677 | else | - | ||||||||||||||||||
678 | child->setOption(QMdiSubWindow::AllowOutsideAreaVertically, false); never executed: child->setOption(QMdiSubWindow::AllowOutsideAreaVertically, false); | 0 | ||||||||||||||||||
679 | - | |||||||||||||||||||
680 | internalRaise(child); | - | ||||||||||||||||||
681 | indicesToActivatedChildren.prepend(childWindows.size() - 1); | - | ||||||||||||||||||
682 | ((!(indicesToActivatedChildren.size() == childWindows.size())) ? qt_assert("indicesToActivatedChildren.size() == childWindows.size()",__FILE__,855) : qt_noop()); | - | ||||||||||||||||||
683 | - | |||||||||||||||||||
684 | - | |||||||||||||||||||
685 | if (tabBar
| 0 | ||||||||||||||||||
686 | tabBar->addTab(child->windowIcon(), tabTextFor(child)); | - | ||||||||||||||||||
687 | updateTabBarGeometry(); | - | ||||||||||||||||||
688 | if (childWindows.count() == 1
| 0 | ||||||||||||||||||
689 | showActiveWindowMaximized = true; never executed: showActiveWindowMaximized = true; | 0 | ||||||||||||||||||
690 | } never executed: end of block | 0 | ||||||||||||||||||
691 | - | |||||||||||||||||||
692 | - | |||||||||||||||||||
693 | if (!(child->windowFlags() & Qt::SubWindow)
| 0 | ||||||||||||||||||
694 | child->setWindowFlags(Qt::SubWindow); never executed: child->setWindowFlags(Qt::SubWindow); | 0 | ||||||||||||||||||
695 | child->installEventFilter(q); | - | ||||||||||||||||||
696 | - | |||||||||||||||||||
697 | QObject::connect(child, qFlagLocation("2""aboutToActivate()" "\0" __FILE__ ":" "870"), q, qFlagLocation("1""_q_deactivateAllWindows()" "\0" __FILE__ ":" "870")); | - | ||||||||||||||||||
698 | QObject::connect(child, qFlagLocation("2""windowStateChanged(Qt::WindowStates,Qt::WindowStates)" "\0" __FILE__ ":" "871"), | - | ||||||||||||||||||
699 | q, qFlagLocation("1""_q_processWindowStateChanged(Qt::WindowStates,Qt::WindowStates)" "\0" __FILE__ ":" "872")); | - | ||||||||||||||||||
700 | } never executed: end of block | 0 | ||||||||||||||||||
701 | - | |||||||||||||||||||
702 | - | |||||||||||||||||||
703 | - | |||||||||||||||||||
704 | - | |||||||||||||||||||
705 | void QMdiAreaPrivate::place(Placer *placer, QMdiSubWindow *child) | - | ||||||||||||||||||
706 | { | - | ||||||||||||||||||
707 | if (!placer
| 0 | ||||||||||||||||||
708 | return; never executed: return; | 0 | ||||||||||||||||||
709 | - | |||||||||||||||||||
710 | QMdiArea * const q = q_func(); | - | ||||||||||||||||||
711 | if (!q->isVisible()
| 0 | ||||||||||||||||||
712 | - | |||||||||||||||||||
713 | - | |||||||||||||||||||
714 | - | |||||||||||||||||||
715 | pendingPlacements.append(child); | - | ||||||||||||||||||
716 | return; never executed: return; | 0 | ||||||||||||||||||
717 | } | - | ||||||||||||||||||
718 | - | |||||||||||||||||||
719 | QVector<QRect> rects; | - | ||||||||||||||||||
720 | rects.reserve(childWindows.size()); | - | ||||||||||||||||||
721 | QRect parentRect = q->rect(); | - | ||||||||||||||||||
722 | 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) { | - | ||||||||||||||||||
723 | if (!sanityCheck(window, "QMdiArea::place")
| 0 | ||||||||||||||||||
724 | || !window->testAttribute(Qt::WA_Moved)
| 0 | ||||||||||||||||||
725 | continue; never executed: continue; | 0 | ||||||||||||||||||
726 | } | - | ||||||||||||||||||
727 | QRect occupiedGeometry; | - | ||||||||||||||||||
728 | if (window->isMaximized()
| 0 | ||||||||||||||||||
729 | occupiedGeometry = QRect(window->d_func()->oldGeometry.topLeft(), | - | ||||||||||||||||||
730 | window->d_func()->restoreSize); | - | ||||||||||||||||||
731 | } never executed: else {end of block | 0 | ||||||||||||||||||
732 | occupiedGeometry = window->geometry(); | - | ||||||||||||||||||
733 | } never executed: end of block | 0 | ||||||||||||||||||
734 | rects.append(QStyle::visualRect(child->layoutDirection(), parentRect, occupiedGeometry)); | - | ||||||||||||||||||
735 | } never executed: end of block | 0 | ||||||||||||||||||
736 | QPoint newPos = placer->place(child->size(), rects, parentRect); | - | ||||||||||||||||||
737 | QRect newGeometry = QRect(newPos.x(), newPos.y(), child->width(), child->height()); | - | ||||||||||||||||||
738 | child->setGeometry(QStyle::visualRect(child->layoutDirection(), parentRect, newGeometry)); | - | ||||||||||||||||||
739 | } never executed: end of block | 0 | ||||||||||||||||||
740 | - | |||||||||||||||||||
741 | - | |||||||||||||||||||
742 | - | |||||||||||||||||||
743 | - | |||||||||||||||||||
744 | void QMdiAreaPrivate::rearrange(Rearranger *rearranger) | - | ||||||||||||||||||
745 | { | - | ||||||||||||||||||
746 | if (!rearranger
| 0 | ||||||||||||||||||
747 | return; never executed: return; | 0 | ||||||||||||||||||
748 | - | |||||||||||||||||||
749 | QMdiArea * const q = q_func(); | - | ||||||||||||||||||
750 | if (!q->isVisible()
| 0 | ||||||||||||||||||
751 | - | |||||||||||||||||||
752 | int index = pendingRearrangements.indexOf(rearranger); | - | ||||||||||||||||||
753 | if (index != -1
| 0 | ||||||||||||||||||
754 | pendingRearrangements.move(index, pendingRearrangements.size() - 1); never executed: pendingRearrangements.move(index, pendingRearrangements.size() - 1); | 0 | ||||||||||||||||||
755 | else | - | ||||||||||||||||||
756 | pendingRearrangements.append(rearranger); never executed: pendingRearrangements.append(rearranger); | 0 | ||||||||||||||||||
757 | return; never executed: return; | 0 | ||||||||||||||||||
758 | } | - | ||||||||||||||||||
759 | - | |||||||||||||||||||
760 | QList<QWidget *> widgets; | - | ||||||||||||||||||
761 | const bool reverseList = rearranger->type() == Rearranger::RegularTiler; | - | ||||||||||||||||||
762 | const QList<QMdiSubWindow *> subWindows = subWindowList(activationOrder, reverseList); | - | ||||||||||||||||||
763 | QSize minSubWindowSize; | - | ||||||||||||||||||
764 | 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) { | - | ||||||||||||||||||
765 | if (!sanityCheck(child, "QMdiArea::rearrange")
| 0 | ||||||||||||||||||
766 | continue; never executed: continue; | 0 | ||||||||||||||||||
767 | if (rearranger->type() == Rearranger::IconTiler
| 0 | ||||||||||||||||||
768 | if (child->isMinimized()
| 0 | ||||||||||||||||||
769 | widgets.append(child); never executed: widgets.append(child); | 0 | ||||||||||||||||||
770 | } never executed: else {end of block | 0 | ||||||||||||||||||
771 | if (child->isMinimized()
| 0 | ||||||||||||||||||
772 | continue; never executed: continue; | 0 | ||||||||||||||||||
773 | if (child->isMaximized()
| 0 | ||||||||||||||||||
774 | child->showNormal(); never executed: child->showNormal(); | 0 | ||||||||||||||||||
775 | minSubWindowSize = minSubWindowSize.expandedTo(child->minimumSize()) | - | ||||||||||||||||||
776 | .expandedTo(child->d_func()->internalMinimumSize); | - | ||||||||||||||||||
777 | widgets.append(child); | - | ||||||||||||||||||
778 | } never executed: end of block | 0 | ||||||||||||||||||
779 | } | - | ||||||||||||||||||
780 | - | |||||||||||||||||||
781 | if (active
| 0 | ||||||||||||||||||
782 | - | |||||||||||||||||||
783 | - | |||||||||||||||||||
784 | int indexToActive = widgets.indexOf((QWidget *)active); | - | ||||||||||||||||||
785 | if (indexToActive > 0
| 0 | ||||||||||||||||||
786 | widgets.move(indexToActive, 0); never executed: widgets.move(indexToActive, 0); | 0 | ||||||||||||||||||
787 | } never executed: end of block | 0 | ||||||||||||||||||
788 | - | |||||||||||||||||||
789 | QRect domain = viewport->rect(); | - | ||||||||||||||||||
790 | if (rearranger->type() == Rearranger::RegularTiler
| 0 | ||||||||||||||||||
791 | domain = resizeToMinimumTileSize(minSubWindowSize, widgets.count()); never executed: domain = resizeToMinimumTileSize(minSubWindowSize, widgets.count()); | 0 | ||||||||||||||||||
792 | - | |||||||||||||||||||
793 | rearranger->rearrange(widgets, domain); | - | ||||||||||||||||||
794 | - | |||||||||||||||||||
795 | if (rearranger->type() == Rearranger::RegularTiler
| 0 | ||||||||||||||||||
796 | isSubWindowsTiled = true; | - | ||||||||||||||||||
797 | updateScrollBars(); | - | ||||||||||||||||||
798 | } never executed: else if (rearranger->type() == Rearranger::SimpleCascaderend of block
| 0 | ||||||||||||||||||
799 | isSubWindowsTiled = false; | - | ||||||||||||||||||
800 | } never executed: end of block | 0 | ||||||||||||||||||
801 | } never executed: end of block | 0 | ||||||||||||||||||
802 | - | |||||||||||||||||||
803 | - | |||||||||||||||||||
804 | - | |||||||||||||||||||
805 | - | |||||||||||||||||||
806 | - | |||||||||||||||||||
807 | - | |||||||||||||||||||
808 | void QMdiAreaPrivate::arrangeMinimizedSubWindows() | - | ||||||||||||||||||
809 | { | - | ||||||||||||||||||
810 | if (!iconTiler
| 0 | ||||||||||||||||||
811 | iconTiler = new IconTiler; never executed: iconTiler = new IconTiler; | 0 | ||||||||||||||||||
812 | rearrange(iconTiler); | - | ||||||||||||||||||
813 | } never executed: end of block | 0 | ||||||||||||||||||
814 | - | |||||||||||||||||||
815 | - | |||||||||||||||||||
816 | - | |||||||||||||||||||
817 | - | |||||||||||||||||||
818 | void QMdiAreaPrivate::activateWindow(QMdiSubWindow *child) | - | ||||||||||||||||||
819 | { | - | ||||||||||||||||||
820 | if (childWindows.isEmpty()
| 0 | ||||||||||||||||||
821 | ((!(!child)) ? qt_assert("!child",__FILE__,994) : qt_noop()); | - | ||||||||||||||||||
822 | ((!(!active)) ? qt_assert("!active",__FILE__,995) : qt_noop()); | - | ||||||||||||||||||
823 | return; never executed: return; | 0 | ||||||||||||||||||
824 | } | - | ||||||||||||||||||
825 | - | |||||||||||||||||||
826 | if (!child
| 0 | ||||||||||||||||||
827 | if (active
| 0 | ||||||||||||||||||
828 | ((!(active->d_func()->isActive)) ? qt_assert("active->d_func()->isActive",__FILE__,1001) : qt_noop()); | - | ||||||||||||||||||
829 | active->d_func()->setActive(false); | - | ||||||||||||||||||
830 | resetActiveWindow(); | - | ||||||||||||||||||
831 | } never executed: end of block | 0 | ||||||||||||||||||
832 | return; never executed: return; | 0 | ||||||||||||||||||
833 | } | - | ||||||||||||||||||
834 | - | |||||||||||||||||||
835 | if (child->isHidden()
| 0 | ||||||||||||||||||
836 | return; never executed: return; | 0 | ||||||||||||||||||
837 | child->d_func()->setActive(true); | - | ||||||||||||||||||
838 | } never executed: end of block | 0 | ||||||||||||||||||
839 | - | |||||||||||||||||||
840 | - | |||||||||||||||||||
841 | - | |||||||||||||||||||
842 | - | |||||||||||||||||||
843 | void QMdiAreaPrivate::activateCurrentWindow() | - | ||||||||||||||||||
844 | { | - | ||||||||||||||||||
845 | QMdiSubWindow *current = q_func()->currentSubWindow(); | - | ||||||||||||||||||
846 | if (current
| 0 | ||||||||||||||||||
847 | current->d_func()->activationEnabled = true; | - | ||||||||||||||||||
848 | current->d_func()->setActive(true, false); | - | ||||||||||||||||||
849 | } never executed: end of block | 0 | ||||||||||||||||||
850 | } never executed: end of block | 0 | ||||||||||||||||||
851 | - | |||||||||||||||||||
852 | void QMdiAreaPrivate::activateHighlightedWindow() | - | ||||||||||||||||||
853 | { | - | ||||||||||||||||||
854 | if (indexToHighlighted < 0
| 0 | ||||||||||||||||||
855 | return; never executed: return; | 0 | ||||||||||||||||||
856 | - | |||||||||||||||||||
857 | ((!(indexToHighlighted < childWindows.size())) ? qt_assert("indexToHighlighted < childWindows.size()",__FILE__,1030) : qt_noop()); | - | ||||||||||||||||||
858 | if (tabToPreviousTimerId != -1
| 0 | ||||||||||||||||||
859 | activateWindow(nextVisibleSubWindow(-1, QMdiArea::ActivationHistoryOrder)); never executed: activateWindow(nextVisibleSubWindow(-1, QMdiArea::ActivationHistoryOrder)); | 0 | ||||||||||||||||||
860 | else | - | ||||||||||||||||||
861 | activateWindow(childWindows.at(indexToHighlighted)); never executed: activateWindow(childWindows.at(indexToHighlighted)); | 0 | ||||||||||||||||||
862 | - | |||||||||||||||||||
863 | hideRubberBand(); | - | ||||||||||||||||||
864 | - | |||||||||||||||||||
865 | } never executed: end of block | 0 | ||||||||||||||||||
866 | - | |||||||||||||||||||
867 | - | |||||||||||||||||||
868 | - | |||||||||||||||||||
869 | - | |||||||||||||||||||
870 | void QMdiAreaPrivate::emitWindowActivated(QMdiSubWindow *activeWindow) | - | ||||||||||||||||||
871 | { | - | ||||||||||||||||||
872 | QMdiArea * const q = q_func(); | - | ||||||||||||||||||
873 | ((!(activeWindow)) ? qt_assert("activeWindow",__FILE__,1046) : qt_noop()); | - | ||||||||||||||||||
874 | if (activeWindow == active
| 0 | ||||||||||||||||||
875 | return; never executed: return; | 0 | ||||||||||||||||||
876 | ((!(activeWindow->d_func()->isActive)) ? qt_assert("activeWindow->d_func()->isActive",__FILE__,1049) : qt_noop()); | - | ||||||||||||||||||
877 | - | |||||||||||||||||||
878 | if (!aboutToBecomeActive
| 0 | ||||||||||||||||||
879 | _q_deactivateAllWindows(activeWindow); never executed: _q_deactivateAllWindows(activeWindow); | 0 | ||||||||||||||||||
880 | ((!(aboutToBecomeActive)) ? qt_assert("aboutToBecomeActive",__FILE__,1053) : qt_noop()); | - | ||||||||||||||||||
881 | - | |||||||||||||||||||
882 | - | |||||||||||||||||||
883 | - | |||||||||||||||||||
884 | if (showActiveWindowMaximized
| 0 | ||||||||||||||||||
885 | if (!activeWindow->isMaximized()
| 0 | ||||||||||||||||||
886 | activeWindow->showMaximized(); never executed: activeWindow->showMaximized(); | 0 | ||||||||||||||||||
887 | showActiveWindowMaximized = false; | - | ||||||||||||||||||
888 | } never executed: end of block | 0 | ||||||||||||||||||
889 | - | |||||||||||||||||||
890 | - | |||||||||||||||||||
891 | const int indexToActiveWindow = childWindows.indexOf(activeWindow); | - | ||||||||||||||||||
892 | ((!(indexToActiveWindow != -1)) ? qt_assert("indexToActiveWindow != -1",__FILE__,1065) : qt_noop()); | - | ||||||||||||||||||
893 | const int index = indicesToActivatedChildren.indexOf(indexToActiveWindow); | - | ||||||||||||||||||
894 | ((!(index != -1)) ? qt_assert("index != -1",__FILE__,1067) : qt_noop()); | - | ||||||||||||||||||
895 | indicesToActivatedChildren.move(index, 0); | - | ||||||||||||||||||
896 | internalRaise(activeWindow); | - | ||||||||||||||||||
897 | - | |||||||||||||||||||
898 | if (updatesDisabledByUs
| 0 | ||||||||||||||||||
899 | q->setUpdatesEnabled(true); | - | ||||||||||||||||||
900 | updatesDisabledByUs = false; | - | ||||||||||||||||||
901 | } never executed: end of block | 0 | ||||||||||||||||||
902 | - | |||||||||||||||||||
903 | ((!(aboutToBecomeActive == activeWindow)) ? qt_assert("aboutToBecomeActive == activeWindow",__FILE__,1076) : qt_noop()); | - | ||||||||||||||||||
904 | active = activeWindow; | - | ||||||||||||||||||
905 | aboutToBecomeActive = 0; | - | ||||||||||||||||||
906 | ((!(active->d_func()->isActive)) ? qt_assert("active->d_func()->isActive",__FILE__,1079) : qt_noop()); | - | ||||||||||||||||||
907 | - | |||||||||||||||||||
908 | - | |||||||||||||||||||
909 | if (tabBar
| 0 | ||||||||||||||||||
910 | tabBar->setCurrentIndex(indexToActiveWindow); never executed: tabBar->setCurrentIndex(indexToActiveWindow); | 0 | ||||||||||||||||||
911 | - | |||||||||||||||||||
912 | - | |||||||||||||||||||
913 | if (active->isMaximized()
| 0 | ||||||||||||||||||
914 | updateScrollBars(); never executed: updateScrollBars(); | 0 | ||||||||||||||||||
915 | - | |||||||||||||||||||
916 | q->subWindowActivated(active); | - | ||||||||||||||||||
917 | } never executed: end of block | 0 | ||||||||||||||||||
918 | - | |||||||||||||||||||
919 | - | |||||||||||||||||||
920 | - | |||||||||||||||||||
921 | - | |||||||||||||||||||
922 | void QMdiAreaPrivate::resetActiveWindow(QMdiSubWindow *deactivatedWindow) | - | ||||||||||||||||||
923 | { | - | ||||||||||||||||||
924 | QMdiArea * const q = q_func(); | - | ||||||||||||||||||
925 | if (deactivatedWindow
| 0 | ||||||||||||||||||
926 | if (deactivatedWindow != active
| 0 | ||||||||||||||||||
927 | return; never executed: return; | 0 | ||||||||||||||||||
928 | active = 0; | - | ||||||||||||||||||
929 | if ((aboutToBecomeActive
| 0 | ||||||||||||||||||
930 | && !isExplicitlyDeactivated(deactivatedWindow)
| 0 | ||||||||||||||||||
931 | return; never executed: return; | 0 | ||||||||||||||||||
932 | } | - | ||||||||||||||||||
933 | q->subWindowActivated(0); | - | ||||||||||||||||||
934 | return; never executed: return; | 0 | ||||||||||||||||||
935 | } | - | ||||||||||||||||||
936 | - | |||||||||||||||||||
937 | if (aboutToBecomeActive
| 0 | ||||||||||||||||||
938 | return; never executed: return; | 0 | ||||||||||||||||||
939 | - | |||||||||||||||||||
940 | active = 0; | - | ||||||||||||||||||
941 | q->subWindowActivated(0); | - | ||||||||||||||||||
942 | } never executed: end of block | 0 | ||||||||||||||||||
943 | - | |||||||||||||||||||
944 | - | |||||||||||||||||||
945 | - | |||||||||||||||||||
946 | - | |||||||||||||||||||
947 | void QMdiAreaPrivate::updateActiveWindow(int removedIndex, bool activeRemoved) | - | ||||||||||||||||||
948 | { | - | ||||||||||||||||||
949 | ((!(indicesToActivatedChildren.size() == childWindows.size())) ? qt_assert("indicesToActivatedChildren.size() == childWindows.size()",__FILE__,1122) : qt_noop()); | - | ||||||||||||||||||
950 | - | |||||||||||||||||||
951 | - | |||||||||||||||||||
952 | if (tabBar
| 0 | ||||||||||||||||||
953 | const QSignalBlocker blocker(tabBar); | - | ||||||||||||||||||
954 | tabBar->removeTab(removedIndex); | - | ||||||||||||||||||
955 | updateTabBarGeometry(); | - | ||||||||||||||||||
956 | } never executed: end of block | 0 | ||||||||||||||||||
957 | - | |||||||||||||||||||
958 | - | |||||||||||||||||||
959 | if (childWindows.isEmpty()
| 0 | ||||||||||||||||||
960 | showActiveWindowMaximized = false; | - | ||||||||||||||||||
961 | resetActiveWindow(); | - | ||||||||||||||||||
962 | return; never executed: return; | 0 | ||||||||||||||||||
963 | } | - | ||||||||||||||||||
964 | - | |||||||||||||||||||
965 | if (indexToHighlighted >= 0
| 0 | ||||||||||||||||||
966 | - | |||||||||||||||||||
967 | - | |||||||||||||||||||
968 | if (indexToHighlighted == removedIndex
| 0 | ||||||||||||||||||
969 | hideRubberBand(); never executed: hideRubberBand(); | 0 | ||||||||||||||||||
970 | else | - | ||||||||||||||||||
971 | - | |||||||||||||||||||
972 | - | |||||||||||||||||||
973 | if (indexToHighlighted > removedIndex
| 0 | ||||||||||||||||||
974 | -- never executed: indexToHighlighted;--indexToHighlighted; never executed: --indexToHighlighted; | 0 | ||||||||||||||||||
975 | } never executed: end of block | 0 | ||||||||||||||||||
976 | - | |||||||||||||||||||
977 | - | |||||||||||||||||||
978 | for (int i = 0; i < indicesToActivatedChildren.size()
| 0 | ||||||||||||||||||
979 | int *index = &indicesToActivatedChildren[i]; | - | ||||||||||||||||||
980 | if (*
| 0 | ||||||||||||||||||
981 | --* never executed: index;--*index; never executed: --*index; | 0 | ||||||||||||||||||
982 | } never executed: end of block | 0 | ||||||||||||||||||
983 | - | |||||||||||||||||||
984 | if (!activeRemoved
| 0 | ||||||||||||||||||
985 | return; never executed: return; | 0 | ||||||||||||||||||
986 | - | |||||||||||||||||||
987 | - | |||||||||||||||||||
988 | QMdiSubWindow *next = nextVisibleSubWindow(0, activationOrder, removedIndex); | - | ||||||||||||||||||
989 | if (next
| 0 | ||||||||||||||||||
990 | activateWindow(next); never executed: activateWindow(next); | 0 | ||||||||||||||||||
991 | } never executed: end of block | 0 | ||||||||||||||||||
992 | - | |||||||||||||||||||
993 | - | |||||||||||||||||||
994 | - | |||||||||||||||||||
995 | - | |||||||||||||||||||
996 | void QMdiAreaPrivate::updateScrollBars() | - | ||||||||||||||||||
997 | { | - | ||||||||||||||||||
998 | if (ignoreGeometryChange
| 0 | ||||||||||||||||||
999 | return; never executed: return; | 0 | ||||||||||||||||||
1000 | - | |||||||||||||||||||
1001 | QMdiArea * const q = q_func(); | - | ||||||||||||||||||
1002 | QSize maxSize = q->maximumViewportSize(); | - | ||||||||||||||||||
1003 | QSize hbarExtent = hbar->sizeHint(); | - | ||||||||||||||||||
1004 | QSize vbarExtent = vbar->sizeHint(); | - | ||||||||||||||||||
1005 | - | |||||||||||||||||||
1006 | if (q->style()->styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents, 0, q)
| 0 | ||||||||||||||||||
1007 | const int doubleFrameWidth = frameWidth * 2; | - | ||||||||||||||||||
1008 | if (hbarpolicy == Qt::ScrollBarAlwaysOn
| 0 | ||||||||||||||||||
1009 | maxSize.rheight() -= doubleFrameWidth; never executed: maxSize.rheight() -= doubleFrameWidth; | 0 | ||||||||||||||||||
1010 | if (vbarpolicy == Qt::ScrollBarAlwaysOn
| 0 | ||||||||||||||||||
1011 | maxSize.rwidth() -= doubleFrameWidth; never executed: maxSize.rwidth() -= doubleFrameWidth; | 0 | ||||||||||||||||||
1012 | hbarExtent.rheight() += doubleFrameWidth; | - | ||||||||||||||||||
1013 | vbarExtent.rwidth() += doubleFrameWidth; | - | ||||||||||||||||||
1014 | } never executed: end of block | 0 | ||||||||||||||||||
1015 | - | |||||||||||||||||||
1016 | const QRect childrenRect = active
| 0 | ||||||||||||||||||
1017 | ? active->geometry() : viewport->childrenRect(); | - | ||||||||||||||||||
1018 | bool useHorizontalScrollBar = useScrollBar(childrenRect, maxSize, Qt::Horizontal); | - | ||||||||||||||||||
1019 | bool useVerticalScrollBar = useScrollBar(childrenRect, maxSize, Qt::Vertical); | - | ||||||||||||||||||
1020 | - | |||||||||||||||||||
1021 | if (useHorizontalScrollBar
| 0 | ||||||||||||||||||
1022 | const QSize max = maxSize - QSize(0, hbarExtent.height()); | - | ||||||||||||||||||
1023 | useVerticalScrollBar = useScrollBar(childrenRect, max, Qt::Vertical); | - | ||||||||||||||||||
1024 | } never executed: end of block | 0 | ||||||||||||||||||
1025 | - | |||||||||||||||||||
1026 | if (useVerticalScrollBar
| 0 | ||||||||||||||||||
1027 | const QSize max = maxSize - QSize(vbarExtent.width(), 0); | - | ||||||||||||||||||
1028 | useHorizontalScrollBar = useScrollBar(childrenRect, max, Qt::Horizontal); | - | ||||||||||||||||||
1029 | } never executed: end of block | 0 | ||||||||||||||||||
1030 | - | |||||||||||||||||||
1031 | if (useHorizontalScrollBar
| 0 | ||||||||||||||||||
1032 | maxSize.rheight() -= hbarExtent.height(); never executed: maxSize.rheight() -= hbarExtent.height(); | 0 | ||||||||||||||||||
1033 | if (useVerticalScrollBar
| 0 | ||||||||||||||||||
1034 | maxSize.rwidth() -= vbarExtent.width(); never executed: maxSize.rwidth() -= vbarExtent.width(); | 0 | ||||||||||||||||||
1035 | - | |||||||||||||||||||
1036 | QRect viewportRect(QPoint(0, 0), maxSize); | - | ||||||||||||||||||
1037 | const int startX = q->isLeftToRight()
| 0 | ||||||||||||||||||
1038 | - childrenRect.right(); | - | ||||||||||||||||||
1039 | - | |||||||||||||||||||
1040 | - | |||||||||||||||||||
1041 | if (isSubWindowsTiled
| 0 | ||||||||||||||||||
1042 | hbar->setValue(0); never executed: hbar->setValue(0); | 0 | ||||||||||||||||||
1043 | const int xOffset = startX + hbar->value(); | - | ||||||||||||||||||
1044 | hbar->setRange(qMin(0, xOffset), | - | ||||||||||||||||||
1045 | qMax(0, xOffset + childrenRect.width() - viewportRect.width())); | - | ||||||||||||||||||
1046 | hbar->setPageStep(childrenRect.width()); | - | ||||||||||||||||||
1047 | hbar->setSingleStep(childrenRect.width() / 20); | - | ||||||||||||||||||
1048 | - | |||||||||||||||||||
1049 | - | |||||||||||||||||||
1050 | if (isSubWindowsTiled
| 0 | ||||||||||||||||||
1051 | vbar->setValue(0); never executed: vbar->setValue(0); | 0 | ||||||||||||||||||
1052 | const int yOffset = childrenRect.top() + vbar->value(); | - | ||||||||||||||||||
1053 | vbar->setRange(qMin(0, yOffset), | - | ||||||||||||||||||
1054 | qMax(0, yOffset + childrenRect.height() - viewportRect.height())); | - | ||||||||||||||||||
1055 | vbar->setPageStep(childrenRect.height()); | - | ||||||||||||||||||
1056 | vbar->setSingleStep(childrenRect.height() / 20); | - | ||||||||||||||||||
1057 | } never executed: end of block | 0 | ||||||||||||||||||
1058 | - | |||||||||||||||||||
1059 | - | |||||||||||||||||||
1060 | - | |||||||||||||||||||
1061 | - | |||||||||||||||||||
1062 | void QMdiAreaPrivate::internalRaise(QMdiSubWindow *mdiChild) const | - | ||||||||||||||||||
1063 | { | - | ||||||||||||||||||
1064 | if (!sanityCheck(mdiChild, "QMdiArea::internalRaise")
| 0 | ||||||||||||||||||
1065 | return; never executed: return; | 0 | ||||||||||||||||||
1066 | - | |||||||||||||||||||
1067 | QMdiSubWindow *stackUnderChild = 0; | - | ||||||||||||||||||
1068 | if (!windowStaysOnTop(mdiChild)
| 0 | ||||||||||||||||||
1069 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(viewport->children())>::type> _container_((viewport->children())); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QObject *object = *_container_.i; _container_.control; _container_.control = 0) { | - | ||||||||||||||||||
1070 | QMdiSubWindow *child = qobject_cast<QMdiSubWindow *>(object); | - | ||||||||||||||||||
1071 | if (!child
| 0 | ||||||||||||||||||
1072 | continue; never executed: continue; | 0 | ||||||||||||||||||
1073 | if (!child->isHidden()
| 0 | ||||||||||||||||||
1074 | if (stackUnderChild
| 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
| 0 | ||||||||||||||||||
1084 | mdiChild->stackUnder(stackUnderChild); never executed: mdiChild->stackUnder(stackUnderChild); | 0 | ||||||||||||||||||
1085 | else | - | ||||||||||||||||||
1086 | mdiChild->raise(); never executed: mdiChild->raise(); | 0 | ||||||||||||||||||
1087 | } | - | ||||||||||||||||||
1088 | - | |||||||||||||||||||
1089 | QRect QMdiAreaPrivate::resizeToMinimumTileSize(const QSize &minSubWindowSize, int subWindowCount) | - | ||||||||||||||||||
1090 | { | - | ||||||||||||||||||
1091 | QMdiArea * const q = q_func(); | - | ||||||||||||||||||
1092 | if (!minSubWindowSize.isValid()
| 0 | ||||||||||||||||||
1093 | return never executed: viewport->rect();return 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
| 0 | ||||||||||||||||||
1105 | QWidget *topLevel = q; | - | ||||||||||||||||||
1106 | - | |||||||||||||||||||
1107 | while (topLevel
| 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()
| 0 | ||||||||||||||||||
1113 | minAreaHeight += hbar->height(); never executed: minAreaHeight += hbar->height(); | 0 | ||||||||||||||||||
1114 | if (vbar->isVisible()
| 0 | ||||||||||||||||||
1115 | minAreaWidth += vbar->width(); never executed: minAreaWidth += vbar->width(); | 0 | ||||||||||||||||||
1116 | if (q->style()->styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents, 0, q)
| 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
| 0 | ||||||||||||||||||
1129 | domain.setWidth(minWidth); | - | ||||||||||||||||||
1130 | if (hbarpolicy == Qt::ScrollBarAlwaysOff
| 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
| 0 | ||||||||||||||||||
1137 | domain.setHeight(minHeight); | - | ||||||||||||||||||
1138 | if (vbarpolicy == Qt::ScrollBarAlwaysOff
| 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: domain;return domain; never executed: return domain; | 0 | ||||||||||||||||||
1144 | } | - | ||||||||||||||||||
1145 | - | |||||||||||||||||||
1146 | - | |||||||||||||||||||
1147 | - | |||||||||||||||||||
1148 | - | |||||||||||||||||||
1149 | bool QMdiAreaPrivate::scrollBarsEnabled() const | - | ||||||||||||||||||
1150 | { | - | ||||||||||||||||||
1151 | return never executed: hbarpolicy != Qt::ScrollBarAlwaysOffreturn hbarpolicy != Qt::ScrollBarAlwaysOff || vbarpolicy != Qt::ScrollBarAlwaysOff;
never executed: return hbarpolicy != Qt::ScrollBarAlwaysOff || vbarpolicy != Qt::ScrollBarAlwaysOff; | 0 | ||||||||||||||||||
1152 | } | - | ||||||||||||||||||
1153 | - | |||||||||||||||||||
1154 | - | |||||||||||||||||||
1155 | - | |||||||||||||||||||
1156 | - | |||||||||||||||||||
1157 | bool QMdiAreaPrivate::lastWindowAboutToBeDestroyed() const | - | ||||||||||||||||||
1158 | { | - | ||||||||||||||||||
1159 | if (childWindows.count() != 1
| 0 | ||||||||||||||||||
1160 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||
1161 | - | |||||||||||||||||||
1162 | QMdiSubWindow *last = childWindows.at(0); | - | ||||||||||||||||||
1163 | if (!last
| 0 | ||||||||||||||||||
1164 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||||||||
1165 | - | |||||||||||||||||||
1166 | if (!last->testAttribute(Qt::WA_DeleteOnClose)
| 0 | ||||||||||||||||||
1167 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||
1168 | - | |||||||||||||||||||
1169 | return never executed: last->d_func()->data.is_closing;return last->d_func()->data.is_closing; never executed: return last->d_func()->data.is_closing; | 0 | ||||||||||||||||||
1170 | } | - | ||||||||||||||||||
1171 | - | |||||||||||||||||||
1172 | - | |||||||||||||||||||
1173 | - | |||||||||||||||||||
1174 | - | |||||||||||||||||||
1175 | void 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
| 0 | ||||||||||||||||||
1179 | continue; never executed: continue; | 0 | ||||||||||||||||||
1180 | if (onlyNextActivationEvent
| 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 | - | |||||||||||||||||||
1191 | void QMdiAreaPrivate::scrollBarPolicyChanged(Qt::Orientation orientation, Qt::ScrollBarPolicy policy) | - | ||||||||||||||||||
1192 | { | - | ||||||||||||||||||
1193 | if (childWindows.isEmpty()
| 0 | ||||||||||||||||||
1194 | return; never executed: return; | 0 | ||||||||||||||||||
1195 | - | |||||||||||||||||||
1196 | const QMdiSubWindow::SubWindowOption option = orientation == Qt::Horizontal
| 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")
| 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 | - | |||||||||||||||||||
1207 | QList<QMdiSubWindow*> | - | ||||||||||||||||||
1208 | QMdiAreaPrivate::subWindowList(QMdiArea::WindowOrder order, bool reversed) const | - | ||||||||||||||||||
1209 | { | - | ||||||||||||||||||
1210 | QList<QMdiSubWindow *> list; | - | ||||||||||||||||||
1211 | if (childWindows.isEmpty()
| 0 | ||||||||||||||||||
1212 | return never executed: list;return list; never executed: return list; | 0 | ||||||||||||||||||
1213 | - | |||||||||||||||||||
1214 | if (order == QMdiArea::CreationOrder
| 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
| 0 | ||||||||||||||||||
1217 | continue; never executed: continue; | 0 | ||||||||||||||||||
1218 | if (!reversed
| 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: else if (order == QMdiArea::StackingOrderend of block
| 0 | ||||||||||||||||||
1224 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(viewport->children())>::type> _container_((viewport->children())); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QObject *object = *_container_.i; _container_.control; _container_.control = 0) { | - | ||||||||||||||||||
1225 | QMdiSubWindow *child = qobject_cast<QMdiSubWindow *>(object); | - | ||||||||||||||||||
1226 | if (!child
| 0 | ||||||||||||||||||
1227 | continue; never executed: continue; | 0 | ||||||||||||||||||
1228 | if (!reversed
| 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: else {end of block | 0 | ||||||||||||||||||
1234 | ((!(indicesToActivatedChildren.size() == childWindows.size())) ? qt_assert("indicesToActivatedChildren.size() == childWindows.size()",__FILE__,1407) : qt_noop()); | - | ||||||||||||||||||
1235 | for (int i = indicesToActivatedChildren.count() - 1; i >= 0
| 0 | ||||||||||||||||||
1236 | QMdiSubWindow *child = childWindows.at(indicesToActivatedChildren.at(i)); | - | ||||||||||||||||||
1237 | if (!child
| 0 | ||||||||||||||||||
1238 | continue; never executed: continue; | 0 | ||||||||||||||||||
1239 | if (!reversed
| 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: list;return list; never executed: return list; | 0 | ||||||||||||||||||
1246 | } | - | ||||||||||||||||||
1247 | - | |||||||||||||||||||
1248 | - | |||||||||||||||||||
1249 | - | |||||||||||||||||||
1250 | - | |||||||||||||||||||
1251 | void QMdiAreaPrivate::disconnectSubWindow(QObject *subWindow) | - | ||||||||||||||||||
1252 | { | - | ||||||||||||||||||
1253 | if (!subWindow
| 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 | - | |||||||||||||||||||
1264 | QMdiSubWindow *QMdiAreaPrivate::nextVisibleSubWindow(int increaseFactor, QMdiArea::WindowOrder order, | - | ||||||||||||||||||
1265 | int removedIndex, int fromIndex) const | - | ||||||||||||||||||
1266 | { | - | ||||||||||||||||||
1267 | if (childWindows.isEmpty()
| 0 | ||||||||||||||||||
1268 | return never executed: 0;return 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
| 0 | ||||||||||||||||||
1275 | if (fromIndex >= 0
| 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
| 0 | ||||||||||||||||||
1284 | if (removedIndex >= 0
| 0 | ||||||||||||||||||
1285 | int candidateIndex = -1; | - | ||||||||||||||||||
1286 | setIndex(&candidateIndex, removedIndex, 0, subWindows.size() - 1, true); | - | ||||||||||||||||||
1287 | current = childWindows.at(candidateIndex); | - | ||||||||||||||||||
1288 | } never executed: else {end of block | 0 | ||||||||||||||||||
1289 | current = subWindows.back(); | - | ||||||||||||||||||
1290 | } never executed: end of block | 0 | ||||||||||||||||||
1291 | } | - | ||||||||||||||||||
1292 | ((!(current)) ? qt_assert("current",__FILE__,1465) : 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__,1474) : qt_noop()); | - | ||||||||||||||||||
1302 | - | |||||||||||||||||||
1303 | - | |||||||||||||||||||
1304 | while (subWindows.at(index)->isHidden()
| 0 | ||||||||||||||||||
1305 | setIndex(&index, index + increaseFactor, 0, subWindows.size() - 1, increasing); | - | ||||||||||||||||||
1306 | if (index == indexToCurrent
| 0 | ||||||||||||||||||
1307 | break; never executed: break; | 0 | ||||||||||||||||||
1308 | } never executed: end of block | 0 | ||||||||||||||||||
1309 | - | |||||||||||||||||||
1310 | if (!subWindows.at(index)->isHidden()
| 0 | ||||||||||||||||||
1311 | return never executed: subWindows.at(index);return subWindows.at(index); never executed: return subWindows.at(index); | 0 | ||||||||||||||||||
1312 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||
1313 | } | - | ||||||||||||||||||
1314 | - | |||||||||||||||||||
1315 | - | |||||||||||||||||||
1316 | - | |||||||||||||||||||
1317 | - | |||||||||||||||||||
1318 | void QMdiAreaPrivate::highlightNextSubWindow(int increaseFactor) | - | ||||||||||||||||||
1319 | { | - | ||||||||||||||||||
1320 | if (childWindows.size() == 1
| 0 | ||||||||||||||||||
1321 | return; never executed: return; | 0 | ||||||||||||||||||
1322 | - | |||||||||||||||||||
1323 | QMdiArea * const q = q_func(); | - | ||||||||||||||||||
1324 | - | |||||||||||||||||||
1325 | if (indexToHighlighted < 0
| 0 | ||||||||||||||||||
1326 | QMdiSubWindow *current = q->currentSubWindow(); | - | ||||||||||||||||||
1327 | if (!current
| 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__,1505) : qt_noop()); | - | ||||||||||||||||||
1333 | ((!(indexToHighlighted < childWindows.size())) ? qt_assert("indexToHighlighted < childWindows.size()",__FILE__,1506) : qt_noop()); | - | ||||||||||||||||||
1334 | - | |||||||||||||||||||
1335 | QMdiSubWindow *highlight = nextVisibleSubWindow(increaseFactor, activationOrder, -1, indexToHighlighted); | - | ||||||||||||||||||
1336 | if (!highlight
| 0 | ||||||||||||||||||
1337 | return; never executed: return; | 0 | ||||||||||||||||||
1338 | - | |||||||||||||||||||
1339 | - | |||||||||||||||||||
1340 | if (!rubberBand
| 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
| 0 | ||||||||||||||||||
1351 | showRubberBandFor(highlight); never executed: showRubberBandFor(highlight); | 0 | ||||||||||||||||||
1352 | - | |||||||||||||||||||
1353 | - | |||||||||||||||||||
1354 | indexToHighlighted = childWindows.indexOf(highlight); | - | ||||||||||||||||||
1355 | ((!(indexToHighlighted >= 0)) ? qt_assert("indexToHighlighted >= 0",__FILE__,1528) : qt_noop()); | - | ||||||||||||||||||
1356 | } never executed: end of block | 0 | ||||||||||||||||||
1357 | - | |||||||||||||||||||
1358 | void QMdiAreaPrivate::showRubberBandFor(QMdiSubWindow *subWindow) | - | ||||||||||||||||||
1359 | { | - | ||||||||||||||||||
1360 | if (!subWindow
| 0 | ||||||||||||||||||
1361 | return; never executed: return; | 0 | ||||||||||||||||||
1362 | - | |||||||||||||||||||
1363 | if (viewMode == QMdiArea::TabbedView
| 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 | - | |||||||||||||||||||
1376 | void QMdiAreaPrivate::setViewMode(QMdiArea::ViewMode mode) | - | ||||||||||||||||||
1377 | { | - | ||||||||||||||||||
1378 | QMdiArea * const q = q_func(); | - | ||||||||||||||||||
1379 | if (viewMode == mode
| 0 | ||||||||||||||||||
1380 | return; never executed: return; | 0 | ||||||||||||||||||
1381 | - | |||||||||||||||||||
1382 | - | |||||||||||||||||||
1383 | inViewModeChange = true; | - | ||||||||||||||||||
1384 | - | |||||||||||||||||||
1385 | - | |||||||||||||||||||
1386 | if (mode == QMdiArea::TabbedView
| 0 | ||||||||||||||||||
1387 | ((!(!tabBar)) ? qt_assert("!tabBar",__FILE__,1560) : 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
| 0 | ||||||||||||||||||
1403 | tabBar->setCurrentIndex(childWindows.indexOf(current)); | - | ||||||||||||||||||
1404 | - | |||||||||||||||||||
1405 | if (current->isMaximized()
| 0 | ||||||||||||||||||
1406 | current->showNormal(); never executed: current->showNormal(); | 0 | ||||||||||||||||||
1407 | - | |||||||||||||||||||
1408 | viewMode = mode; | - | ||||||||||||||||||
1409 | - | |||||||||||||||||||
1410 | - | |||||||||||||||||||
1411 | if (!q->testOption(QMdiArea::DontMaximizeSubWindowOnActivation)
| 0 | ||||||||||||||||||
1412 | current->showMaximized(); | - | ||||||||||||||||||
1413 | } never executed: end of block | 0 | ||||||||||||||||||
1414 | } never executed: else {end of block | 0 | ||||||||||||||||||
1415 | viewMode = mode; | - | ||||||||||||||||||
1416 | } never executed: end of block | 0 | ||||||||||||||||||
1417 | - | |||||||||||||||||||
1418 | if (q->isVisible()
| 0 | ||||||||||||||||||
1419 | tabBar->show(); never executed: tabBar->show(); | 0 | ||||||||||||||||||
1420 | updateTabBarGeometry(); | - | ||||||||||||||||||
1421 | - | |||||||||||||||||||
1422 | QObject::connect(tabBar, qFlagLocation("2""currentChanged(int)" "\0" __FILE__ ":" "1595"), q, qFlagLocation("1""_q_currentTabChanged(int)" "\0" __FILE__ ":" "1595")); | - | ||||||||||||||||||
1423 | QObject::connect(tabBar, qFlagLocation("2""tabCloseRequested(int)" "\0" __FILE__ ":" "1596"), q, qFlagLocation("1""_q_closeTab(int)" "\0" __FILE__ ":" "1596")); | - | ||||||||||||||||||
1424 | QObject::connect(tabBar, qFlagLocation("2""tabMoved(int,int)" "\0" __FILE__ ":" "1597"), q, qFlagLocation("1""_q_moveTab(int,int)" "\0" __FILE__ ":" "1597")); | - | ||||||||||||||||||
1425 | } never executed: elseend of block | 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
| 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__,1615) : qt_noop()); | - | ||||||||||||||||||
1443 | inViewModeChange = false; | - | ||||||||||||||||||
1444 | } never executed: end of block | 0 | ||||||||||||||||||
1445 | - | |||||||||||||||||||
1446 | - | |||||||||||||||||||
1447 | - | |||||||||||||||||||
1448 | - | |||||||||||||||||||
1449 | - | |||||||||||||||||||
1450 | void QMdiAreaPrivate::updateTabBarGeometry() | - | ||||||||||||||||||
1451 | { | - | ||||||||||||||||||
1452 | if (!tabBar
| 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__,1630) : qt_noop()); | - | ||||||||||||||||||
1458 | - | |||||||||||||||||||
1459 | const QSize tabBarSizeHint = tabBar->sizeHint(); | - | ||||||||||||||||||
1460 | - | |||||||||||||||||||
1461 | int areaHeight = q->height(); | - | ||||||||||||||||||
1462 | if (hbar
| 0 | ||||||||||||||||||
1463 | areaHeight -= hbar->height(); never executed: areaHeight -= hbar->height(); | 0 | ||||||||||||||||||
1464 | - | |||||||||||||||||||
1465 | int areaWidth = q->width(); | - | ||||||||||||||||||
1466 | if (vbar
| 0 | ||||||||||||||||||
1467 | areaWidth -= vbar->width(); never executed: areaWidth -= vbar->width(); | 0 | ||||||||||||||||||
1468 | - | |||||||||||||||||||
1469 | QRect tabBarRect; | - | ||||||||||||||||||
1470 | - | |||||||||||||||||||
1471 | switch (tabPosition) { | - | ||||||||||||||||||
1472 | case never executed: QTabWidget::North:case 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: QTabWidget::South:case 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: QTabWidget::East:case QTabWidget::East: never executed: case QTabWidget::East: | 0 | ||||||||||||||||||
1481 | if (q->layoutDirection() == Qt::LeftToRight
| 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: QTabWidget::West:case QTabWidget::West: never executed: case QTabWidget::West: | 0 | ||||||||||||||||||
1488 | if (q->layoutDirection() == Qt::LeftToRight
| 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 | - | |||||||||||||||||||
1505 | void QMdiAreaPrivate::refreshTabBar() | - | ||||||||||||||||||
1506 | { | - | ||||||||||||||||||
1507 | if (!tabBar
| 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 | - | |||||||||||||||||||
1524 | QMdiArea::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 | - | |||||||||||||||||||
1539 | QMdiArea::~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 | - | |||||||||||||||||||
1558 | QSize QMdiArea::sizeHint() const | - | ||||||||||||||||||
1559 | { | - | ||||||||||||||||||
1560 | - | |||||||||||||||||||
1561 | - | |||||||||||||||||||
1562 | int nestedCount = 0; | - | ||||||||||||||||||
1563 | QWidget *widget = this->parentWidget(); | - | ||||||||||||||||||
1564 | while (widget
| 0 | ||||||||||||||||||
1565 | if (qobject_cast<QMdiArea *>(widget)
| 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 (QForeachContainer<typename QtPrivate::remove_reference<decltype(d_func()->childWindows)>::type> _container_((d_func()->childWindows)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QMdiSubWindow *child = *_container_.i; _container_.control; _container_.control = 0) { | - | ||||||||||||||||||
1574 | if (!sanityCheck(child, "QMdiArea::sizeHint")
| 0 | ||||||||||||||||||
1575 | continue; never executed: continue; | 0 | ||||||||||||||||||
1576 | size = size.expandedTo(child->sizeHint()); | - | ||||||||||||||||||
1577 | } never executed: end of block | 0 | ||||||||||||||||||
1578 | return never executed: size.expandedTo(QApplication::globalStrut());return size.expandedTo(QApplication::globalStrut()); never executed: return size.expandedTo(QApplication::globalStrut()); | 0 | ||||||||||||||||||
1579 | } | - | ||||||||||||||||||
1580 | - | |||||||||||||||||||
1581 | - | |||||||||||||||||||
1582 | - | |||||||||||||||||||
1583 | - | |||||||||||||||||||
1584 | QSize 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()
| 0 | ||||||||||||||||||
1591 | 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) { | - | ||||||||||||||||||
1592 | if (!sanityCheck(child, "QMdiArea::sizeHint")
| 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: size.expandedTo(QApplication::globalStrut());return size.expandedTo(QApplication::globalStrut()); never executed: return size.expandedTo(QApplication::globalStrut()); | 0 | ||||||||||||||||||
1598 | } | - | ||||||||||||||||||
1599 | QMdiSubWindow *QMdiArea::currentSubWindow() const | - | ||||||||||||||||||
1600 | { | - | ||||||||||||||||||
1601 | const QMdiAreaPrivate * const d = d_func(); | - | ||||||||||||||||||
1602 | if (d->childWindows.isEmpty()
| 0 | ||||||||||||||||||
1603 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||
1604 | - | |||||||||||||||||||
1605 | if (d->active
| 0 | ||||||||||||||||||
1606 | return never executed: d->active;return d->active; never executed: return d->active; | 0 | ||||||||||||||||||
1607 | - | |||||||||||||||||||
1608 | if (d->isActivated
| 0 | ||||||||||||||||||
1609 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||
1610 | - | |||||||||||||||||||
1611 | ((!(d->indicesToActivatedChildren.count() > 0)) ? qt_assert("d->indicesToActivatedChildren.count() > 0",__FILE__,1794) : 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__,1796) : qt_noop()); | - | ||||||||||||||||||
1614 | QMdiSubWindow *current = d->childWindows.at(index); | - | ||||||||||||||||||
1615 | ((!(current)) ? qt_assert("current",__FILE__,1798) : qt_noop()); | - | ||||||||||||||||||
1616 | return never executed: current;return current; never executed: return current; | 0 | ||||||||||||||||||
1617 | } | - | ||||||||||||||||||
1618 | QMdiSubWindow *QMdiArea::activeSubWindow() const | - | ||||||||||||||||||
1619 | { | - | ||||||||||||||||||
1620 | const QMdiAreaPrivate * const d = d_func(); | - | ||||||||||||||||||
1621 | return never executed: d->active;return d->active; never executed: return d->active; | 0 | ||||||||||||||||||
1622 | } | - | ||||||||||||||||||
1623 | - | |||||||||||||||||||
1624 | - | |||||||||||||||||||
1625 | - | |||||||||||||||||||
1626 | - | |||||||||||||||||||
1627 | - | |||||||||||||||||||
1628 | - | |||||||||||||||||||
1629 | - | |||||||||||||||||||
1630 | void QMdiArea::setActiveSubWindow(QMdiSubWindow *window) | - | ||||||||||||||||||
1631 | { | - | ||||||||||||||||||
1632 | QMdiAreaPrivate * const d = d_func(); | - | ||||||||||||||||||
1633 | if (!window
| 0 | ||||||||||||||||||
1634 | d->activateWindow(0); | - | ||||||||||||||||||
1635 | return; never executed: return; | 0 | ||||||||||||||||||
1636 | } | - | ||||||||||||||||||
1637 | - | |||||||||||||||||||
1638 | if (d->childWindows.isEmpty()
| 0 | ||||||||||||||||||
1639 | QMessageLogger(__FILE__, 1835, __PRETTY_FUNCTION__).warning("QMdiArea::setActiveSubWindow: workspace is empty"); | - | ||||||||||||||||||
1640 | return; never executed: return; | 0 | ||||||||||||||||||
1641 | } | - | ||||||||||||||||||
1642 | - | |||||||||||||||||||
1643 | if (d->childWindows.indexOf(window) == -1
| 0 | ||||||||||||||||||
1644 | QMessageLogger(__FILE__, 1840, __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 | - | |||||||||||||||||||
1656 | void QMdiArea::closeActiveSubWindow() | - | ||||||||||||||||||
1657 | { | - | ||||||||||||||||||
1658 | QMdiAreaPrivate * const d = d_func(); | - | ||||||||||||||||||
1659 | if (d->active
| 0 | ||||||||||||||||||
1660 | d->active->close(); never executed: d->active->close(); | 0 | ||||||||||||||||||
1661 | } never executed: end of block | 0 | ||||||||||||||||||
1662 | QList<QMdiSubWindow *> QMdiArea::subWindowList(WindowOrder order) const | - | ||||||||||||||||||
1663 | { | - | ||||||||||||||||||
1664 | const QMdiAreaPrivate * const d = d_func(); | - | ||||||||||||||||||
1665 | return never executed: d->subWindowList(order, false);return d->subWindowList(order, false); never executed: return d->subWindowList(order, false); | 0 | ||||||||||||||||||
1666 | } | - | ||||||||||||||||||
1667 | void QMdiArea::closeAllSubWindows() | - | ||||||||||||||||||
1668 | { | - | ||||||||||||||||||
1669 | QMdiAreaPrivate * const d = d_func(); | - | ||||||||||||||||||
1670 | if (d->childWindows.isEmpty()
| 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")
| 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 | ||||||||||||||||||
1682 | void QMdiArea::activateNextSubWindow() | - | ||||||||||||||||||
1683 | { | - | ||||||||||||||||||
1684 | QMdiAreaPrivate * const d = d_func(); | - | ||||||||||||||||||
1685 | if (d->childWindows.isEmpty()
| 0 | ||||||||||||||||||
1686 | return; never executed: return; | 0 | ||||||||||||||||||
1687 | - | |||||||||||||||||||
1688 | QMdiSubWindow *next = d->nextVisibleSubWindow(1, d->activationOrder); | - | ||||||||||||||||||
1689 | if (next
| 0 | ||||||||||||||||||
1690 | d->activateWindow(next); never executed: d->activateWindow(next); | 0 | ||||||||||||||||||
1691 | } never executed: end of block | 0 | ||||||||||||||||||
1692 | void QMdiArea::activatePreviousSubWindow() | - | ||||||||||||||||||
1693 | { | - | ||||||||||||||||||
1694 | QMdiAreaPrivate * const d = d_func(); | - | ||||||||||||||||||
1695 | if (d->childWindows.isEmpty()
| 0 | ||||||||||||||||||
1696 | return; never executed: return; | 0 | ||||||||||||||||||
1697 | - | |||||||||||||||||||
1698 | QMdiSubWindow *previous = d->nextVisibleSubWindow(-1, d->activationOrder); | - | ||||||||||||||||||
1699 | if (previous
| 0 | ||||||||||||||||||
1700 | d->activateWindow(previous); never executed: d->activateWindow(previous); | 0 | ||||||||||||||||||
1701 | } never executed: end of block | 0 | ||||||||||||||||||
1702 | QMdiSubWindow *QMdiArea::addSubWindow(QWidget *widget, Qt::WindowFlags windowFlags) | - | ||||||||||||||||||
1703 | { | - | ||||||||||||||||||
1704 | if (!widget
| 0 | ||||||||||||||||||
1705 | QMessageLogger(__FILE__, 1964, __PRETTY_FUNCTION__).warning("QMdiArea::addSubWindow: null pointer to widget"); | - | ||||||||||||||||||
1706 | return never executed: 0;return 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
| 0 | ||||||||||||||||||
1716 | if (d->childWindows.indexOf(child) != -1
| 0 | ||||||||||||||||||
1717 | QMessageLogger(__FILE__, 1976, __PRETTY_FUNCTION__).warning("QMdiArea::addSubWindow: window is already added"); | - | ||||||||||||||||||
1718 | return never executed: child;return child; never executed: return child; | 0 | ||||||||||||||||||
1719 | } | - | ||||||||||||||||||
1720 | child->setParent(viewport(), windowFlags ? windowFlags : child->windowFlags()); | - | ||||||||||||||||||
1721 | - | |||||||||||||||||||
1722 | } never executed: else {end of block | 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__,1985) : qt_noop()); | - | ||||||||||||||||||
1727 | } never executed: end of block | 0 | ||||||||||||||||||
1728 | - | |||||||||||||||||||
1729 | if (childFocus
| 0 | ||||||||||||||||||
1730 | childFocus->setFocus(); never executed: childFocus->setFocus(); | 0 | ||||||||||||||||||
1731 | d->appendChild(child); | - | ||||||||||||||||||
1732 | return never executed: child;return child; never executed: return child; | 0 | ||||||||||||||||||
1733 | } | - | ||||||||||||||||||
1734 | void QMdiArea::removeSubWindow(QWidget *widget) | - | ||||||||||||||||||
1735 | { | - | ||||||||||||||||||
1736 | if (!widget
| 0 | ||||||||||||||||||
1737 | QMessageLogger(__FILE__, 2007, __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()
| 0 | ||||||||||||||||||
1743 | return; never executed: return; | 0 | ||||||||||||||||||
1744 | - | |||||||||||||||||||
1745 | if (QMdiSubWindow *child = qobject_cast<QMdiSubWindow *>(widget)
| 0 | ||||||||||||||||||
1746 | int index = d->childWindows.indexOf(child); | - | ||||||||||||||||||
1747 | if (index == -1
| 0 | ||||||||||||||||||
1748 | QMessageLogger(__FILE__, 2018, __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")
| 0 | ||||||||||||||||||
1762 | continue; never executed: continue; | 0 | ||||||||||||||||||
1763 | if (child->widget() == widget
| 0 | ||||||||||||||||||
1764 | child->setWidget(0); | - | ||||||||||||||||||
1765 | ((!(!child->widget())) ? qt_assert("!child->widget()",__FILE__,2035) : qt_noop()); | - | ||||||||||||||||||
1766 | found = true; | - | ||||||||||||||||||
1767 | break; never executed: break; | 0 | ||||||||||||||||||
1768 | } | - | ||||||||||||||||||
1769 | } never executed: end of block | 0 | ||||||||||||||||||
1770 | - | |||||||||||||||||||
1771 | if (!found
| 0 | ||||||||||||||||||
1772 | QMessageLogger(__FILE__, 2042, __PRETTY_FUNCTION__).warning("QMdiArea::removeSubWindow: widget is not child of any window inside QMdiArea"); never executed: QMessageLogger(__FILE__, 2042, __PRETTY_FUNCTION__).warning("QMdiArea::removeSubWindow: widget is not child of any window inside QMdiArea"); | 0 | ||||||||||||||||||
1773 | } never executed: end of block | 0 | ||||||||||||||||||
1774 | QBrush QMdiArea::background() const | - | ||||||||||||||||||
1775 | { | - | ||||||||||||||||||
1776 | return never executed: d_func()->background;return d_func()->background; never executed: return d_func()->background; | 0 | ||||||||||||||||||
1777 | } | - | ||||||||||||||||||
1778 | - | |||||||||||||||||||
1779 | void QMdiArea::setBackground(const QBrush &brush) | - | ||||||||||||||||||
1780 | { | - | ||||||||||||||||||
1781 | QMdiAreaPrivate * const d = d_func(); | - | ||||||||||||||||||
1782 | if (d->background != brush
| 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 | ||||||||||||||||||
1788 | QMdiArea::WindowOrder QMdiArea::activationOrder() const | - | ||||||||||||||||||
1789 | { | - | ||||||||||||||||||
1790 | const QMdiAreaPrivate * const d = d_func(); | - | ||||||||||||||||||
1791 | return never executed: d->activationOrder;return d->activationOrder; never executed: return d->activationOrder; | 0 | ||||||||||||||||||
1792 | } | - | ||||||||||||||||||
1793 | - | |||||||||||||||||||
1794 | void QMdiArea::setActivationOrder(WindowOrder order) | - | ||||||||||||||||||
1795 | { | - | ||||||||||||||||||
1796 | QMdiAreaPrivate * const d = d_func(); | - | ||||||||||||||||||
1797 | if (order != d->activationOrder
| 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 | - | |||||||||||||||||||
1807 | void QMdiArea::setOption(AreaOption option, bool on) | - | ||||||||||||||||||
1808 | { | - | ||||||||||||||||||
1809 | QMdiAreaPrivate * const d = d_func(); | - | ||||||||||||||||||
1810 | if (on
| 0 | ||||||||||||||||||
1811 | d->options |= option; never executed: d->options |= option; | 0 | ||||||||||||||||||
1812 | else if (!on
| 0 | ||||||||||||||||||
1813 | d->options &= ~option; never executed: d->options &= ~option; | 0 | ||||||||||||||||||
1814 | } never executed: end of block | 0 | ||||||||||||||||||
1815 | - | |||||||||||||||||||
1816 | - | |||||||||||||||||||
1817 | - | |||||||||||||||||||
1818 | - | |||||||||||||||||||
1819 | - | |||||||||||||||||||
1820 | - | |||||||||||||||||||
1821 | bool QMdiArea::testOption(AreaOption option) const | - | ||||||||||||||||||
1822 | { | - | ||||||||||||||||||
1823 | return never executed: d_func()->options & option;return d_func()->options & option; never executed: return d_func()->options & option; | 0 | ||||||||||||||||||
1824 | } | - | ||||||||||||||||||
1825 | QMdiArea::ViewMode QMdiArea::viewMode() const | - | ||||||||||||||||||
1826 | { | - | ||||||||||||||||||
1827 | const QMdiAreaPrivate * const d = d_func(); | - | ||||||||||||||||||
1828 | return never executed: d->viewMode;return d->viewMode; never executed: return d->viewMode; | 0 | ||||||||||||||||||
1829 | } | - | ||||||||||||||||||
1830 | - | |||||||||||||||||||
1831 | void QMdiArea::setViewMode(ViewMode mode) | - | ||||||||||||||||||
1832 | { | - | ||||||||||||||||||
1833 | QMdiAreaPrivate * const d = d_func(); | - | ||||||||||||||||||
1834 | d->setViewMode(mode); | - | ||||||||||||||||||
1835 | } never executed: end of block | 0 | ||||||||||||||||||
1836 | bool QMdiArea::documentMode() const | - | ||||||||||||||||||
1837 | { | - | ||||||||||||||||||
1838 | const QMdiAreaPrivate * const d = d_func(); | - | ||||||||||||||||||
1839 | return never executed: d->documentMode;return d->documentMode; never executed: return d->documentMode; | 0 | ||||||||||||||||||
1840 | } | - | ||||||||||||||||||
1841 | - | |||||||||||||||||||
1842 | void QMdiArea::setDocumentMode(bool enabled) | - | ||||||||||||||||||
1843 | { | - | ||||||||||||||||||
1844 | QMdiAreaPrivate * const d = d_func(); | - | ||||||||||||||||||
1845 | if (d->documentMode == enabled
| 0 | ||||||||||||||||||
1846 | return; never executed: return; | 0 | ||||||||||||||||||
1847 | - | |||||||||||||||||||
1848 | d->documentMode = enabled; | - | ||||||||||||||||||
1849 | d->refreshTabBar(); | - | ||||||||||||||||||
1850 | } never executed: end of block | 0 | ||||||||||||||||||
1851 | bool QMdiArea::tabsClosable() const | - | ||||||||||||||||||
1852 | { | - | ||||||||||||||||||
1853 | const QMdiAreaPrivate * const d = d_func(); | - | ||||||||||||||||||
1854 | return never executed: d->tabsClosable;return d->tabsClosable; never executed: return d->tabsClosable; | 0 | ||||||||||||||||||
1855 | } | - | ||||||||||||||||||
1856 | - | |||||||||||||||||||
1857 | void QMdiArea::setTabsClosable(bool closable) | - | ||||||||||||||||||
1858 | { | - | ||||||||||||||||||
1859 | QMdiAreaPrivate * const d = d_func(); | - | ||||||||||||||||||
1860 | if (d->tabsClosable == closable
| 0 | ||||||||||||||||||
1861 | return; never executed: return; | 0 | ||||||||||||||||||
1862 | - | |||||||||||||||||||
1863 | d->tabsClosable = closable; | - | ||||||||||||||||||
1864 | d->refreshTabBar(); | - | ||||||||||||||||||
1865 | } never executed: end of block | 0 | ||||||||||||||||||
1866 | bool QMdiArea::tabsMovable() const | - | ||||||||||||||||||
1867 | { | - | ||||||||||||||||||
1868 | const QMdiAreaPrivate * const d = d_func(); | - | ||||||||||||||||||
1869 | return never executed: d->tabsMovable;return d->tabsMovable; never executed: return d->tabsMovable; | 0 | ||||||||||||||||||
1870 | } | - | ||||||||||||||||||
1871 | - | |||||||||||||||||||
1872 | void QMdiArea::setTabsMovable(bool movable) | - | ||||||||||||||||||
1873 | { | - | ||||||||||||||||||
1874 | QMdiAreaPrivate * const d = d_func(); | - | ||||||||||||||||||
1875 | if (d->tabsMovable == movable
| 0 | ||||||||||||||||||
1876 | return; never executed: return; | 0 | ||||||||||||||||||
1877 | - | |||||||||||||||||||
1878 | d->tabsMovable = movable; | - | ||||||||||||||||||
1879 | d->refreshTabBar(); | - | ||||||||||||||||||
1880 | } never executed: end of block | 0 | ||||||||||||||||||
1881 | QTabWidget::TabShape QMdiArea::tabShape() const | - | ||||||||||||||||||
1882 | { | - | ||||||||||||||||||
1883 | const QMdiAreaPrivate * const d = d_func(); | - | ||||||||||||||||||
1884 | return never executed: d->tabShape;return d->tabShape; never executed: return d->tabShape; | 0 | ||||||||||||||||||
1885 | } | - | ||||||||||||||||||
1886 | - | |||||||||||||||||||
1887 | void QMdiArea::setTabShape(QTabWidget::TabShape shape) | - | ||||||||||||||||||
1888 | { | - | ||||||||||||||||||
1889 | QMdiAreaPrivate * const d = d_func(); | - | ||||||||||||||||||
1890 | if (d->tabShape == shape
| 0 | ||||||||||||||||||
1891 | return; never executed: return; | 0 | ||||||||||||||||||
1892 | - | |||||||||||||||||||
1893 | d->tabShape = shape; | - | ||||||||||||||||||
1894 | d->refreshTabBar(); | - | ||||||||||||||||||
1895 | } never executed: end of block | 0 | ||||||||||||||||||
1896 | QTabWidget::TabPosition QMdiArea::tabPosition() const | - | ||||||||||||||||||
1897 | { | - | ||||||||||||||||||
1898 | const QMdiAreaPrivate * const d = d_func(); | - | ||||||||||||||||||
1899 | return never executed: d->tabPosition;return d->tabPosition; never executed: return d->tabPosition; | 0 | ||||||||||||||||||
1900 | } | - | ||||||||||||||||||
1901 | - | |||||||||||||||||||
1902 | void QMdiArea::setTabPosition(QTabWidget::TabPosition position) | - | ||||||||||||||||||
1903 | { | - | ||||||||||||||||||
1904 | QMdiAreaPrivate * const d = d_func(); | - | ||||||||||||||||||
1905 | if (d->tabPosition == position
| 0 | ||||||||||||||||||
1906 | return; never executed: return; | 0 | ||||||||||||||||||
1907 | - | |||||||||||||||||||
1908 | d->tabPosition = position; | - | ||||||||||||||||||
1909 | d->refreshTabBar(); | - | ||||||||||||||||||
1910 | } never executed: end of block | 0 | ||||||||||||||||||
1911 | - | |||||||||||||||||||
1912 | - | |||||||||||||||||||
1913 | - | |||||||||||||||||||
1914 | - | |||||||||||||||||||
1915 | - | |||||||||||||||||||
1916 | void QMdiArea::childEvent(QChildEvent *childEvent) | - | ||||||||||||||||||
1917 | { | - | ||||||||||||||||||
1918 | QMdiAreaPrivate * const d = d_func(); | - | ||||||||||||||||||
1919 | if (childEvent->type() == QEvent::ChildPolished
| 0 | ||||||||||||||||||
1920 | if (QMdiSubWindow *mdiChild = qobject_cast<QMdiSubWindow *>(childEvent->child())
| 0 | ||||||||||||||||||
1921 | if (d->childWindows.indexOf(mdiChild) == -1
| 0 | ||||||||||||||||||
1922 | d->appendChild(mdiChild); never executed: d->appendChild(mdiChild); | 0 | ||||||||||||||||||
1923 | } never executed: end of block | 0 | ||||||||||||||||||
1924 | } never executed: end of block | 0 | ||||||||||||||||||
1925 | } never executed: end of block | 0 | ||||||||||||||||||
1926 | - | |||||||||||||||||||
1927 | - | |||||||||||||||||||
1928 | - | |||||||||||||||||||
1929 | - | |||||||||||||||||||
1930 | void QMdiArea::resizeEvent(QResizeEvent *resizeEvent) | - | ||||||||||||||||||
1931 | { | - | ||||||||||||||||||
1932 | QMdiAreaPrivate * const d = d_func(); | - | ||||||||||||||||||
1933 | if (d->childWindows.isEmpty()
| 0 | ||||||||||||||||||
1934 | resizeEvent->ignore(); | - | ||||||||||||||||||
1935 | return; never executed: return; | 0 | ||||||||||||||||||
1936 | } | - | ||||||||||||||||||
1937 | - | |||||||||||||||||||
1938 | - | |||||||||||||||||||
1939 | d->updateTabBarGeometry(); | - | ||||||||||||||||||
1940 | - | |||||||||||||||||||
1941 | - | |||||||||||||||||||
1942 | - | |||||||||||||||||||
1943 | - | |||||||||||||||||||
1944 | - | |||||||||||||||||||
1945 | if (d->isSubWindowsTiled
| 0 | ||||||||||||||||||
1946 | d->tileCalledFromResizeEvent = true; | - | ||||||||||||||||||
1947 | tileSubWindows(); | - | ||||||||||||||||||
1948 | d->tileCalledFromResizeEvent = false; | - | ||||||||||||||||||
1949 | d->isSubWindowsTiled = true; | - | ||||||||||||||||||
1950 | d->startResizeTimer(); | - | ||||||||||||||||||
1951 | - | |||||||||||||||||||
1952 | return; never executed: return; | 0 | ||||||||||||||||||
1953 | } | - | ||||||||||||||||||
1954 | - | |||||||||||||||||||
1955 | - | |||||||||||||||||||
1956 | bool hasMaximizedSubWindow = false; | - | ||||||||||||||||||
1957 | 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) { | - | ||||||||||||||||||
1958 | if (sanityCheck(child, "QMdiArea::resizeEvent")
| 0 | ||||||||||||||||||
1959 | && child->size() != resizeEvent->size()
| 0 | ||||||||||||||||||
1960 | child->resize(resizeEvent->size()); | - | ||||||||||||||||||
1961 | if (!hasMaximizedSubWindow
| 0 | ||||||||||||||||||
1962 | hasMaximizedSubWindow = true; never executed: hasMaximizedSubWindow = true; | 0 | ||||||||||||||||||
1963 | } never executed: end of block | 0 | ||||||||||||||||||
1964 | } never executed: end of block | 0 | ||||||||||||||||||
1965 | - | |||||||||||||||||||
1966 | d->updateScrollBars(); | - | ||||||||||||||||||
1967 | - | |||||||||||||||||||
1968 | - | |||||||||||||||||||
1969 | - | |||||||||||||||||||
1970 | - | |||||||||||||||||||
1971 | if (hasMaximizedSubWindow
| 0 | ||||||||||||||||||
1972 | d->startResizeTimer(); never executed: d->startResizeTimer(); | 0 | ||||||||||||||||||
1973 | else | - | ||||||||||||||||||
1974 | d->arrangeMinimizedSubWindows(); never executed: d->arrangeMinimizedSubWindows(); | 0 | ||||||||||||||||||
1975 | } | - | ||||||||||||||||||
1976 | - | |||||||||||||||||||
1977 | - | |||||||||||||||||||
1978 | - | |||||||||||||||||||
1979 | - | |||||||||||||||||||
1980 | void QMdiArea::timerEvent(QTimerEvent *timerEvent) | - | ||||||||||||||||||
1981 | { | - | ||||||||||||||||||
1982 | QMdiAreaPrivate * const d = d_func(); | - | ||||||||||||||||||
1983 | if (timerEvent->timerId() == d->resizeTimerId
| 0 | ||||||||||||||||||
1984 | killTimer(d->resizeTimerId); | - | ||||||||||||||||||
1985 | d->resizeTimerId = -1; | - | ||||||||||||||||||
1986 | d->arrangeMinimizedSubWindows(); | - | ||||||||||||||||||
1987 | } never executed: else if (timerEvent->timerId() == d->tabToPreviousTimerIdend of block
| 0 | ||||||||||||||||||
1988 | killTimer(d->tabToPreviousTimerId); | - | ||||||||||||||||||
1989 | d->tabToPreviousTimerId = -1; | - | ||||||||||||||||||
1990 | if (d->indexToHighlighted < 0
| 0 | ||||||||||||||||||
1991 | return; never executed: return; | 0 | ||||||||||||||||||
1992 | - | |||||||||||||||||||
1993 | - | |||||||||||||||||||
1994 | ((!(d->indexToHighlighted < d->childWindows.size())) ? qt_assert("d->indexToHighlighted < d->childWindows.size()",__FILE__,2351) : qt_noop()); | - | ||||||||||||||||||
1995 | ((!(d->rubberBand)) ? qt_assert("d->rubberBand",__FILE__,2352) : qt_noop()); | - | ||||||||||||||||||
1996 | d->showRubberBandFor(d->childWindows.at(d->indexToHighlighted)); | - | ||||||||||||||||||
1997 | - | |||||||||||||||||||
1998 | } never executed: end of block | 0 | ||||||||||||||||||
1999 | } never executed: end of block | 0 | ||||||||||||||||||
2000 | - | |||||||||||||||||||
2001 | - | |||||||||||||||||||
2002 | - | |||||||||||||||||||
2003 | - | |||||||||||||||||||
2004 | void QMdiArea::showEvent(QShowEvent *showEvent) | - | ||||||||||||||||||
2005 | { | - | ||||||||||||||||||
2006 | QMdiAreaPrivate * const d = d_func(); | - | ||||||||||||||||||
2007 | if (!d->pendingRearrangements.isEmpty()
| 0 | ||||||||||||||||||
2008 | bool skipPlacement = false; | - | ||||||||||||||||||
2009 | 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) { | - | ||||||||||||||||||
2010 | - | |||||||||||||||||||
2011 | - | |||||||||||||||||||
2012 | if (rearranger->type() != Rearranger::IconTiler
| 0 | ||||||||||||||||||
2013 | skipPlacement = true; never executed: skipPlacement = true; | 0 | ||||||||||||||||||
2014 | d->rearrange(rearranger); | - | ||||||||||||||||||
2015 | } never executed: end of block | 0 | ||||||||||||||||||
2016 | d->pendingRearrangements.clear(); | - | ||||||||||||||||||
2017 | - | |||||||||||||||||||
2018 | if (skipPlacement
| 0 | ||||||||||||||||||
2019 | d->pendingPlacements.clear(); never executed: d->pendingPlacements.clear(); | 0 | ||||||||||||||||||
2020 | } never executed: end of block | 0 | ||||||||||||||||||
2021 | - | |||||||||||||||||||
2022 | if (!d->pendingPlacements.isEmpty()
| 0 | ||||||||||||||||||
2023 | 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) { | - | ||||||||||||||||||
2024 | if (!window
| 0 | ||||||||||||||||||
2025 | continue; never executed: continue; | 0 | ||||||||||||||||||
2026 | if (!window->testAttribute(Qt::WA_Resized)
| 0 | ||||||||||||||||||
2027 | QSize newSize(window->sizeHint().boundedTo(viewport()->size())); | - | ||||||||||||||||||
2028 | window->resize(newSize.expandedTo(qSmartMinSize(window))); | - | ||||||||||||||||||
2029 | } never executed: end of block | 0 | ||||||||||||||||||
2030 | if (!window->testAttribute(Qt::WA_Moved)
| 0 | ||||||||||||||||||
2031 | && !window->isMaximized()
| 0 | ||||||||||||||||||
2032 | d->place(d->placer, window); | - | ||||||||||||||||||
2033 | } never executed: end of block | 0 | ||||||||||||||||||
2034 | } never executed: end of block | 0 | ||||||||||||||||||
2035 | d->pendingPlacements.clear(); | - | ||||||||||||||||||
2036 | } never executed: end of block | 0 | ||||||||||||||||||
2037 | - | |||||||||||||||||||
2038 | d->setChildActivationEnabled(true); | - | ||||||||||||||||||
2039 | d->activateCurrentWindow(); | - | ||||||||||||||||||
2040 | - | |||||||||||||||||||
2041 | QAbstractScrollArea::showEvent(showEvent); | - | ||||||||||||||||||
2042 | } never executed: end of block | 0 | ||||||||||||||||||
2043 | - | |||||||||||||||||||
2044 | - | |||||||||||||||||||
2045 | - | |||||||||||||||||||
2046 | - | |||||||||||||||||||
2047 | bool QMdiArea::viewportEvent(QEvent *event) | - | ||||||||||||||||||
2048 | { | - | ||||||||||||||||||
2049 | QMdiAreaPrivate * const d = d_func(); | - | ||||||||||||||||||
2050 | switch (event->type()) { | - | ||||||||||||||||||
2051 | case never executed: QEvent::ChildRemoved:case QEvent::ChildRemoved: never executed: {case QEvent::ChildRemoved: | 0 | ||||||||||||||||||
2052 | d->isSubWindowsTiled = false; | - | ||||||||||||||||||
2053 | QObject *removedChild = static_cast<QChildEvent *>(event)->child(); | - | ||||||||||||||||||
2054 | for (int i = 0; i < d->childWindows.size()
| 0 | ||||||||||||||||||
2055 | QObject *child = d->childWindows.at(i); | - | ||||||||||||||||||
2056 | if (!child
| 0 | ||||||||||||||||||
2057 | || child->parent() != viewport()
| 0 | ||||||||||||||||||
2058 | if (!testOption(DontMaximizeSubWindowOnActivation)
| 0 | ||||||||||||||||||
2059 | - | |||||||||||||||||||
2060 | - | |||||||||||||||||||
2061 | QWidget *mdiChild = qobject_cast<QWidget *>(removedChild); | - | ||||||||||||||||||
2062 | if (mdiChild
| 0 | ||||||||||||||||||
2063 | d->showActiveWindowMaximized = true; never executed: d->showActiveWindowMaximized = true; | 0 | ||||||||||||||||||
2064 | } never executed: end of block | 0 | ||||||||||||||||||
2065 | d->disconnectSubWindow(child); | - | ||||||||||||||||||
2066 | const bool activeRemoved = i == d->indicesToActivatedChildren.at(0); | - | ||||||||||||||||||
2067 | d->childWindows.removeAt(i); | - | ||||||||||||||||||
2068 | d->indicesToActivatedChildren.removeAll(i); | - | ||||||||||||||||||
2069 | d->updateActiveWindow(i, activeRemoved); | - | ||||||||||||||||||
2070 | d->arrangeMinimizedSubWindows(); | - | ||||||||||||||||||
2071 | break; never executed: break; | 0 | ||||||||||||||||||
2072 | } | - | ||||||||||||||||||
2073 | } never executed: end of block | 0 | ||||||||||||||||||
2074 | d->updateScrollBars(); | - | ||||||||||||||||||
2075 | break; never executed: break; | 0 | ||||||||||||||||||
2076 | } | - | ||||||||||||||||||
2077 | case never executed: QEvent::Destroy:case QEvent::Destroy: never executed: case QEvent::Destroy: | 0 | ||||||||||||||||||
2078 | d->isSubWindowsTiled = false; | - | ||||||||||||||||||
2079 | d->resetActiveWindow(); | - | ||||||||||||||||||
2080 | d->childWindows.clear(); | - | ||||||||||||||||||
2081 | QMessageLogger(__FILE__, 2438, __PRETTY_FUNCTION__).warning("QMdiArea: Deleting the view port is undefined, use setViewport instead."); | - | ||||||||||||||||||
2082 | break; never executed: break; | 0 | ||||||||||||||||||
2083 | default never executed: :default: never executed: default: | 0 | ||||||||||||||||||
2084 | break; never executed: break; | 0 | ||||||||||||||||||
2085 | } | - | ||||||||||||||||||
2086 | return never executed: QAbstractScrollArea::viewportEvent(event);return QAbstractScrollArea::viewportEvent(event); never executed: return QAbstractScrollArea::viewportEvent(event); | 0 | ||||||||||||||||||
2087 | } | - | ||||||||||||||||||
2088 | - | |||||||||||||||||||
2089 | - | |||||||||||||||||||
2090 | - | |||||||||||||||||||
2091 | - | |||||||||||||||||||
2092 | void QMdiArea::scrollContentsBy(int dx, int dy) | - | ||||||||||||||||||
2093 | { | - | ||||||||||||||||||
2094 | QMdiAreaPrivate * const d = d_func(); | - | ||||||||||||||||||
2095 | const bool wasSubWindowsTiled = d->isSubWindowsTiled; | - | ||||||||||||||||||
2096 | d->ignoreGeometryChange = true; | - | ||||||||||||||||||
2097 | viewport()->scroll(isLeftToRight() ? dx : -dx, dy); | - | ||||||||||||||||||
2098 | d->arrangeMinimizedSubWindows(); | - | ||||||||||||||||||
2099 | d->ignoreGeometryChange = false; | - | ||||||||||||||||||
2100 | if (wasSubWindowsTiled
| 0 | ||||||||||||||||||
2101 | d->isSubWindowsTiled = true; never executed: d->isSubWindowsTiled = true; | 0 | ||||||||||||||||||
2102 | } never executed: end of block | 0 | ||||||||||||||||||
2103 | - | |||||||||||||||||||
2104 | - | |||||||||||||||||||
2105 | - | |||||||||||||||||||
2106 | - | |||||||||||||||||||
2107 | - | |||||||||||||||||||
2108 | - | |||||||||||||||||||
2109 | void QMdiArea::tileSubWindows() | - | ||||||||||||||||||
2110 | { | - | ||||||||||||||||||
2111 | QMdiAreaPrivate * const d = d_func(); | - | ||||||||||||||||||
2112 | if (!d->regularTiler
| 0 | ||||||||||||||||||
2113 | d->regularTiler = new RegularTiler; never executed: d->regularTiler = new RegularTiler; | 0 | ||||||||||||||||||
2114 | d->rearrange(d->regularTiler); | - | ||||||||||||||||||
2115 | } never executed: end of block | 0 | ||||||||||||||||||
2116 | - | |||||||||||||||||||
2117 | - | |||||||||||||||||||
2118 | - | |||||||||||||||||||
2119 | - | |||||||||||||||||||
2120 | - | |||||||||||||||||||
2121 | - | |||||||||||||||||||
2122 | void QMdiArea::cascadeSubWindows() | - | ||||||||||||||||||
2123 | { | - | ||||||||||||||||||
2124 | QMdiAreaPrivate * const d = d_func(); | - | ||||||||||||||||||
2125 | if (!d->cascader
| 0 | ||||||||||||||||||
2126 | d->cascader = new SimpleCascader; never executed: d->cascader = new SimpleCascader; | 0 | ||||||||||||||||||
2127 | d->rearrange(d->cascader); | - | ||||||||||||||||||
2128 | } never executed: end of block | 0 | ||||||||||||||||||
2129 | - | |||||||||||||||||||
2130 | - | |||||||||||||||||||
2131 | - | |||||||||||||||||||
2132 | - | |||||||||||||||||||
2133 | bool QMdiArea::event(QEvent *event) | - | ||||||||||||||||||
2134 | { | - | ||||||||||||||||||
2135 | QMdiAreaPrivate * const d = d_func(); | - | ||||||||||||||||||
2136 | switch (event->type()) { | - | ||||||||||||||||||
2137 | - | |||||||||||||||||||
2138 | - | |||||||||||||||||||
2139 | - | |||||||||||||||||||
2140 | - | |||||||||||||||||||
2141 | - | |||||||||||||||||||
2142 | - | |||||||||||||||||||
2143 | - | |||||||||||||||||||
2144 | case never executed: QEvent::WindowActivate:case QEvent::WindowActivate: never executed: {case QEvent::WindowActivate: | 0 | ||||||||||||||||||
2145 | d->isActivated = true; | - | ||||||||||||||||||
2146 | if (d->childWindows.isEmpty()
| 0 | ||||||||||||||||||
2147 | break; never executed: break; | 0 | ||||||||||||||||||
2148 | if (!d->active
| 0 | ||||||||||||||||||
2149 | d->activateCurrentWindow(); never executed: d->activateCurrentWindow(); | 0 | ||||||||||||||||||
2150 | d->setChildActivationEnabled(false, true); | - | ||||||||||||||||||
2151 | break; never executed: break; | 0 | ||||||||||||||||||
2152 | } | - | ||||||||||||||||||
2153 | case never executed: QEvent::WindowDeactivate:case QEvent::WindowDeactivate: never executed: case QEvent::WindowDeactivate: | 0 | ||||||||||||||||||
2154 | d->isActivated = false; | - | ||||||||||||||||||
2155 | d->setChildActivationEnabled(false, true); | - | ||||||||||||||||||
2156 | break; never executed: break; | 0 | ||||||||||||||||||
2157 | case never executed: QEvent::StyleChange:case QEvent::StyleChange: never executed: case QEvent::StyleChange: | 0 | ||||||||||||||||||
2158 | - | |||||||||||||||||||
2159 | - | |||||||||||||||||||
2160 | - | |||||||||||||||||||
2161 | if (d->isSubWindowsTiled
| 0 | ||||||||||||||||||
2162 | tileSubWindows(); | - | ||||||||||||||||||
2163 | d->isSubWindowsTiled = true; | - | ||||||||||||||||||
2164 | } never executed: end of block | 0 | ||||||||||||||||||
2165 | break; never executed: break; | 0 | ||||||||||||||||||
2166 | case never executed: QEvent::WindowIconChange:case QEvent::WindowIconChange: never executed: case QEvent::WindowIconChange: | 0 | ||||||||||||||||||
2167 | 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) { | - | ||||||||||||||||||
2168 | if (sanityCheck(window, "QMdiArea::WindowIconChange")
| 0 | ||||||||||||||||||
2169 | QApplication::sendEvent(window, event); never executed: QApplication::sendEvent(window, event); | 0 | ||||||||||||||||||
2170 | } never executed: end of block | 0 | ||||||||||||||||||
2171 | break; never executed: break; | 0 | ||||||||||||||||||
2172 | case never executed: QEvent::Hide:case QEvent::Hide: never executed: case QEvent::Hide: | 0 | ||||||||||||||||||
2173 | d->setActive(d->active, false, false); | - | ||||||||||||||||||
2174 | d->setChildActivationEnabled(false); | - | ||||||||||||||||||
2175 | break; never executed: break; | 0 | ||||||||||||||||||
2176 | - | |||||||||||||||||||
2177 | case never executed: QEvent::LayoutDirectionChange:case QEvent::LayoutDirectionChange: never executed: case QEvent::LayoutDirectionChange: | 0 | ||||||||||||||||||
2178 | d->updateTabBarGeometry(); | - | ||||||||||||||||||
2179 | break; never executed: break; | 0 | ||||||||||||||||||
2180 | - | |||||||||||||||||||
2181 | default never executed: :default: never executed: default: | 0 | ||||||||||||||||||
2182 | break; never executed: break; | 0 | ||||||||||||||||||
2183 | } | - | ||||||||||||||||||
2184 | return never executed: QAbstractScrollArea::event(event);return QAbstractScrollArea::event(event); never executed: return QAbstractScrollArea::event(event); | 0 | ||||||||||||||||||
2185 | } | - | ||||||||||||||||||
2186 | - | |||||||||||||||||||
2187 | - | |||||||||||||||||||
2188 | - | |||||||||||||||||||
2189 | - | |||||||||||||||||||
2190 | bool QMdiArea::eventFilter(QObject *object, QEvent *event) | - | ||||||||||||||||||
2191 | { | - | ||||||||||||||||||
2192 | if (!object
| 0 | ||||||||||||||||||
2193 | return never executed: QAbstractScrollArea::eventFilter(object, event);return QAbstractScrollArea::eventFilter(object, event); never executed: return QAbstractScrollArea::eventFilter(object, event); | 0 | ||||||||||||||||||
2194 | - | |||||||||||||||||||
2195 | QMdiAreaPrivate * const d = d_func(); | - | ||||||||||||||||||
2196 | - | |||||||||||||||||||
2197 | if (event->type() == QEvent::KeyPress
| 0 | ||||||||||||||||||
2198 | - | |||||||||||||||||||
2199 | QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event); | - | ||||||||||||||||||
2200 | - | |||||||||||||||||||
2201 | - | |||||||||||||||||||
2202 | - | |||||||||||||||||||
2203 | - | |||||||||||||||||||
2204 | if (!(keyEvent->modifiers() & Qt::ControlModifier)
| 0 | ||||||||||||||||||
2205 | - | |||||||||||||||||||
2206 | return never executed: QAbstractScrollArea::eventFilter(object, event);return QAbstractScrollArea::eventFilter(object, event); never executed: return QAbstractScrollArea::eventFilter(object, event); | 0 | ||||||||||||||||||
2207 | - | |||||||||||||||||||
2208 | - | |||||||||||||||||||
2209 | QMdiArea *area = mdiAreaParent(static_cast<QWidget *>(object)); | - | ||||||||||||||||||
2210 | if (!area
| 0 | ||||||||||||||||||
2211 | return never executed: QAbstractScrollArea::eventFilter(object, event);return QAbstractScrollArea::eventFilter(object, event); never executed: return QAbstractScrollArea::eventFilter(object, event); | 0 | ||||||||||||||||||
2212 | - | |||||||||||||||||||
2213 | const bool keyPress = (event->type() == QEvent::KeyPress); | - | ||||||||||||||||||
2214 | - | |||||||||||||||||||
2215 | - | |||||||||||||||||||
2216 | - | |||||||||||||||||||
2217 | - | |||||||||||||||||||
2218 | - | |||||||||||||||||||
2219 | switch (keyEvent->key()) { | - | ||||||||||||||||||
2220 | - | |||||||||||||||||||
2221 | - | |||||||||||||||||||
2222 | - | |||||||||||||||||||
2223 | case never executed: Qt::Key_Control:case Qt::Key_Control: never executed: case Qt::Key_Control: | 0 | ||||||||||||||||||
2224 | - | |||||||||||||||||||
2225 | if (keyPress
| 0 | ||||||||||||||||||
2226 | area->d_func()->startTabToPreviousTimer(); never executed: area->d_func()->startTabToPreviousTimer(); | 0 | ||||||||||||||||||
2227 | else | - | ||||||||||||||||||
2228 | area->d_func()->activateHighlightedWindow(); never executed: area->d_func()->activateHighlightedWindow(); | 0 | ||||||||||||||||||
2229 | break; never executed: break; | 0 | ||||||||||||||||||
2230 | case never executed: Qt::Key_Tab:case Qt::Key_Tab: never executed: case Qt::Key_Tab: | 0 | ||||||||||||||||||
2231 | case never executed: Qt::Key_Backtab:case Qt::Key_Backtab: never executed: case Qt::Key_Backtab: | 0 | ||||||||||||||||||
2232 | if (keyPress
| 0 | ||||||||||||||||||
2233 | 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 | ||||||||||||||||||
2234 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||||||||
2235 | - | |||||||||||||||||||
2236 | case never executed: Qt::Key_Escape:case Qt::Key_Escape: never executed: case Qt::Key_Escape: | 0 | ||||||||||||||||||
2237 | area->d_func()->hideRubberBand(); | - | ||||||||||||||||||
2238 | break; never executed: break; | 0 | ||||||||||||||||||
2239 | - | |||||||||||||||||||
2240 | default never executed: :default: never executed: default: | 0 | ||||||||||||||||||
2241 | break; never executed: break; | 0 | ||||||||||||||||||
2242 | } | - | ||||||||||||||||||
2243 | return never executed: QAbstractScrollArea::eventFilter(object, event);return QAbstractScrollArea::eventFilter(object, event); never executed: return QAbstractScrollArea::eventFilter(object, event); | 0 | ||||||||||||||||||
2244 | } | - | ||||||||||||||||||
2245 | - | |||||||||||||||||||
2246 | QMdiSubWindow *subWindow = qobject_cast<QMdiSubWindow *>(object); | - | ||||||||||||||||||
2247 | - | |||||||||||||||||||
2248 | if (!subWindow
| 0 | ||||||||||||||||||
2249 | - | |||||||||||||||||||
2250 | if (event->type() == QEvent::ApplicationActivate
| 0 | ||||||||||||||||||
2251 | && isVisible()
| 0 | ||||||||||||||||||
2252 | d->activateCurrentWindow(); | - | ||||||||||||||||||
2253 | } never executed: else if (event->type() == QEvent::ApplicationDeactivateend of block
| 0 | ||||||||||||||||||
2254 | d->setActive(d->active, false, false); | - | ||||||||||||||||||
2255 | } never executed: end of block | 0 | ||||||||||||||||||
2256 | return never executed: QAbstractScrollArea::eventFilter(object, event);return QAbstractScrollArea::eventFilter(object, event); never executed: return QAbstractScrollArea::eventFilter(object, event); | 0 | ||||||||||||||||||
2257 | } | - | ||||||||||||||||||
2258 | - | |||||||||||||||||||
2259 | if (subWindow->mdiArea() != this
| 0 | ||||||||||||||||||
2260 | return never executed: QAbstractScrollArea::eventFilter(object, event);return QAbstractScrollArea::eventFilter(object, event); never executed: return QAbstractScrollArea::eventFilter(object, event); | 0 | ||||||||||||||||||
2261 | - | |||||||||||||||||||
2262 | - | |||||||||||||||||||
2263 | switch (event->type()) { | - | ||||||||||||||||||
2264 | case never executed: QEvent::Move:case QEvent::Move: never executed: case QEvent::Move: | 0 | ||||||||||||||||||
2265 | case never executed: QEvent::Resize:case QEvent::Resize: never executed: case QEvent::Resize: | 0 | ||||||||||||||||||
2266 | if (d->tileCalledFromResizeEvent
| 0 | ||||||||||||||||||
2267 | break; never executed: break; | 0 | ||||||||||||||||||
2268 | d->updateScrollBars(); | - | ||||||||||||||||||
2269 | if (!subWindow->isMinimized()
| 0 | ||||||||||||||||||
2270 | d->isSubWindowsTiled = false; never executed: d->isSubWindowsTiled = false; | 0 | ||||||||||||||||||
2271 | break; never executed: break; | 0 | ||||||||||||||||||
2272 | case never executed: QEvent::Show:case QEvent::Show: never executed: case QEvent::Show: | 0 | ||||||||||||||||||
2273 | - | |||||||||||||||||||
2274 | if (d->tabBar
| 0 | ||||||||||||||||||
2275 | const int tabIndex = d->childWindows.indexOf(subWindow); | - | ||||||||||||||||||
2276 | if (!d->tabBar->isTabEnabled(tabIndex)
| 0 | ||||||||||||||||||
2277 | d->tabBar->setTabEnabled(tabIndex, true); never executed: d->tabBar->setTabEnabled(tabIndex, true); | 0 | ||||||||||||||||||
2278 | } never executed: end of block | 0 | ||||||||||||||||||
2279 | - | |||||||||||||||||||
2280 | - | |||||||||||||||||||
2281 | case never executed: QEvent::Hide:case QEvent::Hide: never executed: case QEvent::Hide: code before this statement never executed: case QEvent::Hide: | 0 | ||||||||||||||||||
2282 | d->isSubWindowsTiled = false; | - | ||||||||||||||||||
2283 | break; never executed: break; | 0 | ||||||||||||||||||
2284 | - | |||||||||||||||||||
2285 | case never executed: QEvent::Close:case QEvent::Close: never executed: case QEvent::Close: | 0 | ||||||||||||||||||
2286 | if (d->childWindows.indexOf(subWindow) == d->indexToHighlighted
| 0 | ||||||||||||||||||
2287 | d->hideRubberBand(); never executed: d->hideRubberBand(); | 0 | ||||||||||||||||||
2288 | break; never executed: break; | 0 | ||||||||||||||||||
2289 | - | |||||||||||||||||||
2290 | - | |||||||||||||||||||
2291 | case never executed: QEvent::WindowTitleChange:case QEvent::WindowTitleChange: never executed: case QEvent::WindowTitleChange: | 0 | ||||||||||||||||||
2292 | case never executed: QEvent::ModifiedChange:case QEvent::ModifiedChange: never executed: case QEvent::ModifiedChange: | 0 | ||||||||||||||||||
2293 | if (d->tabBar
| 0 | ||||||||||||||||||
2294 | d->tabBar->setTabText(d->childWindows.indexOf(subWindow), tabTextFor(subWindow)); never executed: d->tabBar->setTabText(d->childWindows.indexOf(subWindow), tabTextFor(subWindow)); | 0 | ||||||||||||||||||
2295 | break; never executed: break; | 0 | ||||||||||||||||||
2296 | case never executed: QEvent::WindowIconChange:case QEvent::WindowIconChange: never executed: case QEvent::WindowIconChange: | 0 | ||||||||||||||||||
2297 | if (d->tabBar
| 0 | ||||||||||||||||||
2298 | d->tabBar->setTabIcon(d->childWindows.indexOf(subWindow), subWindow->windowIcon()); never executed: d->tabBar->setTabIcon(d->childWindows.indexOf(subWindow), subWindow->windowIcon()); | 0 | ||||||||||||||||||
2299 | break; never executed: break; | 0 | ||||||||||||||||||
2300 | - | |||||||||||||||||||
2301 | default never executed: :default: never executed: default: | 0 | ||||||||||||||||||
2302 | break; never executed: break; | 0 | ||||||||||||||||||
2303 | } | - | ||||||||||||||||||
2304 | return never executed: QAbstractScrollArea::eventFilter(object, event);return QAbstractScrollArea::eventFilter(object, event); never executed: return QAbstractScrollArea::eventFilter(object, event); | 0 | ||||||||||||||||||
2305 | } | - | ||||||||||||||||||
2306 | - | |||||||||||||||||||
2307 | - | |||||||||||||||||||
2308 | - | |||||||||||||||||||
2309 | - | |||||||||||||||||||
2310 | void QMdiArea::paintEvent(QPaintEvent *paintEvent) | - | ||||||||||||||||||
2311 | { | - | ||||||||||||||||||
2312 | QMdiAreaPrivate * const d = d_func(); | - | ||||||||||||||||||
2313 | QPainter painter(d->viewport); | - | ||||||||||||||||||
2314 | const QVector<QRect> &exposedRects = paintEvent->region().rects(); | - | ||||||||||||||||||
2315 | for (int i = 0; i < exposedRects.size()
| 0 | ||||||||||||||||||
2316 | painter.fillRect(exposedRects.at(i), d->background); never executed: painter.fillRect(exposedRects.at(i), d->background); | 0 | ||||||||||||||||||
2317 | } never executed: end of block | 0 | ||||||||||||||||||
2318 | void QMdiArea::setupViewport(QWidget *viewport) | - | ||||||||||||||||||
2319 | { | - | ||||||||||||||||||
2320 | QMdiAreaPrivate * const d = d_func(); | - | ||||||||||||||||||
2321 | if (viewport
| 0 | ||||||||||||||||||
2322 | viewport->setAttribute(Qt::WA_OpaquePaintEvent, d->background.isOpaque()); never executed: viewport->setAttribute(Qt::WA_OpaquePaintEvent, d->background.isOpaque()); | 0 | ||||||||||||||||||
2323 | 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) { | - | ||||||||||||||||||
2324 | if (!sanityCheck(child, "QMdiArea::setupViewport")
| 0 | ||||||||||||||||||
2325 | continue; never executed: continue; | 0 | ||||||||||||||||||
2326 | child->setParent(viewport, child->windowFlags()); | - | ||||||||||||||||||
2327 | } never executed: end of block | 0 | ||||||||||||||||||
2328 | } never executed: end of block | 0 | ||||||||||||||||||
2329 | - | |||||||||||||||||||
2330 | - | |||||||||||||||||||
2331 | - | |||||||||||||||||||
Switch to Source code | Preprocessed file |