diff options
| author | con <qtc-committer@nokia.com> | 2009-04-08 10:26:56 +0200 |
|---|---|---|
| committer | con <qtc-committer@nokia.com> | 2009-04-08 10:29:59 +0200 |
| commit | 2e1ecb5c1be9c924cdebb2f49885889afa7fab8e (patch) | |
| tree | c1d8c5384b12fe1bc4cce25a2b9ea712373a8cbd /src/plugins/cpptools/cppcodecompletion.cpp | |
| parent | cbcf5e48712d0e54b17b5d6c93ba84ebe843e99a (diff) | |
| download | qt-creator-2e1ecb5c1be9c924cdebb2f49885889afa7fab8e.tar.gz | |
Function argument widget was closing too early.
In case the completion shortcut contained the escape key (Mac xcode-like
shortcut settings).
Reviewed-by: Thorbjørn Lindeijer <thorbjorn.lindeijer@nokia.com>
Diffstat (limited to 'src/plugins/cpptools/cppcodecompletion.cpp')
| -rw-r--r-- | src/plugins/cpptools/cppcodecompletion.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/plugins/cpptools/cppcodecompletion.cpp b/src/plugins/cpptools/cppcodecompletion.cpp index 398752891d..b9d880a067 100644 --- a/src/plugins/cpptools/cppcodecompletion.cpp +++ b/src/plugins/cpptools/cppcodecompletion.cpp @@ -99,6 +99,7 @@ private: int m_startpos; int m_currentarg; int m_current; + bool m_escapePressed; TextEditor::ITextEditor *m_editor; @@ -197,7 +198,8 @@ using namespace CppTools::Internal; FunctionArgumentWidget::FunctionArgumentWidget(): m_startpos(-1), - m_current(0) + m_current(0), + m_escapePressed(false) { QObject *editorObject = Core::EditorManager::instance()->currentEditor(); m_editor = qobject_cast<TextEditor::ITextEditor *>(editorObject); @@ -267,6 +269,7 @@ void FunctionArgumentWidget::showFunctionHint(QList<Function *> functionSymbols, m_context = context; m_startpos = startPosition; m_current = 0; + m_escapePressed = false; // update the text m_currentarg = -1; @@ -326,7 +329,15 @@ void FunctionArgumentWidget::updateArgumentHighlight() bool FunctionArgumentWidget::eventFilter(QObject *obj, QEvent *e) { switch (e->type()) { + case QEvent::ShortcutOverride: + if (static_cast<QKeyEvent*>(e)->key() == Qt::Key_Escape) { + m_escapePressed = true; + } + break; case QEvent::KeyPress: + if (static_cast<QKeyEvent*>(e)->key() == Qt::Key_Escape) { + m_escapePressed = true; + } if (m_items.size() > 1) { QKeyEvent *ke = static_cast<QKeyEvent*>(e); if (ke->key() == Qt::Key_Up) { @@ -340,7 +351,7 @@ bool FunctionArgumentWidget::eventFilter(QObject *obj, QEvent *e) } break; case QEvent::KeyRelease: - if (static_cast<QKeyEvent*>(e)->key() == Qt::Key_Escape) { + if (static_cast<QKeyEvent*>(e)->key() == Qt::Key_Escape && m_escapePressed) { m_popupFrame->close(); return false; } |
