summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@woboq.com>2017-02-20 13:26:18 +0100
committerOlivier Goffart (Woboq GmbH) <ogoffart@woboq.com>2017-02-23 16:04:39 +0000
commit209aba1e86e6136953a3903bf92987ec5a83ad4f (patch)
tree13f71d3968e7f3f17408dd77d2cc8be5159c21b7
parentd0352bd6f4ca8a4738ad327488c20a8e96d3a83f (diff)
Fix crash while dropping a tabbed group into a single floating QDockWidget
The problem was caused by commit 0feeb6f6d2cfaa964763ca1fcab65672812b4eef which fixed QTBUG-58036. It reparented widget that used to be skiped. In particular, floating widgets are skiped. But seting the parent of a floating widget docks it. And so as a result it would not be skiped anymore. This has two side effect: This breaks the animation (as the widget is docked too early; and cause crash when QDockWidgetGroupWindow get reparented as this breaks invariant that these are always floating. So restore the skip from before commit 0feeb6f6d2cfaa964763ca1fcab65672812b4eef, and explicitly set the parent in all cases when the animation finishes. Change-Id: I0e3e29ad22d6ffe4d62242d48a18dadb916fc14f Reviewed-by: Sérgio Martins <sergio.martins@kdab.com> (cherry picked from commit d57bb19902f863fc6db07674f6bd8881b0886b39)
-rw-r--r--src/widgets/widgets/qdockarealayout.cpp2
-rw-r--r--src/widgets/widgets/qmainwindowlayout.cpp6
2 files changed, 3 insertions, 5 deletions
diff --git a/src/widgets/widgets/qdockarealayout.cpp b/src/widgets/widgets/qdockarealayout.cpp
index ba13dd4352..7bacfd1515 100644
--- a/src/widgets/widgets/qdockarealayout.cpp
+++ b/src/widgets/widgets/qdockarealayout.cpp
@@ -2069,7 +2069,7 @@ void QDockAreaLayoutInfo::reparentWidgets(QWidget *parent)
const QDockAreaLayoutItem &item = item_list.at(i);
if (item.flags & QDockAreaLayoutItem::GapItem)
continue;
- if (!item.widgetItem && item.skip())
+ if (item.skip())
continue;
if (item.subinfo)
item.subinfo->reparentWidgets(parent);
diff --git a/src/widgets/widgets/qmainwindowlayout.cpp b/src/widgets/widgets/qmainwindowlayout.cpp
index 7ba46ee6e8..929a649942 100644
--- a/src/widgets/widgets/qmainwindowlayout.cpp
+++ b/src/widgets/widgets/qmainwindowlayout.cpp
@@ -2112,10 +2112,8 @@ void QMainWindowLayout::animationFinished(QWidget *widget)
}
if (QDockWidget *dw = qobject_cast<QDockWidget*>(widget)) {
- if (currentHoveredFloat) {
- dw->setParent(currentHoveredFloat);
- dw->show();
- }
+ dw->setParent(currentHoveredFloat ? currentHoveredFloat.data() : parentWidget());
+ dw->show();
dw->d_func()->plug(currentGapRect);
}
#endif