diff --git a/Changelog b/Changelog index 6ea830d7..8cbf8ba3 100644 --- a/Changelog +++ b/Changelog @@ -8,6 +8,7 @@ - DockWidgetBase::eventFilter() is protected instead of private (regression vs v1.1) (#148) It's recommended that you rebuild your application when updating KDDW, as MSVC encodes private/protected in the name mangling. - Fixed WASM build on Windows (#163) + - Fixed sidebar overlay not getting hidden when clicking on the main window docking area (#157) * v1.2.0 (17 December 2020) - Wayland support diff --git a/src/private/DockRegistry.cpp b/src/private/DockRegistry.cpp index ec74835c..93864a85 100644 --- a/src/private/DockRegistry.cpp +++ b/src/private/DockRegistry.cpp @@ -636,7 +636,16 @@ bool DockRegistry::eventFilter(QObject *watched, QEvent *event) auto p = watched; while (p) { if (auto dw = qobject_cast(p)) - return onDockWidgetPressed(dw, static_cast(event)); + return onDockWidgetPressed(dw, static_cast(event)); + + if (auto dropArea = qobject_cast(p)) { + if (auto mw = dropArea->mainWindow()) { + // The user clicked somewhere in the main window's drop area, but outside of the + // overlayed dock widget + mw->clearSideBarOverlay(); + return false; + } + } p = p->parent(); } diff --git a/tests/tst_docks.cpp b/tests/tst_docks.cpp index ff7eef3e..e6012f20 100644 --- a/tests/tst_docks.cpp +++ b/tests/tst_docks.cpp @@ -5263,7 +5263,6 @@ void TestDocks::tst_sidebarOverlayGetsHiddenOnClick() const QPoint localPt(100, 250); Tests::clickOn(m1->mapToGlobal(m1->rect().topLeft() + localPt), m1->childAt(localPt)); - QEXPECT_FAIL("", "will fix", Continue); QVERIFY(!dw1->isOverlayed()); delete dw1;