From f02fbd7ffad082d1c51ff96049b64be6300a6049 Mon Sep 17 00:00:00 2001 From: baldurk Date: Wed, 27 May 2026 17:15:48 +0100 Subject: [PATCH] Fix cases where function tooltip would stick around too long --- qrenderdoc/Windows/PythonShell.cpp | 16 ++++++++++++---- qrenderdoc/Windows/PythonShell.h | 1 + 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/qrenderdoc/Windows/PythonShell.cpp b/qrenderdoc/Windows/PythonShell.cpp index 62e7d4a28..90dfd295f 100644 --- a/qrenderdoc/Windows/PythonShell.cpp +++ b/qrenderdoc/Windows/PythonShell.cpp @@ -1463,6 +1463,8 @@ PythonShell::PythonShell(ICaptureContext &ctx, QWidget *parent) m_ToolTip = new RDToolTip(this); + m_ToolTip->installEventFilter(this); + m_ToolTip->setFont(Formatter::FixedFont()); m_InteractiveCompleter = new QCompleter(this); @@ -1903,6 +1905,7 @@ ScintillaEdit *PythonShell::makeEditor(rdcstr filename) editor->installEventFilter(this); QObject::connect(editor, &QWidget::destroyed, [this, editor]() { + hideFunccompleteTooltip(); m_Scintillas.removeOne(editor); m_Watcher->removePath(getEditorFilename(editor)); updateEditorCloseButton(); @@ -2120,10 +2123,7 @@ bool PythonShell::eventFilter(QObject *watched, QEvent *event) } else if(m_FuncTip) { - QRect geom = m_ToolTip->geometry(); - QPoint pos = QCursor::pos(); - QPoint pos2 = m_ToolTip->mapFromGlobal(QCursor::pos()); - if(!geom.contains(pos)) + if(!m_ToolTip->geometry().contains(QCursor::pos())) { hideFunccompleteTooltip(); } @@ -2135,6 +2135,11 @@ bool PythonShell::eventFilter(QObject *watched, QEvent *event) } } + if(m_FuncTip && watched == m_FuncTipWidget && event->type() == QEvent::FocusOut) + { + hideFunccompleteTooltip(); + } + return QObject::eventFilter(watched, event); } @@ -2856,6 +2861,7 @@ void PythonShell::interactive_keypress(QKeyEvent *event) if(!m_ToolTip->isVisible()) m_ToolTip->showTipAtPos(p); m_FuncTip = true; + m_FuncTipWidget = ui->lineInput; } else { @@ -3014,6 +3020,7 @@ void PythonShell::doFunccomplete(ScintillaEdit *editor) if(!m_ToolTip->isVisible()) m_ToolTip->showTipAtPos(p); m_FuncTip = true; + m_FuncTipWidget = editor; m_FuncTipLine = line; } else @@ -3026,6 +3033,7 @@ void PythonShell::hideFunccompleteTooltip() { m_ToolTip->hideTip(); m_FuncTip = false; + m_FuncTipWidget = NULL; // start the syntax check timer in case this naturally disappeared m_SyntaxCheckTimer->start(); } diff --git a/qrenderdoc/Windows/PythonShell.h b/qrenderdoc/Windows/PythonShell.h index cf486239e..23d57ed8a 100644 --- a/qrenderdoc/Windows/PythonShell.h +++ b/qrenderdoc/Windows/PythonShell.h @@ -139,6 +139,7 @@ private: RDToolTip *m_ToolTip; bool m_FuncTip = false; + QWidget *m_FuncTipWidget = NULL; intptr_t m_FuncTipLine = 0; bool m_ContextMenuVisible = false; bool m_HelpPrinting = false;