diff --git a/src/plugins/coreplugin/variablechooser.cpp b/src/plugins/coreplugin/variablechooser.cpp index f09fc95385e..b0d3d1dd174 100644 --- a/src/plugins/coreplugin/variablechooser.cpp +++ b/src/plugins/coreplugin/variablechooser.cpp @@ -545,9 +545,14 @@ static bool handleEscapePressed(QKeyEvent *ke, QWidget *widget) /*! * \internal */ -void VariableChooser::keyPressEvent(QKeyEvent *ev) +bool VariableChooser::event(QEvent *ev) { - handleEscapePressed(ev, this); + if (ev->type() == QEvent::KeyPress || ev->type() == QEvent::ShortcutOverride) { + QKeyEvent *ke = static_cast(ev); + if (handleEscapePressed(ke, this)) + return true; + } + return QWidget::event(ev); } /*! @@ -557,7 +562,7 @@ bool VariableChooser::eventFilter(QObject *obj, QEvent *event) { if (obj != d->currentWidget()) return false; - if (event->type() == QEvent::KeyPress && isVisible()) { + if ((event->type() == QEvent::KeyPress || event->type() == QEvent::ShortcutOverride) && isVisible()) { QKeyEvent *ke = static_cast(event); return handleEscapePressed(ke, this); } else if (event->type() == QEvent::Resize) { diff --git a/src/plugins/coreplugin/variablechooser.h b/src/plugins/coreplugin/variablechooser.h index 74ca3abdec2..bc61b931f0a 100644 --- a/src/plugins/coreplugin/variablechooser.h +++ b/src/plugins/coreplugin/variablechooser.h @@ -58,7 +58,7 @@ public: static void addSupportForChildWidgets(QWidget *parent, Utils::MacroExpander *expander); protected: - void keyPressEvent(QKeyEvent *ev); + bool event(QEvent *ev); bool eventFilter(QObject *, QEvent *event); private: