@@ -33,7 +33,6 @@ struct FloatingDragPreviewPrivate
3333 CFloatingDragPreview *_this;
3434 QWidget* Content;
3535 CDockAreaWidget* ContentSourceArea = nullptr ;
36- CDockContainerWidget* ContenSourceContainer = nullptr ;
3736 QPoint DragStartMousePosition;
3837 CDockManager* DockManager;
3938 CDockContainerWidget *DropContainer = nullptr ;
@@ -123,22 +122,8 @@ void FloatingDragPreviewPrivate::updateDropOverlays(const QPoint &GlobalPos)
123122 int VisibleDockAreas = TopContainer->visibleDockAreaCount ();
124123 ContainerOverlay->setAllowedAreas (
125124 VisibleDockAreas > 1 ? OuterDockAreas : AllDockAreas);
126-
127- DockWidgetArea ContainerArea = InvalidDockWidgetArea;
128- // If there is only one single visible dock area in a container, then
129- // it does not make sense to show a dock overlay because the dock area
130- // would be removed and inserted at the same position
131- if (VisibleDockAreas <= 1 )
132- {
133- ContainerOverlay->hideOverlay ();
134- }
135- else
136- {
137- ContainerArea = ContainerOverlay->showOverlay (TopContainer);
138- }
139- ContainerOverlay->enableDropPreview (ContainerArea != InvalidDockWidgetArea);
140125 auto DockArea = TopContainer->dockAreaAt (GlobalPos);
141- if (DockArea && DockArea->isVisible () && VisibleDockAreas > 0 && DockArea != ContentSourceArea)
126+ if (DockArea && DockArea->isVisible () && VisibleDockAreas >= 0 && DockArea != ContentSourceArea)
142127 {
143128 DockAreaOverlay->enableDropPreview (true );
144129 DockAreaOverlay->setAllowedAreas (
@@ -149,8 +134,7 @@ void FloatingDragPreviewPrivate::updateDropOverlays(const QPoint &GlobalPos)
149134 // the mouse is in the title bar. If the ContainerArea is valid
150135 // then we ignore the dock area of the dockAreaOverlay() and disable
151136 // the drop preview
152- if ((Area == CenterDockWidgetArea)
153- && (ContainerArea != InvalidDockWidgetArea))
137+ if ((Area == CenterDockWidgetArea) && (ContainerDropArea != InvalidDockWidgetArea))
154138 {
155139 DockAreaOverlay->enableDropPreview (false );
156140 ContainerOverlay->enableDropPreview (true );
@@ -159,10 +143,24 @@ void FloatingDragPreviewPrivate::updateDropOverlays(const QPoint &GlobalPos)
159143 {
160144 ContainerOverlay->enableDropPreview (InvalidDockWidgetArea == Area);
161145 }
146+ ContainerOverlay->showOverlay (TopContainer);
162147 }
163148 else
164149 {
165150 DockAreaOverlay->hideOverlay ();
151+ // If there is only one single visible dock area in a container, then
152+ // it does not make sense to show a dock overlay because the dock area
153+ // would be removed and inserted at the same position
154+ if (VisibleDockAreas <= 1 )
155+ {
156+ ContainerOverlay->hideOverlay ();
157+ }
158+ else
159+ {
160+ ContainerOverlay->showOverlay (TopContainer);
161+ }
162+
163+
166164 if (DockArea == ContentSourceArea && InvalidDockWidgetArea == ContainerDropArea)
167165 {
168166 DropContainer = nullptr ;
@@ -270,7 +268,6 @@ CFloatingDragPreview::CFloatingDragPreview(CDockWidget* Content)
270268 if (Content->dockAreaWidget ()->openDockWidgetsCount () == 1 )
271269 {
272270 d->ContentSourceArea = Content->dockAreaWidget ();
273- d->ContenSourceContainer = Content->dockContainer ();
274271 }
275272 setWindowTitle (Content->windowTitle ());
276273}
@@ -282,7 +279,6 @@ CFloatingDragPreview::CFloatingDragPreview(CDockAreaWidget* Content)
282279{
283280 d->DockManager = Content->dockManager ();
284281 d->ContentSourceArea = Content;
285- d->ContenSourceContainer = Content->dockContainer ();
286282 setWindowTitle (Content->currentDockWidget ()->windowTitle ());
287283}
288284
0 commit comments