From 4744f31e59711a407ffaf2db725711aec41bc134 Mon Sep 17 00:00:00 2001 From: Nick D'Ademo Date: Mon, 5 Nov 2018 15:13:19 +0800 Subject: [PATCH] QMdiArea: Do not reset tiled flag on spontaneous system window events Do not reset the isSubWindowsTiled flag if the hide/show event is an external (spontaneous) system window event, i.e. we should instead reset this flag when the subwindow itself is directly hidden or shown. This change ensures that tiling will be performed during the resizeEvent after an application window minimize (hide) and then restore (show). Change-Id: Ib37f52f1162b493be3413fc59951be2f30701439 Reviewed-by: Richard Moe Gustavsen --- src/widgets/widgets/qmdiarea.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/widgets/widgets/qmdiarea.cpp b/src/widgets/widgets/qmdiarea.cpp index f32cd26478..c1817060dd 100644 --- a/src/widgets/widgets/qmdiarea.cpp +++ b/src/widgets/widgets/qmdiarea.cpp @@ -2640,7 +2640,11 @@ bool QMdiArea::eventFilter(QObject *object, QEvent *event) #endif // QT_CONFIG(tabbar) Q_FALLTHROUGH(); case QEvent::Hide: - d->isSubWindowsTiled = false; + // Do not reset the isSubWindowsTiled flag if the event is a spontaneous system window event. + // This ensures that tiling will be performed during the resizeEvent after an application + // window minimize (hide) and then restore (show). + if (!event->spontaneous()) + d->isSubWindowsTiled = false; break; #if QT_CONFIG(rubberband) case QEvent::Close: