From bcfa338fff94b53fa23c73a2eb1e992f3c32c3b0 Mon Sep 17 00:00:00 2001 From: David Schulz Date: Fri, 3 Jun 2022 11:52:26 +0200 Subject: [PATCH] TextEditor: stop HoverHandlerRunner on focus out Since we might get a result for a hover request after Qt Creator lost focus we need to prevent showing tool tips for a Qt Creator in the background. Change-Id: Iaa0eafdfe9340d2623fc4632dfc685463fd0d53a Reviewed-by: Eike Ziller --- src/plugins/texteditor/texteditor.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp index 0fdb90137c2..e0aefc88b64 100644 --- a/src/plugins/texteditor/texteditor.cpp +++ b/src/plugins/texteditor/texteditor.cpp @@ -388,7 +388,6 @@ public: restart(); } -private: void abortHandlers() { for (BaseHoverHandler *handler : m_handlers) @@ -396,6 +395,7 @@ private: m_currentHandlerIndex = -1; } +private: void restart() { abortHandlers(); @@ -6717,6 +6717,7 @@ void TextEditorWidget::focusInEvent(QFocusEvent *e) void TextEditorWidget::focusOutEvent(QFocusEvent *e) { QPlainTextEdit::focusOutEvent(e); + d->m_hoverHandlerRunner.abortHandlers(); if (viewport()->cursor().shape() == Qt::BlankCursor) viewport()->setCursor(Qt::IBeamCursor); d->m_cursorFlashTimer.stop();