QDockWidget: Always show dock widgets with the main window
QMainWindow::show() also showed its dock widget children. When a main window with dock widget children consumed a show event for another reason, hidden dock widget children remained hidden. If a dock widget application went to the background, e.g. because it was hidden behind another application gaining focus, a klick on the dock widget application's app icon would not show its dock widget children. Unless the dock widget application provides shows them explicitly, they can never been shown again by the user. => show all dock widget and group window children, when QMainWindow consumes a show event. Pick-to: 6.5 Change-Id: I7e8b59f021ec4ec5679d0d08d0eeda1e3225a385 Reviewed-by: David Faure <david.faure@kdab.com> (cherry picked from commit 4c60a11d8f935abb762a83b0ab99cefa6db3060c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
ee0ec5df23
commit
cb465195f1
@ -1290,6 +1290,13 @@ 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);
|
||||
|
@ -1494,6 +1494,17 @@ 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.
|
||||
#if QT_CONFIG(dockwidget)
|
||||
|
@ -502,6 +502,7 @@ public:
|
||||
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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user