123#include <QApplication>
125#include <QChildEvent>
126#include <QResizeEvent>
128#include <QtAlgorithms>
130#include <QFontMetrics>
131#include <QStyleOption>
137#include <private/qlayoutengine_p.h>
150 const char error[] =
"null pointer";
161 const char error[] =
"index out of range";
167 const char error[] =
"null pointer";
175static void setIndex(
int *
index,
int candidate,
int min,
int max,
bool isIncreasing)
198 return childrenRect.
width() > maxViewportSize.
width()
199 || childrenRect.
left() < 0
200 || childrenRect.
right() >= maxViewportSize.
width();
203 || childrenRect.
top() < 0
222#if QT_CONFIG(tabwidget)
252 const int nrows =
qMax((
n % ncols) ? (
n / ncols + 1) : (
n / ncols), 1);
253 const int nspecial = (
n % ncols) ? (ncols -
n % ncols) : 0;
254 const int dx = domain.
width() / ncols;
255 const int dy = domain.
height() / nrows;
259 const int y1 = int(
row * (dy + 1));
260 for (
int col = 0; col < ncols; ++col) {
261 if (
row == 1 && col < nspecial)
263 const int x1 = int(col * (dx + 1));
264 int x2 = int(
x1 + dx);
265 int y2 = int(
y1 + dy);
266 if (
row == 0 && col < nspecial) {
273 if (col == ncols - 1 &&
x2 != domain.
right())
295 const int topOffset = 0;
296 const int bottomOffset = 50;
305 const int dy =
qMax(titleBarHeight - (titleBarHeight -
fontMetrics.height()) / 2, 1)
309 const int nrows =
qMax((domain.
height() - (topOffset + bottomOffset)) / dy, 1);
310 const int ncols =
qMax(
n / nrows + ((
n % nrows) ? 1 : 0), 1);
315 for (
int col = 0; col < ncols; ++col) {
317 const int y = topOffset +
row * dy;
341 const int nrows =
n / ncols + ((
n % ncols) ? 1 : 0);
345 for (
int col = 0; col < ncols; ++col) {
346 const int x = col *
width;
369 accOverlap += intersection.
width() * intersection.
height();
382 int minAccOverlap = -1;
383 QRect minAccOverlapRect;
385 const int accOverlap = accumulatedOverlap(srcRect, rects);
386 if (accOverlap < minAccOverlap || minAccOverlap == -1) {
387 minAccOverlap = accOverlap;
388 minAccOverlapRect = srcRect;
391 return minAccOverlapRect;
409 ylist << domain.
top();
414 xlist <<
rect.right() + 1;
415 ylist <<
rect.bottom() + 1;
418 std::sort(xlist.
begin(), xlist.
end());
421 std::sort(ylist.
begin(), ylist.
end());
425 for (
int y :
std::as_const(ylist))
426 for (int
x :
std::as_const(xlist))
438 const auto containedInDomain =
439 [domain](
const QRect &srcRect) {
return domain.
contains(srcRect); };
441 const auto firstOut = std::stable_partition(
source.begin(),
source.end(), containedInDomain);
445 std::copy(firstOut,
source.end(), std::back_inserter(
result));
465 const int overlap = intersection.
width() * intersection.
height();
466 if (overlap >= maxOverlap || maxOverlap == -1) {
467 if (overlap > maxOverlap) {
468 maxOverlap = overlap;
492 QList<QRect> maxOverlappers = findMaxOverlappers(domain, nonInsiders);
493 return findMinOverlapRect(maxOverlappers, rects).
topLeft();
504 const QRect &domain)
const
514 return findBestPlacement(domain, rects, candidates);
518class QMdiAreaTabBar :
public QTabBar
525#ifndef QT_NO_CONTEXTMENU
552#ifndef QT_NO_CONTEXTMENU
559 if (!subWindow || subWindow->isHidden()) {
571 QMdiSubWindow *currentSubWindow = subWindowFromIndex(currentIndex());
601 if (index < 0 || index >=
count())
604 QMdiArea *mdiArea = qobject_cast<QMdiArea *>(parentWidget());
631 activationOrder(
QMdiArea::CreationOrder),
642 ignoreGeometryChange(
false),
643 ignoreWindowStateChange(
false),
645 isSubWindowsTiled(
false),
646 showActiveWindowMaximized(
false),
647 tileCalledFromResizeEvent(
false),
648 updatesDisabledByUs(
false),
649 inViewModeChange(
false),
650 indexToNextWindow(-1),
651 indexToPreviousWindow(-1),
652 indexToHighlighted(-1),
653 indexToLastActiveTab(-1),
655 tabToPreviousTimerId(-1)
668 if (!aboutToActivate)
682 if (
q->updatesEnabled()) {
684 q->setUpdatesEnabled(
false);
691 child->d_func()->setActive(
false);
733#if !QT_CONFIG(tabbar)
743 if (lastActive && lastActive->
isHidden())
757#if !QT_CONFIG(tabbar)
768#if !QT_CONFIG(tabbar)
814 updateTabBarGeometry();
822 child->installEventFilter(
q);
838 if (!
q->isVisible()) {
848 QRect parentRect =
q->rect();
854 QRect occupiedGeometry;
855 if (
window->isMaximized()) {
856 occupiedGeometry =
QRect(
window->d_func()->oldGeometry.topLeft(),
857 window->d_func()->restoreSize);
859 occupiedGeometry =
window->geometry();
877 if (!
q->isVisible()) {
890 QSize minSubWindowSize;
895 if (
child->isMinimized() && !
child->isShaded())
898 if (
child->isMinimized() && !
child->isShaded())
900 if (
child->isMaximized() ||
child->isShaded())
948 active->d_func()->setActive(
false);
957 if (
child->d_func()->isActive &&
active ==
nullptr)
958 child->d_func()->isActive =
false;
960 child->d_func()->setActive(
true);
970 current->d_func()->activationEnabled =
true;
971 current->d_func()->setActive(
true,
false);
985#if QT_CONFIG(rubberband)
997 if (activeWindow ==
active)
999 Q_ASSERT(activeWindow->d_func()->isActive);
1015 Q_ASSERT(indexToActiveWindow != -1);
1022 q->setUpdatesEnabled(
true);
1031#if QT_CONFIG(tabbar)
1032 if (
tabBar &&
tabBar->currentIndex() != indexToActiveWindow)
1033 tabBar->setCurrentIndex(indexToActiveWindow);
1048 if (deactivatedWindow) {
1049 if (deactivatedWindow !=
active)
1056 emit q->subWindowActivated(
nullptr);
1064 emit q->subWindowActivated(
nullptr);
1074#if QT_CONFIG(tabbar)
1075 if (
tabBar && removedIndex >= 0) {
1077 tabBar->removeTab(removedIndex);
1078 updateTabBarGeometry();
1089#if QT_CONFIG(rubberband)
1103 if (*
index > removedIndex)
1125 QSize maxSize =
q->maximumViewportSize();
1126 QSize hbarExtent = hbar->sizeHint();
1127 QSize vbarExtent = vbar->sizeHint();
1130 const int doubleFrameWidth = frameWidth * 2;
1132 maxSize.
rheight() -= doubleFrameWidth;
1134 maxSize.
rwidth() -= doubleFrameWidth;
1135 hbarExtent.
rheight() += doubleFrameWidth;
1136 vbarExtent.
rwidth() += doubleFrameWidth;
1144 if (useHorizontalScrollBar && !useVerticalScrollBar) {
1149 if (useVerticalScrollBar && !useHorizontalScrollBar) {
1160 const int startX =
q->isLeftToRight() ? childrenRect.
left() : viewportRect.
right()
1161 - childrenRect.
right();
1166 const int xOffset = startX + hbar->value();
1167 hbar->setRange(
qMin(0, xOffset),
1169 hbar->setPageStep(childrenRect.
width());
1170 hbar->setSingleStep(childrenRect.
width() / 20);
1175 const int yOffset = childrenRect.
top() + vbar->value();
1176 vbar->setRange(
qMin(0, yOffset),
1178 vbar->setPageStep(childrenRect.
height());
1179 vbar->setSingleStep(childrenRect.
height() / 20);
1192 const auto children =
viewport->children();
1193 for (
QObject *
object : children) {
1198 if (stackUnderChild)
1199 child->stackUnder(stackUnderChild);
1202 stackUnderChild =
child;
1207 if (stackUnderChild)
1216 if (!minSubWindowSize.
isValid() || subWindowCount <= 0)
1221 const int rows =
qMax((subWindowCount % columns) ? (subWindowCount / columns + 1)
1222 : (subWindowCount / columns), 1);
1223 const int minWidth = minSubWindowSize.
width() * columns;
1224 const int minHeight = minSubWindowSize.
height() * rows;
1234 int minAreaWidth = minWidth +
left +
right + 2;
1235 int minAreaHeight = minHeight +
top +
bottom + 2;
1236 if (hbar->isVisible())
1237 minAreaHeight += hbar->
height();
1238 if (vbar->isVisible())
1239 minAreaWidth += vbar->width();
1242 minAreaWidth += 2 *
frame;
1243 minAreaHeight += 2 *
frame;
1256 if (domain.
width() < minWidth) {
1264 if (domain.
height() < minHeight) {
1297 return last->d_func()->data.is_closing;
1306 if (!subWindow || !subWindow->
isVisible())
1308 if (onlyNextActivationEvent)
1309 subWindow->d_func()->ignoreNextActivationEvent = !
enable;
1311 subWindow->d_func()->activationEnabled =
enable;
1393 int removedIndex,
int fromIndex)
const
1402 if (removedIndex < 0) {
1403 if (fromIndex >= 0 && fromIndex < subWindows.
size())
1406 current =
q->currentSubWindow();
1413 int candidateIndex = -1;
1414 setIndex(&candidateIndex, removedIndex, 0, subWindows.
size() - 1,
true);
1417 current = subWindows.
back();
1423 const int indexToCurrent = subWindows.
indexOf(current);
1424 const bool increasing = increaseFactor > 0;
1428 setIndex(&
index, indexToCurrent + increaseFactor, 0, subWindows.
size() - 1, increasing);
1432 while (subWindows.
at(
index)->isHidden()) {
1434 if (
index == indexToCurrent)
1438 if (!subWindows.
at(
index)->isHidden())
1467#if QT_CONFIG(rubberband)
1471 rubberBand->setObjectName(
"qt_rubberband"_L1);
1477#if QT_CONFIG(rubberband)
1479 showRubberBandFor(highlight);
1486#if QT_CONFIG(rubberband)
1487void QMdiAreaPrivate::showRubberBandFor(
QMdiSubWindow *subWindow)
1489 if (!subWindow || !rubberBand)
1492#if QT_CONFIG(tabbar)
1497 rubberBand->setGeometry(subWindow->
geometry());
1499 rubberBand->raise();
1507void QMdiAreaPrivate::setViewMode(QMdiArea::ViewMode mode)
1510 if (viewMode ==
mode || inViewModeChange)
1514 inViewModeChange =
true;
1516#if QT_CONFIG(tabbar)
1519 tabBar =
new QMdiAreaTabBar(
q);
1520 tabBar->setDocumentMode(documentMode);
1521 tabBar->setTabsClosable(tabsClosable);
1522 tabBar->setMovable(tabsMovable);
1523#if QT_CONFIG(tabwidget)
1527 isSubWindowsTiled =
false;
1534 tabBar->setCurrentIndex(childWindows.indexOf(current));
1551 updateTabBarGeometry();
1559#if QT_CONFIG(tabbar)
1565 q->setViewportMargins(0, 0, 0, 0);
1566 indexToLastActiveTab = -1;
1574 inViewModeChange =
false;
1577#if QT_CONFIG(tabbar)
1581void QMdiAreaPrivate::updateTabBarGeometry()
1587#if QT_CONFIG(tabwidget)
1592 int areaHeight =
q->height();
1593 if (hbar && hbar->isVisible())
1594 areaHeight -= hbar->height();
1596 int areaWidth =
q->width();
1597 if (vbar && vbar->isVisible())
1598 areaWidth -= vbar->width();
1601#if QT_CONFIG(tabwidget)
1602 switch (tabPosition) {
1604 q->setViewportMargins(0, tabBarSizeHint.
height(), 0, 0);
1605 tabBarRect =
QRect(0, 0, areaWidth, tabBarSizeHint.
height());
1608 q->setViewportMargins(0, 0, 0, tabBarSizeHint.
height());
1609 tabBarRect =
QRect(0, areaHeight - tabBarSizeHint.
height(), areaWidth, tabBarSizeHint.
height());
1613 q->setViewportMargins(0, 0, tabBarSizeHint.
width(), 0);
1615 q->setViewportMargins(tabBarSizeHint.
width(), 0, 0, 0);
1616 tabBarRect =
QRect(areaWidth - tabBarSizeHint.
width(), 0, tabBarSizeHint.
width(), areaHeight);
1620 q->setViewportMargins(tabBarSizeHint.
width(), 0, 0, 0);
1622 q->setViewportMargins(0, 0, tabBarSizeHint.
width(), 0);
1623 tabBarRect =
QRect(0, 0, tabBarSizeHint.
width(), areaHeight);
1636void QMdiAreaPrivate::refreshTabBar()
1641 tabBar->setDocumentMode(documentMode);
1642 tabBar->setTabsClosable(tabsClosable);
1643 tabBar->setMovable(tabsMovable);
1644#if QT_CONFIG(tabwidget)
1647 updateTabBarGeometry();
1662 setViewport(
nullptr);
1674 d->cascader =
nullptr;
1676 delete d->regularTiler;
1677 d->regularTiler =
nullptr;
1679 delete d->iconTiler;
1680 d->iconTiler =
nullptr;
1683 d->placer =
nullptr;
1693 int nestedCount = 0;
1696 if (qobject_cast<QMdiArea *>(
widget))
1700 const int scaleFactor = 3 * (nestedCount + 1);
1720 size =
size.expandedTo(QAbstractScrollArea::minimumSizeHint());
1721 if (!
d->scrollBarsEnabled()) {
1743 if (
d->childWindows.isEmpty())
1749 if (
d->isActivated && !
window()->isMinimized())
1752 Q_ASSERT(
d->indicesToActivatedChildren.size() > 0);
1753 int index =
d->indicesToActivatedChildren.at(0);
1788 d->activateWindow(
nullptr);
1793 qWarning(
"QMdiArea::setActiveSubWindow: workspace is empty");
1798 qWarning(
"QMdiArea::setActiveSubWindow: window is not inside workspace");
1831 return d->subWindowList(
order,
false);
1847 if (
d->childWindows.isEmpty())
1850 d->isSubWindowsTiled =
false;
1857 d->updateScrollBars();
1870 if (
d->childWindows.isEmpty())
1875 d->activateWindow(
next);
1888 if (
d->childWindows.isEmpty())
1891 QMdiSubWindow *previous =
d->nextVisibleSubWindow(-1,
d->activationOrder);
1893 d->activateWindow(previous);
1922 qWarning(
"QMdiArea::addSubWindow: null pointer to widget");
1934 qWarning(
"QMdiArea::addSubWindow: window is already added");
1967 qWarning(
"QMdiArea::removeSubWindow: null pointer to widget");
1972 if (
d->childWindows.isEmpty())
1978 qWarning(
"QMdiArea::removeSubWindow: window is not inside workspace");
1981 d->disconnectSubWindow(
child);
1982 d->childWindows.removeAll(
child);
1983 d->indicesToActivatedChildren.removeAll(
index);
1985 child->setParent(
nullptr);
1994 child->setWidget(
nullptr);
2002 qWarning(
"QMdiArea::removeSubWindow: widget is not child of any window inside QMdiArea");
2015 return d_func()->background;
2021 if (
d->background !=
brush) {
2024 d->viewport->update();
2043 return d->activationOrder;
2049 if (
order !=
d->activationOrder)
2050 d->activationOrder =
order;
2062 d->options.setFlag(
option, on);
2072 return d_func()->options &
option;
2093 d->setViewMode(
mode);
2096#if QT_CONFIG(tabbar)
2106bool QMdiArea::documentMode()
const
2109 return d->documentMode;
2112void QMdiArea::setDocumentMode(
bool enabled)
2131bool QMdiArea::tabsClosable()
const
2134 return d->tabsClosable;
2137void QMdiArea::setTabsClosable(
bool closable)
2140 if (
d->tabsClosable == closable)
2143 d->tabsClosable = closable;
2156bool QMdiArea::tabsMovable()
const
2159 return d->tabsMovable;
2162void QMdiArea::setTabsMovable(
bool movable)
2165 if (
d->tabsMovable == movable)
2168 d->tabsMovable = movable;
2173#if QT_CONFIG(tabwidget)
2193 if (
d->tabShape == shape)
2196 d->tabShape = shape;
2213 return d->tabPosition;
2235 if (
d->childWindows.indexOf(mdiChild) == -1)
2236 d->appendChild(mdiChild);
2247 if (
d->childWindows.isEmpty()) {
2252#if QT_CONFIG(tabbar)
2253 d->updateTabBarGeometry();
2259 if (
d->isSubWindowsTiled) {
2260 d->tileCalledFromResizeEvent =
true;
2262 d->tileCalledFromResizeEvent =
false;
2263 d->isSubWindowsTiled =
true;
2264 d->startResizeTimer();
2270 bool hasMaximizedSubWindow =
false;
2275 const auto minSizeHint =
child->minimumSizeHint();
2279 if (minSizeHint.isValid())
2280 realSize = realSize.expandedTo(minSizeHint);
2281 child->resize(realSize);
2282 if (!hasMaximizedSubWindow)
2283 hasMaximizedSubWindow =
true;
2287 d->updateScrollBars();
2292 if (hasMaximizedSubWindow)
2293 d->startResizeTimer();
2295 d->arrangeMinimizedSubWindows();
2305 killTimer(
d->resizeTimerId);
2306 d->resizeTimerId = -1;
2307 d->arrangeMinimizedSubWindows();
2308 }
else if (
timerEvent->timerId() ==
d->tabToPreviousTimerId) {
2309 killTimer(
d->tabToPreviousTimerId);
2310 d->tabToPreviousTimerId = -1;
2311 if (
d->indexToHighlighted < 0)
2313#if QT_CONFIG(rubberband)
2315 Q_ASSERT(
d->indexToHighlighted <
d->childWindows.size());
2317 d->showRubberBandFor(
d->childWindows.at(
d->indexToHighlighted));
2328 if (!
d->pendingRearrangements.isEmpty()) {
2329 bool skipPlacement =
false;
2330 foreach (
Rearranger *rearranger,
d->pendingRearrangements) {
2334 skipPlacement =
true;
2335 d->rearrange(rearranger);
2337 d->pendingRearrangements.clear();
2339 if (skipPlacement && !
d->pendingPlacements.isEmpty())
2340 d->pendingPlacements.clear();
2343 if (!
d->pendingPlacements.isEmpty()) {
2352 && !
window->isMaximized()) {
2356 d->pendingPlacements.clear();
2359 d->setChildActivationEnabled(
true);
2360 d->activateCurrentWindow();
2362 QAbstractScrollArea::showEvent(
showEvent);
2371 switch (
event->type()) {
2373 d->isSubWindowsTiled =
false;
2375 for (
int i = 0;
i <
d->childWindows.size(); ++
i) {
2384 d->showActiveWindowMaximized =
true;
2386 d->disconnectSubWindow(
child);
2387 const bool activeRemoved =
i ==
d->indicesToActivatedChildren.at(0);
2388 d->childWindows.removeAt(
i);
2389 d->indicesToActivatedChildren.removeAll(
i);
2390 d->updateActiveWindow(
i, activeRemoved);
2391 d->arrangeMinimizedSubWindows();
2395 d->updateScrollBars();
2399 d->isSubWindowsTiled =
false;
2400 d->resetActiveWindow();
2401 d->childWindows.clear();
2402 qWarning(
"QMdiArea: Deleting the view port is undefined, use setViewport instead.");
2407 return QAbstractScrollArea::viewportEvent(
event);
2416 const bool wasSubWindowsTiled =
d->isSubWindowsTiled;
2417 d->ignoreGeometryChange =
true;
2418 viewport()->scroll(isLeftToRight() ? dx : -dx, dy);
2419 d->arrangeMinimizedSubWindows();
2420 d->ignoreGeometryChange =
false;
2421 if (wasSubWindowsTiled)
2422 d->isSubWindowsTiled =
true;
2433 if (!
d->regularTiler)
2435 d->rearrange(
d->regularTiler);
2448 d->rearrange(
d->cascader);
2457 switch (
event->type()) {
2459 d->isActivated =
true;
2460 if (
d->childWindows.isEmpty())
2463 d->activateCurrentWindow();
2464 d->setChildActivationEnabled(
false,
true);
2468 d->isActivated =
false;
2469 d->setChildActivationEnabled(
false,
true);
2475 if (
d->isSubWindowsTiled) {
2477 d->isSubWindowsTiled =
true;
2487 d->setActive(
d->active,
false,
false);
2488 d->setChildActivationEnabled(
false);
2490#if QT_CONFIG(tabbar)
2492 d->updateTabBarGeometry();
2498 return QAbstractScrollArea::event(
event);
2507 return QAbstractScrollArea::eventFilter(
object,
event);
2516 return QAbstractScrollArea::eventFilter(
object,
event);
2521 return QAbstractScrollArea::eventFilter(
object,
event);
2529 switch (keyEvent->
key()) {
2532 area->d_func()->startTabToPreviousTimer();
2534 area->d_func()->activateHighlightedWindow();
2541#if QT_CONFIG(rubberband)
2543 area->d_func()->hideRubberBand();
2549 return QAbstractScrollArea::eventFilter(
object,
event);
2552 QMdiSubWindow *subWindow = qobject_cast<QMdiSubWindow *>(
object);
2558 d->activateCurrentWindow();
2560 d->setActive(
d->active,
false,
false);
2562 return QAbstractScrollArea::eventFilter(
object,
event);
2565 if (subWindow->
mdiArea() !=
this)
2566 return QAbstractScrollArea::eventFilter(
object,
event);
2569 switch (
event->type()) {
2572 if (
d->tileCalledFromResizeEvent)
2574 d->updateScrollBars();
2576 d->isSubWindowsTiled =
false;
2579#if QT_CONFIG(tabbar)
2581 const int tabIndex =
d->childWindows.indexOf(subWindow);
2582 if (!
d->tabBar->isTabEnabled(tabIndex))
2583 d->tabBar->setTabEnabled(tabIndex,
true);
2591 if (!
event->spontaneous())
2592 d->isSubWindowsTiled =
false;
2594#if QT_CONFIG(rubberband)
2596 if (
d->childWindows.indexOf(subWindow) ==
d->indexToHighlighted)
2597 d->hideRubberBand();
2600#if QT_CONFIG(tabbar)
2604 d->tabBar->setTabText(
d->childWindows.indexOf(subWindow),
tabTextFor(subWindow));
2608 d->tabBar->setTabIcon(
d->childWindows.indexOf(subWindow), subWindow->
windowIcon());
2614 return QAbstractScrollArea::eventFilter(
object,
event);
2649#include "moc_qmdiarea.cpp"
static QFont font()
Returns the default application font.
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.
static QCoreApplication * instance() noexcept
Returns a pointer to the application's QCoreApplication (or QGuiApplication/QApplication) instance.
\reentrant \inmodule QtGui
QScreen * primaryScreen
the primary (or default) screen of the application.
The QKeyEvent class describes a key event.
Qt::KeyboardModifiers modifiers() const
Returns the keyboard modifier flags that existed immediately after the event occurred.
int key() const
Returns the code of the key that was pressed or released.
virtual QSize minimumSize() const =0
Implemented in subclasses to return the minimum size of this item.
virtual void setGeometry(const QRect &)=0
Implemented in subclasses to set this item's geometry to r.
virtual QWidget * widget() const
If this item manages a QWidget, returns that widget.
virtual QSize sizeHint() const =0
Implemented in subclasses to return the preferred size of this item.
qsizetype size() const noexcept
bool isEmpty() const noexcept
iterator erase(const_iterator begin, const_iterator end)
const_reference at(qsizetype i) const noexcept
void move(qsizetype from, qsizetype to)
void prepend(rvalue_ref t)
void reserve(qsizetype size)
void append(parameter_type t)
void internalRaise(QMdiSubWindow *child) const
void place(QMdi::Placer *placer, QMdiSubWindow *child)
void resetActiveWindow(QMdiSubWindow *child=nullptr)
QPointer< QMdiSubWindow > aboutToBecomeActive
void activateCurrentWindow()
QList< int > indicesToActivatedChildren
bool scrollBarsEnabled() const
void appendChild(QMdiSubWindow *child)
void activateHighlightedWindow()
void emitWindowActivated(QMdiSubWindow *child)
QMdi::Rearranger * iconTiler
QPointer< QMdiSubWindow > active
QList< QMdiSubWindow * > subWindowList(QMdiArea::WindowOrder, bool reversed=false) const
QRect resizeToMinimumTileSize(const QSize &minSubWindowSize, int subWindowCount)
QMdiArea::WindowOrder activationOrder
bool isExplicitlyDeactivated(QMdiSubWindow *subWindow) const
void arrangeMinimizedSubWindows()
bool lastWindowAboutToBeDestroyed() const
bool ignoreGeometryChange
void activateWindow(QMdiSubWindow *child)
void highlightNextSubWindow(int increaseFactor)
QList< QMdi::Rearranger * > pendingRearrangements
QMdiArea::AreaOptions options
bool tileCalledFromResizeEvent
void disconnectSubWindow(QObject *subWindow)
void _q_moveTab(int from, int to)
bool windowStaysOnTop(QMdiSubWindow *subWindow) const
QList< QPointer< QMdiSubWindow > > pendingPlacements
bool ignoreWindowStateChange
void _q_currentTabChanged(int index)
QList< QPointer< QMdiSubWindow > > childWindows
void _q_deactivateAllWindows(QMdiSubWindow *aboutToActivate=nullptr)
void scrollBarPolicyChanged(Qt::Orientation, Qt::ScrollBarPolicy) override
bool showActiveWindowMaximized
QMdiArea::ViewMode viewMode
void updateActiveWindow(int removedIndex, bool activeRemoved)
void rearrange(QMdi::Rearranger *rearranger)
void setChildActivationEnabled(bool enable=true, bool onlyNextActivationEvent=false) const
void _q_closeTab(int index)
void _q_processWindowStateChanged(Qt::WindowStates oldState, Qt::WindowStates newState)
QMdiSubWindow * nextVisibleSubWindow(int increaseFactor, QMdiArea::WindowOrder, int removed=-1, int fromIndex=-1) const
The QMdiArea widget provides an area in which MDI windows are displayed.
bool eventFilter(QObject *object, QEvent *event) override
\reimp
WindowOrder activationOrder
the ordering criteria for subwindow lists
bool testOption(AreaOption opton) const
Returns true if option is enabled; otherwise returns false.
void setActivationOrder(WindowOrder order)
QBrush background
the background brush for the workspace
void childEvent(QChildEvent *childEvent) override
\reimp
QMdiSubWindow * addSubWindow(QWidget *widget, Qt::WindowFlags flags=Qt::WindowFlags())
Adds widget as a new subwindow to the MDI area.
void setViewMode(ViewMode mode)
bool viewportEvent(QEvent *event) override
\reimp
void setBackground(const QBrush &background)
void closeActiveSubWindow()
Closes the active subwindow.
ViewMode viewMode
the way sub-windows are displayed in the QMdiArea.
void activateNextSubWindow()
Gives the keyboard focus to another window in the list of child windows.
QMdiArea(QWidget *parent=nullptr)
Constructs an empty mdi area.
WindowOrder
Specifies the criteria to use for ordering the list of child windows returned by subWindowList().
QMdiSubWindow * activeSubWindow() const
Returns a pointer to the current active subwindow.
void cascadeSubWindows()
Arranges all the child windows in a cascade pattern.
void showEvent(QShowEvent *showEvent) override
\reimp
void setOption(AreaOption option, bool on=true)
If on is true, option is enabled on the MDI area; otherwise it is disabled.
void closeAllSubWindows()
Closes all subwindows by sending a QCloseEvent to each window.
bool event(QEvent *event) override
\reimp
void tileSubWindows()
Arranges all child windows in a tile pattern.
void activatePreviousSubWindow()
Gives the keyboard focus to another window in the list of child windows.
~QMdiArea()
Destroys the MDI area.
QSize sizeHint() const override
\reimp
QSize minimumSizeHint() const override
\reimp
QMdiSubWindow * currentSubWindow() const
Returns a pointer to the current subwindow, or \nullptr if there is no current subwindow.
void setupViewport(QWidget *viewport) override
This slot is called by QAbstractScrollArea after setViewport() has been called.
void timerEvent(QTimerEvent *timerEvent) override
\reimp
void scrollContentsBy(int dx, int dy) override
\reimp
void paintEvent(QPaintEvent *paintEvent) override
\reimp
void removeSubWindow(QWidget *widget)
Removes widget from the MDI area.
QList< QMdiSubWindow * > subWindowList(WindowOrder order=CreationOrder) const
Returns a list of all subwindows in the MDI area.
AreaOption
This enum describes options that customize the behavior of the QMdiArea.
@ DontMaximizeSubWindowOnActivation
void resizeEvent(QResizeEvent *resizeEvent) override
\reimp
void setActiveSubWindow(QMdiSubWindow *window)
Activates the subwindow window.
void setVisible(WindowStateAction, bool visible=true)
QPointer< QMenu > systemMenu
The QMdiSubWindow class provides a subwindow class for QMdiArea.
SubWindowOption
This enum describes options that customize the behavior of QMdiSubWindow.
@ AllowOutsideAreaHorizontally
@ AllowOutsideAreaVertically
QMdiArea * mdiArea() const
void rearrange(QList< QWidget * > &widgets, const QRect &domain) const override
QPoint place(const QSize &size, const QList< QRect > &rects, const QRect &domain) const override
virtual QPoint place(const QSize &size, const QList< QRect > &rects, const QRect &domain) const =0
virtual void rearrange(QList< QWidget * > &widgets, const QRect &domain) const =0
virtual Type type() const =0
void rearrange(QList< QWidget * > &widgets, const QRect &domain) const override
void rearrange(QList< QWidget * > &widgets, const QRect &domain) const override
void installEventFilter(QObject *filterObj)
Installs an event filter filterObj on this object.
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
\threadsafe
void removeEventFilter(QObject *obj)
Removes an event filter object obj from this object.
The QPaintEvent class contains event parameters for paint events.
The QPainter class performs low-level painting on widgets and other paint devices.
void fillRect(const QRectF &, const QBrush &)
Fills the given rectangle with the brush specified.
\inmodule QtCore\reentrant
constexpr int x() const noexcept
Returns the x coordinate of this point.
constexpr int y() const noexcept
Returns the y coordinate of this point.
\inmodule QtCore\reentrant
constexpr int height() const noexcept
Returns the height of the rectangle.
constexpr bool isValid() const noexcept
Returns true if the rectangle is valid, otherwise returns false.
QRect intersected(const QRect &other) const noexcept
constexpr int bottom() const noexcept
Returns the y-coordinate of the rectangle's bottom edge.
constexpr QPoint topLeft() const noexcept
Returns the position of the rectangle's top-left corner.
constexpr int top() const noexcept
Returns the y-coordinate of the rectangle's top edge.
bool contains(const QRect &r, bool proper=false) const noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
constexpr int left() const noexcept
Returns the x-coordinate of the rectangle's left edge.
constexpr void setWidth(int w) noexcept
Sets the width of the rectangle to the given width.
constexpr int width() const noexcept
Returns the width of the rectangle.
constexpr void setHeight(int h) noexcept
Sets the height of the rectangle to the given height.
constexpr int right() const noexcept
Returns the x-coordinate of the rectangle's right edge.
The QResizeEvent class contains event parameters for resize events.
The QRubberBand class provides a rectangle or line that can indicate a selection or a boundary.
QSize virtualSize
the pixel size of the virtual desktop to which this screen belongs
The QShowEvent class provides an event that is sent when a widget is shown.
Exception-safe wrapper around QObject::blockSignals().
constexpr QSize boundedTo(const QSize &) const noexcept
Returns a size holding the minimum width and height of this size and the given otherSize.
constexpr int height() const noexcept
Returns the height.
constexpr int width() const noexcept
Returns the width.
constexpr int & rheight() noexcept
Returns a reference to the height.
constexpr QSize expandedTo(const QSize &) const noexcept
Returns a size holding the maximum width and height of this size and the given otherSize.
constexpr int & rwidth() noexcept
Returns a reference to the width.
constexpr bool isValid() const noexcept
Returns true if both the width and height is equal to or greater than 0; otherwise returns false.
\macro QT_RESTRICTED_CAST_FROM_ASCII
QString & replace(qsizetype i, qsizetype len, QChar after)
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
\variable QStyleOptionToolBox::selectedPosition
void initFrom(const QWidget *w)
@ SH_ScrollView_FrameOnlyAroundContents
static QRect visualRect(Qt::LayoutDirection direction, const QRect &boundingRect, const QRect &logicalRect)
Returns the given logicalRectangle converted to screen coordinates based on the specified direction.
@ PM_MdiSubWindowMinimizedWidth
virtual int pixelMetric(PixelMetric metric, const QStyleOption *option=nullptr, const QWidget *widget=nullptr) const =0
Returns the value of the given pixel metric.
The QTabBar class provides a tab bar, e.g.
void mousePressEvent(QMouseEvent *) override
\reimp
Shape
This enum type lists the built-in shapes supported by QTabBar.
for(qsizetype i=0;i< list.size();++i)
void newState(QList< State > &states, const char *token, const char *lexem, bool pre)
Combined button and popup list for selecting options.
DBusConnection const char DBusError * error
qfloat16 qSqrt(qfloat16 f)
static int area(const QSize &s)
Q_WIDGETS_EXPORT QSize qSmartMinSize(const QSize &sizeHint, const QSize &minSizeHint, const QSize &minSize, const QSize &maxSize, const QSizePolicy &sizePolicy)
static const double leftOffset
static const double rightOffset
static QString tabTextFor(QMdiSubWindow *subWindow)
static bool sanityCheck(const QMdiSubWindow *const child, const char *where)
static QMdiArea * mdiAreaParent(QWidget *widget)
static bool useScrollBar(const QRect &childrenRect, const QSize &maxViewportSize, Qt::Orientation orientation)
static void setIndex(int *index, int candidate, int min, int max, bool isIncreasing)
constexpr const T & qMin(const T &a, const T &b)
constexpr const T & qMax(const T &a, const T &b)
GLint GLint GLint GLint GLint x
[0]
GLint GLsizei GLsizei height
GLuint GLfloat GLfloat GLfloat GLfloat y1
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLuint GLfloat GLfloat GLfloat x1
GLdouble GLdouble GLdouble GLdouble top
GLenum GLenum GLsizei count
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLsizei GLsizei GLchar * source
GLfixed GLfixed GLfixed y2
GLdouble GLdouble GLdouble GLdouble q
GLenum GLenum GLsizei void * row
GLfixed GLfixed GLint GLint order
static qreal position(const QQuickItem *item, QQuickAnchors::Anchor anchorLine)
#define Q_ASSERT_X(cond, x, msg)
#define QT_CONFIG(feature)
if(qFloatDistance(a, b)<(1<< 7))
[0]
QList< QWidget * > widgets
[11]
view viewport() -> scroll(dx, dy, deviceRect)
qsizetype indexOf(const AT &t, qsizetype from=0) const noexcept
bool contains(const AT &t) const noexcept
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent