From a0e0425a107aebf8727673505ea2376400b54b07 Mon Sep 17 00:00:00 2001 From: Axel Spoerl Date: Thu, 3 Apr 2025 19:40:47 +0200 Subject: [PATCH] Rename QDockWidgetGroupWindow::reparent() to reparentToMainWindow() Naming the private API "reparent()" was unfortunate. It is ambigous, as it suggests that the QDockWidget argument may be parented to the group window. In fact the opposite is the case: It is removed from the group window and re-parented to the QMainWindow. Rename the API into reparentToMainWindow(), which is what it does. Amends e6d85cf28bc4f750b69c33b72c006b067ae1190f. Task-number: QTBUG-135442 Pick-to: 6.9 6.8 6.5 Change-Id: I6f9f37c190f3550348b1e4e14a8612d8880170dd Reviewed-by: Marc Mutz --- src/widgets/widgets/qdockwidget.cpp | 2 +- src/widgets/widgets/qmainwindowlayout.cpp | 6 +++--- src/widgets/widgets/qmainwindowlayout_p.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/widgets/widgets/qdockwidget.cpp b/src/widgets/widgets/qdockwidget.cpp index abee5f67219..4387b7626a7 100644 --- a/src/widgets/widgets/qdockwidget.cpp +++ b/src/widgets/widgets/qdockwidget.cpp @@ -854,7 +854,7 @@ void QDockWidgetPrivate::endDrag(EndDragMode mode) // Reparent, if the drag was out of a dock widget group window if (mode == EndDragMode::LocationChange) { if (auto *groupWindow = qobject_cast(q->parentWidget())) - groupWindow->reparent(q); + groupWindow->reparentToMainWindow(q); } } q->activateWindow(); diff --git a/src/widgets/widgets/qmainwindowlayout.cpp b/src/widgets/widgets/qmainwindowlayout.cpp index 9291fbf240c..4ce5ba4e7c5 100644 --- a/src/widgets/widgets/qmainwindowlayout.cpp +++ b/src/widgets/widgets/qmainwindowlayout.cpp @@ -680,7 +680,7 @@ bool QDockWidgetGroupWindow::eventFilter(QObject *obj, QEvent *event) case QEvent::Close: // We don't want closed dock widgets in a floating tab // => dock it to the main dock, before closing; - reparent(dockWidget); + reparentToMainWindow(dockWidget); dockWidget->setFloating(false); break; @@ -725,7 +725,7 @@ void QDockWidgetGroupWindow::destroyIfSingleItemLeft() QDockAreaLayoutInfo &parentInfo = mwLayout->layoutState.dockAreaLayout.docks[layoutInfo()->dockPos]; // Re-parent last dock widget - reparent(lastDockWidget); + reparentToMainWindow(lastDockWidget); // the group window could still have placeholder items => clear everything layoutInfo()->item_list.clear(); @@ -735,7 +735,7 @@ void QDockWidgetGroupWindow::destroyIfSingleItemLeft() destroyOrHideIfEmpty(); } -void QDockWidgetGroupWindow::reparent(QDockWidget *dockWidget) +void QDockWidgetGroupWindow::reparentToMainWindow(QDockWidget *dockWidget) { // reparent a dockWidget to the main window // - remove it from the floating dock's layout info diff --git a/src/widgets/widgets/qmainwindowlayout_p.h b/src/widgets/widgets/qmainwindowlayout_p.h index 7e22788ec49..3cc62c7d917 100644 --- a/src/widgets/widgets/qmainwindowlayout_p.h +++ b/src/widgets/widgets/qmainwindowlayout_p.h @@ -363,7 +363,7 @@ public: void restore(); void apply(); void childEvent(QChildEvent *event) override; - void reparent(QDockWidget *dockWidget); + void reparentToMainWindow(QDockWidget *dockWidget); void destroyIfSingleItemLeft(); QList dockWidgets() const { return findChildren(); }