From 28cdb974cce58111a19e8691f4dd929a5c9f74ea Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Tue, 6 Oct 2009 18:05:17 +0200 Subject: Prevent OK key being processed twice in file dialog (keypad navigation) All key events were being explicitly ignored by the file dialog when key navigation is enabled, and it doesn't have edit focus. When a file is opened by pressing the OK key, there is no edit focus after returning from accept() and the OK key can propagate outside the modal dialog. This causes the parent widget to receive and act upon the OK key as well which makes problems - e.g. in QTBUG-4724, recursive menu activation Task-number: QTBUG-4724 Reviewed-by: Alessandro Portale --- src/gui/dialogs/qfiledialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/dialogs/qfiledialog.cpp b/src/gui/dialogs/qfiledialog.cpp index eb5fed0..eab842f 100644 --- a/src/gui/dialogs/qfiledialog.cpp +++ b/src/gui/dialogs/qfiledialog.cpp @@ -3149,7 +3149,7 @@ void QFileDialogListView::keyPressEvent(QKeyEvent *e) QListView::keyPressEvent(e); } #ifdef QT_KEYPAD_NAVIGATION - if ((QApplication::navigationMode() == Qt::NavigationModeKeypadTabOrder + else if ((QApplication::navigationMode() == Qt::NavigationModeKeypadTabOrder || QApplication::navigationMode() == Qt::NavigationModeKeypadDirectional) && !hasEditFocus()) { e->ignore(); -- cgit v0.12