Merge branch '1.2'
This commit is contained in:
@@ -23,6 +23,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
|
||||
|
||||
@@ -637,7 +637,16 @@ bool DockRegistry::eventFilter(QObject *watched, QEvent *event)
|
||||
auto p = watched;
|
||||
while (p) {
|
||||
if (auto dw = qobject_cast<DockWidgetBase*>(p))
|
||||
return onDockWidgetPressed(dw, static_cast<QMouseEvent*>(event));
|
||||
return onDockWidgetPressed(dw, static_cast<QMouseEvent *>(event));
|
||||
|
||||
if (auto dropArea = qobject_cast<DropArea *>(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();
|
||||
}
|
||||
|
||||
@@ -263,6 +263,7 @@ private Q_SLOTS:
|
||||
void tst_restoreSideBar();
|
||||
void tst_toggleActionOnSideBar();
|
||||
void tst_deleteOnCloseWhenOnSideBar();
|
||||
void tst_sidebarOverlayGetsHiddenOnClick();
|
||||
|
||||
// And fix these
|
||||
void tst_floatingWindowDeleted();
|
||||
@@ -5215,6 +5216,61 @@ void TestDocks::tst_deleteOnCloseWhenOnSideBar()
|
||||
QVERIFY(dock1);
|
||||
}
|
||||
|
||||
void TestDocks::tst_sidebarOverlayGetsHiddenOnClick()
|
||||
{
|
||||
EnsureTopLevelsDeleted e;
|
||||
KDDockWidgets::Config::self().setFlags(KDDockWidgets::Config::Flag_AutoHideSupport);
|
||||
|
||||
{
|
||||
// Case #1 click on another dockwidget should hide the overlay
|
||||
|
||||
auto m1 = createMainWindow(QSize(1000, 1000), MainWindowOption_None, "MW1");
|
||||
auto dw1 = new DockWidgetType(QStringLiteral("1"));
|
||||
auto dw2 = new DockWidgetType(QStringLiteral("2"));
|
||||
|
||||
m1->addDockWidget(dw1, Location_OnBottom);
|
||||
m1->addDockWidget(dw2, Location_OnBottom);
|
||||
|
||||
m1->moveToSideBar(dw1);
|
||||
m1->overlayOnSideBar(dw1);
|
||||
|
||||
QVERIFY(dw1->isOverlayed());
|
||||
|
||||
Tests::clickOn(dw2->mapToGlobal(dw2->rect().bottomLeft() + QPoint(5, -5)), dw2);
|
||||
QVERIFY(!dw1->isOverlayed());
|
||||
|
||||
auto widget2 = new MyWidget("foo");
|
||||
dw2->setWidget(widget2);
|
||||
m1->overlayOnSideBar(dw1);
|
||||
QVERIFY(dw1->isOverlayed());
|
||||
|
||||
Tests::clickOn(widget2->mapToGlobal(widget2->rect().bottomLeft() + QPoint(5, -5)), widget2);
|
||||
QVERIFY(!dw1->isOverlayed());
|
||||
|
||||
delete dw1;
|
||||
}
|
||||
|
||||
{
|
||||
// Case #1 click on empty main window space, should hide the overlay
|
||||
|
||||
auto m1 = createMainWindow(QSize(1000, 1000), MainWindowOption_None, "MW1");
|
||||
auto dw1 = new DockWidgetType(QStringLiteral("1"));
|
||||
|
||||
m1->addDockWidget(dw1, Location_OnBottom);
|
||||
|
||||
m1->moveToSideBar(dw1);
|
||||
m1->overlayOnSideBar(dw1);
|
||||
|
||||
QVERIFY(dw1->isOverlayed());
|
||||
|
||||
const QPoint localPt(100, 250);
|
||||
Tests::clickOn(m1->mapToGlobal(m1->rect().topLeft() + localPt), m1->childAt(localPt));
|
||||
QVERIFY(!dw1->isOverlayed());
|
||||
|
||||
delete dw1;
|
||||
}
|
||||
}
|
||||
|
||||
void TestDocks::tst_embeddedMainWindow()
|
||||
{
|
||||
EnsureTopLevelsDeleted e;
|
||||
|
||||
Reference in New Issue
Block a user