Fix the QMainWindow context menu when there are floating tabs

If QMainWindow::GroupedDragging is enabled and there are QDockWidgetGroupWindow,
we should still show actions for these QDockWidgets in the context menu

Addresses point 4. of QTBUG-52108

Task-number: QTBUG-52108
Change-Id: I11ae401c4fe15e213b0f26e7579634e2062e953c
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
bb10
Olivier Goffart 2016-06-27 14:12:54 +02:00 committed by Olivier Goffart (Woboq GmbH)
parent 3d621af54b
commit 27df6cb32d
1 changed files with 13 additions and 3 deletions

View File

@ -1717,10 +1717,20 @@ QMenu *QMainWindow::createPopupMenu()
menu = new QMenu(this);
for (int i = 0; i < dockwidgets.size(); ++i) {
QDockWidget *dockWidget = dockwidgets.at(i);
if (dockWidget->parentWidget() == this
&& !d->layout->layoutState.dockAreaLayout.indexOf(dockWidget).isEmpty()) {
menu->addAction(dockwidgets.at(i)->toggleViewAction());
// filter to find out if we own this QDockWidget
if (dockWidget->parentWidget() == this) {
if (d->layout->layoutState.dockAreaLayout.indexOf(dockWidget).isEmpty())
continue;
} else if (QDockWidgetGroupWindow *dwgw =
qobject_cast<QDockWidgetGroupWindow *>(dockWidget->parentWidget())) {
if (dwgw->parentWidget() != this)
continue;
if (dwgw->layoutInfo()->indexOf(dockWidget).isEmpty())
continue;
} else {
continue;
}
menu->addAction(dockwidgets.at(i)->toggleViewAction());
}
menu->addSeparator();
}