Removed supefluous onAutoHideToggleRequested() function

This commit is contained in:
Uwe Kindler 2022-10-25 09:52:57 +02:00
commit ebdd950b4e
11 changed files with 137 additions and 169 deletions

View File

@ -30,6 +30,7 @@ set(ads_SRCS
SideTabBar.cpp
DockWidgetSideTab.cpp
AutoHideDockContainer.cpp
PushButton.cpp
ads.qrc
)
set(ads_HEADERS
@ -54,6 +55,7 @@ set(ads_HEADERS
SideTabBar.h
DockWidgetSideTab.h
AutoHideDockContainer.h
PushButton.h
)
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")
if (UNIX AND NOT APPLE)

View File

@ -198,6 +198,8 @@ void DockAreaTitleBarPrivate::createButtons()
internal::setToolTip(AutoHideButton, QObject::tr("Toggle Auto Hide"));
internal::setButtonIcon(AutoHideButton, QStyle::SP_DialogOkButton, ads::AutoHideIcon);
AutoHideButton->setSizePolicy(ButtonSizePolicy);
AutoHideButton->setCheckable(testConfigFlag(CDockManager::AutoHideButtonCheckable));
AutoHideButton->setChecked(false);
Layout->addWidget(AutoHideButton, 0);
_this->connect(AutoHideButton, SIGNAL(clicked()), SLOT(onAutoHideButtonClicked()));

View File

@ -315,11 +315,6 @@ struct DockAreaWidgetPrivate
*/
void updateTitleBarButtonVisibility(bool isTopLevel);
/**
* Convenience function to know if all dock widgets are focusable
*/
bool allDockWidgetsFocusable() const;
/**
* Scans all contained dock widgets for the max. minimum size hint
*/
@ -387,7 +382,7 @@ void DockAreaWidgetPrivate::updateTitleBarButtonVisibility(bool IsTopLevel)
if (IsTopLevel)
{
TitleBar->button(TitleBarButtonClose)->setVisible(!container->isFloating());
TitleBar->button(TitleBarButtonAutoHide)->setVisible(!container->isFloating() && allDockWidgetsFocusable());
TitleBar->button(TitleBarButtonAutoHide)->setVisible(!container->isFloating());
// Undock and tabs should never show when auto hidden
TitleBar->button(TitleBarButtonUndock)->setVisible(!container->isFloating() && !_this->isAutoHide());
TitleBar->button(TitleBarButtonTabsMenu)->setVisible(!_this->isAutoHide());
@ -395,25 +390,12 @@ void DockAreaWidgetPrivate::updateTitleBarButtonVisibility(bool IsTopLevel)
else
{
TitleBar->button(TitleBarButtonClose)->setVisible(true);
TitleBar->button(TitleBarButtonAutoHide)->setVisible(allDockWidgetsFocusable());
TitleBar->button(TitleBarButtonAutoHide)->setVisible(true);
TitleBar->button(TitleBarButtonUndock)->setVisible(!_this->isAutoHide());
TitleBar->button(TitleBarButtonTabsMenu)->setVisible(!_this->isAutoHide());
}
}
bool DockAreaWidgetPrivate::allDockWidgetsFocusable() const
{
for (const auto &dockWidget : _this->dockWidgets())
{
if (!dockWidget->features().testFlag(CDockWidget::DockWidgetFocusable))
{
return false;
}
}
return true;
}
//============================================================================
CDockAreaWidget::CDockAreaWidget(CDockManager* DockManager, CDockContainerWidget* parent) :
@ -1099,6 +1081,12 @@ void CDockAreaWidget::closeArea()
//============================================================================
void CDockAreaWidget::toggleAutoHideArea(bool Enable)
{
if (!Enable)
{
autoHideDockContainer()->moveContentsToParent();
return;
}
const auto area = dockContainer()->calculateSideTabBarArea(this);
if (dockManager()->testConfigFlag(CDockManager::AutoHideButtonTogglesArea))
@ -1110,7 +1098,7 @@ void CDockAreaWidget::toggleAutoHideArea(bool Enable)
continue;
}
onAutoHideToggleRequested(DockWidget, !isAutoHide(), area);
dockContainer()->createAndInitializeAutoHideDockWidgetContainer(area, DockWidget, DockWidget->autoHideInsertOrder());
}
}
else
@ -1120,22 +1108,10 @@ void CDockAreaWidget::toggleAutoHideArea(bool Enable)
{
return;
}
onAutoHideToggleRequested(DockWidget, !isAutoHide(), area);
dockContainer()->createAndInitializeAutoHideDockWidgetContainer(area, DockWidget, DockWidget->autoHideInsertOrder());
}
}
//============================================================================
void CDockAreaWidget::onAutoHideToggleRequested(CDockWidget* DockWidget, bool Enable, CDockWidgetSideTab::SideTabBarArea area)
{
if (Enable)
{
dockContainer()->createAndInitializeAutoHideDockWidgetContainer(area, DockWidget, DockWidget->autoHideInsertOrder());
}
else
{
autoHideDockContainer()->moveContentsToParent();
}
}
//============================================================================
void CDockAreaWidget::closeOtherAreas()

