Fixed #496 Nonfloatable hidden window disappears on drop in empty area

This commit is contained in:
Uwe Kindler 2023-03-21 08:31:55 +01:00
parent db16c5f1b5
commit db3dc80170

View File

@ -72,6 +72,26 @@ struct FloatingDragPreviewPrivate
* outside of any drop area
*/
void createFloatingWidget();
/**
* Returns true, if the content is floatable
*/
bool isContentFloatable() const
{
CDockWidget* DockWidget = qobject_cast<CDockWidget*>(Content);
if (DockWidget && DockWidget->features().testFlag(CDockWidget::DockWidgetFloatable))
{
return true;
}
CDockAreaWidget* DockArea = qobject_cast<CDockAreaWidget*>(Content);
if (DockArea && DockArea->features().testFlag(CDockWidget::DockWidgetFloatable))
{
return true;
}
return false;
}
};
// struct LedArrayPanelPrivate
@ -328,10 +348,18 @@ void CFloatingDragPreview::finishDragging()
{
ADS_PRINT("CFloatingDragPreview::finishDragging");
cleanupAutoHideContainerWidget();
auto DockDropArea = d->DockManager->dockAreaOverlay()->visibleDropAreaUnderCursor();
auto ContainerDropArea = d->DockManager->containerOverlay()->visibleDropAreaUnderCursor();
bool ValidDropArea = (DockDropArea != InvalidDockWidgetArea) || (ContainerDropArea != InvalidDockWidgetArea);
bool FloatingRequested = !d->DropContainer && !ValidDropArea;
// Non floatable auto hide widgets should stay in its current auto hide
// state if they are dragged into a floating window
if (!FloatingRequested || d->isContentFloatable())
{
cleanupAutoHideContainerWidget();
}
if (!d->DropContainer)
{
d->createFloatingWidget();