|
22 | 22 | #include "DockManager.h" |
23 | 23 | #include "DockContainerWidget.h" |
24 | 24 | #include "DockOverlay.h" |
| 25 | +#include "AutoHideDockContainer.h" |
| 26 | +#include "ads_globals.h" |
25 | 27 |
|
26 | 28 | namespace ads |
27 | 29 | { |
@@ -373,7 +375,7 @@ void CFloatingDragPreview::finishDragging() |
373 | 375 | // state if they are dragged into a floating window |
374 | 376 | if (ValidDropArea || d->isContentFloatable()) |
375 | 377 | { |
376 | | - cleanupAutoHideContainerWidget(); |
| 378 | + cleanupAutoHideContainerWidget(ContainerDropArea); |
377 | 379 | } |
378 | 380 |
|
379 | 381 | if (!d->DropContainer) |
@@ -408,18 +410,29 @@ void CFloatingDragPreview::finishDragging() |
408 | 410 |
|
409 | 411 |
|
410 | 412 | //============================================================================ |
411 | | -void CFloatingDragPreview::cleanupAutoHideContainerWidget() |
| 413 | +void CFloatingDragPreview::cleanupAutoHideContainerWidget(DockWidgetArea ContainerDropArea) |
412 | 414 | { |
413 | 415 | auto DroppedDockWidget = qobject_cast<CDockWidget*>(d->Content); |
414 | 416 | auto DroppedArea = qobject_cast<CDockAreaWidget*>(d->Content); |
415 | | - if (DroppedDockWidget && DroppedDockWidget->autoHideDockContainer()) |
| 417 | + auto AutoHideContainer = DroppedDockWidget |
| 418 | + ? DroppedDockWidget->autoHideDockContainer() |
| 419 | + : DroppedArea->autoHideDockContainer(); |
| 420 | + |
| 421 | + if (!AutoHideContainer) |
416 | 422 | { |
417 | | - DroppedDockWidget->autoHideDockContainer()->cleanupAndDelete(); |
| 423 | + return; |
418 | 424 | } |
419 | | - if (DroppedArea && DroppedArea->autoHideDockContainer()) |
| 425 | + |
| 426 | + // If the dropped widget is already an auto hide widget and if it is moved |
| 427 | + // to a new side bar location in the same container, then we do not need |
| 428 | + // to cleanup |
| 429 | + if (ads::internal::isSideBarArea(ContainerDropArea) |
| 430 | + && (d->DropContainer == AutoHideContainer->dockContainer())) |
420 | 431 | { |
421 | | - DroppedArea->autoHideDockContainer()->cleanupAndDelete(); |
| 432 | + return; |
422 | 433 | } |
| 434 | + |
| 435 | + AutoHideContainer->cleanupAndDelete(); |
423 | 436 | } |
424 | 437 |
|
425 | 438 |
|
|
0 commit comments