mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2025-01-13 00:30:25 +08:00
Pulled latest changes from duer autohide branch
This commit is contained in:
parent
53e8010732
commit
8fc333806a
@ -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) :
|
||||
|
@ -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))
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user