diff --git a/demo/MainWindow.cpp b/demo/MainWindow.cpp index 25534bd..398f059 100644 --- a/demo/MainWindow.cpp +++ b/demo/MainWindow.cpp @@ -381,7 +381,9 @@ void MainWindowPrivate::createContent() //SpecialDockArea->setAllowedAreas({ads::LeftDockWidgetArea, ads::RightDockWidgetArea}); // just for testing } - DockManager->addDockWidget(ads::LeftDockWidgetArea, createLongTextLabelDockWidget()); + DockWidget = createLongTextLabelDockWidget(); + DockWidget->setFeature(ads::CDockWidget::DockWidgetFocusable, false); + DockManager->addDockWidget(ads::LeftDockWidgetArea, DockWidget); auto FileSystemWidget = createFileSystemTreeDockWidget(); FileSystemWidget->setFeature(ads::CDockWidget::DockWidgetFloatable, false); appendFeaturStringToWindowTitle(FileSystemWidget); @@ -588,7 +590,7 @@ CMainWindow::CMainWindow(QWidget *parent) : // uncomment the following line to enable focus highlighting of the dock // widget that has the focus - // CDockManager::setConfigFlag(CDockManager::FocusHighlighting, true); + CDockManager::setConfigFlag(CDockManager::FocusHighlighting, true); // uncomment if you would like to enable an equal distribution of the // available size of a splitter to all contained dock widgets diff --git a/src/DockFocusController.cpp b/src/DockFocusController.cpp index 43acc96..cf707e7 100644 --- a/src/DockFocusController.cpp +++ b/src/DockFocusController.cpp @@ -103,6 +103,11 @@ DockFocusControllerPrivate::DockFocusControllerPrivate( //============================================================================ void DockFocusControllerPrivate::updateDockWidgetFocus(CDockWidget* DockWidget) { + if (!DockWidget->features().testFlag(CDockWidget::DockWidgetFocusable)) + { + return; + } + CDockAreaWidget* NewFocusedDockArea = nullptr; if (FocusedDockWidget) { diff --git a/src/DockWidget.h b/src/DockWidget.h index 15f58d3..d55a803 100644 --- a/src/DockWidget.h +++ b/src/DockWidget.h @@ -152,7 +152,8 @@ public: DockWidgetFloatable = 0x04, DockWidgetDeleteOnClose = 0x08, ///< deletes the dock widget when it is closed CustomCloseHandling = 0x10, - DefaultDockWidgetFeatures = DockWidgetClosable | DockWidgetMovable | DockWidgetFloatable, + DockWidgetFocusable = 0x20, + DefaultDockWidgetFeatures = DockWidgetClosable | DockWidgetMovable | DockWidgetFloatable | DockWidgetFocusable, AllDockWidgetFeatures = DefaultDockWidgetFeatures | DockWidgetDeleteOnClose | CustomCloseHandling, NoDockWidgetFeatures = 0x00 };