mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-12-25 07:31:33 +08:00
Merge branch 'FixesPack_Parenting_Memory_leaks_etc' of https://github.com/ymiroshnyk/Qt-Advanced-Docking-System into ymiroshnyk-FixesPack_Parenting_Memory_leaks_etc
This commit is contained in:
commit
bfe6b9bd26
@ -86,18 +86,6 @@ public:
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete widgets without parents in this layout
|
||||
*/
|
||||
~CDockAreaLayout()
|
||||
{
|
||||
for(auto Widget : m_Widgets)
|
||||
{
|
||||
if(!Widget->parent())
|
||||
delete Widget;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of widgets in this layout
|
||||
*/
|
||||
@ -112,7 +100,6 @@ public:
|
||||
*/
|
||||
void insertWidget(int index, QWidget* Widget)
|
||||
{
|
||||
Widget->setParent(nullptr);
|
||||
if (index < 0)
|
||||
{
|
||||
index = m_Widgets.count();
|
||||
@ -143,6 +130,8 @@ public:
|
||||
{
|
||||
LayoutItem->widget()->setParent(nullptr);
|
||||
}
|
||||
delete LayoutItem;
|
||||
|
||||
m_CurrentWidget = nullptr;
|
||||
m_CurrentIndex = -1;
|
||||
}
|
||||
@ -182,11 +171,7 @@ public:
|
||||
parent->setUpdatesEnabled(false);
|
||||
}
|
||||
|
||||
auto LayoutItem = m_ParentLayout->takeAt(1);
|
||||
if (LayoutItem)
|
||||
{
|
||||
LayoutItem->widget()->setParent(nullptr);
|
||||
}
|
||||
delete m_ParentLayout->takeAt(1);
|
||||
|
||||
m_ParentLayout->addWidget(next);
|
||||
if (prev)
|
||||
@ -247,7 +232,7 @@ public:
|
||||
|
||||
|
||||
using DockAreaLayout = CDockAreaLayout;
|
||||
static constexpr DockWidgetAreas DefaultAllowedAreas = AllDockAreas;
|
||||
static const DockWidgetAreas DefaultAllowedAreas = AllDockAreas;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -296,11 +296,11 @@ bool DockManagerPrivate::restoreStateFromXml(const QByteArray &state, int versi
|
||||
{
|
||||
// Delete remaining empty floating widgets
|
||||
int FloatingWidgetIndex = DockContainerCount - 1;
|
||||
int DeleteCount = FloatingWidgets.count() - FloatingWidgetIndex;
|
||||
for (int i = 0; i < DeleteCount; ++i)
|
||||
for (int i = FloatingWidgetIndex; i < FloatingWidgets.count(); ++i)
|
||||
{
|
||||
FloatingWidgets[FloatingWidgetIndex + i]->deleteLater();
|
||||
_this->removeDockContainer(FloatingWidgets[FloatingWidgetIndex + i]->dockContainer());
|
||||
auto* floatingWidget = FloatingWidgets[i];
|
||||
_this->removeDockContainer(floatingWidget->dockContainer());
|
||||
floatingWidget->deleteLater();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -542,6 +542,7 @@ void CDockWidget::setDockArea(CDockAreaWidget* DockArea)
|
||||
{
|
||||
d->DockArea = DockArea;
|
||||
d->ToggleViewAction->setChecked(DockArea != nullptr && !this->isClosed());
|
||||
setParent(DockArea);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user