diff options
author | Wang Chuan <ouchuanm@outlook.com> | 2019-12-13 21:50:03 +0800 |
---|---|---|
committer | ouchuan <ouchuanm@outlook.com> | 2020-01-11 22:13:09 +0800 |
commit | f4d5939ad613fda69aa750139ef929fac18b97ae (patch) | |
tree | 6de8482908da3e7d591ef506b927ba2aa3e0f455 /src/quicktemplates2/qquicktooltip.cpp | |
parent | 090eab86b05478572485b3086c087a846fbae7fd (diff) |
QQuickToolTip: prevent closing after invisible tooltip created
Since all items using ToolTip attached property share the same ToolTip
item, a dynamically created invisible Tooltip may unexpectedly close
the current visible ToolTip.
Fix this issue by checking the parent of ToolTip when trying to close
it
Fixes: QTBUG-78202
Change-Id: I0f6558040c6b8bf22240b0c94af912a43d525ed9
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src/quicktemplates2/qquicktooltip.cpp')
-rw-r--r-- | src/quicktemplates2/qquicktooltip.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/quicktemplates2/qquicktooltip.cpp b/src/quicktemplates2/qquicktooltip.cpp index 9ea0160e..9d733c94 100644 --- a/src/quicktemplates2/qquicktooltip.cpp +++ b/src/quicktemplates2/qquicktooltip.cpp @@ -557,8 +557,9 @@ void QQuickToolTipAttached::hide() QQuickToolTip *tip = d->instance(false); if (!tip) return; - - tip->close(); + // check the parent item to prevent unexpectedly closing tooltip by new created invisible tooltip + if (parent() == tip->parentItem()) + tip->close(); } QT_END_NAMESPACE |