@@ -33,7 +33,6 @@ struct FloatingDragPreviewPrivate
33
33
CFloatingDragPreview *_this;
34
34
QWidget* Content;
35
35
CDockAreaWidget* ContentSourceArea = nullptr ;
36
- CDockContainerWidget* ContenSourceContainer = nullptr ;
37
36
QPoint DragStartMousePosition;
38
37
CDockManager* DockManager;
39
38
CDockContainerWidget *DropContainer = nullptr ;
@@ -123,22 +122,8 @@ void FloatingDragPreviewPrivate::updateDropOverlays(const QPoint &GlobalPos)
123
122
int VisibleDockAreas = TopContainer->visibleDockAreaCount ();
124
123
ContainerOverlay->setAllowedAreas (
125
124
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);
140
125
auto DockArea = TopContainer->dockAreaAt (GlobalPos);
141
- if (DockArea && DockArea->isVisible () && VisibleDockAreas > 0 && DockArea != ContentSourceArea)
126
+ if (DockArea && DockArea->isVisible () && VisibleDockAreas >= 0 && DockArea != ContentSourceArea)
142
127
{
143
128
DockAreaOverlay->enableDropPreview (true );
144
129
DockAreaOverlay->setAllowedAreas (
@@ -149,8 +134,7 @@ void FloatingDragPreviewPrivate::updateDropOverlays(const QPoint &GlobalPos)
149
134
// the mouse is in the title bar. If the ContainerArea is valid
150
135
// then we ignore the dock area of the dockAreaOverlay() and disable
151
136
// the drop preview
152
- if ((Area == CenterDockWidgetArea)
153
- && (ContainerArea != InvalidDockWidgetArea))
137
+ if ((Area == CenterDockWidgetArea) && (ContainerDropArea != InvalidDockWidgetArea))
154
138
{
155
139
DockAreaOverlay->enableDropPreview (false );
156
140
ContainerOverlay->enableDropPreview (true );
@@ -159,10 +143,24 @@ void FloatingDragPreviewPrivate::updateDropOverlays(const QPoint &GlobalPos)
159
143
{
160
144
ContainerOverlay->enableDropPreview (InvalidDockWidgetArea == Area);
161
145
}
146
+ ContainerOverlay->showOverlay (TopContainer);
162
147
}
163
148
else
164
149
{
165
150
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
+
166
164
if (DockArea == ContentSourceArea && InvalidDockWidgetArea == ContainerDropArea)
167
165
{
168
166
DropContainer = nullptr ;
@@ -270,7 +268,6 @@ CFloatingDragPreview::CFloatingDragPreview(CDockWidget* Content)
270
268
if (Content->dockAreaWidget ()->openDockWidgetsCount () == 1 )
271
269
{
272
270
d->ContentSourceArea = Content->dockAreaWidget ();
273
- d->ContenSourceContainer = Content->dockContainer ();
274
271
}
275
272
setWindowTitle (Content->windowTitle ());
276
273
}
@@ -282,7 +279,6 @@ CFloatingDragPreview::CFloatingDragPreview(CDockAreaWidget* Content)
282
279
{
283
280
d->DockManager = Content->dockManager ();
284
281
d->ContentSourceArea = Content;
285
- d->ContenSourceContainer = Content->dockContainer ();
286
282
setWindowTitle (Content->currentDockWidget ()->windowTitle ());
287
283
}
288
284
0 commit comments