mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-11-15 13:15:43 +08:00
Renamed toggleAutoHide to setAutoHide and added toggleAutoHide function
This commit is contained in:
parent
fda5887d50
commit
540961b8dd
@ -493,7 +493,7 @@ void CDockAreaTitleBar::onCurrentTabChanged(int Index)
|
||||
//============================================================================
|
||||
void CDockAreaTitleBar::onAutoHideButtonClicked()
|
||||
{
|
||||
d->DockArea->toggleAutoHide(!d->DockArea->isAutoHide());
|
||||
d->DockArea->setAutoHide(!d->DockArea->isAutoHide());
|
||||
}
|
||||
|
||||
|
||||
|
@ -61,6 +61,15 @@ namespace ads
|
||||
static const char* const INDEX_PROPERTY = "index";
|
||||
static const char* const ACTION_PROPERTY = "action";
|
||||
|
||||
/**
|
||||
* Check, if auto hide is enabled
|
||||
*/
|
||||
static bool isAutoHideFeatureEnabled()
|
||||
{
|
||||
return CDockManager::testAutoHideConfigFlag(CDockManager::AutoHideFeatureEnabled);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Internal dock area layout mimics stack layout but only inserts the current
|
||||
* widget into the internal QLayout object.
|
||||
@ -826,7 +835,7 @@ void CDockAreaWidget::updateTitleBarVisibility()
|
||||
Hidden &= !IsAutoHide; // Titlebar must always be visible when auto hidden so it can be dragged
|
||||
d->TitleBar->setVisible(!Hidden);
|
||||
|
||||
if (CDockManager::testAutoHideConfigFlag(CDockManager::AutoHideFeatureEnabled))
|
||||
if (isAutoHideFeatureEnabled())
|
||||
{
|
||||
auto tabBar = d->TitleBar->tabBar();
|
||||
tabBar->setVisible(!IsAutoHide); // Never show tab bar when auto hidden
|
||||
@ -1176,16 +1185,29 @@ void CDockAreaWidget::closeArea()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
void CDockAreaWidget::toggleAutoHide(bool Enable)
|
||||
SideBarLocation CDockAreaWidget::calculateSideTabBarArea() const
|
||||
{
|
||||
return dockContainer()->calculateSideTabBarArea(this);
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
void CDockAreaWidget::setAutoHide(bool Enable)
|
||||
{
|
||||
if (!isAutoHideFeatureEnabled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Enable)
|
||||
{
|
||||
autoHideDockContainer()->moveContentsToParent();
|
||||
return;
|
||||
}
|
||||
|
||||
const auto area = dockContainer()->calculateSideTabBarArea(this);
|
||||
const auto area = calculateSideTabBarArea();
|
||||
|
||||
if (CDockManager::testAutoHideConfigFlag(CDockManager::AutoHideButtonTogglesArea)
|
||||
&& features().testFlag(CDockWidget::DockWidgetPinnable))
|
||||
@ -1212,6 +1234,18 @@ void CDockAreaWidget::toggleAutoHide(bool Enable)
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
void CDockAreaWidget::toggleAutoHide()
|
||||
{
|
||||
if (!isAutoHideFeatureEnabled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
setAutoHide(!isAutoHide());
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
void CDockAreaWidget::closeOtherAreas()
|
||||
{
|
||||
|
@ -89,6 +89,12 @@ private Q_SLOTS:
|
||||
*/
|
||||
void updateTitleBarButtonToolTip();
|
||||
|
||||
/**
|
||||
* Calculate the auto hide side bar location depending on the dock area
|
||||
* widget position in the container
|
||||
*/
|
||||
SideBarLocation calculateSideTabBarArea() const;
|
||||
|
||||
protected:
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
@ -211,7 +217,7 @@ public:
|
||||
CAutoHideDockContainer* autoHideDockContainer() const;
|
||||
|
||||
/**
|
||||
* Returns true if the dock area exists in an auto hide dock container
|
||||
* Returns true if the dock area is in an auto hide container
|
||||
*/
|
||||
bool isAutoHide() const;
|
||||
|
||||
@ -385,9 +391,15 @@ public Q_SLOTS:
|
||||
void closeArea();
|
||||
|
||||
/**
|
||||
* Toggles the Auto hides behaviour of the dock area and all dock widgets in this area
|
||||
* Sets the dock area into auto hide mode or into normal mode
|
||||
*/
|
||||
void toggleAutoHide(bool Enable);
|
||||
void setAutoHide(bool Enable);
|
||||
|
||||
/**
|
||||
* Switches the dock area to auto hide mode or vice versa depending on its
|
||||
* current state.
|
||||
*/
|
||||
void toggleAutoHide();
|
||||
|
||||
/**
|
||||
* This function closes all other areas except of this area
|
||||
|
@ -1411,7 +1411,7 @@ enum eBorderLocation
|
||||
|
||||
|
||||
//============================================================================
|
||||
SideBarLocation CDockContainerWidget::calculateSideTabBarArea(CDockAreaWidget* DockAreaWidget)
|
||||
SideBarLocation CDockContainerWidget::calculateSideTabBarArea(const CDockAreaWidget* DockAreaWidget) const
|
||||
{
|
||||
|
||||
auto ContentRect = this->contentRect();
|
||||
|
@ -220,7 +220,7 @@ public:
|
||||
/**
|
||||
* Get's the auto hide dock side tab bar area based on the dock area widget position
|
||||
*/
|
||||
SideBarLocation calculateSideTabBarArea(CDockAreaWidget* DockAreaWidget);
|
||||
SideBarLocation calculateSideTabBarArea(const CDockAreaWidget* DockAreaWidget) const;
|
||||
|
||||
/**
|
||||
* Removes dockwidget
|
||||
|
Loading…
Reference in New Issue
Block a user