summaryrefslogtreecommitdiffstats
path: root/src/gui/dialogs/qfiledialog.cpp
diff options
context:
space:
mode:
authorSami Merilä <sami.merila@nokia.com>2009-10-02 13:15:56 (GMT)
committerSami Merilä <sami.merila@nokia.com>2009-10-02 13:15:56 (GMT)
commitc206ea53ebac0436bad0c00c1e340f23efb3aa16 (patch)
tree935d443ba4945469925d8c11c5b0b3f9c2966446 /src/gui/dialogs/qfiledialog.cpp
parent8fa169202bf2bf169b65a72daee6b497f36be65c (diff)
downloadQt-c206ea53ebac0436bad0c00c1e340f23efb3aa16.zip
Qt-c206ea53ebac0436bad0c00c1e340f23efb3aa16.tar.gz
Qt-c206ea53ebac0436bad0c00c1e340f23efb3aa16.tar.bz2
Filedialog impossible to use with keypad navigation
QFileDialog contains own internal derived classes for line edit and list view. Unfortunately, these classes do not handle keypad navigation correctly - they just accept the navigation key events, causing the navigation to halt. Added support for QFileDialogListView, QFileDialogTreeView and private filedialog class QFileDialogPrivate to handle and possibly ignore keypad navigaion key events. Additionally, added support to keypad navigation to ignore empty widgets. This allows keypad navigation not to go invisible when empty widgets are tried to be navigated into. Task-number: QT-643 Reviewed-by: Alessandro Portale
Diffstat (limited to 'src/gui/dialogs/qfiledialog.cpp')
-rw-r--r--src/gui/dialogs/qfiledialog.cpp22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/gui/dialogs/qfiledialog.cpp b/src/gui/dialogs/qfiledialog.cpp
index 297c900..eb5fed0 100644
--- a/src/gui/dialogs/qfiledialog.cpp
+++ b/src/gui/dialogs/qfiledialog.cpp
@@ -3022,6 +3022,12 @@ bool QFileDialogPrivate::itemViewKeyboardEvent(QKeyEvent *event) {
case Qt::Key_Escape:
q->hide();
return true;
+#ifdef QT_KEYPAD_NAVIGATION
+ case Qt::Key_Down:
+ case Qt::Key_Up:
+ return (QApplication::navigationMode() != Qt::NavigationModeKeypadTabOrder
+ && QApplication::navigationMode() != Qt::NavigationModeKeypadDirectional);
+#endif
default:
break;
}
@@ -3142,7 +3148,17 @@ void QFileDialogListView::keyPressEvent(QKeyEvent *e)
if (!d_ptr->itemViewKeyboardEvent(e)) {
QListView::keyPressEvent(e);
}
+#ifdef QT_KEYPAD_NAVIGATION
+ if ((QApplication::navigationMode() == Qt::NavigationModeKeypadTabOrder
+ || QApplication::navigationMode() == Qt::NavigationModeKeypadDirectional)
+ && !hasEditFocus()) {
+ e->ignore();
+ } else {
+ e->accept();
+ }
+#else
e->accept();
+#endif
}
QFileDialogTreeView::QFileDialogTreeView(QWidget *parent) : QTreeView(parent)
@@ -3189,7 +3205,11 @@ void QFileDialogLineEdit::keyPressEvent(QKeyEvent *e)
{
int key = e->key();
QLineEdit::keyPressEvent(e);
- if (key != Qt::Key_Escape)
+ if (key != Qt::Key_Escape
+#ifdef QT_KEYPAD_NAVIGATION
+ && QApplication::navigationMode() == Qt::NavigationModeNone
+#endif
+ )
e->accept();
if (hideOnEsc && (key == Qt::Key_Escape || key == Qt::Key_Return || key == Qt::Key_Enter)) {
e->accept();