This commit is contained in:
Uwe Kindler
2025-11-26 08:53:10 +01:00
18 changed files with 187 additions and 101 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

View File

@@ -1,6 +1,7 @@
# User Guide
- [Configuration Flags](#configuration-flags)
- [User Guide](#user-guide)
- [Configuration Flags](#configuration-flags)
- [Setting Configuration Flags](#setting-configuration-flags)
- [`ActiveTabHasCloseButton`](#activetabhasclosebutton)
- [`DockAreaHasCloseButton`](#dockareahasclosebutton)
@@ -30,7 +31,8 @@
- [`DisableTabTextEliding`](#disabletabtexteliding)
- [`ShowTabTextOnlyForActiveTab`](#showtabtextonlyforactivetab)
- [`DoubleClickUndocksWidget`](#doubleclickundockswidget)
- [Auto Hide Dock Widgets](#auto-hide-dock-widgets)
- [`TabsAtBottom`](#tabsatbottom)
- [Auto Hide Dock Widgets](#auto-hide-dock-widgets)
- [Pinning Auto-Hide Widgets to a certain border](#pinning-auto-hide-widgets-to-a-certain-border)
- [Show / Hide Auto-Hide Widgets via Mouse Over](#show--hide-auto-hide-widgets-via-mouse-over)
- [Drag \& Drop to Auto-Hide](#drag--drop-to-auto-hide)
@@ -39,7 +41,7 @@
- [Auto-Hide Drag to Float / Dock](#auto-hide-drag-to-float--dock)
- [Auto-Hide Context Menu](#auto-hide-context-menu)
- [Adding Auto Hide Widgets](#adding-auto-hide-widgets)
- [Auto-Hide Configuration Flags](#auto-hide-configuration-flags)
- [Auto-Hide Configuration Flags](#auto-hide-configuration-flags)
- [Setting Auto-Hide Flags](#setting-auto-hide-flags)
- [`AutoHideFeatureEnabled`](#autohidefeatureenabled)
- [`DockAreaHasAutoHideButton`](#dockareahasautohidebutton)
@@ -52,7 +54,7 @@
- [`AutoHideHasMinimizeButton`](#autohidehasminimizebutton)
- [`AutoHideOpenOnDragHover`](#autohideopenondraghover)
- [`AutoHideCloseOnOutsideMouseClick`](#autohidecloseonoutsidemouseclick)
- [DockWidget Feature Flags](#dockwidget-feature-flags)
- [DockWidget Feature Flags](#dockwidget-feature-flags)
- [`DockWidgetClosable`](#dockwidgetclosable)
- [`DockWidgetMovable`](#dockwidgetmovable)
- [`DockWidgetFloatable`](#dockwidgetfloatable)
@@ -62,18 +64,18 @@
- [`DockWidgetForceCloseWithArea`](#dockwidgetforceclosewitharea)
- [`NoTab`](#notab)
- [`DeleteContentOnClose`](#deletecontentonclose)
- [Central Widget](#central-widget)
- [Empty Dock Area](#empty-dock-area)
- [Custom Close Handling](#custom-close-handling)
- [Globally Lock Docking Features](#globally-lock-docking-features)
- [Dock Widget Size / Minimum Size Handling](#dock-widget-size--minimum-size-handling)
- [Styling](#styling)
- [Central Widget](#central-widget)
- [Empty Dock Area](#empty-dock-area)
- [Custom Close Handling](#custom-close-handling)
- [Globally Lock Docking Features](#globally-lock-docking-features)
- [Dock Widget Size / Minimum Size Handling](#dock-widget-size--minimum-size-handling)
- [Styling](#styling)
- [Disabling the Internal Style Sheet](#disabling-the-internal-style-sheet)
- [Using ADS on Linux](#using-ads-on-linux)
- [Using ADS on Linux](#using-ads-on-linux)
- [Supported Distributions](#supported-distributions)
- [Requirements](#requirements)
- [Manjaro xfce 25.0.1 and Xubuntu 24.04.2 issues](#manjaro-xfce-2501-and-xubuntu-24042-issues)
- [OpenGl + ADS](#opengl--ads)
- [OpenGl + ADS](#opengl--ads)
## Configuration Flags
@@ -510,6 +512,12 @@ for active tabs. Inactive tabs only show their icon:
If the flag is set (default), a double click on a tab undocks the dock widget.
If you would like to disable undocking, just clear this flag.
### `TabsAtBottom`
If the flag is set, tabs will be shown at the bottom instead of in the title bar.
![TabsAtBottom true](cfg_flag_TabsAtBottom.png)
## Auto Hide Dock Widgets
The Advanced Docking System supports "Auto-Hide" functionality for **all**

View File

@@ -27,6 +27,7 @@ CMainWindow::CMainWindow(QWidget *parent)
CDockManager::setConfigFlag(CDockManager::OpaqueSplitterResize, true);
CDockManager::setConfigFlag(CDockManager::XmlCompressionEnabled, false);
CDockManager::setConfigFlag(CDockManager::FocusHighlighting, true);
CDockManager::setConfigFlag(CDockManager::TabsAtBottom, true);
CDockManager::setAutoHideConfigFlags(CDockManager::DefaultAutoHideConfig);
CDockManager::setAutoHideConfigFlag(CDockManager::AutoHideOpenOnDragHover, true);
CDockManager::setConfigParam(CDockManager::AutoHideOpenOnDragHoverDelay_ms, 500);

View File

@@ -93,7 +93,7 @@ public:
/**
* Virtual Destructor
*/
virtual ~CAutoHideTab();
~CAutoHideTab() override;
/**
* Update stylesheet style if a property changes

View File

@@ -94,7 +94,7 @@ target_link_libraries(${library_name} PUBLIC Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::Gui
Qt${QT_VERSION_MAJOR}::Widgets)
if(QT_VERSION_MAJOR STREQUAL "6")
if(UNIX AND NOT APPLE AND QT_VERSION_MAJOR STREQUAL "6")
target_link_libraries(${library_name} PRIVATE Qt6::GuiPrivate) #needed for <qpa/qplatformnativeinterface.h>
endif()

View File

@@ -260,10 +260,10 @@ void DockAreaTitleBarPrivate::createAutoHideTitleLabel()
{
AutoHideTitleLabel = new CElidingLabel("");
AutoHideTitleLabel->setObjectName("autoHideTitleLabel");
// At position 0 is the tab bar - insert behind tab bar
Layout->insertWidget(1, AutoHideTitleLabel);
AutoHideTitleLabel->setVisible(false); // Default hidden
Layout->insertWidget(2 ,new CSpacerWidget(_this));
// When the tabs are at the top, they will be at position 0, insert the label behind them, and hide it.
Layout->addWidget(AutoHideTitleLabel);
AutoHideTitleLabel->setVisible(CDockManager::testConfigFlag(CDockManager::TabsAtBottom));
Layout->addWidget(new CSpacerWidget(_this));
}
@@ -272,7 +272,9 @@ void DockAreaTitleBarPrivate::createTabBar()
{
TabBar = componentsFactory()->createDockAreaTabBar(DockArea);
TabBar->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);
if (!CDockManager::testConfigFlag(CDockManager::TabsAtBottom))
Layout->addWidget(TabBar);
_this->connect(TabBar, SIGNAL(tabClosed(int)), SLOT(markTabsMenuOutdated()));
_this->connect(TabBar, SIGNAL(tabOpened(int)), SLOT(markTabsMenuOutdated()));
_this->connect(TabBar, SIGNAL(tabInserted(int)), SLOT(markTabsMenuOutdated()));
@@ -351,8 +353,8 @@ CDockAreaTitleBar::CDockAreaTitleBar(CDockAreaWidget* parent) :
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
d->createTabBar();
d->createButtons();
d->createAutoHideTitleLabel();
d->createButtons();
setFocusPolicy(Qt::NoFocus);
}
@@ -900,8 +902,11 @@ QString CDockAreaTitleBar::titleBarButtonToolTip(TitleBarButton Button) const
//============================================================================
void CDockAreaTitleBar::showAutoHideControls(bool Show)
{
d->TabBar->setVisible(!Show); // Auto hide toolbar never has tabs
if (Show)
d->TabBar->setVisible(false); // Auto hide toolbar never has tabs
d->MinimizeButton->setVisible(Show);
if (!CDockManager::testConfigFlag(CDockManager::TabsAtBottom))
d->AutoHideTitleLabel->setVisible(Show);
}

View File

@@ -179,14 +179,17 @@ public:
parent->setUpdatesEnabled(false);
}
if (m_CurrentWidget)
{
auto LayoutItem = m_ParentLayout->takeAt(1);
if (LayoutItem)
{
LayoutItem->widget()->setParent(nullptr);
}
delete LayoutItem;
}
m_ParentLayout->addWidget(next);
m_ParentLayout->insertWidget(1, next);
if (prev)
{
prev->hide();
@@ -362,6 +365,14 @@ void DockAreaWidgetPrivate::createTitleBar()
{
TitleBar = componentsFactory()->createDockAreaTitleBar(_this);
Layout->addWidget(TitleBar);
if (CDockManager::testConfigFlag(CDockManager::TabsAtBottom))
{
// Title bar will be index 0, container widgets will be index 1,
// so tabs will always be at the end of the layout.
Layout->addWidget(tabBar());
tabBar()->setVisible(CDockManager::testConfigFlag(CDockManager::AlwaysShowTabs));
}
QObject::connect(tabBar(), &CDockAreaTabBar::tabCloseRequested, _this, &CDockAreaWidget::onTabCloseRequested);
QObject::connect(TitleBar, &CDockAreaTitleBar::tabBarClicked, _this, &CDockAreaWidget::setCurrentIndex);
QObject::connect(tabBar(), &CDockAreaTabBar::tabMoved, _this, &CDockAreaWidget::reorderDockWidget);
@@ -726,6 +737,7 @@ void CDockAreaWidget::setCurrentIndex(int index)
TabBar->setCurrentIndex(index);
d->ContentsLayout->setCurrentIndex(index);
d->ContentsLayout->currentWidget()->show();
d->TitleBar->autoHideTitleLabel()->setText(d->ContentsLayout->currentWidget()->windowTitle());
Q_EMIT currentChanged(index);
}
@@ -879,8 +891,23 @@ void CDockAreaWidget::updateTitleBarVisibility()
{
// Always show title bar if it contains title bar actions
if (CDockWidget* TopLevelWidget = Container->topLevelDockWidget())
{
Hidden |= TopLevelWidget->titleBarActions().empty();
}
else if (CDockManager::testConfigFlag(CDockManager::TabsAtBottom))
{
Hidden = true;
for (CDockWidget* DockWidget : Container->openedDockWidgets())
{
if (!DockWidget->titleBarActions().empty())
{
Hidden = false;
break;
}
}
}
}
if (!Hidden && d->Flags.testFlag(HideSingleWidgetTitleBar))
{
// Always show title bar if it contains title bar actions
@@ -889,6 +916,8 @@ void CDockAreaWidget::updateTitleBarVisibility()
}
}
d->TitleBar->setVisible(!Hidden);
if (CDockManager::testConfigFlag(CDockManager::TabsAtBottom))
d->TitleBar->tabBar()->setVisible(openDockWidgetsCount() > 1);
}
if (isAutoHideFeatureEnabled())

View File

@@ -199,7 +199,7 @@ public:
/**
* Virtual Destructor
*/
virtual ~CDockAreaWidget();
~CDockAreaWidget() override;
/**
* Returns the dock manager object this dock area belongs to

View File

@@ -219,7 +219,7 @@ public:
/**
* Virtual Destructor
*/
virtual ~CDockContainerWidget();
~CDockContainerWidget() override;
/**
* Adds dockwidget into the given area.

View File

@@ -41,6 +41,7 @@
#include <QVariant>
#include <QDebug>
#include <QFile>
#include <QDialog>
#include <QAction>
#include <QXmlStreamWriter>
#include <QSettings>
@@ -530,15 +531,30 @@ CDockManager::CDockManager(QWidget *parent) :
window()->installEventFilter(this);
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
connect(qApp, &QApplication::focusWindowChanged, [this](QWindow* focusWindow)
connect(qApp, &QApplication::focusWindowChanged, this, [this](QWindow* focusWindow)
{
if (!focusWindow)
{
return;
}
// bring the main application window that hosts the dock manager and all floating
// widgets in front of any other application
auto widget = QWidget::find(focusWindow->winId());
if (!widget)
{
return;
}
// If the user clicks the main window or drags a floating widget or works with a
// dialog, then raise the main window, all floating widgets and the focus window
// itself to bring it into foregreound of any other application
bool raise = qobject_cast<QMainWindow*>(widget)
|| qobject_cast<QDialog*>(widget)
|| qobject_cast<ads::CFloatingDockContainer*>(widget);
if (!raise)
{
return;
}
this->raise();
for (auto FloatingWidget : d->FloatingWidgets)
{

View File

@@ -216,6 +216,7 @@ public:
DisableTabTextEliding = 0x4000000, //! Set this flag to disable eliding of tab texts in dock area tabs
ShowTabTextOnlyForActiveTab =0x8000000, //! Set this flag to show label texts in dock area tabs only for active tabs
DoubleClickUndocksWidget = 0x10000000, //!< If the flag is set, a double click on a tab undocks the widget
TabsAtBottom = 0x20000000, //!< If the flag is set, tabs will be shown at the bottom instead of in the title bar.
DefaultDockAreaButtons = DockAreaHasCloseButton

View File

@@ -289,7 +289,7 @@ public:
/**
* Virtual Destructor
*/
virtual ~CDockWidget();
~CDockWidget() override;
/**
* We return a fixed minimum size hint or the size hint of the content

View File

@@ -539,7 +539,7 @@ QMenu* CDockWidgetTab::buildContextMenu(QMenu *Menu)
Menu = new QMenu(this);
}
qDebug() << "CDockWidgetTab::buildContextMenu";
ADS_PRINT("CDockWidgetTab::buildContextMenu");
const bool isFloatable = d->DockWidget->features().testFlag(CDockWidget::DockWidgetFloatable);
const bool isTopLevelArea = d->DockArea->isTopLevelArea();
const bool isFloating = d->DockWidget->isFloating();

View File

@@ -220,7 +220,7 @@ public:
/**
* Virtual Destructor
*/
virtual ~CFloatingDockContainer();
~CFloatingDockContainer() override;
/**
* Access function for the internal dock container

View File

@@ -82,6 +82,10 @@ ads--CDockWidgetTab[activeTab="true"] QLabel {
color: palette(foreground);
}
#autoHideTitleLabel {
padding-left: 4px;
color: palette(foreground);
}
#tabCloseButton {
margin-top: 2px;
@@ -278,7 +282,7 @@ ads--CAutoHideDockContainer ads--CDockAreaWidget[focused="true"] ads--CDockAreaT
}
#autoHideTitleLabel {
ads--CAutoHideDockContainer #autoHideTitleLabel {
padding-left: 4px;
color: palette(light);
}

View File

@@ -39,6 +39,12 @@ ads--CTitleBarButton {
}
#autoHideTitleLabel {
padding-left: 4px;
color: palette(foreground);
}
#tabsMenuButton {
qproperty-icon: url(:/ads/images/tabs-menu-button.svg);
qproperty-iconSize: 16px;
@@ -88,6 +94,12 @@ ads--CDockWidgetTab[activeTab="true"] QLabel {
}
#autoHideTitleLabel {
padding-left: 4px;
color: palette(foreground);
}
#tabCloseButton {
margin-top: 2px;
background: none;
@@ -314,7 +326,7 @@ ads--CAutoHideDockContainer ads--CDockAreaWidget[focused="true"] ads--CDockAreaT
}
#autoHideTitleLabel {
ads--CAutoHideDockContainer #autoHideTitleLabel {
padding-left: 4px;
color: palette(light);
}

View File

@@ -95,6 +95,10 @@ ads--CDockWidgetTab[activeTab="true"] QLabel {
color: palette(foreground);
}
#autoHideTitleLabel {
padding-left: 4px;
color: palette(foreground);
}
#tabCloseButton {
margin-top: 2px;
@@ -316,7 +320,7 @@ ads--CAutoHideDockContainer ads--CDockAreaWidget[focused="true"] ads--CDockAreaT
}
#autoHideTitleLabel {
ads--CAutoHideDockContainer #autoHideTitleLabel {
padding-left: 4px;
color: palette(light);
}

View File

@@ -40,6 +40,12 @@ ads--CTitleBarButton {
}
#autoHideTitleLabel {
padding-left: 4px;
color: palette(foreground);
}
#tabsMenuButton {
qproperty-icon: url(:/ads/images/tabs-menu-button.svg);
qproperty-iconSize: 16px;
@@ -391,7 +397,7 @@ ads--CAutoHideDockContainer ads--CDockAreaWidget[focused="true"] ads--CDockAreaT
}
#autoHideTitleLabel {
ads--CAutoHideDockContainer #autoHideTitleLabel {
padding-left: 4px;
color: palette(light);
}