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 <marc.mutz@qt.io>
This commit is contained in:
Axel Spoerl 2025-04-03 19:40:47 +02:00
parent 900d1daaeb
commit a0e0425a10
3 changed files with 5 additions and 5 deletions

View File

@ -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<QDockWidgetGroupWindow *>(q->parentWidget()))
groupWindow->reparent(q);
groupWindow->reparentToMainWindow(q);
}
}
q->activateWindow();

View File

@ -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

View File

@ -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<QDockWidget *> dockWidgets() const { return findChildren<QDockWidget *>(); }