QMainWindow: Remove dockwidgets from the floating tabs when plugging

Example on how to reproduce the bug with examples/widgets/mainwindows/mainwindow:

 - Select the option "Groupped Dragging" from the "Main window" menu
 - Drag and drop dock widget so there are at least three of them in
   the same group of tabs (for example red, black, and green)
 - Drag the tab bar of one of them outside to make it floating
   (for example black)
 - Drag away the group of two remaining tabs to make them floating
 - Drack back the floating-alone (black) dock widget somewhere
   back inside the main window.
 => The black dock widget is tabbed with the other instead of being
    where we put it

That's because it was still inactive (skipped) in the tab group.

Task-number: QTBUG-47209
Change-Id: I84ac33d4ca1df0381c6007486b41830bd7be99a8
Reviewed-by: Paul Olav Tvete <paul.tvete@theqtcompany.com>
This commit is contained in:
Olivier Goffart 2015-07-05 17:05:23 +02:00 committed by Olivier Goffart (Woboq GmbH)
parent 3e34484a3f
commit 4e8adb4b7b

View File

@ -1941,6 +1941,16 @@ bool QMainWindowLayout::plug(QLayoutItem *widgetItem)
QWidget *widget = widgetItem->widget();
#ifndef QT_NO_DOCKWIDGET
// Let's remove the widget from any possible group window
foreach (QDockWidgetGroupWindow *dwgw,
parent()->findChildren<QDockWidgetGroupWindow*>(QString(), Qt::FindDirectChildrenOnly)) {
QList<int> path = dwgw->layoutInfo()->indexOf(widget);
if (!path.isEmpty())
dwgw->layoutInfo()->remove(path);
}
#endif
QList<int> previousPath = layoutState.indexOf(widget);
const QLayoutItem *it = layoutState.plug(currentGapPos);