Fix check state of the auto hide button

when dragging the container into a floating window
This commit is contained in:
Syarif Fakhri 2022-09-06 17:59:56 +08:00
parent fde133c25e
commit 052d3cecb9
4 changed files with 17 additions and 9 deletions

View File

@ -800,6 +800,15 @@ void CDockAreaWidget::markTitleBarMenuOutdated()
}
//============================================================================
void CDockAreaWidget::updateAutoHidebuttonCheckState()
{
auto autoHideButton = titleBarButton(TitleBarButtonAutoHide);
autoHideButton->blockSignals(true);
autoHideButton->setChecked(isOverlayed());
autoHideButton->blockSignals(false);
}
//============================================================================
void CDockAreaWidget::saveState(QXmlStreamWriter& s) const

View File

@ -150,6 +150,11 @@ protected:
*/
void markTitleBarMenuOutdated();
/*
* Update the auto hide button checked state based on if it's overlayed or not
*/
void updateAutoHidebuttonCheckState();
protected Q_SLOTS:
void toggleView(bool Open);

View File

@ -1063,9 +1063,7 @@ bool DockContainerWidgetPrivate::restoreOverlayDockArea(CDockingStateReader& s,
dockContainer->hide();
DockArea = dockContainer->dockAreaWidget();
const auto titleBar = DockArea->titleBar();
QSignalBlocker blocker(titleBar);
titleBar->button(TitleBarButtonAutoHide)->setChecked(true);
DockArea->updateAutoHidebuttonCheckState();
}
while (s.readNextStartElement())
@ -1655,6 +1653,7 @@ void CDockContainerWidget::removeDockArea(CDockAreaWidget* area)
dumpLayout();
d->emitDockAreasRemoved();
area->setOverlayDockContainer(nullptr);
area->updateAutoHidebuttonCheckState();
return;
}
@ -1783,8 +1782,6 @@ void CDockContainerWidget::dropFloatingWidget(CFloatingDockContainer* FloatingWi
auto ContainerDropArea = d->DockManager->containerOverlay()->dropAreaUnderCursor();
bool Dropped = false;
// Handle any overlay widgets
// todo: cleanup - move into own func?
auto overlayWidgets = FloatingWidget->dockContainer()->overlayWidgets();
for (const auto overlayWidget : overlayWidgets)
{

View File

@ -82,10 +82,7 @@ COverlayDockContainer::COverlayDockContainer(CDockManager* DockManager, SideTabB
d->DockArea = new CDockAreaWidget(DockManager, parent);
d->DockArea->setObjectName("OverlayDockArea");
d->DockArea->setOverlayDockContainer(this);
auto autoHideButton = d->DockArea->titleBar()->button(TitleBarButtonAutoHide);
autoHideButton->blockSignals(true);
autoHideButton->setChecked(true);
autoHideButton->blockSignals(false);
d->DockArea->updateAutoHidebuttonCheckState();
QBoxLayout* l = new QBoxLayout(QBoxLayout::LeftToRight);
d->Splitter = new QSplitter(Qt::Orientation::Horizontal);