Removed AutoHideInsertOrder enum - new side tabs are always appended.

This commit is contained in:
Uwe Kindler 2022-11-01 20:42:52 +01:00
parent 0d78303713
commit fda5887d50
11 changed files with 18 additions and 67 deletions

View File

@ -647,7 +647,7 @@ CMainWindow::CMainWindow(QWidget *parent) :
// uncomment the following line if you want a central widget in the main dock container (the dock manager) without a titlebar // uncomment the following line if you want a central widget in the main dock container (the dock manager) without a titlebar
// If you enable this code, you can test it in the demo with the Calendar 0 // If you enable this code, you can test it in the demo with the Calendar 0
// dock widget. // dock widget.
// CDockManager::setConfigFlag(CDockManager::HideSingleCentralWidgetTitleBar, true); //CDockManager::setConfigFlag(CDockManager::HideSingleCentralWidgetTitleBar, true);
// uncomment the following line to enable focus highlighting of the dock // uncomment the following line to enable focus highlighting of the dock
// widget that has the focus // widget that has the focus

View File

@ -46,7 +46,7 @@ CMainWindow::CMainWindow(QWidget *parent)
TableDockWidget->setWidget(table); TableDockWidget->setWidget(table);
TableDockWidget->setMinimumSizeHintMode(CDockWidget::MinimumSizeHintFromDockWidget); TableDockWidget->setMinimumSizeHintMode(CDockWidget::MinimumSizeHintFromDockWidget);
TableDockWidget->setMinimumSize(200,150); TableDockWidget->setMinimumSize(200,150);
const auto autoHideContainer = DockManager->addAutoHideDockWidget(SideBarLocation::Left, TableDockWidget, CDockWidget::Last); const auto autoHideContainer = DockManager->addAutoHideDockWidget(SideBarLocation::Left, TableDockWidget);
autoHideContainer->setSize(480); autoHideContainer->setSize(480);
ui->menuView->addAction(TableDockWidget->toggleViewAction()); ui->menuView->addAction(TableDockWidget->toggleViewAction());
@ -58,7 +58,7 @@ CMainWindow::CMainWindow(QWidget *parent)
TableDockWidget->setMinimumSizeHintMode(CDockWidget::MinimumSizeHintFromDockWidget); TableDockWidget->setMinimumSizeHintMode(CDockWidget::MinimumSizeHintFromDockWidget);
TableDockWidget->resize(250, 150); TableDockWidget->resize(250, 150);
TableDockWidget->setMinimumSize(200,150); TableDockWidget->setMinimumSize(200,150);
DockManager->addAutoHideDockWidget(SideBarLocation::Left, TableDockWidget, CDockWidget::Last); DockManager->addAutoHideDockWidget(SideBarLocation::Left, TableDockWidget);
ui->menuView->addAction(TableDockWidget->toggleViewAction()); ui->menuView->addAction(TableDockWidget->toggleViewAction());
QTableWidget* propertiesTable = new QTableWidget(); QTableWidget* propertiesTable = new QTableWidget();

View File

@ -493,7 +493,7 @@ void CDockAreaTitleBar::onCurrentTabChanged(int Index)
//============================================================================ //============================================================================
void CDockAreaTitleBar::onAutoHideButtonClicked() void CDockAreaTitleBar::onAutoHideButtonClicked()
{ {
d->DockArea->toggleAutoHideArea(!d->DockArea->isAutoHide()); d->DockArea->toggleAutoHide(!d->DockArea->isAutoHide());
} }

View File

@ -1177,7 +1177,7 @@ void CDockAreaWidget::closeArea()
} }
//============================================================================ //============================================================================
void CDockAreaWidget::toggleAutoHideArea(bool Enable) void CDockAreaWidget::toggleAutoHide(bool Enable)
{ {
if (!Enable) if (!Enable)
{ {
@ -1197,7 +1197,7 @@ void CDockAreaWidget::toggleAutoHideArea(bool Enable)
continue; continue;
} }
dockContainer()->createAndSetupAutoHideContainer(area, DockWidget, DockWidget->autoHideInsertOrder()); dockContainer()->createAndSetupAutoHideContainer(area, DockWidget);
} }
} }
else else
@ -1207,7 +1207,7 @@ void CDockAreaWidget::toggleAutoHideArea(bool Enable)
{ {
return; return;
} }
dockContainer()->createAndSetupAutoHideContainer(area, DockWidget, DockWidget->autoHideInsertOrder()); dockContainer()->createAndSetupAutoHideContainer(area, DockWidget);
} }
} }

View File

