From 8f470b05125e711cfe063031ff3e75a8c8c6a76a Mon Sep 17 00:00:00 2001
From: Orgad Shaneh <orgad.shaneh@audiocodes.com>
Date: Wed, 21 Aug 2013 23:21:13 +0300
Subject: [PATCH] ProposalWidgets: Accept escape key event

Otherwise it is passed on to other widgets (like the Find toolbar)

Task-number: QTCREATORBUG-5748
Change-Id: I3e7fe19327d2b3d15c9c9f84360b936dc4698dfd
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
---
 .../texteditor/codeassist/functionhintproposalwidget.cpp  | 8 ++++++--
 .../texteditor/codeassist/genericproposalwidget.cpp       | 1 +
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/plugins/texteditor/codeassist/functionhintproposalwidget.cpp b/src/plugins/texteditor/codeassist/functionhintproposalwidget.cpp
index 84bcaa83574..5cd0a136af0 100644
--- a/src/plugins/texteditor/codeassist/functionhintproposalwidget.cpp
+++ b/src/plugins/texteditor/codeassist/functionhintproposalwidget.cpp
@@ -190,12 +190,16 @@ bool FunctionHintProposalWidget::eventFilter(QObject *obj, QEvent *e)
 {
     switch (e->type()) {
     case QEvent::ShortcutOverride:
-        if (static_cast<QKeyEvent*>(e)->key() == Qt::Key_Escape)
+        if (static_cast<QKeyEvent*>(e)->key() == Qt::Key_Escape) {
             d->m_escapePressed = true;
+            e->accept();
+        }
         break;
     case QEvent::KeyPress:
-        if (static_cast<QKeyEvent*>(e)->key() == Qt::Key_Escape)
+        if (static_cast<QKeyEvent*>(e)->key() == Qt::Key_Escape) {
             d->m_escapePressed = true;
+            e->accept();
+        }
         if (d->m_model->size() > 1) {
             QKeyEvent *ke = static_cast<QKeyEvent*>(e);
             if (ke->key() == Qt::Key_Up) {
diff --git a/src/plugins/texteditor/codeassist/genericproposalwidget.cpp b/src/plugins/texteditor/codeassist/genericproposalwidget.cpp
index 6422ffb10c0..024acecb088 100644
--- a/src/plugins/texteditor/codeassist/genericproposalwidget.cpp
+++ b/src/plugins/texteditor/codeassist/genericproposalwidget.cpp
@@ -571,6 +571,7 @@ bool GenericProposalWidget::eventFilter(QObject *o, QEvent *e)
         switch (ke->key()) {
         case Qt::Key_Escape:
             abort();
+            e->accept();
             return true;
 
         case Qt::Key_N:
-- 
GitLab