View File

@ -169,11 +169,6 @@ protected:
protected Q_SLOTS:
void toggleView(bool Open);
/**
* Auto hides the dock area and all dock widgets in this area
*/
void onAutoHideToggleRequested(CDockWidget* DockWidget, bool Enable, CDockWidgetSideTab::SideTabBarArea area);
public:
using Super = QFrame;

View File

@ -234,6 +234,7 @@ public:
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
AutoHideButtonCheckable = 0x80, //!< If the flag is set, the auto hide button will be checked and unchecked depending on the auto hide state. Mainly for styling purposes.
DefaultAutoHideConfig = AutoHideFeatureEnabled
| DockAreaHasAutoHideButton

View File

@ -35,15 +35,11 @@
#include "DockAreaWidget.h"
#include "DockManager.h"
#include "ElidingLabel.h"
#include "DockWidget.h"
namespace ads
{
using tTabLabel = CVerticalElidingLabel;
/**
* Private data class of CDockWidgetTab class (pimpl)
*/
@ -141,34 +137,35 @@ void CDockWidgetSideTab::updateOrientationAndSpacing(SideTabBarArea area)
{
setOrientation((area == Bottom || area == Top) ? Qt::Horizontal : Qt::Vertical);
/*if (CDockManager::testConfigFlag(CDockManager::LeftSideBarPrioritizeIconOnly) && area == Left)
if (icon().isNull())
{
d->TitleLabel->hide();
d->TitleLayout->setContentsMargins(0, 0, 0, 0);
d->IconLabel->setContentsMargins(Spacing / 2, Spacing / 2, Spacing / 2, Spacing / 2);
return;
}
if (CDockManager::testConfigFlag(CDockManager::LeftSideBarPrioritizeIconOnly) && area == Left)
{
setText("");
setOrientation(Qt::Horizontal);
return;
}
if (CDockManager::testConfigFlag(CDockManager::RightSideBarPrioritizeIconOnly) && area == Right)
{
d->TitleLabel->hide();
d->TitleLayout->setContentsMargins(0, 0, 0, 0);
d->IconLabel->setContentsMargins(Spacing / 2, Spacing / 2, Spacing, Spacing / 2);
setText("");
setOrientation(Qt::Horizontal);
return;
}
if (CDockManager::testConfigFlag(CDockManager::BottomSideBarPrioritizeIconOnly) && area == Bottom)
{
d->TitleLabel->hide();
d->TitleLayout->setContentsMargins(0, 0, 0, 0);
d->IconLabel->setContentsMargins(Spacing / 2, Spacing / 2, Spacing / 2, Spacing);
setText("");
setOrientation(Qt::Horizontal);
return;
}
if (CDockManager::testConfigFlag(CDockManager::TopSideBarPrioritizeIconOnly) && area == Top)
{
d->TitleLabel->hide();
d->TitleLayout->setContentsMargins(0, 0, 0, 0);
d->IconLabel->setContentsMargins(Spacing / 2, Spacing / 2, Spacing / 2, Spacing / 2);
setText("");
setOrientation(Qt::Horizontal);
return;
}*/
}
}

View File

