Commit d8edeb1e authored by Eike Ziller's avatar Eike Ziller
Browse files

VariableChooser: Fix closing with Escape key



Change-Id: Ibf0f344d50941255a28c19cf6914521c1c7b0cf6
Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
Reviewed-by: default avatarEike Ziller <eike.ziller@theqtcompany.com>
parent 222be8f2
......@@ -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<QKeyEvent *>(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<QKeyEvent *>(event);
return handleEscapePressed(ke, this);
} else if (event->type() == QEvent::Resize) {
......
......@@ -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:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment