diff options
Diffstat (limited to 'src/widgets/dialogs/qfiledialog.cpp')
-rw-r--r-- | src/widgets/dialogs/qfiledialog.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp index 81beccd5c8..ee2b1e6dae 100644 --- a/src/widgets/dialogs/qfiledialog.cpp +++ b/src/widgets/dialogs/qfiledialog.cpp @@ -3778,6 +3778,12 @@ void QFileDialogPrivate::_q_nativeEnterDirectory(const QUrl &directory) bool QFileDialogPrivate::itemViewKeyboardEvent(QKeyEvent *event) { Q_Q(QFileDialog); + + if (event->matches(QKeySequence::Cancel)) { + q->hide(); + return true; + } + switch (event->key()) { case Qt::Key_Backspace: _q_navigateToParent(); @@ -3793,9 +3799,6 @@ bool QFileDialogPrivate::itemViewKeyboardEvent(QKeyEvent *event) { return true; } break; - case Qt::Key_Escape: - q->hide(); - return true; default: break; } @@ -3982,7 +3985,7 @@ void QFileDialogLineEdit::keyPressEvent(QKeyEvent *e) int key = e->key(); QLineEdit::keyPressEvent(e); - if (key != Qt::Key_Escape && key != Qt::Key_Back) + if (!e->matches(QKeySequence::Cancel) && key != Qt::Key_Back) e->accept(); } |