forked from qt-creator/qt-creator
Debugger: Robustify tooltip widget event filter setup
Amends 5354e7e557
.
Change-Id: I0b02c6df8d09d04055bd17dde0754c2a5135b0a5
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
@@ -980,17 +980,23 @@ void DebuggerToolTipManagerPrivate::debugModeEntered()
|
|||||||
this, &DebuggerToolTipManagerPrivate::updateVisibleToolTips);
|
this, &DebuggerToolTipManagerPrivate::updateVisibleToolTips);
|
||||||
connect(em, &EditorManager::editorOpened,
|
connect(em, &EditorManager::editorOpened,
|
||||||
this, &DebuggerToolTipManagerPrivate::slotEditorOpened);
|
this, &DebuggerToolTipManagerPrivate::slotEditorOpened);
|
||||||
connect(em, &EditorManager::editorAboutToClose, [this](IEditor *editor) {
|
connect(em, &EditorManager::editorAboutToClose, this, [this](IEditor *editor) {
|
||||||
if (auto textEditor = qobject_cast<BaseTextEditor *>(editor))
|
if (auto textEditor = qobject_cast<BaseTextEditor *>(editor))
|
||||||
m_tooltips.erase(textEditor->editorWidget());
|
m_tooltips.erase(textEditor->editorWidget());
|
||||||
});
|
});
|
||||||
connect(em, &EditorManager::currentEditorAboutToChange, [this](IEditor *editor) {
|
connect(em, &EditorManager::currentEditorAboutToChange, this, [this](IEditor *editor) {
|
||||||
if (auto textEditor = qobject_cast<BaseTextEditor *>(editor))
|
if (auto textEditor = qobject_cast<BaseTextEditor *>(editor)) {
|
||||||
textEditor->widget()->window()->removeEventFilter(this);
|
QWidget *widget = textEditor->widget();
|
||||||
|
QTC_ASSERT(widget, return);
|
||||||
|
widget->removeEventFilter(this);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
connect(em, &EditorManager::currentEditorChanged, [this](IEditor *editor) {
|
connect(em, &EditorManager::currentEditorChanged, this, [this](IEditor *editor) {
|
||||||
if (auto textEditor = qobject_cast<BaseTextEditor *>(editor))
|
if (auto textEditor = qobject_cast<BaseTextEditor *>(editor)) {
|
||||||
textEditor->widget()->window()->installEventFilter(this);
|
QWidget *widget = textEditor->widget();
|
||||||
|
QTC_ASSERT(widget, return);
|
||||||
|
widget->window()->installEventFilter(this);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
setupEditors();
|
setupEditors();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user