mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-12-24 07:21:32 +08:00
Add CDockManager::removeDockWidget()
This commit is contained in:
parent
27dd7a1b75
commit
641946bff5
@ -414,14 +414,15 @@ void CDockAreaWidget::removeDockWidget(CDockWidget* DockWidget)
|
||||
auto TabWidget = DockWidget->tabWidget();
|
||||
TabWidget->hide();
|
||||
d->tabBar()->removeTab(TabWidget);
|
||||
CDockContainerWidget* DockContainer = dockContainer();
|
||||
if (NextOpenDockWidget)
|
||||
{
|
||||
setCurrentDockWidget(NextOpenDockWidget);
|
||||
}
|
||||
else if (d->ContentsLayout->isEmpty())
|
||||
else if (d->ContentsLayout->isEmpty() && DockContainer->dockAreaCount() > 1)
|
||||
{
|
||||
qDebug() << "Dock Area empty";
|
||||
dockContainer()->removeDockArea(this);
|
||||
DockContainer->removeDockArea(this);
|
||||
this->deleteLater();
|
||||
}
|
||||
else
|
||||
@ -434,14 +435,13 @@ void CDockAreaWidget::removeDockWidget(CDockWidget* DockWidget)
|
||||
|
||||
d->updateCloseButtonState();
|
||||
updateTitleBarVisibility();
|
||||
auto TopLevelDockWidget = dockContainer()->topLevelDockWidget();
|
||||
auto TopLevelDockWidget = DockContainer->topLevelDockWidget();
|
||||
if (TopLevelDockWidget)
|
||||
{
|
||||
TopLevelDockWidget->emitTopLevelChanged(true);
|
||||
}
|
||||
|
||||
#if (ADS_DEBUG_LEVEL > 0)
|
||||
CDockContainerWidget* DockContainer = dockContainer();
|
||||
DockContainer->dumpLayout();
|
||||
#endif
|
||||
}
|
||||
|
@ -998,6 +998,15 @@ CDockAreaWidget* CDockContainerWidget::addDockWidget(DockWidgetArea area, CDockW
|
||||
}
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
void CDockContainerWidget::removeDockWidget(CDockWidget* Dockwidget)
|
||||
{
|
||||
CDockAreaWidget* Area = Dockwidget->dockAreaWidget();
|
||||
if (Area)
|
||||
{
|
||||
Area->removeDockWidget(Dockwidget);
|
||||
}
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
unsigned int CDockContainerWidget::zOrderIndex() const
|
||||
|
@ -166,6 +166,11 @@ public:
|
||||
CDockAreaWidget* addDockWidget(DockWidgetArea area, CDockWidget* Dockwidget,
|
||||
CDockAreaWidget* DockAreaWidget = nullptr);
|
||||
|
||||
/**
|
||||
* Removes dockwidget
|
||||
*/
|
||||
void removeDockWidget(CDockWidget* Dockwidget);
|
||||
|
||||
/**
|
||||
* Returns the current zOrderIndex
|
||||
*/
|
||||
|
@ -586,6 +586,12 @@ CDockWidget* CDockManager::findDockWidget(const QString& ObjectName) const
|
||||
return d->DockWidgetsMap.value(ObjectName, nullptr);
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
void CDockManager::removeDockWidget(CDockWidget* Dockwidget)
|
||||
{
|
||||
d->DockWidgetsMap.remove(Dockwidget->objectName());
|
||||
CDockContainerWidget::removeDockWidget(Dockwidget);
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
QMap<QString, CDockWidget*> CDockManager::dockWidgetsMap() const
|
||||
|
@ -192,6 +192,11 @@ public:
|
||||
*/
|
||||
CDockWidget* findDockWidget(const QString& ObjectName) const;
|
||||
|
||||
/**
|
||||
* Remove the given Dock from the dock manager
|
||||
*/
|
||||
void removeDockWidget(CDockWidget* Dockwidget);
|
||||
|
||||
/**
|
||||
* This function returns a readable reference to the internal dock
|
||||
* widgets map so that it is possible to iterate over all dock widgets
|
||||
|
Loading…
Reference in New Issue
Block a user