Skip to content

Commit

Permalink
Revert "QDockWidget: Always show dock widgets with the main window"
Browse files Browse the repository at this point in the history
This reverts commit 4c60a11.

Reason for revert: Breaks QMainWindow::restoreState(). Dock widget is shown, even if restored into hidden state.

Change-Id: I9808de4e0fd48871c3b234ae9bbaf6c64c8e832d
Reviewed-by: Volker Hilsheimer <[email protected]>
(cherry picked from commit 0ea3730)
  • Loading branch information
ASpoerl authored and Senthil Kandaswamy committed Apr 3, 2024
1 parent db413ca commit 93106d5
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 19 deletions.
7 changes: 0 additions & 7 deletions src/widgets/widgets/qmainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
11 changes: 0 additions & 11 deletions src/widgets/widgets/qmainwindowlayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1626,17 +1626,6 @@ inline static Qt::DockWidgetArea toDockWidgetArea(int pos)
return QDockWidgetPrivate::toDockWidgetArea(static_cast<QInternal::DockPosition>(pos));
}

void QMainWindowLayout::showDockWidgets() const
{
const auto dockWidgets = parent()->findChildren<QDockWidget *>(Qt::FindDirectChildrenOnly);
for (auto *dockWidget : dockWidgets)
dockWidget->show();

const auto groupWindows = parent()->findChildren<QDockWidgetGroupWindow *>(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<int> &path)
Expand Down
1 change: 0 additions & 1 deletion src/widgets/widgets/qmainwindowlayout_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 93106d5

Please sign in to comment.