From 55aef74a8ebd65d2178bd3a2536ca44dcaecd46e Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Wed, 11 May 2016 12:33:43 +0200 Subject: QQuickPopup: emit xChanged() and yChanged() when _local_ coords change Emitting xChanged() and yChanged() when the (scene) geometry of the internal popup item changes is not sufficient, because QQuickPopup operates in the parent item's coordinate space. When a popup is pushed inside the window margins, the local coordinates change, but the global coordinates don't. Change-Id: I296f1ecd1d1e882c2ff730a2bf68641bd57cbb4f Reviewed-by: Mitch Curtis --- tests/auto/controls/data/tst_popup.qml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'tests') diff --git a/tests/auto/controls/data/tst_popup.qml b/tests/auto/controls/data/tst_popup.qml index 156bc652..a681b2f9 100644 --- a/tests/auto/controls/data/tst_popup.qml +++ b/tests/auto/controls/data/tst_popup.qml @@ -334,6 +334,24 @@ TestCase { compare(xSpy.count, 1) compare(ySpy.count, 1) + // re-parent and reset the position + control.parent = rect.createObject(testCase, {color: "red", width: 100, height: 100}) + control.x = 0 + control.y = 0 + compare(xSpy.count, 2) + compare(ySpy.count, 2) + + // moving parent outside margins triggers change notifiers + control.parent.x = -50 + compare(control.x, 50 + control.leftMargin) + compare(xSpy.count, 3) + compare(ySpy.count, 2) + + control.parent.y = -60 + compare(control.y, 60 + control.topMargin) + compare(xSpy.count, 3) + compare(ySpy.count, 3) + control.destroy() } -- cgit v1.2.3