Skip to content

Commit 679fa81

Browse files
Added new CDockWidget feature flag focusable
1 parent 281127c commit 679fa81

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

demo/MainWindow.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,9 @@ void MainWindowPrivate::createContent()
381381
//SpecialDockArea->setAllowedAreas({ads::LeftDockWidgetArea, ads::RightDockWidgetArea}); // just for testing
382382
}
383383

384-
DockManager->addDockWidget(ads::LeftDockWidgetArea, createLongTextLabelDockWidget());
384+
DockWidget = createLongTextLabelDockWidget();
385+
DockWidget->setFeature(ads::CDockWidget::DockWidgetFocusable, false);
386+
DockManager->addDockWidget(ads::LeftDockWidgetArea, DockWidget);
385387
auto FileSystemWidget = createFileSystemTreeDockWidget();
386388
FileSystemWidget->setFeature(ads::CDockWidget::DockWidgetFloatable, false);
387389
appendFeaturStringToWindowTitle(FileSystemWidget);
@@ -588,7 +590,7 @@ CMainWindow::CMainWindow(QWidget *parent) :
588590

589591
// uncomment the following line to enable focus highlighting of the dock
590592
// widget that has the focus
591-
// CDockManager::setConfigFlag(CDockManager::FocusHighlighting, true);
593+
CDockManager::setConfigFlag(CDockManager::FocusHighlighting, true);
592594

593595
// uncomment if you would like to enable an equal distribution of the
594596
// available size of a splitter to all contained dock widgets

src/DockFocusController.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,11 @@ DockFocusControllerPrivate::DockFocusControllerPrivate(
103103
//============================================================================
104104
void DockFocusControllerPrivate::updateDockWidgetFocus(CDockWidget* DockWidget)
105105
{
106+
if (!DockWidget->features().testFlag(CDockWidget::DockWidgetFocusable))
107+
{
108+
return;
109+
}
110+
106111
CDockAreaWidget* NewFocusedDockArea = nullptr;
107112
if (FocusedDockWidget)
108113
{

src/DockWidget.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,8 @@ private slots:
152152
DockWidgetFloatable = 0x04,
153153
DockWidgetDeleteOnClose = 0x08, ///< deletes the dock widget when it is closed
154154
CustomCloseHandling = 0x10,
155-
DefaultDockWidgetFeatures = DockWidgetClosable | DockWidgetMovable | DockWidgetFloatable,
155+
DockWidgetFocusable = 0x20,
156+
DefaultDockWidgetFeatures = DockWidgetClosable | DockWidgetMovable | DockWidgetFloatable | DockWidgetFocusable,
156157
AllDockWidgetFeatures = DefaultDockWidgetFeatures | DockWidgetDeleteOnClose | CustomCloseHandling,
157158
NoDockWidgetFeatures = 0x00
158159
};

0 commit comments

Comments
 (0)