From bde0f36262987b244d215bc10f68b09e4a380660 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Wed, 28 Sep 2016 15:59:10 +0200 Subject: Fix QQuickToolTipAttached parent The parent must not be a null item. Change-Id: Ide71a69e8cde8114542fa97570e0e5f5d724a884 Task-number: QTBUG-56243 Reviewed-by: Mitch Curtis --- tests/auto/controls/data/tst_tooltip.qml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tests/auto/controls/data/tst_tooltip.qml') diff --git a/tests/auto/controls/data/tst_tooltip.qml b/tests/auto/controls/data/tst_tooltip.qml index 04064fa1..b80a2cae 100644 --- a/tests/auto/controls/data/tst_tooltip.qml +++ b/tests/auto/controls/data/tst_tooltip.qml @@ -185,6 +185,7 @@ TestCase { function test_warning() { ignoreWarning(Qt.resolvedUrl("tst_tooltip.qml") + ":68:5: QML QtObject: ToolTip must be attached to an Item") - object.ToolTip.text = "" + ignoreWarning(":1:30: QML ToolTip: cannot find any window to open popup in.") + object.ToolTip.show("") // don't crash (QTBUG-56243) } } -- cgit v1.2.3 From e95dc3b4853c1736aef0ef2cc5248ec0aa46e3ff Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Fri, 30 Sep 2016 22:47:34 +0200 Subject: Cancel exit transition when the same tooltip is shown again Task-number: QTBUG-54206 Task-number: QTBUG-54532 Change-Id: I7e4d993e3b1e30d7d7956629604f948dd1c85e32 Reviewed-by: J-P Nurmi --- tests/auto/controls/data/tst_tooltip.qml | 48 ++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to 'tests/auto/controls/data/tst_tooltip.qml') diff --git a/tests/auto/controls/data/tst_tooltip.qml b/tests/auto/controls/data/tst_tooltip.qml index b80a2cae..82ad01f1 100644 --- a/tests/auto/controls/data/tst_tooltip.qml +++ b/tests/auto/controls/data/tst_tooltip.qml @@ -188,4 +188,52 @@ TestCase { ignoreWarning(":1:30: QML ToolTip: cannot find any window to open popup in.") object.ToolTip.show("") // don't crash (QTBUG-56243) } + + Component { + id: toolTipWithExitTransition + + ToolTip { + enter: Transition { + NumberAnimation { property: "opacity"; from: 0.0; to: 1.0; duration: 100 } + } + exit: Transition { + NumberAnimation { property: "opacity"; from: 1.0; to: 0.0; duration: 1000 } + } + } + } + + function test_makeVisibleWhileExitTransitionRunning_data() { + return [ + { tag: "imperative", imperative: true }, + { tag: "declarative", imperative: false } + ] + } + + function test_makeVisibleWhileExitTransitionRunning(data) { + var control = toolTipWithExitTransition.createObject(testCase) + + // Show, hide, and show the tooltip again. Its exit transition should + // start and get cancelled, and then its enter transition should run. + if (data.imperative) + control.open() + else + control.visible = true + tryCompare(control, "opacity", 1) + + if (data.imperative) + control.close() + else + control.visible = false + verify(control.exit.running) + wait(100) // TODO: replace with tryVerify() in 5.8 + verify(control.opacity < 1) + + if (data.imperative) + control.open() + else + control.visible = true + tryCompare(control, "opacity", 1) + + control.destroy() + } } -- cgit v1.2.3 From bfaa08a335f21e6fdf533969779f806883fe27b0 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Sat, 1 Oct 2016 13:07:31 +0200 Subject: Fix QQuickToolTip's delay and visibility The imperative open() and close() methods used to be the only ways to open and close popups, but the visible-property was later made writable to allow declarative visibility bindings. Since then, it is no longer sufficient for QQuickToolTip to overshadow open() and close() in QML, because setting the visible-property would bypass these overshadowed method. There was a bit of duplicate code between setVisible(), open(), and close(). This change moves the logic to one place by changing open() and close() to call setVisible(). Furthermore, setVisible() has been made virtual to make it possible for QQuickToolTip to apply its delay properly. QQuickToolTip needs to control the delay and timeout timers before the effective visibility is applied on the popup. Task-number: QTBUG-55572 Change-Id: I5a109157f9ec5d0db145e710426665a9a8d7e870 Reviewed-by: J-P Nurmi --- tests/auto/controls/data/tst_tooltip.qml | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'tests/auto/controls/data/tst_tooltip.qml') diff --git a/tests/auto/controls/data/tst_tooltip.qml b/tests/auto/controls/data/tst_tooltip.qml index 82ad01f1..c78a7770 100644 --- a/tests/auto/controls/data/tst_tooltip.qml +++ b/tests/auto/controls/data/tst_tooltip.qml @@ -156,8 +156,10 @@ TestCase { function test_delay_data() { return [ - {tag: "0", delay: 0}, - {tag: "100", delay: 100}, + {tag: "imperative:0", delay: 0, imperative: true}, + {tag: "imperative:100", delay: 100, imperative: true}, + {tag: "declarative:0", delay: 0, imperative: false}, + {tag: "declarative:100", delay: 100, imperative: false} ] } @@ -165,18 +167,31 @@ TestCase { var control = toolTip.createObject(testCase, {delay: data.delay}) compare(control.visible, false) - control.open() + if (data.imperative) + control.open() + else + control.visible = true compare(control.visible, data.delay <= 0) tryCompare(control, "visible", true) control.destroy() } - function test_timeout() { + function test_timeout_data() { + return [ + {tag: "imperative", imperative: true}, + {tag: "declarative", imperative: false} + ] + } + + function test_timeout(data) { var control = toolTip.createObject(testCase, {timeout: 100}) compare(control.visible, false) - control.open() + if (data.imperative) + control.open() + else + control.visible = true compare(control.visible, true) tryCompare(control, "visible", false) -- cgit v1.2.3