mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2025-01-13 00:30:25 +08:00
Added setAutoHide() and toggleAutoHide() function to CDockWidget
This commit is contained in:
parent
7c1d04f7be
commit
9c14c62637
@ -1304,11 +1304,10 @@ void CDockAreaWidget::setAutoHide(bool Enable)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto area = calculateSideTabBarArea();
|
|
||||||
|
|
||||||
if (CDockManager::testAutoHideConfigFlag(CDockManager::AutoHideButtonTogglesArea)
|
if (CDockManager::testAutoHideConfigFlag(CDockManager::AutoHideButtonTogglesArea)
|
||||||
&& features().testFlag(CDockWidget::DockWidgetPinnable))
|
&& features().testFlag(CDockWidget::DockWidgetPinnable))
|
||||||
{
|
{
|
||||||
|
auto area = calculateSideTabBarArea();
|
||||||
for (const auto DockWidget : openedDockWidgets())
|
for (const auto DockWidget : openedDockWidgets())
|
||||||
{
|
{
|
||||||
if (Enable == isAutoHide())
|
if (Enable == isAutoHide())
|
||||||
@ -1321,12 +1320,7 @@ void CDockAreaWidget::setAutoHide(bool Enable)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const auto DockWidget = currentDockWidget();
|
currentDockWidget()->setAutoHide(true);
|
||||||
if (Enable == isAutoHide())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
dockContainer()->createAndSetupAutoHideContainer(area, DockWidget);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1156,6 +1156,45 @@ void CDockWidget::raise()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
void CDockWidget::setAutoHide(bool Enable)
|
||||||
|
{
|
||||||
|
if (!CDockManager::testAutoHideConfigFlag(CDockManager::AutoHideFeatureEnabled))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Do nothing if nothing changes
|
||||||
|
if (Enable == isAutoHide())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto DockArea = dockAreaWidget();
|
||||||
|
if (!Enable)
|
||||||
|
{
|
||||||
|
DockArea->setAutoHide(false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
auto area = DockArea->calculateSideTabBarArea();
|
||||||
|
dockContainer()->createAndSetupAutoHideContainer(area, this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
void CDockWidget::toggleAutoHide()
|
||||||
|
{
|
||||||
|
if (!CDockManager::testAutoHideConfigFlag(CDockManager::AutoHideFeatureEnabled))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
setAutoHide(!isAutoHide());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace ads
|
} // namespace ads
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -592,6 +592,18 @@ public Q_SLOTS:
|
|||||||
*/
|
*/
|
||||||
void showNormal();
|
void showNormal();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the dock widget into auto hide mode if this feature is enabled
|
||||||
|
* via CDockManager::setAutoHideFlags(CDockManager::AutoHideFeatureEnabled)
|
||||||
|
*/
|
||||||
|
void setAutoHide(bool Enable);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Switches the dock widget to auto hide mode or vice versa depending on its
|
||||||
|
* current state.
|
||||||
|
*/
|
||||||
|
void toggleAutoHide();
|
||||||
|
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user