path: root/tests
diff options
authorMitch Curtis <mitch.curtis@qt.io>2020-07-28 14:45:34 +0200
committerMitch Curtis <mitch.curtis@qt.io>2020-09-02 09:24:52 +0200
commit0e516bc9638d7b5ade38d356a304473af6adbc48 (patch)
tree3087e3d172e517bb537fcfd0f4df7ce810622eca /tests
parentccc4f40946ccfc68d5580c9abfd9e2fb4565a608 (diff)
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 <volker.hilsheimer@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'tests')
1 files changed, 11 insertions, 0 deletions
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)
+ }