diff --git a/src/DockAreaWidget.cpp b/src/DockAreaWidget.cpp index f0b036a..bf4a714 100644 --- a/src/DockAreaWidget.cpp +++ b/src/DockAreaWidget.cpp @@ -315,6 +315,11 @@ 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 */ @@ -382,7 +387,7 @@ void DockAreaWidgetPrivate::updateTitleBarButtonVisibility(bool IsTopLevel) if (IsTopLevel) { TitleBar->button(TitleBarButtonClose)->setVisible(!container->isFloating()); - TitleBar->button(TitleBarButtonAutoHide)->setVisible(!container->isFloating()); + TitleBar->button(TitleBarButtonAutoHide)->setVisible(!container->isFloating() && allDockWidgetsFocusable()); // Undock and tabs should never show when overlayed TitleBar->button(TitleBarButtonUndock)->setVisible(!container->isFloating() && !_this->isOverlayed()); TitleBar->button(TitleBarButtonTabsMenu)->setVisible(!_this->isOverlayed()); @@ -390,12 +395,25 @@ void DockAreaWidgetPrivate::updateTitleBarButtonVisibility(bool IsTopLevel) else { TitleBar->button(TitleBarButtonClose)->setVisible(true); - TitleBar->button(TitleBarButtonAutoHide)->setVisible(true); + TitleBar->button(TitleBarButtonAutoHide)->setVisible(allDockWidgetsFocusable()); TitleBar->button(TitleBarButtonUndock)->setVisible(!_this->isOverlayed()); TitleBar->button(TitleBarButtonTabsMenu)->setVisible(!_this->isOverlayed()); } } +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) : diff --git a/src/DockContainerWidget.cpp b/src/DockContainerWidget.cpp index 87c13ca..f97c92e 100644 --- a/src/DockContainerWidget.cpp +++ b/src/DockContainerWidget.cpp @@ -1521,11 +1521,7 @@ CDockWidgetSideTab::SideTabBarArea CDockContainerWidget::getDockAreaPosition(CDo // It's bottom if the width is wider than the height, and if it's below 50% of the window const auto dockWidgetFrameGeometry = DockAreaWidget->frameGeometry(); const auto splitterCenter = rootSplitter()->mapToGlobal(rootSplitter()->frameGeometry().center()); - const auto a = dockWidgetFrameGeometry.width(); - const auto b = dockWidgetFrameGeometry.height(); - const auto c = DockAreaWidget->mapToGlobal(dockWidgetFrameGeometry.topLeft()).y(); - const auto d = splitterCenter.y(); - const auto e = CDockManager::testConfigFlag(CDockManager::DockContainerHasBottomSideBar); + if (dockWidgetFrameGeometry.width() > dockWidgetFrameGeometry.height() && DockAreaWidget->mapToGlobal(dockWidgetFrameGeometry.topLeft()).y() > splitterCenter.y() && CDockManager::testConfigFlag(CDockManager::DockContainerHasBottomSideBar)) diff --git a/src/OverlayDockContainer.cpp b/src/OverlayDockContainer.cpp index 26134e5..799cf9f 100644 --- a/src/OverlayDockContainer.cpp +++ b/src/OverlayDockContainer.cpp @@ -204,7 +204,6 @@ void COverlayDockContainer::updateSize() const auto rect = rootSplitter->frameGeometry(); move(rect.topLeft()); resize(rect.width(), rect.height()); - d->DockArea->updateGeometry(); } //============================================================================ @@ -313,6 +312,8 @@ CDockAreaWidget* COverlayDockContainer::dockAreaWidget() const //============================================================================ void COverlayDockContainer::moveContentsToParent() { + cleanupAndDelete(); + const auto position = mapToGlobal(d->getSimplifiedDockAreaPosition()); const auto dockAreaWidget = parentContainer()->dockAreaAt(position); @@ -324,7 +325,8 @@ void COverlayDockContainer::moveContentsToParent() { parentContainer()->addDockWidget(d->getArea(d->Area), d->DockWidget); } - cleanupAndDelete(); + + parentContainer()->removeDockArea(d->DockArea); } @@ -457,14 +459,15 @@ bool COverlayDockContainer::eventFilter(QObject* watched, QEvent* event) updateSize(); updateMask(); } - return QWidget::eventFilter(watched, event); + + return QSplitter::eventFilter(watched, event); } //============================================================================ void COverlayDockContainer::mousePressEvent(QMouseEvent* event) { - QWidget::mousePressEvent(event); + QSplitter::mousePressEvent(event); } @@ -472,7 +475,7 @@ void COverlayDockContainer::mousePressEvent(QMouseEvent* event) void COverlayDockContainer::resizeEvent(QResizeEvent* event) { updateMask(); - QWidget::resizeEvent(event); + QSplitter::resizeEvent(event); } }