forked from qt-creator/qt-creator
Workaround QCompleter issue with closing its popup on escape
QCompleter doesn't close its popup if there's a application wide 'escape' shortcut. This commit adds the necessary shortcut overrides for CompletingTextEdit and FancyLineEdit, which fixes the issue at least for find tool bar, advanced search, gerrit dialog and description field of submit editor. Task-number: QTCREATORBUG-9453 Change-Id: Ib1df218ab6b9a54fbf19d6132c6edd8e83ace46c Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: Eike Ziller <eike.ziller@digia.com>
This commit is contained in:
@@ -190,6 +190,20 @@ void CompletingTextEdit::focusInEvent(QFocusEvent *e)
|
||||
QTextEdit::focusInEvent(e);
|
||||
}
|
||||
|
||||
bool CompletingTextEdit::event(QEvent *e)
|
||||
{
|
||||
// workaround for QTCREATORBUG-9453
|
||||
if (e->type() == QEvent::ShortcutOverride && completer()
|
||||
&& completer()->popup() && completer()->popup()->isVisible()) {
|
||||
QKeyEvent *ke = static_cast<QKeyEvent *>(e);
|
||||
if (ke->key() == Qt::Key_Escape && !ke->modifiers()) {
|
||||
ke->accept();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return QTextEdit::event(e);
|
||||
}
|
||||
|
||||
} // namespace Utils
|
||||
|
||||
#include "moc_completingtextedit.cpp"
|
||||
|
||||
Reference in New Issue
Block a user