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

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

View File

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

View File

@ -1065,6 +1065,7 @@ CDockAreaWidget* CDockManager::setCentralWidget(CDockWidget* widget)
widget->setFeature(CDockWidget::DockWidgetClosable, false); widget->setFeature(CDockWidget::DockWidgetClosable, false);
widget->setFeature(CDockWidget::DockWidgetMovable, false); widget->setFeature(CDockWidget::DockWidgetMovable, false);
widget->setFeature(CDockWidget::DockWidgetFloatable, false); widget->setFeature(CDockWidget::DockWidgetFloatable, false);
widget->setFeature(CDockWidget::DockWidgetPinnable, false);
d->CentralWidget = widget; d->CentralWidget = widget;
CDockAreaWidget* CentralArea = addDockWidget(CenterDockWidgetArea, widget); CDockAreaWidget* CentralArea = addDockWidget(CenterDockWidgetArea, widget);
CentralArea->setDockAreaFlag(CDockAreaWidget::eDockAreaFlag::HideSingleWidgetTitleBar, true); 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 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 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. 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, AllDockWidgetFeatures = DefaultDockWidgetFeatures | DockWidgetDeleteOnClose | CustomCloseHandling,
DockWidgetAlwaysCloseAndDelete = DockWidgetForceCloseWithArea | DockWidgetDeleteOnClose, DockWidgetAlwaysCloseAndDelete = DockWidgetForceCloseWithArea | DockWidgetDeleteOnClose,
NoDockWidgetFeatures = 0x000 NoDockWidgetFeatures = 0x000