forked from pool/libqt5-qtbase
52 lines
2.0 KiB
Diff
52 lines
2.0 KiB
Diff
|
From a69373ff735e1ae3e14b5a05a08e4aebf9216185 Mon Sep 17 00:00:00 2001
|
||
|
From: Dmitry Kazakov <dimula73@gmail.com>
|
||
|
Date: Thu, 6 Dec 2018 16:16:27 +0300
|
||
|
Subject: [PATCH 1/3] Fix notification of QDockWidget when it gets undocked
|
||
|
|
||
|
Before the patch the notification was emitted only when the docker
|
||
|
was attached to the panel or changed a position on it.
|
||
|
|
||
|
It looks like the old behavior was documented in a unittest,
|
||
|
so this patch might actually be a "behavior change".
|
||
|
|
||
|
Change-Id: Id3ffbd2018a8e68844d174328dd1c4ceb7fa01d3
|
||
|
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
|
||
|
---
|
||
|
src/widgets/widgets/qdockwidget.cpp | 2 ++
|
||
|
tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp | 6 +++++-
|
||
|
2 files changed, 7 insertions(+), 1 deletion(-)
|
||
|
|
||
|
diff --git a/src/widgets/widgets/qdockwidget.cpp b/src/widgets/widgets/qdockwidget.cpp
|
||
|
index 4041c730b8..f98e0e44db 100644
|
||
|
--- a/src/widgets/widgets/qdockwidget.cpp
|
||
|
+++ b/src/widgets/widgets/qdockwidget.cpp
|
||
|
@@ -1182,6 +1182,8 @@ void QDockWidgetPrivate::setWindowState(bool floating, bool unplug, const QRect
|
||
|
QMainWindowLayout *mwlayout = qt_mainwindow_layout_from_dock(q);
|
||
|
if (mwlayout)
|
||
|
emit q->dockLocationChanged(mwlayout->dockWidgetArea(q));
|
||
|
+ } else {
|
||
|
+ emit q->dockLocationChanged(Qt::NoDockWidgetArea);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
diff --git a/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp b/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp
|
||
|
index f8ce6a2c0a..625116654d 100644
|
||
|
--- a/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp
|
||
|
+++ b/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp
|
||
|
@@ -670,7 +670,11 @@ void tst_QDockWidget::dockLocationChanged()
|
||
|
spy.clear();
|
||
|
|
||
|
dw.setFloating(true);
|
||
|
- QTest::qWait(100);
|
||
|
+ QTRY_COMPARE(spy.count(), 1);
|
||
|
+ QCOMPARE(qvariant_cast<Qt::DockWidgetArea>(spy.at(0).at(0)),
|
||
|
+ Qt::NoDockWidgetArea);
|
||
|
+ spy.clear();
|
||
|
+
|
||
|
dw.setFloating(false);
|
||
|
QTRY_COMPARE(spy.count(), 1);
|
||
|
QCOMPARE(qvariant_cast<Qt::DockWidgetArea>(spy.at(0).at(0)),
|
||
|
--
|
||
|
2.21.0
|
||
|
|