Skip to content

Commit db3dc80

Browse files
Fixed #496 Nonfloatable hidden window disappears on drop in empty area
1 parent db16c5f commit db3dc80

File tree

1 file changed

+30
-2
lines changed

1 file changed

+30
-2
lines changed

src/FloatingDragPreview.cpp

+30-2
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,26 @@ struct FloatingDragPreviewPrivate
7272
* outside of any drop area
7373
*/
7474
void createFloatingWidget();
75+
76+
/**
77+
* Returns true, if the content is floatable
78+
*/
79+
bool isContentFloatable() const
80+
{
81+
CDockWidget* DockWidget = qobject_cast<CDockWidget*>(Content);
82+
if (DockWidget && DockWidget->features().testFlag(CDockWidget::DockWidgetFloatable))
83+
{
84+
return true;
85+
}
86+
87+
CDockAreaWidget* DockArea = qobject_cast<CDockAreaWidget*>(Content);
88+
if (DockArea && DockArea->features().testFlag(CDockWidget::DockWidgetFloatable))
89+
{
90+
return true;
91+
}
92+
93+
return false;
94+
}
7595
};
7696
// struct LedArrayPanelPrivate
7797

@@ -328,10 +348,18 @@ void CFloatingDragPreview::finishDragging()
328348
{
329349
ADS_PRINT("CFloatingDragPreview::finishDragging");
330350

331-
cleanupAutoHideContainerWidget();
332-
333351
auto DockDropArea = d->DockManager->dockAreaOverlay()->visibleDropAreaUnderCursor();
334352
auto ContainerDropArea = d->DockManager->containerOverlay()->visibleDropAreaUnderCursor();
353+
bool ValidDropArea = (DockDropArea != InvalidDockWidgetArea) || (ContainerDropArea != InvalidDockWidgetArea);
354+
bool FloatingRequested = !d->DropContainer && !ValidDropArea;
355+
356+
// Non floatable auto hide widgets should stay in its current auto hide
357+
// state if they are dragged into a floating window
358+
if (!FloatingRequested || d->isContentFloatable())
359+
{
360+
cleanupAutoHideContainerWidget();
361+
}
362+
335363
if (!d->DropContainer)
336364
{
337365
d->createFloatingWidget();

0 commit comments

Comments
 (0)