From 93106d529c53fa6ebf2829c36acbfa6196baaef2 Mon Sep 17 00:00:00 2001 From: Axel Spoerl Date: Fri, 22 Dec 2023 11:24:15 +0000 Subject: [PATCH] Revert "QDockWidget: Always show dock widgets with the main window" This reverts commit 4c60a11d8f935abb762a83b0ab99cefa6db3060c. Reason for revert: Breaks QMainWindow::restoreState(). Dock widget is shown, even if restored into hidden state. Change-Id: I9808de4e0fd48871c3b234ae9bbaf6c64c8e832d Reviewed-by: Volker Hilsheimer (cherry picked from commit 0ea37300d111beea3bb353f036d6c747f63c88dd) --- src/widgets/widgets/qmainwindow.cpp | 7 ------- src/widgets/widgets/qmainwindowlayout.cpp | 11 ----------- src/widgets/widgets/qmainwindowlayout_p.h | 1 - 3 files changed, 19 deletions(-) diff --git a/src/widgets/widgets/qmainwindow.cpp b/src/widgets/widgets/qmainwindow.cpp index fec367e9dd5..10489f830b4 100644 --- a/src/widgets/widgets/qmainwindow.cpp +++ b/src/widgets/widgets/qmainwindow.cpp @@ -1287,13 +1287,6 @@ bool QMainWindow::event(QEvent *event) return true; #endif // QT_CONFIG(statustip) -#if QT_CONFIG(dockwidget) - case QEvent::Show: - Q_ASSERT(d->layout); - d->layout->showDockWidgets(); - break; -#endif // QT_CONFIG(dockwidget) - case QEvent::StyleChange: #if QT_CONFIG(dockwidget) Q_ASSERT(d->layout); diff --git a/src/widgets/widgets/qmainwindowlayout.cpp b/src/widgets/widgets/qmainwindowlayout.cpp index 9f7bc68357e..3dd06398d32 100644 --- a/src/widgets/widgets/qmainwindowlayout.cpp +++ b/src/widgets/widgets/qmainwindowlayout.cpp @@ -1626,17 +1626,6 @@ inline static Qt::DockWidgetArea toDockWidgetArea(int pos) return QDockWidgetPrivate::toDockWidgetArea(static_cast(pos)); } -void QMainWindowLayout::showDockWidgets() const -{ - const auto dockWidgets = parent()->findChildren(Qt::FindDirectChildrenOnly); - for (auto *dockWidget : dockWidgets) - dockWidget->show(); - - const auto groupWindows = parent()->findChildren(Qt::FindDirectChildrenOnly); - for (auto *groupWindow : groupWindows) - groupWindow->show(); -} - // Checks if QDockWidgetGroupWindow or QDockWidget can be plugged the area indicated by path. // Returns false if called with invalid widget type or if compiled without dockwidget support. static bool isAreaAllowed(QWidget *widget, const QList &path) diff --git a/src/widgets/widgets/qmainwindowlayout_p.h b/src/widgets/widgets/qmainwindowlayout_p.h index c8f500a0db3..1f18addebbe 100644 --- a/src/widgets/widgets/qmainwindowlayout_p.h +++ b/src/widgets/widgets/qmainwindowlayout_p.h @@ -498,7 +498,6 @@ class Q_AUTOTEST_EXPORT QMainWindowLayout Qt::Orientation orientation); Qt::DockWidgetArea dockWidgetArea(QWidget* widget) const; bool restoreDockWidget(QDockWidget *dockwidget); - void showDockWidgets() const; #if QT_CONFIG(tabbar) void tabifyDockWidget(QDockWidget *first, QDockWidget *second); void raise(QDockWidget *widget);