Skip to content

Commit 45af886

Browse files
Fixed debug output, moved all calls to FloatingWidget->deleteLater() to a centra place in CDockContainerWidget::dropFloatingWidget
1 parent 8e522ce commit 45af886

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

src/DockAreaTabBar.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ void CDockAreaTabBar::mouseReleaseEvent(QMouseEvent* ev)
172172
{
173173
if (ev->button() == Qt::LeftButton)
174174
{
175-
ADS_PRINT("CTabsScrollArea::mouseReleaseEvent");
175+
ADS_PRINT("CDockAreaTabBar::mouseReleaseEvent");
176176
ev->accept();
177177
d->FloatingWidget = nullptr;
178178
d->DragStartMousePos = QPoint();

src/DockContainerWidget.cpp

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,6 @@ void DockContainerWidgetPrivate::dropIntoContainer(CFloatingDockContainer* Float
427427

428428
RootSplitter = Splitter;
429429
addDockAreasToList(NewDockAreas);
430-
FloatingWidget->deleteLater();
431430

432431
// If we dropped the floating widget into the main dock container that does
433432
// not contain any dock widgets, then splitter is invisible and we need to
@@ -470,7 +469,6 @@ void DockContainerWidgetPrivate::dropIntoCenterOfSection(
470469
}
471470
}
472471
TargetArea->setCurrentIndex(NewCurrentIndex);
473-
FloatingWidget->deleteLater();
474472
TargetArea->updateTitleBarVisibility();
475473
return;
476474
}
@@ -563,7 +561,6 @@ void DockContainerWidgetPrivate::dropIntoSection(CFloatingDockContainer* Floatin
563561
TargetAreaSplitter->setSizes(Sizes);
564562
}
565563

566-
FloatingWidget->deleteLater();
567564
addDockAreasToList(NewDockAreas);
568565
_this->dumpLayout();
569566
}
@@ -1390,6 +1387,7 @@ void CDockContainerWidget::dropFloatingWidget(CFloatingDockContainer* FloatingWi
13901387
CDockAreaWidget* DockArea = dockAreaAt(TargetPos);
13911388
auto dropArea = InvalidDockWidgetArea;
13921389
auto ContainerDropArea = d->DockManager->containerOverlay()->dropAreaUnderCursor();
1390+
bool Dropped = false;
13931391

13941392
if (DockArea)
13951393
{
@@ -1406,6 +1404,7 @@ void CDockContainerWidget::dropFloatingWidget(CFloatingDockContainer* FloatingWi
14061404
{
14071405
ADS_PRINT("Dock Area Drop Content: " << dropArea);
14081406
d->dropIntoSection(FloatingWidget, DockArea, dropArea);
1407+
Dropped = true;
14091408
}
14101409
}
14111410

@@ -1417,16 +1416,22 @@ void CDockContainerWidget::dropFloatingWidget(CFloatingDockContainer* FloatingWi
14171416
if (dropArea != InvalidDockWidgetArea)
14181417
{
14191418
d->dropIntoContainer(FloatingWidget, dropArea);
1419+
Dropped = true;
14201420
}
14211421
}
14221422

1423-
// If we dropped a floating widget with only one single dock widget, then we
1424-
// drop a top level widget that changes from floating to docked now
1425-
CDockWidget::emitTopLevelEventForWidget(SingleDroppedDockWidget, false);
1423+
if (Dropped)
1424+
{
1425+
FloatingWidget->deleteLater();
14261426

1427-
// If there was a top level widget before the drop, then it is not top
1428-
// level widget anymore
1429-
CDockWidget::emitTopLevelEventForWidget(SingleDockWidget, false);
1427+
// If we dropped a floating widget with only one single dock widget, then we
1428+
// drop a top level widget that changes from floating to docked now
1429+
CDockWidget::emitTopLevelEventForWidget(SingleDroppedDockWidget, false);
1430+
1431+
// If there was a top level widget before the drop, then it is not top
1432+
// level widget anymore
1433+
CDockWidget::emitTopLevelEventForWidget(SingleDockWidget, false);
1434+
}
14301435
}
14311436

14321437

0 commit comments

Comments
 (0)