114#include <QApplication>
115#include <QStylePainter>
116#include <QVBoxLayout>
117#include <QMouseEvent>
118#if QT_CONFIG(whatsthis)
121#if QT_CONFIG(tooltip)
124#if QT_CONFIG(mainwindow)
125#include <QMainWindow>
130#include <QScopedValueRollback>
137#include <QProxyStyle>
173 auto proxyStyle = qobject_cast<QProxyStyle *>(style);
174 auto styleToCheck = proxyStyle ? proxyStyle->baseStyle() : style;
175 return styleToCheck->
inherits(
"QMacStyle");
179 int delta,
int maxDelta,
int minDelta)
181 if (cflags & moveFlag) {
183 return (cflags & resizeFlag) ?
qMin(delta, maxDelta) : delta;
184 return (cflags & resizeFlag) ?
qMax(delta, minDelta) : delta;
190 uint resizeReverseFlag,
int delta)
192 if (cflags & resizeFlag) {
193 if (cflags & resizeReverseFlag)
205 if (qobject_cast<QMdiSubWindow *>(
parent))
226 && strcmp(
widget->metaObject()->className(), T::staticMetaObject.className()) == 0) {
237 if (
auto *mdiArea =
q->mdiArea()) {
238 const auto &subWindows = mdiArea->subWindowList();
239 for (
auto *subWindow : subWindows) {
240 if (subWindow !=
q && subWindow->isMaximized()) {
242 if (!subWindowD->originalTitle.isNull())
247 return q->window()->windowTitle();
263 QString childTitle =
q->windowTitle();
268 if (!original.
contains(QMdiSubWindow::tr(
"- [%1]").arg(childTitle))) {
269 auto title = QMdiSubWindow::tr(
"%1 - [%2]").
arg(original, childTitle);
271 q->window()->setWindowTitle(
title);
277 q->window()->setWindowTitle(childTitle);
287#if QT_CONFIG(tooltip)
317 switch (subControl) {
319 toolTip = QMdiSubWindow::tr(
"Minimize");
322 toolTip = QMdiSubWindow::tr(
"Maximize");
325 toolTip = QMdiSubWindow::tr(
"Unshade");
328 toolTip = QMdiSubWindow::tr(
"Shade");
332 toolTip = QMdiSubWindow::tr(
"Restore Down");
334 toolTip = QMdiSubWindow::tr(
"Restore");
337 toolTip = QMdiSubWindow::tr(
"Close");
340 toolTip = QMdiSubWindow::tr(
"Help");
343 toolTip = QMdiSubWindow::tr(
"Menu");
381 void updateWindowIcon();
399 return label.deviceIndependentSize().toSize();
413#if QT_CONFIG(tooltip)
476void ControlLabel::updateWindowIcon()
521 QStyle::SubControls visibleControls;
527 initStyleOption(&
opt);
538 activeControl(
QStyle::SC_None),
539 hoverControl(
QStyle::SC_None),
540 visibleControls(
QStyle::SC_None),
557 initStyleOption(&
opt);
578 visibleControls.setFlag(subControl,
visible && !(visibleControls & subControl));
587 initStyleOption(&
opt);
588 if (activeControl == hoverControl) {
589 opt.activeSubControls = activeControl;
592 opt.activeSubControls = hoverControl;
608 activeControl = getSubControl(
event->position().toPoint());
623 if (under_mouse == activeControl) {
624 switch (activeControl) {
650 if (hoverControl != under_mouse) {
651 hoverControl = under_mouse;
670#if QT_CONFIG(tooltip)
673 initStyleOption(&
opt);
687 option->subControls = visibleControls;
708 connect(m_controllerWidget,
SIGNAL(_q_minimize()), mdiChild,
SLOT(showMinimized()));
720#if QT_CONFIG(menubar)
721 removeButtonsFromMenuBar();
724 m_menuLabel =
nullptr;
725 delete m_controllerWidget;
726 m_controllerWidget =
nullptr;
729#if QT_CONFIG(menubar)
733QMenuBar *QMdiSubWindowPrivate::menuBar()
const
735#if !QT_CONFIG(mainwindow)
742 if (
QMainWindow *mainWindow = qobject_cast<QMainWindow *>(
q->window()))
743 return mainWindow->menuBar();
762 if (currentLeft != m_menuLabel) {
764 previousLeft = currentLeft;
772 currentRight->
hide();
773 if (currentRight != m_controllerWidget) {
775 previousRight = currentRight;
777 m_controllerWidget->
show();
779 mdiChild->d_func()->setNewWindowTitle();
789 previousRight =
nullptr;
790 previousLeft =
nullptr;
798 if (m_controllerWidget) {
800 if (currentRight == m_controllerWidget) {
802 if (!ce->mdiChild || !ce->mdiChild->isMaximized())
803 previousRight =
nullptr;
805 child = ce->mdiChild;
809 previousRight->
show();
810 previousRight =
nullptr;
813 m_controllerWidget->
hide();
818 if (currentLeft == m_menuLabel) {
820 if (!ce->mdiChild || !ce->mdiChild->isMaximized())
821 previousLeft =
nullptr;
827 previousLeft->
show();
828 previousLeft =
nullptr;
836 child->d_func()->setNewWindowTitle();
862 userMinimumSize(0,0),
865 isInInteractiveMode(
false),
867 isInRubberBandMode(
false),
870 ignoreWindowTitleChange(
false),
871 ignoreNextActivationEvent(
false),
872 activationEnabled(true),
873 isShadeRequestFromMinimizeMode(
false),
874 isMaximizeMode(
false),
875 isWidgetHiddenByUs(
false),
877 isExplicitlyDeactivated(
false),
878 keyboardSingleStep(5),
879 keyboardPageStep(20),
881 currentOperation(
None),
882 hoveredSubControl(
QStyle::SC_None),
883 activeSubControl(
QStyle::SC_None),
884 focusInReason(
Qt::ActiveWindowFocusReason)
896 if (
QAction *senderAction = qobject_cast<QAction *>(
q->sender())) {
897 if (senderAction->isChecked()) {
915 QAction *action = qobject_cast<QAction *>(
q->sender());
934 q->cursor().setPos(
q->mapToGlobal(pressPos));
940#if QT_CONFIG(rubberband)
944 enterRubberBandMode();
973#if QT_CONFIG(rubberband)
974 if (isInRubberBandMode)
975 leaveRubberBandMode();
1003 q->setWindowModified(
false);
1037void QMdiSubWindowPrivate::createSystemMenu()
1040 Q_ASSERT_X(
q,
"QMdiSubWindowPrivate::createSystemMenu",
1041 "You can NOT call this function before QMdiSubWindow's ctor");
1044 const QStyle *style =
q->style();
1045 addToSystemMenu(
RestoreAction, QMdiSubWindow::tr(
"&Restore"),
SLOT(showNormal()));
1050 addToSystemMenu(
MinimizeAction, QMdiSubWindow::tr(
"Mi&nimize"),
SLOT(showMinimized()));
1052 addToSystemMenu(
MaximizeAction, QMdiSubWindow::tr(
"Ma&ximize"),
SLOT(showMaximized()));
1059#if !defined(QT_NO_SHORTCUT)
1111 ?
q->minimumSize() :
q->minimumSizeHint();
1112 int margin, minWidth;
1115 if (
q->isMaximized() || (
q->isMinimized() && !
q->isShaded())) {
1134 if (!
q->mask().isEmpty())
1169 if (restrictHorizontal || restrictVertical) {
1170 QRect parentRect =
q->parentWidget()->rect();
1176 if (restrictHorizontal)
1178 if (restrictVertical)
1181 if (restrictHorizontal) {
1215 geometry.
setSize(
q->geometry().size());
1261#if QT_CONFIG(menubar)
1262 removeButtonsFromMenuBar();
1267 const bool wasVisible =
q->isVisible();
1269 q->setVisible(
false);
1286 q->setGeometry(newGeometry);
1289 q->setVisible(
true);
1295#if QT_CONFIG(sizegrip)
1296 setSizeGripVisible(
true);
1342#if QT_CONFIG(sizegrip)
1343 setSizeGripVisible(
false);
1355 const bool wasVisible =
q->isVisible();
1357 q->setVisible(
false);
1368#if QT_CONFIG(menubar)
1370 showButtonsInMenuBar(mBar);
1381 QAbstractScrollArea *
scrollArea = qobject_cast<QAbstractScrollArea *>(
parent->parentWidget());
1385 const int xOffset = hbar ? hbar->
value() : 0;
1386 const int yOffset = vbar ? vbar->
value() : 0;
1387 availableRect.
adjust(-xOffset, -yOffset, -xOffset, -yOffset);
1396 q->setVisible(
true);
1425 if (activate && !
isActive &&
q->isEnabled()) {
1428 Qt::WindowStates oldWindowState =
q->windowState();
1430 emit q->aboutToActivate();
1431#if QT_CONFIG(menubar)
1433 showButtonsInMenuBar(mBar);
1436 emit q->windowStateChanged(oldWindowState,
q->windowState());
1437 }
else if (!activate &&
isActive) {
1439 Qt::WindowStates oldWindowState =
q->windowState();
1444 if (focusWidget && (focusWidget ==
q ||
q->
isAncestorOf(focusWidget)))
1450 emit q->windowStateChanged(oldWindowState,
q->windowState());
1453 if (activate &&
isActive &&
q->isEnabled() && !
q->hasFocus()
1474 q->update(windowDecoration);
1485#if QT_CONFIG(whatsthis)
1500 if (
q->isMinimized())
1516 if (
q->isMaximized())
1546 if (operation ==
Move) {
1548 QRegion move(frameWidth, frameWidth,
width - 2 * frameWidth, cornerConst);
1564 switch (operation) {
1579 -
QRegion(frameWidth, frameWidth, cornerConst, cornerConst);
1605 OperationInfoMap::const_iterator
it;
1675 Qt::WindowStates windowStates =
q->windowState() |
state;
1678 windowStates &=
~Qt::WindowMaximized;
1679 windowStates &=
~Qt::WindowFullScreen;
1680 windowStates &=
~Qt::WindowNoState;
1683 windowStates &=
~Qt::WindowMinimized;
1684 windowStates &=
~Qt::WindowFullScreen;
1685 windowStates &=
~Qt::WindowNoState;
1688 windowStates &=
~Qt::WindowMinimized;
1689 windowStates &=
~Qt::WindowMaximized;
1690 windowStates &=
~Qt::WindowFullScreen;
1701 q->overrideWindowState(windowStates);
1717 height +=
q->isMinimized() ? 8 : 4;
1727 Qt::WindowFlags
flags =
q->windowFlags();
1747 if (!
rect.isValid())
1749 tempWidth +=
rect.width();
1751 *minWidth = tempWidth;
1768#if !QT_CONFIG(menubar) || !QT_CONFIG(mainwindow)
1772 QMainWindow *mainWindow = qobject_cast<QMainWindow *>(
q->window());
1773 if (!mainWindow || !qobject_cast<QMenuBar *>(mainWindow->menuWidget())
1774 || mainWindow->menuWidget()->
isHidden())
1781#if QT_CONFIG(menubar)
1794 removeButtonsFromMenuBar();
1806 int buttonHeight = 0;
1814 && topLevelWindow->
layout()) {
1825void QMdiSubWindowPrivate::removeButtonsFromMenuBar()
1832 QMenuBar *currentMenuBar =
nullptr;
1833#if QT_CONFIG(mainwindow)
1834 if (
QMainWindow *mainWindow = qobject_cast<QMainWindow *>(
q->window())) {
1837 currentMenuBar = qobject_cast<QMenuBar *>(
mainWindow->menuWidget());
1862 QWidget *titleWidget =
nullptr;
1863 if (isRequestFromChild)
1872 if (
q->maximizedButtonsWidget())
1877#if QT_CONFIG(rubberband)
1878void QMdiSubWindowPrivate::enterRubberBandMode()
1881 if (
q->isMaximized())
1888 rubberBand->setObjectName(
"qt_rubberband"_L1);
1891 rubberBand->setGeometry(rubberBandPos.
x(), rubberBandPos.
y(),
1894 isInRubberBandMode =
true;
1898void QMdiSubWindowPrivate::leaveRubberBandMode()
1904 isInRubberBandMode =
false;
1905 q->setGeometry(rubberBand->geometry());
1933 Qt::WindowFlags windowFlags = q_func()->windowFlags();
1938#if defined(Q_OS_MACOS) && QT_CONFIG(action)
1939 if (q_func()->style()->
inherits(
"QMacStyle"))
1942 action->setIconVisibleInMenu(
false);
1981 q->focusNextChild();
1987 q->focusPreviousChild();
1995 if (!focusWidget->hasFocus() &&
q->isAncestorOf(focusWidget)
1996 && focusWidget->isVisible() && !
q->isMinimized()
1998 focusWidget->setFocus();
2012 else if (!
q->hasFocus())
2022 if (!candidate->
hasFocus() && q_func()->isAncestorOf(candidate)
2055 windowFlags &= ~windowType;
2056 windowFlags &=
~Qt::WindowFullscreenButtonHint;
2062 stayOnTopAction->setChecked(
true);
2064 stayOnTopAction->setChecked(
false);
2068#if QT_CONFIG(sizegrip)
2076 QSize currentSize =
q->size();
2096 ctrlWidget->setControlVisible(action, visible);
2108void QMdiSubWindowPrivate::addToSystemMenu(WindowStateAction action,
const QString &
text,
2125 return QSize(-1, -1);
2129#if QT_CONFIG(sizegrip)
2134void QMdiSubWindowPrivate::setSizeGrip(
QSizeGrip *newSizeGrip)
2143 bool putSizeGripInLayout =
layout ? true :
false;
2145 putSizeGripInLayout =
false;
2146 if (putSizeGripInLayout) {
2151 newSizeGrip->
move(
q->isLeftToRight() ?
q->width() - newSizeGrip->
width() : 0,
2153 sizeGrip = newSizeGrip;
2155 newSizeGrip->
raise();
2163void QMdiSubWindowPrivate::setSizeGripVisible(
bool visible)
const
2179 if (
q->isWindowModified()) {
2211 d->createSystemMenu();
2212 addActions(
d->systemMenu->actions());
2214 d->setWindowFlags(
flags);
2216 setAutoFillBackground(
true);
2217 setMouseTracking(
true);
2221 d->updateGeometryConstraints();
2223 d->titleBarPalette =
d->desktopPalette();
2227 if (windowIcon().isNull())
2230 d->menuIcon = windowIcon();
2244#if QT_CONFIG(menubar)
2245 d->removeButtonsFromMenuBar();
2247 d->setActive(
false);
2265 d->removeBaseWidget();
2270 qWarning(
"QMdiSubWindow::setWidget: widget is already set");
2275 d->removeBaseWidget();
2282#if QT_CONFIG(sizegrip)
2287 d->sizeGrip->raise();
2291 d->baseWidget->installEventFilter(
this);
2293 d->ignoreWindowTitleChange =
true;
2296 d->updateWindowTitle(
true);
2301 d->lastChildWindowTitle =
d->baseWidget->windowTitle();
2302 d->ignoreWindowTitleChange =
false;
2304 if (
windowIcon().isNull() && !
d->baseWidget->windowIcon().isNull())
2307 d->updateGeometryConstraints();
2319 return d_func()->baseWidget;
2331 return d->controlContainer->controllerWidget();
2344 return d->controlContainer->systemMenuLabel();
2357 return d_func()->isShadeMode;
2369 d->options.setFlag(
option, on);
2371#if QT_CONFIG(rubberband)
2373 d->leaveRubberBandMode();
2384 return d_func()->options &
option;
2403 return d_func()->keyboardSingleStep;
2411 d_func()->keyboardSingleStep = step;
2430 return d_func()->keyboardPageStep;
2438 d_func()->keyboardPageStep = step;
2459void QMdiSubWindow::setSystemMenu(
QMenu *systemMenu)
2462 if (
Q_UNLIKELY(systemMenu && systemMenu ==
d->systemMenu)) {
2463 qWarning(
"QMdiSubWindow::setSystemMenu: system menu is already set");
2467 if (
d->systemMenu) {
2468 delete d->systemMenu;
2469 d->systemMenu =
nullptr;
2475 if (systemMenu->
parent() !=
this)
2477 d->systemMenu = systemMenu;
2487QMenu *QMdiSubWindow::systemMenu()
const
2489 return d_func()->systemMenu;
2497void QMdiSubWindow::showSystemMenu()
2518 globalPopupPos -=
QPoint(
d->systemMenu->sizeHint().width(), 0);
2519 d->systemMenu->popup(globalPopupPos);
2564 if (!
d->isShadeRequestFromMinimizeMode &&
isShaded())
2567 d->isMaximizeMode =
false;
2569 d->storeFocusWidget();
2571 if (!
d->isShadeRequestFromMinimizeMode) {
2572 d->isShadeMode =
true;
2576#if QT_CONFIG(menubar)
2577 d->removeButtonsFromMenuBar();
2586#if QT_CONFIG(sizegrip)
2587 d->setSizeGripVisible(
false);
2590 if (!
d->restoreSize.isValid() ||
d->isShadeMode) {
2592 d->restoreSize.setWidth(
d->oldGeometry.width());
2593 d->restoreSize.setHeight(
d->oldGeometry.height());
2602 d->updateGeometryConstraints();
2608 resize(
d->internalMinimumSize);
2612 d->baseWidget->hide();
2613 d->isWidgetHiddenByUs =
true;
2619 d->setFocusWidget();
2620 d->resizeEnabled =
false;
2621 d->moveEnabled =
true;
2622 d->updateDirtyRegions();
2645 if (
d->systemMenu &&
d->systemMenu ==
object) {
2662#if QT_CONFIG(sizegrip)
2663 if (
object !=
d->baseWidget &&
parent() && qobject_cast<QSizeGrip *>(
object)) {
2671#if QT_CONFIG(rubberband)
2672 d->enterRubberBandMode();
2681 switch (
event->type()) {
2686 if (!
d->isWidgetHiddenByUs)
2693 Qt::WindowStates oldState =
changeEvent->oldState();
2694 Qt::WindowStates
newState =
d->baseWidget->windowState();
2708 d->updateGeometryConstraints();
2711 if (
d->ignoreWindowTitleChange)
2713 if (
object ==
d->baseWidget) {
2714 d->updateWindowTitle(
true);
2715 d->lastChildWindowTitle =
d->baseWidget->windowTitle();
2716#if QT_CONFIG(menubar)
2719 d->originalTitle.clear();
2720 if (
d->baseWidget &&
d->baseWidget->windowTitle() ==
windowTitle())
2721 d->updateWindowTitle(
true);
2723 d->updateWindowTitle(
false);
2728 if (
object !=
d->baseWidget)
2749 switch (
event->type()) {
2756 d->activationEnabled =
false;
2760 if (wasMinimized || wasMaximized || wasShaded)
2762 d->updateGeometryConstraints();
2763 resize(
d->internalMinimumSize.expandedTo(
size()));
2765 d->updateDirtyRegions();
2768 else if (wasMinimized)
2770 else if (wasMaximized)
2775 d->setActive(
false);
2779#if QT_CONFIG(menubar)
2780 d->removeButtonsFromMenuBar();
2785#if QT_CONFIG(rubberband)
2786 if (
d->isInRubberBandMode)
2787 d->leaveRubberBandMode();
2789 d->isShadeMode =
false;
2790 d->isMaximizeMode =
false;
2791 d->isWidgetHiddenByUs =
false;
2793#if QT_CONFIG(sizegrip)
2803 d->updateGeometryConstraints();
2806 d->updateDirtyRegions();
2813 if (
d->ignoreNextActivationEvent) {
2814 d->ignoreNextActivationEvent =
false;
2817 d->isExplicitlyDeactivated =
false;
2821 if (
d->ignoreNextActivationEvent) {
2822 d->ignoreNextActivationEvent =
false;
2825 d->isExplicitlyDeactivated =
true;
2826 d->setActive(
false);
2829 if (!
d->ignoreWindowTitleChange)
2830 d->updateWindowTitle(
false);
2831 d->updateInternalWindowTitle();
2836#if QT_CONFIG(menubar)
2842 d->updateInternalWindowTitle();
2845 d->updateDirtyRegions();
2848 d->updateGeometryConstraints();
2852 if (
d->menuIcon.isNull())
2854 if (
d->controlContainer)
2855 d->controlContainer->updateWindowIcon(
d->menuIcon);
2860 d->titleBarPalette =
d->desktopPalette();
2865#if QT_CONFIG(tooltip)
2888#if QT_CONFIG(sizegrip)
2894 d->setSizeGripVisible(
false);
2896 d->setSizeGripVisible(
true);
2897 resize(
size().expandedTo(
d->internalMinimumSize));
2901 d->updateDirtyRegions();
2904#if QT_CONFIG(menubar)
2905 if (
d->controlContainer) {
2920#if QT_CONFIG(menubar)
2921 d_func()->removeButtonsFromMenuBar();
2941 if (
event->isOverride()) {
2946 Qt::WindowStates oldState =
event->oldState();
2962 if (!
d->oldGeometry.isValid())
2969 d->setMinimizeMode();
2971 d->setMaximizeMode();
2977 if (
d->activationEnabled)
2987 bool acceptClose =
true;
2989 acceptClose =
d->baseWidget->close();
2994#if QT_CONFIG(menubar)
2995 d->removeButtonsFromMenuBar();
2997 d->setActive(
false);
3026#if QT_CONFIG(sizegrip)
3029 height() -
d->sizeGrip->height());
3038 if (
d->isMaximizeMode)
3045 if (
d->resizeTimerId <= 0)
3046 d->cachedStyleOptions =
d->titleBarOptions();
3060 d->resizeTimerId = -1;
3061 d->updateDirtyRegions();
3076 if (
d->isMaximizeMode)
3092 if (
d->resizeTimerId != -1) {
3094 int border =
d->hasBorder(
d->cachedStyleOptions) ? 4 : 0;
3095 int titleBarHeight =
d->titleBarHeight(
d->cachedStyleOptions);
3098 if (!
d->windowTitle.isEmpty()) {
3101 d->cachedStyleOptions.text =
d->cachedStyleOptions.fontMetrics
3106 d->cachedStyleOptions =
d->titleBarOptions();
3113 if (
isMaximized() && !
d->drawTitleBarWhenMaximized()) {
3121 if (!
d->windowTitle.isEmpty())
3148 if (
d->isInInteractiveMode)
3149 d->leaveInteractiveMode();
3150#if QT_CONFIG(rubberband)
3151 if (
d->isInRubberBandMode)
3152 d->leaveRubberBandMode();
3163 if (
d->resizeEnabled ||
d->moveEnabled)
3165#if QT_CONFIG(rubberband)
3168 d->enterRubberBandMode();
3174 d->activeSubControl =
d->hoveredSubControl;
3199 if (!
d->isMoveOperation()) {
3245#if QT_CONFIG(rubberband)
3246 if (
d->isInRubberBandMode && !
d->isInInteractiveMode)
3247 d->leaveRubberBandMode();
3249 if (
d->resizeEnabled ||
d->moveEnabled)
3258 &&
d->activeSubControl ==
d->hoveredSubControl) {
3259 d->processClickedSubControl();
3277 if (!
d->isMoveOperation() && !
d->isResizeOperation()) {
3285 if (
isHoverControl(
d->hoveredSubControl) &&
d->hoveredSubControl != oldHover) {
3287 d->hoveredSubControl,
this);
3291 hoverRegion +=
QRegion(0, 0,
width(),
d->titleBarHeight(options));
3298 if ((
d->isResizeOperation() &&
d->resizeEnabled) || (
d->isMoveOperation() &&
d->moveEnabled)) {
3308 if ((
d->isResizeOperation() && !
d->resizeEnabled) || (
d->isMoveOperation() && !
d->moveEnabled))
3319 if (!
d->isInInteractiveMode || !
parent()) {
3325 switch (keyEvent->
key()) {
3328 delta =
QPoint(
d->keyboardPageStep, 0);
3330 delta =
QPoint(
d->keyboardSingleStep, 0);
3334 delta =
QPoint(0, -
d->keyboardPageStep);
3336 delta =
QPoint(0, -
d->keyboardSingleStep);
3340 delta =
QPoint(-
d->keyboardPageStep, 0);
3342 delta =
QPoint(-
d->keyboardSingleStep, 0);
3346 delta =
QPoint(0,
d->keyboardPageStep);
3348 delta =
QPoint(0,
d->keyboardSingleStep);
3353 d->leaveInteractiveMode();
3363#if QT_CONFIG(rubberband)
3364 d->isInRubberBandMode ?
d->rubberBand->geometry() :
3367 d->setNewGeometry(newPosition);
3368 QRect currentGeometry =
3369#if QT_CONFIG(rubberband)
3370 d->isInRubberBandMode ?
d->rubberBand->geometry() :
3373 if (currentGeometry == oldGeometry)
3379 if (
d->isMoveOperation()) {
3380 actualDelta =
QPoint(currentGeometry.
x() - oldGeometry.
x(),
3381 currentGeometry.
y() - oldGeometry.
y());
3384 : currentGeometry.
x() - oldGeometry.
x();
3389 if (actualDelta != delta)
3390 newPosition += (actualDelta - delta);
3395#ifndef QT_NO_CONTEXTMENU
3402 if (!
d->systemMenu) {
3439#if QT_CONFIG(sizegrip)
3441 d_func()->setSizeGrip(sizeGrip);
3451 int margin, minWidth;
3452 d->sizeParameters(&margin, &minWidth);
3453 QSize size(2 * margin,
d->titleBarHeight() + margin);
3454 if (
d->baseWidget &&
d->baseWidget->sizeHint().isValid())
3455 size +=
d->baseWidget->sizeHint();
3470 return d->iconSize();
3473 int margin, minWidth;
3474 d->sizeParameters(&margin, &minWidth);
3475 int decorationHeight = margin +
d->titleBarHeight();
3476 int minHeight = decorationHeight;
3485 if (minLayoutSize.
isValid()) {
3486 minWidth =
qMax(minWidth, minLayoutSize.
width() + 2 * margin);
3487 minHeight += minLayoutSize.
height();
3489 }
else if (
d->baseWidget &&
d->baseWidget->isVisible()) {
3490 QSize minBaseWidgetSize =
d->baseWidget->minimumSizeHint();
3491 if (minBaseWidgetSize.
isValid()) {
3492 minWidth =
qMax(minWidth, minBaseWidgetSize.
width() + 2 * margin);
3493 minHeight += minBaseWidgetSize.
height();
3497#if QT_CONFIG(sizegrip)
3499 int sizeGripHeight = 0;
3500 if (
d->sizeGrip &&
d->sizeGrip->isVisibleTo(
const_cast<QMdiSubWindow *
>(
this)))
3501 sizeGripHeight =
d->sizeGrip->height();
3504 minHeight =
qMax(minHeight, decorationHeight + sizeGripHeight);
3507 return QSize(minWidth, minHeight);
3512#include "moc_qmdisubwindow.cpp"
3513#include "qmdisubwindow.moc"
int value
the slider's current value
The QAction class provides an abstraction for user commands that can be added to different user inter...
void setIcon(const QIcon &icon)
static QWidget * focusWidget()
Returns the application widget that has the keyboard input focus, or \nullptr if no widget in this ap...
static QFont font()
Returns the default application font.
The QCloseEvent class contains parameters that describe a close event.
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.
static void setPos(int x, int y)
Moves the cursor (hot spot) of the primary screen to the global screen position (x,...
Type type() const
Returns the event type.
void ignore()
Clears the accept flag parameter of the event object, the equivalent of calling setAccepted(false).
The QFocusEvent class contains event parameters for widget focus events.
\reentrant \inmodule QtGui
QString elidedText(const QString &text, Qt::TextElideMode mode, int width, int flags=0) const
The QHelpEvent class provides an event that is used to request helpful information about a particular...
const QPoint & globalPos() const
Returns the mouse cursor position when the event was generated in global coordinates.
const QPoint & pos() const
Returns the mouse cursor position when the event was generated, relative to the widget to which the e...
The QHideEvent class provides an event which is sent after a widget is hidden.
The QIcon class provides scalable icons in different modes and states.
bool isNull() const
Returns true if the icon is empty; otherwise returns false.
QPixmap pixmap(const QSize &size, Mode mode=Normal, State state=Off) const
Returns a pixmap with the requested size, mode, and state, generating one if necessary.
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.
The QLayout class is the base class of geometry managers.
void removeWidget(QWidget *w)
Removes the widget widget from the layout.
void addWidget(QWidget *w)
Adds widget w to this layout in a manner specific to the layout.
QSize minimumSize() const override
Returns the minimum size of this layout.
bool setAlignment(QWidget *w, Qt::Alignment alignment)
Sets the alignment for widget w to alignment and returns true if w is found in this layout (not inclu...
virtual int indexOf(const QWidget *) const
Searches for widget widget in this layout (not including child layouts).
void setContentsMargins(int left, int top, int right, int bottom)
The QMainWindow class provides a main application window.
iterator insert(const Key &key, const T &value)
iterator find(const Key &key)
const_iterator constBegin() const
const_iterator constEnd() const
The QMdiArea widget provides an area in which MDI windows are displayed.
QPointer< QWidget > restoreFocusWidget
void updateDirtyRegions()
bool isShadeRequestFromMinimizeMode
void leaveInteractiveMode()
bool isExplicitlyDeactivated
void _q_enterInteractiveMode()
QStyle::SubControl hoveredSubControl
void sizeParameters(int *margin, int *minWidth) const
void setVisible(WindowStateAction, bool visible=true)
void updateWindowTitle(bool requestFromChild)
void setEnabled(WindowStateAction, bool enable=true)
QPointer< QMdi::ControlContainer > controlContainer
QRegion getRegion(Operation operation) const
QPointer< QAction > actions[NumWindowStateActions]
QPalette desktopPalette() const
QString lastChildWindowTitle
QString originalWindowTitleHelper() const
QSize internalMinimumSize
QStyleOptionTitleBar cachedStyleOptions
Operation getOperation(const QPoint &pos) const
bool drawTitleBarWhenMaximized() const
void updateGeometryConstraints()
OperationInfoMap operationMap
void _q_processFocusChanged(QWidget *old, QWidget *now)
bool ignoreWindowTitleChange
QPointer< QMenu > systemMenu
void ensureWindowState(Qt::WindowState state)
QPointer< QWidget > baseWidget
void setActive(bool activate, bool changeFocus=true)
QStyle::SubControl activeSubControl
void _q_updateStaysOnTopHint()
void updateInternalWindowTitle()
void processClickedSubControl()
Operation currentOperation
int titleBarHeight() const
QString originalWindowTitle()
bool hasBorder(const QStyleOptionTitleBar &options) const
void setNewGeometry(const QPoint &pos)
void setWindowFlags(Qt::WindowFlags windowFlags) override
QPoint mousePressPosition
QStyleOptionTitleBar titleBarOptions() const
Qt::FocusReason focusInReason
QMdiSubWindow::SubWindowOptions options
The QMdiSubWindow class provides a subwindow class for QMdiArea.
void setKeyboardPageStep(int step)
void showShaded()
Calling this function makes the subwindow enter the shaded mode.
void mouseDoubleClickEvent(QMouseEvent *mouseEvent) override
\reimp
void focusInEvent(QFocusEvent *focusInEvent) override
\reimp
void leaveEvent(QEvent *leaveEvent) override
\reimp
void resizeEvent(QResizeEvent *resizeEvent) override
\reimp
QSize minimumSizeHint() const override
\reimp
void childEvent(QChildEvent *childEvent) override
\reimp
bool eventFilter(QObject *object, QEvent *event) override
\reimp
bool event(QEvent *event) override
\reimp
QWidget * maximizedSystemMenuIconWidget() const
void changeEvent(QEvent *changeEvent) override
\reimp
int keyboardSingleStep
sets how far a widget should move or resize when using the keyboard arrow keys.
void mousePressEvent(QMouseEvent *mouseEvent) override
\reimp
void setKeyboardSingleStep(int step)
bool testOption(SubWindowOption) const
Returns true if option is enabled; otherwise returns false.
void focusOutEvent(QFocusEvent *focusOutEvent) override
\reimp
SubWindowOption
This enum describes options that customize the behavior of QMdiSubWindow.
@ AllowOutsideAreaHorizontally
@ AllowOutsideAreaVertically
QMdiSubWindow(QWidget *parent=nullptr, Qt::WindowFlags flags=Qt::WindowFlags())
Constructs a new QMdiSubWindow widget.
QWidget * maximizedButtonsWidget() const
void windowStateChanged(Qt::WindowStates oldState, Qt::WindowStates newState)
QMdiSubWindow emits this signal after the window state changes.
void hideEvent(QHideEvent *hideEvent) override
\reimp
void closeEvent(QCloseEvent *closeEvent) override
\reimp
QSize sizeHint() const override
\reimp
void setOption(SubWindowOption option, bool on=true)
If on is true, option is enabled on the subwindow; otherwise it is disabled.
bool isShaded() const
Returns true if this window is shaded; otherwise returns false.
void keyPressEvent(QKeyEvent *keyEvent) override
\reimp
void contextMenuEvent(QContextMenuEvent *contextMenuEvent) override
\reimp
QWidget * widget() const
Returns the current internal widget.
~QMdiSubWindow()
Destroys the subwindow.
void showEvent(QShowEvent *showEvent) override
\reimp
QMdiArea * mdiArea() const
void mouseReleaseEvent(QMouseEvent *mouseEvent) override
\reimp
void setWidget(QWidget *widget)
Sets widget as the internal widget of this subwindow.
int keyboardPageStep
sets how far a widget should move or resize when using the keyboard page keys.
void timerEvent(QTimerEvent *timerEvent) override
\reimp
void paintEvent(QPaintEvent *paintEvent) override
\reimp
void mouseMoveEvent(QMouseEvent *mouseEvent) override
\reimp
void moveEvent(QMoveEvent *moveEvent) override
\reimp
QWidget * controllerWidget() const
QWidget * systemMenuLabel() const
void updateWindowIcon(const QIcon &windowIcon)
ControlContainer(QMdiSubWindow *mdiChild)
QSize sizeHint() const override
bool event(QEvent *event) override
This virtual function receives events to an object and should return true if the event e was recogniz...
void mousePressEvent(QMouseEvent *mouseEvent) override
This event handler, for event event, can be reimplemented in a subclass to receive mouse press events...
void mouseReleaseEvent(QMouseEvent *mouseEvent) override
This event handler, for event event, can be reimplemented in a subclass to receive mouse release even...
void mouseDoubleClickEvent(QMouseEvent *mouseEvent) override
This event handler, for event event, can be reimplemented in a subclass to receive mouse double click...
ControlLabel(QMdiSubWindow *subWindow, QWidget *parent=nullptr)
void paintEvent(QPaintEvent *paintEvent) override
This event handler can be reimplemented in a subclass to receive paint events passed in event.
The QMoveEvent class contains event parameters for move events.
int startTimer(int interval, Qt::TimerType timerType=Qt::CoarseTimer)
This is an overloaded function that will start a timer of type timerType and a timeout of interval mi...
T findChild(const QString &aName=QString(), Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
Returns the child of this object that can be cast into type T and that is called name,...
void installEventFilter(QObject *filterObj)
Installs an event filter filterObj on this object.
QObject * parent() const
Returns a pointer to the parent object.
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
virtual bool eventFilter(QObject *watched, QEvent *event)
Filters events if this object has been installed as an event filter for the watched object.
void removeEventFilter(QObject *obj)
Removes an event filter object obj from this object.
bool inherits(const char *classname) const
Returns true if this object is an instance of a class that inherits className or a QObject subclass t...
void killTimer(int id)
Kills the timer with timer identifier, id.
The QPaintEvent class contains event parameters for paint events.
The QPainter class performs low-level painting on widgets and other paint devices.
void setClipRect(const QRectF &, Qt::ClipOperation op=Qt::ReplaceClip)
Enables clipping, and sets the clip region to the given rectangle using the given clip operation.
void setFont(const QFont &f)
Sets the painter's font to the given font.
void drawPixmap(const QRectF &targetRect, const QPixmap &pixmap, const QRectF &sourceRect)
Draws the rectangular portion source of the given pixmap into the given target in the paint device.
The QPalette class contains color groups for each widget state.
void setCurrentColorGroup(ColorGroup cg)
Set the palette's current color group to cg.
const QColor & color(ColorGroup cg, ColorRole cr) const
Returns the color in the specified color group, used for the given color role.
void setColor(ColorGroup cg, ColorRole cr, const QColor &color)
Sets the color in the specified color group, used for the given color role, to the specified solid co...
Returns a copy of the pixmap that is transformed using the given transformation transform and transfo...
constexpr QPoint toPoint() const
Rounds the coordinates of this point to the nearest integer, and returns a QPoint object with the rou...
\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.
bool isNull() const
Returns true if the referenced object has been destroyed or if there is no referenced object; otherwi...
\inmodule QtCore\reentrant
constexpr void adjust(int x1, int y1, int x2, int y2) noexcept
Adds dx1, dy1, dx2 and dy2 respectively to the existing coordinates of the rectangle.
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.
constexpr QPoint topLeft() const noexcept
Returns the position of the rectangle's top-left corner.
constexpr void setSize(const QSize &s) noexcept
Sets the size of the rectangle to the given size.
constexpr int x() const noexcept
Returns the x-coordinate of the rectangle's left edge.
constexpr QSize size() const noexcept
Returns the size of the rectangle.
constexpr void setTopLeft(const QPoint &p) noexcept
Set the top-left corner of the rectangle to the given position.
constexpr int width() const noexcept
Returns the width of the rectangle.
constexpr int y() const noexcept
Returns the y-coordinate of the rectangle's top edge.
The QRegion class specifies a clip region for a painter.
bool isEmpty() const
Returns true if the region is empty; otherwise returns false.
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.
bool contains(const T &value) const
The QShowEvent class provides an event that is sent when a widget is shown.
QPointF globalPosition() const
Returns the position of the point in this event on the screen or virtual desktop.
QPointF position() const
Returns the position of the point in this event, relative to the widget or item that received the eve...
Qt::MouseButton button() const
Returns the button that caused the event.
Qt::MouseButtons buttons() const
Returns the button state when the event was generated.
The QSizeGrip class provides a resize handle for resizing top-level windows.
QSize sizeHint() const override
\reimp
constexpr int height() const noexcept
Returns the height.
constexpr int width() const noexcept
Returns the width.
constexpr QSize expandedTo(const QSize &) const noexcept
Returns a size holding the maximum width and height of this size and the given otherSize.
constexpr void setWidth(int w) noexcept
Sets the width to the given width.
constexpr bool isNull() const noexcept
Returns true if both the width and height is 0; otherwise returns false.
constexpr void setHeight(int h) noexcept
Sets the height to the given height.
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)
void clear()
Clears the contents of the string and makes it null.
bool isNull() const
Returns true if this string is null; otherwise returns false.
QString arg(qlonglong a, int fieldwidth=0, int base=10, QChar fillChar=u' ') const
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
bool contains(QChar c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
The QStyleHintReturnMask class provides style hints that return a QRegion.
\variable QStyleOptionMenuItem::menuItemType
QStyle::SubControls subControls
QStyle::SubControls activeSubControls
\variable QStyleOptionFocusRect::backgroundColor
\variable QStyleOptionToolBox::selectedPosition
Qt::WindowFlags titleBarFlags
void initFrom(const QWidget *w)
The QStylePainter class is a convenience class for drawing QStyle elements inside a widget.
The QStyle class is an abstract base class that encapsulates the look and feel of a GUI.
virtual void drawComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p, const QWidget *widget=nullptr) const =0
Draws the given control using the provided painter with the style options specified by option.
virtual QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc, const QWidget *widget=nullptr) const =0
Returns the rectangle containing the specified subControl of the given complex control (with the styl...
virtual QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option=nullptr, const QWidget *widget=nullptr) const =0
virtual QSize sizeFromContents(ContentsType ct, const QStyleOption *opt, const QSize &contentsSize, const QWidget *w=nullptr) const =0
Returns the size of the element described by the specified option and type, based on the provided con...
@ SH_TitleBar_ShowToolTipsOnButtons
@ SH_Workspace_FillSpaceOnMaximize
virtual int styleHint(StyleHint stylehint, const QStyleOption *opt=nullptr, const QWidget *widget=nullptr, QStyleHintReturn *returnData=nullptr) const =0
Returns an integer representing the specified style hint for the given widget described by the provid...
@ SP_TitleBarNormalButton
virtual SubControl hitTestComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, const QPoint &pt, const QWidget *widget=nullptr) const =0
Returns the sub control at the given position in the given complex control (with the style options sp...
@ PM_TitleBarButtonIconSize
@ PM_MdiSubWindowFrameWidth
@ PM_MdiSubWindowMinimizedWidth
ComplexControl
This enum describes the available complex controls.
virtual int pixelMetric(PixelMetric metric, const QStyleOption *option=nullptr, const QWidget *widget=nullptr) const =0
Returns the value of the given pixel metric.
SubControl
This enum describes the available sub controls.
@ SC_TitleBarUnshadeButton
@ SC_TitleBarNormalButton
@ SC_TitleBarContextHelpButton
The QVBoxLayout class lines up widgets vertically.
static void enterWhatsThisMode()
This function switches the user interface into "What's This?" mode.
QSet< QString >::iterator it
void newState(QList< State > &states, const char *token, const char *lexem, bool pre)
Combined button and popup list for selecting options.
@ WA_CanHostQMdiSubWindowTitleBar
@ MSWindowsFixedSizeDialogHint
@ WindowMaximizeButtonHint
@ WindowMinimizeButtonHint
@ WindowMinMaxButtonsHint
MyMainWidget * mainWindow
static int area(const QSize &s)
static bool isChildOfQMdiSubWindow(const QWidget *child)
static const Qt::WindowFlags CustomizeWindowFlags
static const QStyle::SubControl SubControls[]
static int getMoveDeltaComponent(uint cflags, uint moveFlag, uint resizeFlag, int delta, int maxDelta, int minDelta)
static bool isHoverControl(QStyle::SubControl control)
static int getResizeDeltaComponent(uint cflags, uint resizeFlag, uint resizeReverseFlag, int delta)
static bool isMacStyle(QStyle *style)
QString qt_setWindowTitle_helperHelper(const QString &, const QWidget *)
Returns a modified window title with the [*] place holder replaced according to the rules described i...
static const int NumSubControls
static ControlElement< T > * ptr(QWidget *widget)
static const int BoundaryMargin
static bool isChildOfTabbedQMdiArea(const QMdiSubWindow *child)
constexpr const T & qMin(const T &a, const T &b)
constexpr const T & qMax(const T &a, const T &b)
static bool contains(const QJsonArray &haystack, unsigned needle)
GLint GLint GLint GLint GLint x
[0]
GLint GLsizei GLsizei height
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLint GLenum GLsizei GLsizei GLsizei GLint border
GLuint GLsizei const GLchar * label
[43]
GLenum GLuint GLintptr offset
GLdouble GLdouble GLdouble GLdouble q
#define Q_ASSERT_X(cond, x, msg)
#define QT_CONFIG(feature)
static void showSystemMenu(QWindow *w)
if(qFloatDistance(a, b)<(1<< 7))
[0]
connect(quitButton, &QPushButton::clicked, &app, &QCoreApplication::quit, Qt::QueuedConnection)
app setAttribute(Qt::AA_DontShowIconsInMenus)
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent