File tree Expand file tree Collapse file tree 4 files changed +24
-5
lines changed Expand file tree Collapse file tree 4 files changed +24
-5
lines changed Original file line number Diff line number Diff line change @@ -1643,6 +1643,15 @@ void CDockContainerWidget::removeDockArea(CDockAreaWidget* area)
1643
1643
}
1644
1644
1645
1645
1646
+ // ============================================================================
1647
+ QList<QPointer<CDockAreaWidget>> CDockContainerWidget::removeAllDockAreas ()
1648
+ {
1649
+ auto Result = d->DockAreas ;
1650
+ d->DockAreas .clear ();
1651
+ return Result;
1652
+ }
1653
+
1654
+
1646
1655
// ============================================================================
1647
1656
CDockAreaWidget* CDockContainerWidget::dockAreaAt (const QPoint& GlobalPos) const
1648
1657
{
@@ -1756,7 +1765,7 @@ void CDockContainerWidget::dropFloatingWidget(CFloatingDockContainer* FloatingWi
1756
1765
if (Dropped)
1757
1766
{
1758
1767
// Fix https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/issues/351
1759
- FloatingWidget->hideAndDeleteLater ();
1768
+ FloatingWidget->finishDropOperation ();
1760
1769
1761
1770
// If we dropped a floating widget with only one single dock widget, then we
1762
1771
// drop a top level widget that changes from floating to docked now
Original file line number Diff line number Diff line change @@ -139,6 +139,11 @@ class ADS_EXPORT CDockContainerWidget : public QFrame
139
139
*/
140
140
void removeDockArea (CDockAreaWidget* area);
141
141
142
+ /* *
143
+ * Remove all dock areas and returns the list of removed dock areas
144
+ */
145
+ QList<QPointer<CDockAreaWidget>> removeAllDockAreas ();
146
+
142
147
/* *
143
148
* Saves the state into the given stream
144
149
*/
Original file line number Diff line number Diff line change @@ -776,7 +776,7 @@ CFloatingDockContainer::~CFloatingDockContainer()
776
776
continue ;
777
777
}
778
778
779
- // QPointer delete safety - just in case some dock wigdet in destruction
779
+ // QPointer delete safety - just in case some dock widget in destruction
780
780
// deletes another related/twin or child dock widget.
781
781
std::vector<QPointer<QWidget>> deleteWidgets;
782
782
for (auto widget : area->dockWidgets ())
@@ -1167,14 +1167,19 @@ QList<CDockWidget*> CFloatingDockContainer::dockWidgets() const
1167
1167
}
1168
1168
1169
1169
// ============================================================================
1170
- void CFloatingDockContainer::hideAndDeleteLater ()
1170
+ void CFloatingDockContainer::finishDropOperation ()
1171
1171
{
1172
1172
// Widget has been redocked, so it must be hidden right way (see
1173
1173
// https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/issues/351)
1174
1174
// but AutoHideChildren must be set to false because "this" still contains
1175
1175
// dock widgets that shall not be toggled hidden.
1176
1176
d->AutoHideChildren = false ;
1177
1177
hide ();
1178
+ // The floating widget will be deleted now. Ensure, that the destructor
1179
+ // of the floating widget does not delete any dock areas that have been
1180
+ // moved to a new container - simply remove all dock areas before deleting
1181
+ // the floating widget
1182
+ d->DockContainer ->removeAllDockAreas ();
1178
1183
deleteLater ();
1179
1184
if (d->DockManager )
1180
1185
{
Original file line number Diff line number Diff line change @@ -258,9 +258,9 @@ private Q_SLOTS:
258
258
QList<CDockWidget*> dockWidgets () const ;
259
259
260
260
/* *
261
- * This function hides the floating bar instantely and delete it later.
261
+ * This function hides the floating widget instantly and delete it later.
262
262
*/
263
- void hideAndDeleteLater ();
263
+ void finishDropOperation ();
264
264
265
265
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
266
266
/* *
You can’t perform that action at this time.
0 commit comments