mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-11-15 13:15:43 +08:00
Added function to add / remove CAutoHideDockContainer from SideBar
This commit is contained in:
parent
3fded82f26
commit
7b9f9e10e5
@ -241,6 +241,32 @@ CAutoHideDockContainer* CAutoHideSideBar::insertDockWidget(int Index, CDockWidge
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
void CAutoHideSideBar::removeAutoHideWidget(CAutoHideDockContainer* AutoHideWidget)
|
||||
{
|
||||
AutoHideWidget->autoHideTab()->removeFromSideBar();
|
||||
auto DockContainer = AutoHideWidget->dockContainer();
|
||||
if (DockContainer)
|
||||
{
|
||||
DockContainer->removeAutoHideWidget(AutoHideWidget);
|
||||
}
|
||||
AutoHideWidget->setParent(nullptr);
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
void CAutoHideSideBar::addAutoHideWidget(CAutoHideDockContainer* AutoHideWidget)
|
||||
{
|
||||
auto SideBar = AutoHideWidget->autoHideTab()->sideBar();
|
||||
if (SideBar)
|
||||
{
|
||||
SideBar->removeAutoHideWidget(AutoHideWidget);
|
||||
}
|
||||
AutoHideWidget->setParent(d->ContainerWidget);
|
||||
d->ContainerWidget->registerAutoHideWidget(AutoHideWidget);
|
||||
insertTab(-1, AutoHideWidget->autoHideTab());
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
void CAutoHideSideBar::removeTab(CAutoHideTab* SideTab)
|
||||
{
|
||||
|
@ -66,6 +66,7 @@ private:
|
||||
friend struct AutoHideSideBarPrivate;
|
||||
friend class DockWidgetSideTab;
|
||||
friend DockContainerWidgetPrivate;
|
||||
friend CDockContainerWidget;
|
||||
|
||||
protected:
|
||||
virtual bool eventFilter(QObject *watched, QEvent *event) override;
|
||||
@ -106,6 +107,18 @@ public:
|
||||
*/
|
||||
CAutoHideDockContainer* insertDockWidget(int Index, CDockWidget* DockWidget);
|
||||
|
||||
/**
|
||||
* Removes the auto hide widget from this side bar
|
||||
*/
|
||||
void removeAutoHideWidget(CAutoHideDockContainer* AutoHideWidget);
|
||||
|
||||
/**
|
||||
* Adds the given AutoHideWidget to this sidebar.
|
||||
* If the AutoHideWidget is in another sidebar, then it will be removed
|
||||
* from this sidebar.
|
||||
*/
|
||||
void addAutoHideWidget(CAutoHideDockContainer* AutoHideWidget);
|
||||
|
||||
/**
|
||||
* Returns orientation of side tab.
|
||||
*/
|
||||
|
@ -121,6 +121,13 @@ void CAutoHideTab::setSideBar(CAutoHideSideBar* SideTabBar)
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
CAutoHideSideBar* CAutoHideTab::sideBar() const
|
||||
{
|
||||
return d->SideBar;
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
void CAutoHideTab::removeFromSideBar()
|
||||
{
|
||||
|
@ -128,6 +128,12 @@ public:
|
||||
* is set and if the tab has an icon - that means the icon is not null
|
||||
*/
|
||||
bool iconOnly() const;
|
||||
|
||||
/**
|
||||
* Returns the side bar that contains this tab or a nullptr if the tab is
|
||||
* not in a side bar
|
||||
*/
|
||||
CAutoHideSideBar* sideBar() const;
|
||||
}; // class AutoHideTab
|
||||
}
|
||||
// namespace ads
|
||||
|
Loading…
Reference in New Issue
Block a user