mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-12-25 07:31:33 +08:00
Removed individual config flags for each sidebar with the global AutoHideFeatureEnabled flag
This commit is contained in:
parent
866ccb2c4e
commit
63fed89f26
@ -653,7 +653,7 @@ CMainWindow::CMainWindow(QWidget *parent) :
|
||||
//CDockManager::setConfigFlag(CDockManager::FocusHighlighting, true);
|
||||
|
||||
// uncomment if you would like to enable dock widget auto hiding
|
||||
// CDockManager::setConfigFlag(CDockManager::DefaultAutoHideConfig, true);
|
||||
CDockManager::setConfigFlag(CDockManager::DefaultAutoHideConfig, true);
|
||||
|
||||
// uncomment if you would like to enable an equal distribution of the
|
||||
// available size of a splitter to all contained dock widgets
|
||||
|
@ -454,33 +454,6 @@ void CAutoHideDockContainer::toggleCollapseState()
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
bool CAutoHideDockContainer::areaExistsInConfig(CDockWidgetSideTab::SideTabBarArea area)
|
||||
{
|
||||
switch (area)
|
||||
{
|
||||
case CDockWidgetSideTab::Left:
|
||||
{
|
||||
return CDockManager::testConfigFlag(CDockManager::DockContainerHasLeftSideBar);
|
||||
}
|
||||
case CDockWidgetSideTab::Right:
|
||||
{
|
||||
return CDockManager::testConfigFlag(CDockManager::DockContainerHasRightSideBar);
|
||||
}
|
||||
case CDockWidgetSideTab::Bottom:
|
||||
{
|
||||
return CDockManager::testConfigFlag(CDockManager::DockContainerHasBottomSideBar);
|
||||
}
|
||||
case CDockWidgetSideTab::Top:
|
||||
{
|
||||
return CDockManager::testConfigFlag(CDockManager::DockContainerHasTopSideBar);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
bool CAutoHideDockContainer::eventFilter(QObject* watched, QEvent* event)
|
||||
{
|
||||
|
@ -152,11 +152,6 @@ public:
|
||||
* Toggles the current collapse state
|
||||
*/
|
||||
void toggleCollapseState();
|
||||
|
||||
/*
|
||||
* Convenience function fr determining if area exists in config
|
||||
*/
|
||||
static bool areaExistsInConfig(CDockWidgetSideTab::SideTabBarArea area);
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -191,7 +191,7 @@ void DockAreaTitleBarPrivate::createButtons()
|
||||
_this->connect(UndockButton, SIGNAL(clicked()), SLOT(onUndockButtonClicked()));
|
||||
|
||||
// AutoHide Button
|
||||
const auto autoHideEnabled = testConfigFlag(CDockManager::DockContainerHasRightSideBar) || testConfigFlag(CDockManager::DockContainerHasLeftSideBar) || testConfigFlag(CDockManager::DockContainerHasBottomSideBar);
|
||||
const auto autoHideEnabled = testConfigFlag(CDockManager::AutoHideFeatureEnabled);
|
||||
AutoHideButton = new CTitleBarButton(testConfigFlag(CDockManager::DockAreaHasAutoHideButton) && autoHideEnabled);
|
||||
AutoHideButton->setObjectName("dockAreaAutoHideButton");
|
||||
AutoHideButton->setAutoRaise(true);
|
||||
|
@ -1048,7 +1048,7 @@ bool DockContainerWidgetPrivate::restoreAutoHideDockArea(CDockingStateReader& s,
|
||||
ADS_PRINT("Restore NodeDockArea Tabs: " << Tabs << " Current: "
|
||||
<< CurrentDockWidget);
|
||||
|
||||
if (!CAutoHideDockContainer::areaExistsInConfig(area))
|
||||
if (!CDockManager::testConfigFlag(CDockManager::AutoHideFeatureEnabled))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -1452,7 +1452,10 @@ CDockContainerWidget::CDockContainerWidget(CDockManager* DockManager, QWidget *p
|
||||
{
|
||||
d->DockManager->registerDockContainer(this);
|
||||
createRootSplitter();
|
||||
createSideTabBarWidgets();
|
||||
if (CDockManager::testConfigFlag(CDockManager::AutoHideFeatureEnabled))
|
||||
{
|
||||
createSideTabBarWidgets();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1503,7 +1506,7 @@ CAutoHideDockContainer* CDockContainerWidget::createAndInitializeAutoHideDockWid
|
||||
{
|
||||
DockWidget->setDockManager(d->DockManager); // Overlay Dock Container needs a valid dock manager
|
||||
}
|
||||
if (!CAutoHideDockContainer::areaExistsInConfig(area))
|
||||
if (!CDockManager::testConfigFlag(CDockManager::AutoHideFeatureEnabled))
|
||||
{
|
||||
Q_ASSERT_X(false, "CDockContainerWidget::createAndInitializeDockWidgetOverlayContainer",
|
||||
"Requested area does not exist in config");
|
||||
@ -2094,7 +2097,6 @@ void CDockContainerWidget::createRootSplitter()
|
||||
//============================================================================
|
||||
void CDockContainerWidget::createSideTabBarWidgets()
|
||||
{
|
||||
if (CDockManager::testConfigFlag(CDockManager::DockContainerHasLeftSideBar))
|
||||
{
|
||||
auto leftLayout = new QVBoxLayout();
|
||||
d->SideTabBarWidgets[CDockWidgetSideTab::Left] = new CSideTabBar(this, Qt::Vertical);
|
||||
@ -2103,7 +2105,6 @@ void CDockContainerWidget::createSideTabBarWidgets()
|
||||
d->Layout->addLayout(leftLayout, 1, 0);
|
||||
}
|
||||
|
||||
if (CDockManager::testConfigFlag(CDockManager::DockContainerHasRightSideBar))
|
||||
{
|
||||
auto rightLayout = new QVBoxLayout();
|
||||
d->SideTabBarWidgets[CDockWidgetSideTab::Right] = new CSideTabBar(this, Qt::Vertical);
|
||||
@ -2112,13 +2113,11 @@ void CDockContainerWidget::createSideTabBarWidgets()
|
||||
d->Layout->addLayout(rightLayout, 1, 2);
|
||||
}
|
||||
|
||||
if (CDockManager::testConfigFlag(CDockManager::DockContainerHasBottomSideBar))
|
||||
{
|
||||
d->SideTabBarWidgets[CDockWidgetSideTab::Bottom] = new CSideTabBar(this, Qt::Horizontal);
|
||||
d->Layout->addWidget(d->SideTabBarWidgets[CDockWidgetSideTab::Bottom], 2, 1);
|
||||
}
|
||||
|
||||
if (CDockManager::testConfigFlag(CDockManager::DockContainerHasTopSideBar))
|
||||
{
|
||||
d->SideTabBarWidgets[CDockWidgetSideTab::Top] = new CSideTabBar(this, Qt::Horizontal);
|
||||
d->Layout->addWidget(d->SideTabBarWidgets[CDockWidgetSideTab::Top], 0, 1);
|
||||
|
@ -226,23 +226,17 @@ public:
|
||||
|
||||
enum eAutoHideFlag
|
||||
{
|
||||
DockContainerHasLeftSideBar = 0x01, //!< If the flag is set the dock manager will have a left side bar
|
||||
DockContainerHasRightSideBar = 0x02, //!< If the flag is set the dock manager will have a right side bar
|
||||
DockContainerHasBottomSideBar = 0x04, //!< If the flag is set the dock manager will have a bottom side bar
|
||||
DockContainerHasTopSideBar = 0x08, //!< If the flag is set the dock manager will have a top side bar
|
||||
DockAreaHasAutoHideButton = 0x10, //!< If the flag is set each dock area has a auto hide menu button
|
||||
LeftSideBarPrioritizeIconOnly = 0x20, //!< If the flag is set left side bar will prioritize showing icons only over text
|
||||
RightSideBarPrioritizeIconOnly = 0x40, //!< If the flag is set right side bar will prioritize showing icons only over text
|
||||
BottomSideBarPrioritizeIconOnly = 0x80,//!< If the flag is set bottom side bar will prioritize showing icons only over text
|
||||
TopSideBarPrioritizeIconOnly = 0x100, //!< If the flag is set top side bar will prioritize showing icons only over text
|
||||
AutoHideDockAreaHasTitle = 0x200, //!< If the flag is set overlay dock area title bar will show the window title
|
||||
AutoHideButtonTogglesArea = 0x400, //!< If the flag is set, the auto hide button enables auto hiding for all dock widgets in an area, if disabled, only the current dock widget will be toggled
|
||||
AutoHideFeatureEnabled = 0x01,
|
||||
DockAreaHasAutoHideButton = 0x02, //!< If the flag is set each dock area has a auto hide menu button
|
||||
LeftSideBarPrioritizeIconOnly = 0x04, //!< If the flag is set left side bar will prioritize showing icons only over text
|
||||
RightSideBarPrioritizeIconOnly = 0x08, //!< If the flag is set right side bar will prioritize showing icons only over text
|
||||
BottomSideBarPrioritizeIconOnly = 0x10,//!< If the flag is set bottom side bar will prioritize showing icons only over text
|
||||
TopSideBarPrioritizeIconOnly = 0x20, //!< If the flag is set top side bar will prioritize showing icons only over text
|
||||
AutoHideDockAreaHasTitle = 0x40, //!< If the flag is set overlay dock area title bar will show the window title
|
||||
AutoHideButtonTogglesArea = 0x80, //!< If the flag is set, the auto hide button enables auto hiding for all dock widgets in an area, if disabled, only the current dock widget will be toggled
|
||||
|
||||
DefaultAutoHideConfig = DockContainerHasLeftSideBar
|
||||
| DockContainerHasRightSideBar
|
||||
| DockContainerHasBottomSideBar
|
||||
| DockContainerHasTopSideBar
|
||||
| DockAreaHasAutoHideButton
|
||||
DefaultAutoHideConfig = AutoHideFeatureEnabled
|
||||
| DockAreaHasAutoHideButton
|
||||
| AutoHideDockAreaHasTitle, ///< the default configuration for left and right side bars
|
||||
};
|
||||
Q_DECLARE_FLAGS(AutoHideFlags, eAutoHideFlag)
|
||||
|
Loading…
Reference in New Issue
Block a user