Remove a dock widget from the layout before adding as tab

So the layout can grow first and not complain there's not enough
space.

Fixes fuzzer test-case 3.json.
The warning was: "Constraints not honoured" in Item::onLayoutRequest()
This commit is contained in:
Sergio Martins
2019-10-15 12:51:49 +01:00
parent fe4627280e
commit 92bbe4d4f7
2 changed files with 3 additions and 1 deletions

View File

@@ -154,6 +154,7 @@ void DockWidgetBase::addDockWidgetAsTab(DockWidgetBase *other)
}
Q_ASSERT(frame);
other->setParent(nullptr);
frame->addWidget(other);
}

View File

@@ -4790,6 +4790,7 @@ void TestDocks::tst_stealFrame()
dock1->addDockWidgetAsTab(dock3);
QPointer<Frame> f2 = dock2->frame();
dock4->addDockWidgetAsTab(dock2);
QVERIFY(Testing::waitForDeleted(f2.data()));
QVERIFY(!f2.data());
QCOMPARE(layout1->count(), 1);
@@ -4817,7 +4818,7 @@ void TestDocks::tst_stealFrame()
// 5. And also steal a side-by-side one into the tab
QPointer<Frame> f4 = dock4->frame();
dock1->addDockWidgetAsTab(dock4);
QVERIFY(!f4);
QVERIFY(Testing::waitForDeleted(f4.data()));
QCOMPARE(layout1->count(), 1);
QCOMPARE(layout1->placeholderCount(), 0);