diff --git a/src/widgets/widgets/qmainwindowlayout.cpp b/src/widgets/widgets/qmainwindowlayout.cpp index 60db982cb75..3346e0202fa 100644 --- a/src/widgets/widgets/qmainwindowlayout.cpp +++ b/src/widgets/widgets/qmainwindowlayout.cpp @@ -2725,8 +2725,18 @@ void QMainWindowLayout::hover(QLayoutItem *widgetItem, const QPoint &mousePos) if (QDockWidget *dw = qobject_cast(widget)) allowed = dw->isAreaAllowed(toDockWidgetArea(path.at(1))); - if (qobject_cast(widget)) - allowed = true; + // Read permissions from a DockWidgetGroupWindow depending on its DockWidget children + if (QDockWidgetGroupWindow* dwgw = qobject_cast(widget)) { + const QList children = dwgw->findChildren(QString(), Qt::FindDirectChildrenOnly); + + if (children.count() == 1) { + // Group window has a single child => read its permissions + allowed = children.at(0)->isAreaAllowed(toDockWidgetArea(path.at(1))); + } else { + // Group window has more than one or no children => dock it anywhere + allowed = true; + } + } #endif #if QT_CONFIG(toolbar) if (QToolBar *tb = qobject_cast(widget))