Lucas 2021-10-01 15:30:33 +02:00 committed by GitHub
parent 130b0de646
commit 0b82ff30fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 7 deletions

View File

@ -1565,8 +1565,9 @@ void CDockContainerWidget::dropFloatingWidget(CFloatingDockContainer* FloatingWi
}
if (Dropped)
{
FloatingWidget->deleteLater();
{
// Fix https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/issues/351
FloatingWidget->hideAndDeleteLater();
// If we dropped a floating widget with only one single dock widget, then we
// drop a top level widget that changes from floating to docked now

View File

@ -373,6 +373,7 @@ struct FloatingDockContainerPrivate
CDockAreaWidget *SingleDockArea = nullptr;
QPoint DragStartPos;
bool Hiding = false;
bool AutoHideChildren = true;
#ifdef Q_OS_LINUX
QWidget* MouseEventHandler = nullptr;
CFloatingWidgetTitleBar* TitleBar = nullptr;
@ -841,15 +842,18 @@ void CFloatingDockContainer::hideEvent(QHideEvent *event)
return;
}
d->Hiding = true;
for (auto DockArea : d->DockContainer->openedDockAreas())
if ( d->AutoHideChildren )
{
for (auto DockWidget : DockArea->openedDockWidgets())
d->Hiding = true;
for ( auto DockArea : d->DockContainer->openedDockAreas() )
{
DockWidget->toggleView(false);
for ( auto DockWidget : DockArea->openedDockWidgets() )
{
DockWidget->toggleView( false );
}
}
d->Hiding = false;
}
d->Hiding = false;
}
@ -1035,6 +1039,18 @@ QList<CDockWidget*> CFloatingDockContainer::dockWidgets() const
return d->DockContainer->dockWidgets();
}
//============================================================================
void CFloatingDockContainer::hideAndDeleteLater()
{
// Widget has been redocked, so it must be hidden right way (see
// https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/issues/351)
// but AutoHideChildren must be set to false because "this" still contains
// dock widgets that shall not be toggled hidden.
d->AutoHideChildren = false;
hide();
deleteLater();
}
//============================================================================
void CFloatingDockContainer::finishDragging()
{

View File

@ -258,6 +258,11 @@ public:
*/
QList<CDockWidget*> dockWidgets() const;
/**
* This function hides the floating bar instantely and delete it later.
*/
void hideAndDeleteLater();
#ifdef Q_OS_LINUX
/**
* This is a function that responds to FloatingWidgetTitleBar::maximizeRequest()