From 5354e7e557364a0c4b47652fe1e295469ae19c33 Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 24 Oct 2024 10:52:32 +0200 Subject: [PATCH] Debugger: Compactify new DebuggerToolTipManager code a bit Change-Id: I126a6159c5d82af03838da5fcb7dcf2d919d894f Reviewed-by: Eike Ziller --- .../debugger/debuggertooltipmanager.cpp | 49 +++++-------------- 1 file changed, 12 insertions(+), 37 deletions(-) diff --git a/src/plugins/debugger/debuggertooltipmanager.cpp b/src/plugins/debugger/debuggertooltipmanager.cpp index 5587c566390..162994008aa 100644 --- a/src/plugins/debugger/debuggertooltipmanager.cpp +++ b/src/plugins/debugger/debuggertooltipmanager.cpp @@ -72,9 +72,6 @@ public: void slotTooltipOverrideRequested(TextEditor::TextEditorWidget *editorWidget, const QPoint &point, int pos, bool *handled); void slotEditorOpened(Core::IEditor *e); - void slotEditorAboutToClose(Core::IEditor *e); - void slotCurrentEditorAboutToChange(Core::IEditor *e); - void slotCurrentEditorChanged(Core::IEditor *e); void hideAllToolTips(); void purgeClosedToolTips(); @@ -973,24 +970,6 @@ void DebuggerToolTipManagerPrivate::slotEditorOpened(IEditor *e) } } -void DebuggerToolTipManagerPrivate::slotEditorAboutToClose(IEditor *e) -{ - if (auto textEditor = qobject_cast(e)) - m_tooltips.erase(textEditor->editorWidget()); -} - -void DebuggerToolTipManagerPrivate::slotCurrentEditorAboutToChange(Core::IEditor *e) -{ - if (auto textEditor = qobject_cast(e)) - textEditor->widget()->window()->removeEventFilter(this); -} - -void DebuggerToolTipManagerPrivate::slotCurrentEditorChanged(Core::IEditor *e) -{ - if (auto textEditor = qobject_cast(e)) - textEditor->widget()->window()->installEventFilter(this); -} - void DebuggerToolTipManagerPrivate::debugModeEntered() { // Hook up all signals in debug mode. @@ -1001,22 +980,18 @@ void DebuggerToolTipManagerPrivate::debugModeEntered() this, &DebuggerToolTipManagerPrivate::updateVisibleToolTips); connect(em, &EditorManager::editorOpened, this, &DebuggerToolTipManagerPrivate::slotEditorOpened); - connect( - em, - &EditorManager::editorAboutToClose, - this, - &DebuggerToolTipManagerPrivate::slotEditorAboutToClose); - connect( - em, - &EditorManager::currentEditorAboutToChange, - this, - &DebuggerToolTipManagerPrivate::slotCurrentEditorAboutToChange); - connect( - em, - &EditorManager::currentEditorChanged, - this, - &DebuggerToolTipManagerPrivate::slotCurrentEditorChanged); - + connect(em, &EditorManager::editorAboutToClose, [this](IEditor *editor) { + if (auto textEditor = qobject_cast(editor)) + m_tooltips.erase(textEditor->editorWidget()); + }); + connect(em, &EditorManager::currentEditorAboutToChange, [this](IEditor *editor) { + if (auto textEditor = qobject_cast(editor)) + textEditor->widget()->window()->removeEventFilter(this); + }); + connect(em, &EditorManager::currentEditorChanged, [this](IEditor *editor) { + if (auto textEditor = qobject_cast(editor)) + textEditor->widget()->window()->installEventFilter(this); + }); setupEditors(); } }