mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2025-01-13 00:30:25 +08:00
Some small improvements and execute auto hide code only if config is enabled
This commit is contained in:
parent
8e46431b35
commit
28745fa2f8
@ -190,8 +190,6 @@ CAutoHideDockContainer::CAutoHideDockContainer(CDockManager* DockManager, SideBa
|
|||||||
d->DockArea = new CDockAreaWidget(DockManager, parent);
|
d->DockArea = new CDockAreaWidget(DockManager, parent);
|
||||||
d->DockArea->setObjectName("autoHideDockArea");
|
d->DockArea->setObjectName("autoHideDockArea");
|
||||||
d->DockArea->setAutoHideDockContainer(this);
|
d->DockArea->setAutoHideDockContainer(this);
|
||||||
d->DockArea->updateAutoHideButtonCheckState();
|
|
||||||
d->DockArea->updateTitleBarButtonToolTip();
|
|
||||||
|
|
||||||
setObjectName("autoHideDockContainer");
|
setObjectName("autoHideDockContainer");
|
||||||
|
|
||||||
|
@ -455,6 +455,8 @@ bool CDockAreaWidget::isAutoHide() const
|
|||||||
void CDockAreaWidget::setAutoHideDockContainer(CAutoHideDockContainer* AutoHideDockContainer)
|
void CDockAreaWidget::setAutoHideDockContainer(CAutoHideDockContainer* AutoHideDockContainer)
|
||||||
{
|
{
|
||||||
d->AutoHideDockContainer = AutoHideDockContainer;
|
d->AutoHideDockContainer = AutoHideDockContainer;
|
||||||
|
updateAutoHideButtonCheckState();
|
||||||
|
updateTitleBarButtonToolTip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -812,16 +814,24 @@ void CDockAreaWidget::updateTitleBarVisibility()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (d->TitleBar)
|
if (!d->TitleBar)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Hidden = Container->hasTopLevelDockWidget() && (Container->isFloating()
|
||||||
|
|| CDockManager::testConfigFlag(CDockManager::HideSingleCentralWidgetTitleBar));
|
||||||
|
Hidden |= (d->Flags.testFlag(HideSingleWidgetTitleBar) && openDockWidgetsCount() == 1);
|
||||||
|
bool IsAutoHide = isAutoHide();
|
||||||
|
Hidden &= !IsAutoHide; // Titlebar must always be visible when auto hidden so it can be dragged
|
||||||
|
d->TitleBar->setVisible(!Hidden);
|
||||||
|
|
||||||
|
if (CDockManager::testAutoHideConfigFlag(CDockManager::AutoHideFeatureEnabled))
|
||||||
{
|
{
|
||||||
bool Hidden = Container->hasTopLevelDockWidget() && (Container->isFloating()
|
|
||||||
|| CDockManager::testConfigFlag(CDockManager::HideSingleCentralWidgetTitleBar));
|
|
||||||
Hidden |= (d->Flags.testFlag(HideSingleWidgetTitleBar) && openDockWidgetsCount() == 1);
|
|
||||||
d->TitleBar->setVisible(isAutoHide() ? true : !Hidden); // Titlebar must always be visible when auto hidden so it can be dragged
|
|
||||||
auto tabBar = d->TitleBar->tabBar();
|
auto tabBar = d->TitleBar->tabBar();
|
||||||
tabBar->setVisible(isAutoHide() ? false : !Hidden); // Never show tab bar when auto hidden
|
tabBar->setVisible(!IsAutoHide); // Never show tab bar when auto hidden
|
||||||
d->TitleBar->autoHideTitleLabel()->setVisible(isAutoHide()); // Always show when auto hidden, never otherwise
|
d->TitleBar->autoHideTitleLabel()->setVisible(IsAutoHide); // Always show when auto hidden, never otherwise
|
||||||
updateTitleBarButtonVisibility(Container->topLevelDockArea() == this);
|
updateTitleBarButtonVisibility(Container->topLevelDockArea() == this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -849,6 +859,7 @@ void CDockAreaWidget::updateAutoHideButtonCheckState()
|
|||||||
//============================================================================
|
//============================================================================
|
||||||
void CDockAreaWidget::updateTitleBarButtonVisibility(bool IsTopLevel) const
|
void CDockAreaWidget::updateTitleBarButtonVisibility(bool IsTopLevel) const
|
||||||
{
|
{
|
||||||
|
qDebug() << "CDockAreaWidget::updateTitleBarButtonVisibility IsTopLevel " << IsTopLevel;
|
||||||
d->updateTitleBarButtonVisibility(IsTopLevel);
|
d->updateTitleBarButtonVisibility(IsTopLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,6 +79,16 @@ private Q_SLOTS:
|
|||||||
*/
|
*/
|
||||||
void reorderDockWidget(int fromIndex, int toIndex);
|
void reorderDockWidget(int fromIndex, int toIndex);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Update the auto hide button checked state based on if it's contained in an auto hide container or not
|
||||||
|
*/
|
||||||
|
void updateAutoHideButtonCheckState();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Update the title bar button tooltips
|
||||||
|
*/
|
||||||
|
void updateTitleBarButtonToolTip();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
@ -152,21 +162,11 @@ protected:
|
|||||||
*/
|
*/
|
||||||
void markTitleBarMenuOutdated();
|
void markTitleBarMenuOutdated();
|
||||||
|
|
||||||
/*
|
|
||||||
* Update the auto hide button checked state based on if it's contained in an auto hide container or not
|
|
||||||
*/
|
|
||||||
void updateAutoHideButtonCheckState();
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Update the title bar button visibility based on if it's top level or not
|
* Update the title bar button visibility based on if it's top level or not
|
||||||
*/
|
*/
|
||||||
void updateTitleBarButtonVisibility(bool IsTopLevel) const;
|
void updateTitleBarButtonVisibility(bool IsTopLevel) const;
|
||||||
|
|
||||||
/*
|
|
||||||
* Update the title bar button tooltips
|
|
||||||
*/
|
|
||||||
void updateTitleBarButtonToolTip();
|
|
||||||
|
|
||||||
protected Q_SLOTS:
|
protected Q_SLOTS:
|
||||||
void toggleView(bool Open);
|
void toggleView(bool Open);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user