@ -85,7 +85,6 @@ public:
/**
* Default Constructor
* param[in] DockWidget The dock widget this title bar belongs to
* param[in] Orientation Horizontal or vertical orientation
* param[in] parent The parent widget of this title bar
*/
CDockWidgetSideTab(CDockWidget* DockWidget, QWidget* parent = nullptr);

View File

@ -2,164 +2,166 @@
* Default style sheet on Windows Platforms
*/
ads--CDockContainerWidget {
background: palette(window);
background: palette(window);
}
ads--CDockContainerWidget > QSplitter{
padding: 1 0 1 0;
ads--CDockContainerWidget > QSplitter {
padding: 1 0 1 0;
}
ads--CDockContainerWidget ads--CDockSplitter::handle {
background: palette(dark);
background: palette(dark);
}
ads--CDockAreaWidget {
background: palette(window);
border: 1px solid white;
background: palette(window);
border: 1px solid white;
}
ads--CDockWidgetTab {
background: palette(window);
border-color: palette(light);
border-style: solid;
border-width: 0 1px 0 0;
padding: 0 0px;
background: palette(window);
border-color: palette(light);
border-style: solid;
border-width: 0 1px 0 0;
padding: 0 0px;
}
ads--CDockWidgetTab[activeTab="true"] {
background: qlineargradient(spread : pad, x1 : 0, y1 : 0, x2 : 0, y2 : 0.5, stop : 0
palette(window), stop:1 palette(light));
/*background: palette(highlight);*/
background: qlineargradient(
spread: pad,
x1: 0,
y1: 0,
x2: 0,
y2: 0.5,
stop: 0 palette(window),
stop: 1 palette(light)
);
/*background: palette(highlight);*/
}
ads--CDockWidgetTab QLabel {
color: palette(dark);
color: palette(dark);
}
ads--CDockWidgetTab[activeTab="true"] QLabel {
color: palette(foreground);
color: palette(foreground);
}
ads--CDockWidget {
background: palette(light);
border-color: palette(light);
border-style: solid;
border-width: 1px 0 0 0;
background: palette(light);
border-color: palette(light);
border-style: solid;
border-width: 1px 0 0 0;
}
ads--CTitleBarButton {
padding: 0px 0px;
padding: 0px 0px;
}
QScrollArea#dockWidgetScrollArea {
padding: 0px;
border: none;
padding: 0px;
border: none;
}
#tabCloseButton {
margin-top: 2px;
background: none;
border: none;
padding: 0px -2px;
qproperty-icon: url(:/ads/images/close-button.svg),
url(:/ads/images/close-button-disabled.svg) disabled;
qproperty-iconSize: 16px;
margin-top: 2px;
background: none;
border: none;
padding: 0px -2px;
qproperty-icon: url(:/ads/images/close-button.svg),
url(:/ads/images/close-button-disabled.svg) disabled;
qproperty-iconSize: 16px;
}
#tabCloseButton:hover {
border: 1px solid rgba(0, 0, 0, 32);
background: rgba(0, 0, 0, 16);
border: 1px solid rgba(0, 0, 0, 32);
background: rgba(0, 0, 0, 16);
}
#tabCloseButton:pressed {
background: rgba(0, 0, 0, 32);
background: rgba(0, 0, 0, 32);
}
#tabsMenuButton::menu-indicator {
image: none;
image: none;
}
#tabsMenuButton {
qproperty-icon: url(:/ads/images/tabs-menu-button.svg);
qproperty-iconSize: 16px;
qproperty-icon: url(:/ads/images/tabs-menu-button.svg);
qproperty-iconSize: 16px;
}
#dockAreaCloseButton {
qproperty-icon: url(:/ads/images/close-button.svg),
url(:/ads/images/close-button-disabled.svg) disabled;
qproperty-iconSize: 16px;
qproperty-icon: url(:/ads/images/close-button.svg),
url(:/ads/images/close-button-disabled.svg) disabled;
qproperty-iconSize: 16px;
}
#detachGroupButton {
qproperty-icon: url(:/ads/images/detach-button.svg),
url(:/ads/images/detach-button-disabled.svg) disabled;
qproperty-iconSize: 16px;
qproperty-icon: url(:/ads/images/detach-button.svg),
url(:/ads/images/detach-button-disabled.svg) disabled;
qproperty-iconSize: 16px;
}
/*-----------------------------------------------------------------------------
* Styling of auto hide functionality
*----------------------------------------------------------------------------
*/
ads--CDockWidgetSideTab {
/*background: palette(window);*/
qproperty-iconSize: 16px 16px;/* this is optional in case you would like to change icon size*/
/*background: palette(window);*/
qproperty-iconSize: 16px 16px; /* this is optional in case you would like to change icon size*/
}
ads--CDockWidgetSideTab[sideTabBarArea="0"] {
/*border-right: 1px solid white;*/
border-top: 3px solid grey;
border-right: 1px solid white;
}
ads--CDockWidgetSideTab[sideTabBarArea="1"] {
/*border-bottom: 1px solid white;*/
border-left: 3px solid grey;
border-bottom: 1px solid white;
}
ads--CDockWidgetSideTab[sideTabBarArea="2"] {
border-bottom: 1px solid white;
border-right: 3px solid grey;
border-bottom: 1px solid white;
}
ads--CDockWidgetSideTab[sideTabBarArea="3"] {
border-right: 1px solid white;
border-bottom: 3px solid grey;
border-right: 1px solid white;
}
ads--CDockWidgetSideTab:hover[sideTabBarArea="0"] {
border-top: 3px solid palette(highlight);
}
ads--CDockWidgetSideTab:hover[sideTabBarArea="1"] {
border-left: 3px solid palette(highlight);
}
ads--CDockWidgetSideTab:hover[sideTabBarArea="2"] {
border-right: 3px solid palette(highlight);
}
ads--CDockWidgetSideTab:hover[sideTabBarArea="3"] {
}
ads--CDockWidgetSideTab:hover[sideTabBarArea="0"][activeTab="true"] {
border-bottom: 3px solid palette(highlight);
}
ads--CDockWidgetSideTab[sideTabBarArea="0"][activeTab="true"] {
border-top: 3px solid palette(highlight);
}
ads--CDockWidgetSideTab[sideTabBarArea="1"][activeTab="true"] {
border-left: 3px solid palette(highlight);
}
ads--CDockWidgetSideTab[sideTabBarArea="2"][activeTab="true"] {
border-right: 3px solid palette(highlight);
}
ads--CDockWidgetSideTab[sideTabBarArea="3"][activeTab="true"] {
border-bottom: 3px solid palette(highlight);
}
/*
@ -195,7 +197,7 @@ ads--CAutoHideDockContainer #dockAreaAutoHideButton
}
#autoHideTitleLabel {
padding-left: 4px;
padding-left: 4px;
}
ads--CResizeHandle

View File

@ -43,7 +43,10 @@ ads--CDockWidgetTab[activeTab="true"] QLabel {
color: palette(foreground);
}
/* Side tab styling */
/*-----------------------------------------------------------------------------
* Styling of auto hide functionality
*----------------------------------------------------------------------------
*/
ads--CDockWidgetSideTab {
background: palette(window);
qproperty-iconSize: 16px 16px;/* this is optional in case you would like to change icon size*/
@ -54,17 +57,17 @@ ads--CDockWidgetSideTab[sideTabBarArea="0"] {
border-right: 1px solid white;
}
ads--CDockWidgetSideTab[sideTabBarArea="1"],[sideTabBarArea="2"] {
ads--CDockWidgetSideTab[sideTabBarArea="1"] {
border-left: 3px solid grey;
border-bottom: 1px solid white;
}
ads--CDockWidgetSideTab[sideTabBarArea="3"],[sideTabBarArea="4"] {
ads--CDockWidgetSideTab[sideTabBarArea="2"] {
border-right: 3px solid grey;
border-bottom: 1px solid white;
}
ads--CDockWidgetSideTab[sideTabBarArea="5"] {
ads--CDockWidgetSideTab[sideTabBarArea="3"] {
border-bottom: 3px solid grey;
border-right: 1px solid white;
}
@ -73,38 +76,33 @@ ads--CDockWidgetSideTab:hover[sideTabBarArea="0"] {
border-top: 3px solid palette(highlight);
}
ads--CDockWidgetSideTab:hover[sideTabBarArea="1"],:hover[sideTabBarArea="2"] {
ads--CDockWidgetSideTab:hover[sideTabBarArea="1"] {
border-left: 3px solid palette(highlight);
}
ads--CDockWidgetSideTab:hover[sideTabBarArea="3"],:hover[sideTabBarArea="4"] {
ads--CDockWidgetSideTab:hover[sideTabBarArea="2"] {
border-right: 3px solid palette(highlight);
}
ads--CDockWidgetSideTab:hover[sideTabBarArea="5"] {
ads--CDockWidgetSideTab:hover[sideTabBarArea="3"] {
border-bottom: 3px solid palette(highlight);
}
ads--CDockWidgetSideTab:hover[sideTabBarArea="0"][activeTab="true"] {
border-top: 3px solid palette(highlight);
}
ads--CDockWidgetSideTab[sideTabBarArea="0"][activeTab="true"] {
border-top: 3px solid palette(highlight);
}
ads--CDockWidgetSideTab[sideTabBarArea="1"][activeTab="true"],[sideTabBarArea="2"][activeTab="true"] {
ads--CDockWidgetSideTab[sideTabBarArea="1"][activeTab="true"] {
border-left: 3px solid palette(highlight);
}
ads--CDockWidgetSideTab[sideTabBarArea="3"][activeTab="true"],[sideTabBarArea="4"][focused="true"] {
ads--CDockWidgetSideTab[sideTabBarArea="2"][activeTab="true"] {
border-right: 3px solid palette(highlight);
}
ads--CDockWidgetSideTab[sideTabBarArea="5"][activeTab="true"] {
ads--CDockWidgetSideTab[sideTabBarArea="3"][activeTab="true"] {
border-bottom: 3px solid palette(highlight);
}
/* Side tab styling */
ads--CDockWidget {
background: palette(light);

View File

@ -36,7 +36,10 @@ ads--CDockWidgetTab[activeTab="true"] QLabel {
color: palette(foreground);
}
/* Side tab styling */
/*-----------------------------------------------------------------------------
* Styling of auto hide functionality
*----------------------------------------------------------------------------
*/
ads--CDockWidgetSideTab {
background: palette(window);
qproperty-iconSize: 16px 16px;/* this is optional in case you would like to change icon size*/
@ -47,17 +50,17 @@ ads--CDockWidgetSideTab[sideTabBarArea="0"] {
border-right: 1px solid white;
}
ads--CDockWidgetSideTab[sideTabBarArea="1"],[sideTabBarArea="2"] {
ads--CDockWidgetSideTab[sideTabBarArea="1"] {
border-left: 3px solid grey;
border-bottom: 1px solid white;
}
ads--CDockWidgetSideTab[sideTabBarArea="3"],[sideTabBarArea="4"] {
ads--CDockWidgetSideTab[sideTabBarArea="2"] {
border-right: 3px solid grey;
border-bottom: 1px solid white;
}
ads--CDockWidgetSideTab[sideTabBarArea="5"] {
ads--CDockWidgetSideTab[sideTabBarArea="3"] {
border-bottom: 3px solid grey;
border-right: 1px solid white;
}
@ -66,38 +69,33 @@ ads--CDockWidgetSideTab:hover[sideTabBarArea="0"] {
border-top: 3px solid palette(highlight);
}
ads--CDockWidgetSideTab:hover[sideTabBarArea="1"],:hover[sideTabBarArea="2"] {
ads--CDockWidgetSideTab:hover[sideTabBarArea="1"] {
border-left: 3px solid palette(highlight);
}
ads--CDockWidgetSideTab:hover[sideTabBarArea="3"],:hover[sideTabBarArea="4"] {
ads--CDockWidgetSideTab:hover[sideTabBarArea="2"] {
border-right: 3px solid palette(highlight);
}
ads--CDockWidgetSideTab:hover[sideTabBarArea="5"] {
ads--CDockWidgetSideTab:hover[sideTabBarArea="3"] {
border-bottom: 3px solid palette(highlight);
}
ads--CDockWidgetSideTab:hover[sideTabBarArea="0"][activeTab="true"] {
border-top: 3px solid palette(highlight);
}
ads--CDockWidgetSideTab[sideTabBarArea="0"][activeTab="true"] {
border-top: 3px solid palette(highlight);
}
ads--CDockWidgetSideTab[sideTabBarArea="1"][activeTab="true"],[sideTabBarArea="2"][activeTab="true"] {
ads--CDockWidgetSideTab[sideTabBarArea="1"][activeTab="true"] {
border-left: 3px solid palette(highlight);
}
ads--CDockWidgetSideTab[sideTabBarArea="3"][activeTab="true"],[sideTabBarArea="4"][focused="true"] {
ads--CDockWidgetSideTab[sideTabBarArea="2"][activeTab="true"] {
border-right: 3px solid palette(highlight);
}
ads--CDockWidgetSideTab[sideTabBarArea="5"][activeTab="true"] {
ads--CDockWidgetSideTab[sideTabBarArea="3"][activeTab="true"] {
border-bottom: 3px solid palette(highlight);
}
/* Side tab styling */
ads--CDockWidget {
background: palette(light);

View File

@ -44,7 +44,10 @@ ads--CDockWidgetTab[activeTab="true"] QLabel {
color: palette(foreground);
}
/* Side tab styling */
/*-----------------------------------------------------------------------------
* Styling of auto hide functionality
*----------------------------------------------------------------------------
*/
ads--CDockWidgetSideTab {
background: palette(window);
qproperty-iconSize: 16px 16px;/* this is optional in case you would like to change icon size*/
@ -55,17 +58,17 @@ ads--CDockWidgetSideTab[sideTabBarArea="0"] {
border-right: 1px solid white;
}
ads--CDockWidgetSideTab[sideTabBarArea="1"],[sideTabBarArea="2"] {
ads--CDockWidgetSideTab[sideTabBarArea="1"] {
border-left: 3px solid grey;
border-bottom: 1px solid white;
}
ads--CDockWidgetSideTab[sideTabBarArea="3"],[sideTabBarArea="4"] {
ads--CDockWidgetSideTab[sideTabBarArea="2"] {
border-right: 3px solid grey;
border-bottom: 1px solid white;
}
ads--CDockWidgetSideTab[sideTabBarArea="5"] {
ads--CDockWidgetSideTab[sideTabBarArea="3"] {
border-bottom: 3px solid grey;
border-right: 1px solid white;
}
@ -74,38 +77,33 @@ ads--CDockWidgetSideTab:hover[sideTabBarArea="0"] {
border-top: 3px solid palette(highlight);
}
ads--CDockWidgetSideTab:hover[sideTabBarArea="1"],:hover[sideTabBarArea="2"] {
ads--CDockWidgetSideTab:hover[sideTabBarArea="1"] {
border-left: 3px solid palette(highlight);
}
ads--CDockWidgetSideTab:hover[sideTabBarArea="3"],:hover[sideTabBarArea="4"] {
ads--CDockWidgetSideTab:hover[sideTabBarArea="2"] {
border-right: 3px solid palette(highlight);
}
ads--CDockWidgetSideTab:hover[sideTabBarArea="5"] {
ads--CDockWidgetSideTab:hover[sideTabBarArea="3"] {
border-bottom: 3px solid palette(highlight);
}
ads--CDockWidgetSideTab:hover[sideTabBarArea="0"][activeTab="true"] {
border-top: 3px solid palette(highlight);
}
ads--CDockWidgetSideTab[sideTabBarArea="0"][activeTab="true"] {
border-top: 3px solid palette(highlight);
}
ads--CDockWidgetSideTab[sideTabBarArea="1"][activeTab="true"],[sideTabBarArea="2"][activeTab="true"] {
ads--CDockWidgetSideTab[sideTabBarArea="1"][activeTab="true"] {
border-left: 3px solid palette(highlight);
}
ads--CDockWidgetSideTab[sideTabBarArea="3"][activeTab="true"],[sideTabBarArea="4"][focused="true"] {
ads--CDockWidgetSideTab[sideTabBarArea="2"][activeTab="true"] {
border-right: 3px solid palette(highlight);
}
ads--CDockWidgetSideTab[sideTabBarArea="5"][activeTab="true"] {
ads--CDockWidgetSideTab[sideTabBarArea="3"][activeTab="true"] {
border-bottom: 3px solid palette(highlight);
}
/* Side tab styling */
ads--CDockWidget {
background: palette(light);