summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2016-01-19 13:18:35 +0100
committerOlivier Goffart (Woboq GmbH) <ogoffart@woboq.com>2016-01-20 13:25:57 +0000
commit191858abe8cd2681f8f4e9de47819829bf1eaebb (patch)
tree8195cebb8621c84f485ea6d308c5c1198f695d3f
parent8dad3bf2121e3ad5e405665fefa28c4d53192bf7 (diff)
QMainWindowLayout::unplug(): Prevent unplugging when the widget is not a window.
Task-number: QTBUG-50490 Change-Id: Icf02e2316bbad0794bd5ac6dccd857bfb28a498b Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
-rw-r--r--src/widgets/widgets/qmainwindowlayout.cpp23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/widgets/widgets/qmainwindowlayout.cpp b/src/widgets/widgets/qmainwindowlayout.cpp
index 54e956c4cf..1bb8496505 100644
--- a/src/widgets/widgets/qmainwindowlayout.cpp
+++ b/src/widgets/widgets/qmainwindowlayout.cpp
@@ -2252,17 +2252,18 @@ void QMainWindowLayout::setCentralWidget(QWidget *widget)
QLayoutItem *QMainWindowLayout::unplug(QWidget *widget, bool group)
{
#if !defined(QT_NO_DOCKWIDGET) && !defined(QT_NO_TABBAR)
- QDockWidgetGroupWindow *floatingParent = qobject_cast<QDockWidgetGroupWindow *>(widget->parentWidget());
- if (group && floatingParent && !widget->isWindow()) {
- // We are just dragging a floating window as it, not need to do anything, we just have to
- // look up the corresponding QWidgetItem* if it exists
- QList<int> tabbedWindowPath = layoutState.indexOf(widget->parentWidget());
- return tabbedWindowPath.isEmpty() ? 0 : layoutState.item(tabbedWindowPath);
- } else if (floatingParent) {
- // We are unplugging a dock widget from a floating window.
- if (QDockWidget *dw = qobject_cast<QDockWidget*>(widget)) {
- dw->d_func()->unplug(widget->geometry());
- return 0;
+ if (!widget->isWindow() && qobject_cast<const QDockWidgetGroupWindow *>(widget->parentWidget())) {
+ if (group) {
+ // We are just dragging a floating window as it, not need to do anything, we just have to
+ // look up the corresponding QWidgetItem* if it exists
+ QList<int> tabbedWindowPath = layoutState.indexOf(widget->parentWidget());
+ return tabbedWindowPath.isEmpty() ? 0 : layoutState.item(tabbedWindowPath);
+ } else {
+ // We are unplugging a dock widget from a floating window.
+ if (QDockWidget *dw = qobject_cast<QDockWidget*>(widget)) {
+ dw->d_func()->unplug(widget->geometry());
+ return 0;
+ }
}
}
#endif