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

@ -1566,7 +1566,8 @@ void CDockContainerWidget::dropFloatingWidget(CFloatingDockContainer* FloatingWi
if (Dropped) 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 // 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 // drop a top level widget that changes from floating to docked now

View File

@ -373,6 +373,7 @@ struct FloatingDockContainerPrivate
CDockAreaWidget *SingleDockArea = nullptr; CDockAreaWidget *SingleDockArea = nullptr;
QPoint DragStartPos; QPoint DragStartPos;
bool Hiding = false; bool Hiding = false;
bool AutoHideChildren = true;
#ifdef Q_OS_LINUX #ifdef Q_OS_LINUX
QWidget* MouseEventHandler = nullptr; QWidget* MouseEventHandler = nullptr;
CFloatingWidgetTitleBar* TitleBar = nullptr; CFloatingWidgetTitleBar* TitleBar = nullptr;
@ -841,15 +842,18 @@ void CFloatingDockContainer::hideEvent(QHideEvent *event)
return; return;
} }
if ( d->AutoHideChildren )
{
d->Hiding = true; d->Hiding = true;
for (auto DockArea : d->DockContainer->openedDockAreas()) for ( auto DockArea : d->DockContainer->openedDockAreas() )
{ {
for (auto DockWidget : DockArea->openedDockWidgets()) for ( auto DockWidget : DockArea->openedDockWidgets() )
{ {
DockWidget->toggleView(false); DockWidget->toggleView( false );
} }
} }
d->Hiding = false; d->Hiding = false;
}
} }
@ -1035,6 +1039,18 @@ QList<CDockWidget*> CFloatingDockContainer::dockWidgets() const
return d->DockContainer->dockWidgets(); 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() void CFloatingDockContainer::finishDragging()
{ {

View File

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