diff options
author | Axel Spoerl <axel.spoerl@qt.io> | 2023-05-16 10:40:13 +0200 |
---|---|---|
committer | Axel Spoerl <axel.spoerl@qt.io> | 2023-06-07 18:46:56 +0200 |
commit | c153066baaa88718ed45b68230d81285eb436d3d (patch) | |
tree | 4adaf029862085737da16d697a943dee5b3d6247 /tests/auto | |
parent | 5a2474b2dd0472948c53b16c4bf566db489dcfb9 (diff) |
QDockWidget: Propagate window title when re-docking
When a floating dockwidget's title changes, it is rendered as a
window title. When the title changes while floating, the change will be
reverted to the pre-change title when the dockwidget is docked again.
This patch explicitly propagates the window title, if it has been
programmatically changed while the dock widget is floating.
It adds test functionality in tst_QDockWidget::floatingTabs().
Fixes: QTBUG-113591
Pick-to: 6.6 6.5
Change-Id: I96fa69fb27ad1a85f4ea9ce44c0a22290259fca6
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp b/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp index 35a05f768a..97878e0887 100644 --- a/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp +++ b/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp @@ -65,7 +65,7 @@ private slots: // Dock area permissions for DockWidgets and DockWidgetGroupWindows void dockPermissions(); - // test floating tabs and item_tree consistency + // test floating tabs, item_tree and window title consistency void floatingTabs(); // test hide & show @@ -1375,7 +1375,10 @@ void tst_QDockWidget::floatingTabs() /* * replug both dock widgets into their initial position - * expected behavior: both docks are plugged and no longer floating + * expected behavior: + - both docks are plugged + - both docks are no longer floating + - title changes have been propagated */ @@ -1396,6 +1399,12 @@ void tst_QDockWidget::floatingTabs() QTRY_VERIFY(d1->isFloating()); QTRY_VERIFY(!d2->isFloating()); + // Change titles + static constexpr QLatin1StringView newD1("New D1"); + static constexpr QLatin1StringView newD2("New D2"); + d1->setWindowTitle(newD1); + d2->setWindowTitle(newD2); + // Plug back into dock areas qCDebug(lcTestDockWidget) << "*** test plugging back to dock areas ***"; qCDebug(lcTestDockWidget) << "Move d1 to left dock"; @@ -1415,6 +1424,10 @@ void tst_QDockWidget::floatingTabs() QTRY_VERIFY(!mainWindow->findChild<QDockWidgetGroupWindow*>()); QTRY_VERIFY(ftabs.isNull()); + // check window titles + QCOMPARE(d1->windowTitle(), newD1); + QCOMPARE(d2->windowTitle(), newD2); + // Check if paths are consistent qCDebug(lcTestDockWidget) << "Checking path consistency" << layout->layoutState.indexOf(d1) << layout->layoutState.indexOf(d2); |