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 <eike.ziller@qt.io>
This commit is contained in:
David Schulz
2022-06-03 11:52:26 +02:00
parent 9276523a35
commit bcfa338fff

View File

@@ -388,7 +388,6 @@ public:
restart(); restart();
} }
private:
void abortHandlers() void abortHandlers()
{ {
for (BaseHoverHandler *handler : m_handlers) for (BaseHoverHandler *handler : m_handlers)
@@ -396,6 +395,7 @@ private:
m_currentHandlerIndex = -1; m_currentHandlerIndex = -1;
} }
private:
void restart() void restart()
{ {
abortHandlers(); abortHandlers();
@@ -6717,6 +6717,7 @@ void TextEditorWidget::focusInEvent(QFocusEvent *e)
void TextEditorWidget::focusOutEvent(QFocusEvent *e) void TextEditorWidget::focusOutEvent(QFocusEvent *e)
{ {
QPlainTextEdit::focusOutEvent(e); QPlainTextEdit::focusOutEvent(e);
d->m_hoverHandlerRunner.abortHandlers();
if (viewport()->cursor().shape() == Qt::BlankCursor) if (viewport()->cursor().shape() == Qt::BlankCursor)
viewport()->setCursor(Qt::IBeamCursor); viewport()->setCursor(Qt::IBeamCursor);
d->m_cursorFlashTimer.stop(); d->m_cursorFlashTimer.stop();