@ -387,7 +387,7 @@ public Q_SLOTS:
/** /**
* Toggles the Auto hides behaviour of the dock area and all dock widgets in this area * Toggles the Auto hides behaviour of the dock area and all dock widgets in this area
*/ */
void toggleAutoHideArea(bool Enable); void toggleAutoHide(bool Enable);
/** /**
* This function closes all other areas except of this area * This function closes all other areas except of this area

View File

@ -1372,7 +1372,7 @@ CDockAreaWidget* CDockContainerWidget::addDockWidget(DockWidgetArea area, CDockW
//============================================================================ //============================================================================
CAutoHideDockContainer* CDockContainerWidget::createAndSetupAutoHideContainer( CAutoHideDockContainer* CDockContainerWidget::createAndSetupAutoHideContainer(
SideBarLocation area, CDockWidget* DockWidget, CDockWidget::eAutoHideInsertOrder insertOrder) SideBarLocation area, CDockWidget* DockWidget)
{ {
if (!CDockManager::testAutoHideConfigFlag(CDockManager::AutoHideFeatureEnabled)) if (!CDockManager::testAutoHideConfigFlag(CDockManager::AutoHideFeatureEnabled))
{ {
@ -1385,7 +1385,7 @@ CAutoHideDockContainer* CDockContainerWidget::createAndSetupAutoHideContainer(
DockWidget->setDockManager(d->DockManager); // Auto hide Dock Container needs a valid dock manager DockWidget->setDockManager(d->DockManager); // Auto hide Dock Container needs a valid dock manager
} }
return sideTabBar(area)->insertDockWidget(insertOrder == CDockWidget::First ? 0 : -1, DockWidget); return sideTabBar(area)->insertDockWidget(-1, DockWidget);
} }
@ -1714,7 +1714,7 @@ void CDockContainerWidget::dropFloatingWidget(CFloatingDockContainer* FloatingWi
auto autoHideWidgets = FloatingWidget->dockContainer()->autoHideWidgets(); auto autoHideWidgets = FloatingWidget->dockContainer()->autoHideWidgets();
for (const auto autohideWidget : autoHideWidgets) for (const auto autohideWidget : autoHideWidgets)
{ {
createAndSetupAutoHideContainer(autohideWidget->sideBarLocation(), autohideWidget->dockWidget(), autohideWidget->dockWidget()->autoHideInsertOrder()); createAndSetupAutoHideContainer(autohideWidget->sideBarLocation(), autohideWidget->dockWidget());
} }
if (DockArea) if (DockArea)

View File

@ -100,8 +100,7 @@ protected:
* Initializing inserts the tabs into the side tab widget and hides it * Initializing inserts the tabs into the side tab widget and hides it
* Returns nullptr if you try and insert into an area where the configuration is not enabled * Returns nullptr if you try and insert into an area where the configuration is not enabled
*/ */
CAutoHideDockContainer* createAndSetupAutoHideContainer( CAutoHideDockContainer* createAndSetupAutoHideContainer(SideBarLocation area, CDockWidget* DockWidget);
SideBarLocation area, CDockWidget* DockWidget, CDockWidget::eAutoHideInsertOrder insertOrder);
/** /**
* Helper function for creation of the root splitter * Helper function for creation of the root splitter

View File

@ -867,18 +867,17 @@ CDockAreaWidget* CDockManager::addDockWidgetToContainer(DockWidgetArea area,
} }
//============================================================================ //============================================================================
CAutoHideDockContainer* CDockManager::addAutoHideDockWidget(SideBarLocation area, CDockWidget* Dockwidget, CAutoHideDockContainer* CDockManager::addAutoHideDockWidget(SideBarLocation area, CDockWidget* Dockwidget)
CDockWidget::eAutoHideInsertOrder insertOrder)
{ {
return addAutoHideDockWidgetToContainer(area, Dockwidget, this, insertOrder); return addAutoHideDockWidgetToContainer(area, Dockwidget, this);
} }
//============================================================================ //============================================================================
CAutoHideDockContainer* CDockManager::addAutoHideDockWidgetToContainer(SideBarLocation area, CDockWidget* Dockwidget, CAutoHideDockContainer* CDockManager::addAutoHideDockWidgetToContainer(SideBarLocation area, CDockWidget* Dockwidget,
CDockContainerWidget* DockContainerWidget, CDockWidget::eAutoHideInsertOrder insertOrder) CDockContainerWidget* DockContainerWidget)
{ {
d->DockWidgetsMap.insert(Dockwidget->objectName(), Dockwidget); d->DockWidgetsMap.insert(Dockwidget->objectName(), Dockwidget);
auto container = DockContainerWidget->createAndSetupAutoHideContainer(area, Dockwidget, insertOrder); auto container = DockContainerWidget->createAndSetupAutoHideContainer(area, Dockwidget);
container->collapseView(true); container->collapseView(true);
Q_EMIT dockWidgetAdded(Dockwidget); Q_EMIT dockWidgetAdded(Dockwidget);

View File

@ -347,8 +347,7 @@ public:
* An overlay widget is used for auto hide functionality * An overlay widget is used for auto hide functionality
* \return Returns the CAutoHideDockContainer that contains the new DockWidget * \return Returns the CAutoHideDockContainer that contains the new DockWidget
*/ */
CAutoHideDockContainer* addAutoHideDockWidget(SideBarLocation area, CDockWidget* Dockwidget, CAutoHideDockContainer* addAutoHideDockWidget(SideBarLocation area, CDockWidget* Dockwidget);
CDockWidget::eAutoHideInsertOrder insertOrder = CDockWidget::Last);
/** /**
* Adds dock widget overlayed into the given container based on the CDockWidgetSideTab::SideTabBarArea. * Adds dock widget overlayed into the given container based on the CDockWidgetSideTab::SideTabBarArea.
@ -356,7 +355,7 @@ public:
* \return Returns the CAutoHideDockContainer that contains the new DockWidget * \return Returns the CAutoHideDockContainer that contains the new DockWidget
*/ */
CAutoHideDockContainer* addAutoHideDockWidgetToContainer(SideBarLocation area, CAutoHideDockContainer* addAutoHideDockWidgetToContainer(SideBarLocation area,
CDockWidget* Dockwidget, CDockContainerWidget* DockContainerWidget, CDockWidget::eAutoHideInsertOrder = CDockWidget::Last); CDockWidget* Dockwidget, CDockContainerWidget* DockContainerWidget);
/** /**
* This function will add the given Dockwidget to the given dock area as * This function will add the given Dockwidget to the given dock area as

View File

@ -94,7 +94,6 @@ struct DockWidgetPrivate
QList<QAction*> TitleBarActions; QList<QAction*> TitleBarActions;
CDockWidget::eMinimumSizeHintMode MinimumSizeHintMode = CDockWidget::MinimumSizeHintFromDockWidget; CDockWidget::eMinimumSizeHintMode MinimumSizeHintMode = CDockWidget::MinimumSizeHintFromDockWidget;
WidgetFactory* Factory = nullptr; WidgetFactory* Factory = nullptr;
CDockWidget::eAutoHideInsertOrder AutoHideInsertOrder = CDockWidget::Last;
QPointer<CAutoHideTab> SideTabWidget; QPointer<CAutoHideTab> SideTabWidget;
/** /**
@ -1139,18 +1138,6 @@ bool CDockWidget::isCurrentTab() const
} }
//============================================================================
void CDockWidget::setAutoHideInsertOrder(eAutoHideInsertOrder insertOrder)
{
d->AutoHideInsertOrder = insertOrder;
}
CDockWidget::eAutoHideInsertOrder CDockWidget::autoHideInsertOrder() const
{
return d->AutoHideInsertOrder;
}
//============================================================================ //============================================================================
void CDockWidget::raise() void CDockWidget::raise()
{ {

View File

@ -231,17 +231,6 @@ public:
ActionModeShow //!< ActionModeShow ActionModeShow //!< ActionModeShow
}; };
/**
* This mode configures the order of pinning and unpinning auto hide widgets
* First will add it to the top of the SideTabBar, while Last will append it to the end
*/
enum eAutoHideInsertOrder
{
First,
Last
};
/** /**
* This constructor creates a dock widget with the given title. * This constructor creates a dock widget with the given title.
@ -537,28 +526,6 @@ public:
*/ */
bool isCurrentTab() const; bool isCurrentTab() const;
/*
* Set default dock proportion when auto hiding
* see *DefaultAutoHideDockProportion()
*/
void setDefaultAutoHideDockProportion(float Proportion);
/*
* Set default dock proportion when auto hiding
* 0.25 is a quarter of the size, 0.5 is half the size, 1 is the entire size
*/
float DefaultAutoHideDockProportion() const;
/*
* Set auto hide insertion mode
*/
void setAutoHideInsertOrder(eAutoHideInsertOrder insertOrder);
/*
* Get auto hide insertion mode
*/
eAutoHideInsertOrder autoHideInsertOrder() const;
public: // reimplements QFrame ----------------------------------------------- public: // reimplements QFrame -----------------------------------------------
/** /**
* Emits titleChanged signal if title change event occurs * Emits titleChanged signal if title change event occurs