diff options
author | Olivier Goffart <ogoffart@woboq.com> | 2015-07-05 17:05:23 +0200 |
---|---|---|
committer | Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> | 2015-07-16 15:06:02 +0000 |
commit | 4e8adb4b7bfcd9892aaea0a7451d0c241be861d6 (patch) | |
tree | 3faebbc74ed680e213321481f22a3a66e084720d | |
parent | 3e34484a3fed9a8edcbb9ffa7651f0803428259f (diff) |
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>
-rw-r--r-- | src/widgets/widgets/qmainwindowlayout.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/widgets/widgets/qmainwindowlayout.cpp b/src/widgets/widgets/qmainwindowlayout.cpp index d208cddc88..aa2cf5c999 100644 --- a/src/widgets/widgets/qmainwindowlayout.cpp +++ b/src/widgets/widgets/qmainwindowlayout.cpp @@ -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); |