Fixed some auto hide specific bugs

This commit is contained in:
Uwe Kindler 2022-11-02 14:29:23 +01:00
parent d2c08aca70
commit 159579fb48
7 changed files with 23 additions and 6 deletions

View File

@ -265,6 +265,7 @@ void CAutoHideDockContainer::updateSize()
//============================================================================
CAutoHideDockContainer::~CAutoHideDockContainer()
{
qDebug() << "~CAutoHideDockContainer()"
ADS_PRINT("~CAutoHideDockContainer");
// Remove event filter in case there are any queued messages

View File

@ -143,6 +143,7 @@ CAutoHideDockContainer* CAutoHideSideBar::insertDockWidget(int Index, CDockWidge
auto AutoHideContainer = new CAutoHideDockContainer(DockWidget, d->SideTabArea, d->ContainerWidget);
DockWidget->dockManager()->dockFocusController()->clearDockWidgetFocus(DockWidget);
auto Tab = AutoHideContainer->autoHideTab();
DockWidget->setSideTabWidget(Tab);
insertTab(Index, Tab);
return AutoHideContainer;
}

View File

@ -498,13 +498,14 @@ void CDockAreaTitleBar::onAutoHideButtonClicked()
}
else
{
qDebug() << "d->DockArea->currentDockWidget()->toggleAutoHide()";
d->DockArea->currentDockWidget()->toggleAutoHide();
}
}
//============================================================================
void CDockAreaTitleBar::onAutoHideDockAreaClicked()
void CDockAreaTitleBar::onAutoHideDockAreaActionClicked()
{
d->DockArea->toggleAutoHide();
}
@ -675,7 +676,7 @@ void CDockAreaTitleBar::contextMenuEvent(QContextMenuEvent* ev)
Action->setEnabled(d->DockArea->features().testFlag(CDockWidget::DockWidgetFloatable));
if (CDockManager::testAutoHideConfigFlag(CDockManager::AutoHideFeatureEnabled))
{
Action = Menu.addAction(IsAutoHide ? tr("Dock") : tr("Auto Hide Group"), this, SLOT(onAutoHideDockAreaClicked()));
Action = Menu.addAction(IsAutoHide ? tr("Dock") : tr("Auto Hide Group"), this, SLOT(onAutoHideDockAreaActionClicked()));
Action->setEnabled(d->DockArea->features().testFlag(CDockWidget::DockWidgetPinnable));
}
Menu.addSeparator();

View File

@ -62,7 +62,7 @@ private Q_SLOTS:
void onTabsMenuActionTriggered(QAction* Action);
void onCurrentTabChanged(int Index);
void onAutoHideButtonClicked();
void onAutoHideDockAreaClicked();
void onAutoHideDockAreaActionClicked();
protected:
/**

View File

@ -514,6 +514,15 @@ void CDockAreaWidget::insertDockWidget(int index, CDockWidget* DockWidget,
void CDockAreaWidget::removeDockWidget(CDockWidget* DockWidget)
{
ADS_PRINT("CDockAreaWidget::removeDockWidget");
// If this dock area is in a auto hide container, then we can delete
// the auto hide container now
if (isAutoHide())
{
autoHideDockContainer()->cleanupAndDelete();
return;
}
auto CurrentDockWidget = currentDockWidget();
auto NextOpenDockWidget = (DockWidget == CurrentDockWidget) ? nextOpenDockWidget(DockWidget) : nullptr;
@ -528,7 +537,7 @@ void CDockAreaWidget::removeDockWidget(CDockWidget* DockWidget)
{
setCurrentDockWidget(NextOpenDockWidget);
}
else if (d->ContentsLayout->isEmpty() && DockContainer->dockAreaCount() >= 1 && !isAutoHide()) // Don't remove empty dock areas that are auto hidden, they'll be deleted by the auto hide dock
else if (d->ContentsLayout->isEmpty() && DockContainer->dockAreaCount() >= 1) // Don't remove empty dock areas that are auto hidden, they'll be deleted by the auto hide dock
{
ADS_PRINT("Dock Area empty");
DockContainer->removeDockArea(this);
@ -868,7 +877,6 @@ void CDockAreaWidget::updateAutoHideButtonCheckState()
//============================================================================
void CDockAreaWidget::updateTitleBarButtonVisibility(bool IsTopLevel) const
{
qDebug() << "CDockAreaWidget::updateTitleBarButtonVisibility IsTopLevel " << IsTopLevel;
d->updateTitleBarButtonVisibility(IsTopLevel);
}
@ -970,9 +978,15 @@ bool CDockAreaWidget::restoreState(CDockingStateReader& s, CDockAreaWidget*& Cre
}
ADS_PRINT("Dock Widget found - parent " << DockWidget->parent());
if (DockWidget->autoHideDockContainer())
{
DockWidget->autoHideDockContainer()->cleanupAndDelete();
}
// We hide the DockArea here to prevent the short display (the flashing)
// of the dock areas during application startup
DockArea->hide();
qDebug() << "DockArea->addDockWidget " << DockWidget->windowTitle();
DockArea->addDockWidget(DockWidget);
DockWidget->setToggleViewActionChecked(!Closed);
DockWidget->setClosedState(Closed);

View File

@ -1440,6 +1440,7 @@ void CDockContainerWidget::deleteAutoHideWidgets()
d->AutoHideWidgets.clear();
}
//============================================================================
QList<CAutoHideDockContainer*> CDockContainerWidget::autoHideWidgets() const
{

View File

@ -437,7 +437,6 @@ bool DockManagerPrivate::restoreState(const QByteArray& State, int version)
// Hide updates of floating widgets from use
hideFloatingWidgets();
markDockWidgetsDirty();
_this->deleteAutoHideWidgets();
if (!restoreStateFromXml(state, version))
{