From b950b8a20972e7cef7066e22f2ef63344d534657 Mon Sep 17 00:00:00 2001 From: Syarif Fakhri Date: Tue, 13 Sep 2022 12:45:26 +0800 Subject: [PATCH] Fix overlayed containers able to drag into the center of the central widget --- src/FloatingDragPreview.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/FloatingDragPreview.cpp b/src/FloatingDragPreview.cpp index 4fcbb51..616e6e2 100644 --- a/src/FloatingDragPreview.cpp +++ b/src/FloatingDragPreview.cpp @@ -121,14 +121,21 @@ void FloatingDragPreviewPrivate::updateDropOverlays(const QPoint &GlobalPos) } int VisibleDockAreas = TopContainer->visibleDockAreaCount(); - ContainerOverlay->setAllowedAreas( - VisibleDockAreas > 1 ? OuterDockAreas : AllDockAreas); + + // Include the overlay widget we're dragging as a visible widget + auto dockAreaWidget = qobject_cast(Content); + if (dockAreaWidget && dockAreaWidget->isOverlayed()) + { + VisibleDockAreas++; + } + + ContainerOverlay->setAllowedAreas( VisibleDockAreas > 1 ? OuterDockAreas : AllDockAreas); auto DockArea = TopContainer->dockAreaAt(GlobalPos); if (DockArea && DockArea->isVisible() && VisibleDockAreas >= 0 && DockArea != ContentSourceArea) { DockAreaOverlay->enableDropPreview(true); - DockAreaOverlay->setAllowedAreas( - (VisibleDockAreas == 1) ? NoDockWidgetArea : DockArea->allowedAreas()); + DockAreaOverlay->setAllowedAreas( (VisibleDockAreas == 1) ? NoDockWidgetArea : DockArea->allowedAreas()); + DockWidgetArea Area = DockAreaOverlay->showOverlay(DockArea); // A CenterDockWidgetArea for the dockAreaOverlay() indicates that