Fixed debug output, moved all calls to FloatingWidget->deleteLater() to a centra place in CDockContainerWidget::dropFloatingWidget

This commit is contained in:
Uwe Kindler 2019-12-10 12:47:55 +01:00
parent 8e522ce311
commit 45af8867b2
2 changed files with 15 additions and 10 deletions

View File

@ -172,7 +172,7 @@ void CDockAreaTabBar::mouseReleaseEvent(QMouseEvent* ev)
{ {
if (ev->button() == Qt::LeftButton) if (ev->button() == Qt::LeftButton)
{ {
ADS_PRINT("CTabsScrollArea::mouseReleaseEvent"); ADS_PRINT("CDockAreaTabBar::mouseReleaseEvent");
ev->accept(); ev->accept();
d->FloatingWidget = nullptr; d->FloatingWidget = nullptr;
d->DragStartMousePos = QPoint(); d->DragStartMousePos = QPoint();

View File

@ -427,7 +427,6 @@ void DockContainerWidgetPrivate::dropIntoContainer(CFloatingDockContainer* Float
RootSplitter = Splitter; RootSplitter = Splitter;
addDockAreasToList(NewDockAreas); addDockAreasToList(NewDockAreas);
FloatingWidget->deleteLater();
// If we dropped the floating widget into the main dock container that does // If we dropped the floating widget into the main dock container that does
// not contain any dock widgets, then splitter is invisible and we need to // not contain any dock widgets, then splitter is invisible and we need to
@ -470,7 +469,6 @@ void DockContainerWidgetPrivate::dropIntoCenterOfSection(
} }
} }
TargetArea->setCurrentIndex(NewCurrentIndex); TargetArea->setCurrentIndex(NewCurrentIndex);
FloatingWidget->deleteLater();
TargetArea->updateTitleBarVisibility(); TargetArea->updateTitleBarVisibility();
return; return;
} }
@ -563,7 +561,6 @@ void DockContainerWidgetPrivate::dropIntoSection(CFloatingDockContainer* Floatin
TargetAreaSplitter->setSizes(Sizes); TargetAreaSplitter->setSizes(Sizes);
} }
FloatingWidget->deleteLater();
addDockAreasToList(NewDockAreas); addDockAreasToList(NewDockAreas);
_this->dumpLayout(); _this->dumpLayout();
} }
@ -1390,6 +1387,7 @@ void CDockContainerWidget::dropFloatingWidget(CFloatingDockContainer* FloatingWi
CDockAreaWidget* DockArea = dockAreaAt(TargetPos); CDockAreaWidget* DockArea = dockAreaAt(TargetPos);
auto dropArea = InvalidDockWidgetArea; auto dropArea = InvalidDockWidgetArea;
auto ContainerDropArea = d->DockManager->containerOverlay()->dropAreaUnderCursor(); auto ContainerDropArea = d->DockManager->containerOverlay()->dropAreaUnderCursor();
bool Dropped = false;
if (DockArea) if (DockArea)
{ {
@ -1406,6 +1404,7 @@ void CDockContainerWidget::dropFloatingWidget(CFloatingDockContainer* FloatingWi
{ {
ADS_PRINT("Dock Area Drop Content: " << dropArea); ADS_PRINT("Dock Area Drop Content: " << dropArea);
d->dropIntoSection(FloatingWidget, DockArea, dropArea); d->dropIntoSection(FloatingWidget, DockArea, dropArea);
Dropped = true;
} }
} }
@ -1417,9 +1416,14 @@ void CDockContainerWidget::dropFloatingWidget(CFloatingDockContainer* FloatingWi
if (dropArea != InvalidDockWidgetArea) if (dropArea != InvalidDockWidgetArea)
{ {
d->dropIntoContainer(FloatingWidget, dropArea); d->dropIntoContainer(FloatingWidget, dropArea);
Dropped = true;
} }
} }
if (Dropped)
{
FloatingWidget->deleteLater();
// 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
CDockWidget::emitTopLevelEventForWidget(SingleDroppedDockWidget, false); CDockWidget::emitTopLevelEventForWidget(SingleDroppedDockWidget, false);
@ -1427,6 +1431,7 @@ void CDockContainerWidget::dropFloatingWidget(CFloatingDockContainer* FloatingWi
// If there was a top level widget before the drop, then it is not top // If there was a top level widget before the drop, then it is not top
// level widget anymore // level widget anymore
CDockWidget::emitTopLevelEventForWidget(SingleDockWidget, false); CDockWidget::emitTopLevelEventForWidget(SingleDockWidget, false);
}
} }