From 0e516bc9638d7b5ade38d356a304473af6adbc48 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Tue, 28 Jul 2020 14:45:34 +0200 Subject: ToolTip: only begin timeout when opened The old sequence of events was: 1. setVisible(true) (enter transition begins) 2. startTimeout() 3. opened() (enter transition ends) 4. time out elapses (exit transition begins) 5. closed() (exit transition ends) In most cases, a timeout would be longer than an enter transition, so the only (barely) noticeable issue would be a slightly quicker timeout than what was set. However, if the timeout was shorter than the enter transition, then the sequence would be: 1. setVisible(true) (enter transition begins) 2. startTimeout() 3. time out elapses (exit transition begins) 4. closed() (exit transition ends) This can result in the enter transition being interrupted and the tooltip never being properly visible. Avoid this by only starting the timeout when opened() has been emitted. This also brings the behavior in line with what would be expected when reading the documentation. [ChangeLog][Important Behavior Changes] ToolTip's timeout now begins only after opened() has been emitted. This bug fix results in tooltips with enter transitions being visible for the entire duration of the timeout property. This means that they are visible slightly longer than they were before, so it may be worthwhile to visually check tooltips in your application and adjust timeouts if necessary. Fixes: QTBUG-82257 Change-Id: Iebad64a8cca1f328f9ce85aa78ea0f12918dadf1 Reviewed-by: Volker Hilsheimer Reviewed-by: Richard Moe Gustavsen --- tests/auto/controls/data/tst_tooltip.qml | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'tests/auto') diff --git a/tests/auto/controls/data/tst_tooltip.qml b/tests/auto/controls/data/tst_tooltip.qml index 6ca17263..27ba6264 100644 --- a/tests/auto/controls/data/tst_tooltip.qml +++ b/tests/auto/controls/data/tst_tooltip.qml @@ -445,4 +445,15 @@ TestCase { compare(item.ToolTip.toolTip.contentItem.wrapMode, Text.Wrap) verify(item.ToolTip.toolTip.contentItem.width < item.ToolTip.toolTip.contentItem.implicitWidth) } + + function test_timeoutAfterOpened() { + let control = createTemporaryObject(toolTipWithExitTransition, testCase, { timeout: 1, exit: null }) + verify(control) + + let openedSpy = createTemporaryObject(signalSpy, testCase, { target: control, signalName: "opened" }) + verify(openedSpy.valid) + + control.show("Test") + tryCompare(openedSpy, "count", 1) + } } -- cgit v1.2.3