QToolTip: don’t close again on Close event

Prevent recursion: hideTipImmediately() calls QWidget::close(),
which will soon start calling QWindow::close(), which
will send another close event.

Fix this by calling hideTipImmediately() only for Close
events not targeted for the tip label.

Task-number: QTBUG-46701
Change-Id: I6fd373ce13aed860b0d4836d5fbf470374ed2543
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
bb10
Morten Johan Sørvig 2020-10-29 15:59:38 +01:00
parent d03415b7eb
commit 24239aef35
1 changed files with 7 additions and 1 deletions

View File

@ -342,7 +342,13 @@ 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
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: