Fix central dock widget being pinnable

- Add config for dock widget being pinnable
This commit is contained in:
Syarif Fakhri 2022-09-13 16:19:11 +08:00
parent 8ddabc4cc8
commit 19192541f9
4 changed files with 9 additions and 2 deletions

View File

@ -488,7 +488,10 @@ void CDockAreaTitleBar::onCurrentTabChanged(int Index)
//============================================================================
void CDockAreaTitleBar::onAutoHideButtonClicked(bool Checked)
{
if (d->DockArea->features().testFlag(CDockWidget::DockWidgetPinnable))
{
d->DockArea->toggleAutoHideArea(Checked);
}
}

View File

@ -363,6 +363,8 @@ void DockAreaWidgetPrivate::updateTitleBarButtonStates()
_this->features().testFlag(CDockWidget::DockWidgetClosable));
TitleBar->button(TitleBarButtonUndock)->setEnabled(
_this->features().testFlag(CDockWidget::DockWidgetFloatable));
TitleBar->button(TitleBarButtonAutoHide)->setEnabled(
_this->features().testFlag(CDockWidget::DockWidgetPinnable));
TitleBar->updateDockWidgetActionsButtons();
UpdateTitleBarButtons = false;
}

View File

@ -1065,6 +1065,7 @@ CDockAreaWidget* CDockManager::setCentralWidget(CDockWidget* widget)
widget->setFeature(CDockWidget::DockWidgetClosable, false);
widget->setFeature(CDockWidget::DockWidgetMovable, false);
widget->setFeature(CDockWidget::DockWidgetFloatable, false);
widget->setFeature(CDockWidget::DockWidgetPinnable, false);
d->CentralWidget = widget;
CDockAreaWidget* CentralArea = addDockWidget(CenterDockWidgetArea, widget);
CentralArea->setDockAreaFlag(CDockAreaWidget::eDockAreaFlag::HideSingleWidgetTitleBar, true);

View File

@ -159,7 +159,8 @@ public:
DockWidgetForceCloseWithArea = 0x040, ///< dock widget will be closed when the dock area hosting it is closed
NoTab = 0x080, ///< dock widget tab will never be shown if this flag is set
DeleteContentOnClose = 0x100, ///< deletes only the contained widget on close, keeping the dock widget intact and in place. Attempts to rebuild the contents widget on show if there is a widget factory set.
DefaultDockWidgetFeatures = DockWidgetClosable | DockWidgetMovable | DockWidgetFloatable | DockWidgetFocusable,
DockWidgetPinnable = 0x200, ///< dock widget can be pinned and added to an overlay widget
DefaultDockWidgetFeatures = DockWidgetClosable | DockWidgetMovable | DockWidgetFloatable | DockWidgetFocusable | DockWidgetPinnable,
AllDockWidgetFeatures = DefaultDockWidgetFeatures | DockWidgetDeleteOnClose | CustomCloseHandling,
DockWidgetAlwaysCloseAndDelete = DockWidgetForceCloseWithArea | DockWidgetDeleteOnClose,
NoDockWidgetFeatures = 0x000