diff --git a/examples/autohide/mainwindow.cpp b/examples/autohide/mainwindow.cpp index 96d3997..1913c35 100644 --- a/examples/autohide/mainwindow.cpp +++ b/examples/autohide/mainwindow.cpp @@ -45,7 +45,7 @@ CMainWindow::CMainWindow(QWidget *parent) table->setColumnCount(3); table->setRowCount(10); CDockWidget* TableDockWidget = new CDockWidget("Table 1"); - TableDockWidget->setFeature(CDockWidget::AutoHideDockWidgetClosable, false); + TableDockWidget->setFeature(CDockWidget::DisableCloseButtonWhenAutoHide, true); TableDockWidget->setWidget(table); TableDockWidget->setMinimumSizeHintMode(CDockWidget::MinimumSizeHintFromDockWidget); TableDockWidget->setMinimumSize(200,150); @@ -57,7 +57,7 @@ CMainWindow::CMainWindow(QWidget *parent) table->setColumnCount(5); table->setRowCount(1020); TableDockWidget = new CDockWidget("Table 2"); - TableDockWidget->setFeature(CDockWidget::AutoHideDockWidgetClosable, false); + TableDockWidget->setFeature(CDockWidget::DisableCloseButtonWhenAutoHide, true); TableDockWidget->setWidget(table); TableDockWidget->setMinimumSizeHintMode(CDockWidget::MinimumSizeHintFromDockWidget); TableDockWidget->resize(250, 150); @@ -69,7 +69,7 @@ CMainWindow::CMainWindow(QWidget *parent) propertiesTable->setColumnCount(3); propertiesTable->setRowCount(10); CDockWidget* PropertiesDockWidget = new CDockWidget("Properties"); - PropertiesDockWidget->setFeature(CDockWidget::AutoHideDockWidgetClosable, true); + PropertiesDockWidget->setFeature(CDockWidget::DisableCloseButtonWhenAutoHide, true); PropertiesDockWidget->setWidget(propertiesTable); PropertiesDockWidget->setMinimumSizeHintMode(CDockWidget::MinimumSizeHintFromDockWidget); PropertiesDockWidget->resize(250, 150); diff --git a/src/DockAreaWidget.cpp b/src/DockAreaWidget.cpp index 9200953..d69f953 100644 --- a/src/DockAreaWidget.cpp +++ b/src/DockAreaWidget.cpp @@ -371,8 +371,11 @@ void DockAreaWidgetPrivate::updateTitleBarButtonStates() } TitleBar->button(TitleBarButtonClose)->setEnabled( - (_this->isAutoHide() ? _this->features().testFlag(CDockWidget::AutoHideDockWidgetClosable) : true) - && _this->features().testFlag(CDockWidget::DockWidgetClosable)); + _this->features().testFlag(CDockWidget::DockWidgetClosable) + ? _this->isAutoHide() + ? !_this->features(BitwiseOr).testFlag(CDockWidget::DisableCloseButtonWhenAutoHide) + : true + : false); TitleBar->button(TitleBarButtonUndock)->setEnabled( _this->features().testFlag(CDockWidget::DockWidgetFloatable)); TitleBar->button(TitleBarButtonAutoHide)->setEnabled( diff --git a/src/DockWidget.h b/src/DockWidget.h index 4b82acc..d5b7ccb 100644 --- a/src/DockWidget.h +++ b/src/DockWidget.h @@ -162,8 +162,8 @@ public: 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. DockWidgetPinnable = 0x200, ///< dock widget can be pinned and added to an auto hide dock container - AutoHideDockWidgetClosable = 0x400,///< dock widget in an auto hide dock container is closable - DefaultDockWidgetFeatures = DockWidgetClosable | DockWidgetMovable | DockWidgetFloatable | DockWidgetFocusable | DockWidgetPinnable | AutoHideDockWidgetClosable, + DisableCloseButtonWhenAutoHide = 0x400,///< when set, auto hide dock widget close button will be disabled + DefaultDockWidgetFeatures = DockWidgetClosable | DockWidgetMovable | DockWidgetFloatable | DockWidgetFocusable | DockWidgetPinnable, AllDockWidgetFeatures = DefaultDockWidgetFeatures | DockWidgetDeleteOnClose | CustomCloseHandling, DockWidgetAlwaysCloseAndDelete = DockWidgetForceCloseWithArea | DockWidgetDeleteOnClose, NoDockWidgetFeatures = 0x000