Don't hide QToolTip automatically when another window is closed

QTipLabel has a global application event filter, looking for reasons
to close the tooltip. To fix QTBUG-55523 an additional condition was
added in 7c18cb4f83 to also close the
tooltip when intercepting QEvent::Close, but this was unnecessary,
as the fix in 29205c53e4 was sufficient.

Furthermore, hiding the tooltip on close events turned out to cause
issues when the closing widget/window was the tooltip itself, causing
recursion. This was fixed by 24239aef35.
(which unintentionally also changed behavior for WindowActivate,
WindowDeactivate, FocusIn, and FocusOut due to the case fallthrough).

As it turns out, there is another case that will close the tooltip
prematurely, and that's when the Qt::UI_AnimateTooltip effect is
enabled, which is the case on e.g. Windows. In that situation a
QRollEffect widget is created for the duration of the effect,
which is then closed after the effect finishes. When closing
the effect via QWidget close, we'll end up with a close event,
triggering QTipLabel to hide itself.

Since the logic of hiding the tooltip when other windows close
was never needed to fix the original issue in QTBUG-55523, we
opt to remove it completely, instead of adding even more
heuristics to the code.

Task-number: QTBUG-55523
Change-Id: I8d341262c85fd2e8cf9c496974e46ae0e9245e5c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
bb10
Tor Arne Vestbø 2021-09-10 16:02:15 +02:00
parent e346b9524c
commit 1093562d08
1 changed files with 0 additions and 7 deletions

View File

@ -342,13 +342,6 @@ bool QTipLabel::eventFilter(QObject *o, QEvent *e)
case QEvent::FocusIn:
case QEvent::FocusOut:
#endif
case QEvent::Close:
// For QTBUG-55523 (QQC) specifically: Hide tooltip when windows are closed,
// unless the close event is for the this tooltip, in which case we don't
// recursively hide/close again.
if (o != windowHandle() && o != this)
hideTipImmediately();
break;
case QEvent::MouseButtonPress:
case QEvent::MouseButtonRelease:
case QEvent::MouseButtonDblClick: