summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gui/dialogs/qfiledialog.cpp22
-rw-r--r--src/gui/kernel/qwidget.cpp10
2 files changed, 28 insertions, 4 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();
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index 0b75b06..3cfbb09 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -11444,11 +11444,15 @@ QWidget *QWidgetPrivate::widgetInNavigationDirection(Direction direction)
QWidget *targetWidget = 0;
int shortestDistance = INT_MAX;
foreach(QWidget *targetCandidate, QApplication::allWidgets()) {
-
- if (targetCandidate->focusProxy()) //skip if focus proxy set
- continue;
const QRect targetCandidateRect = targetCandidate->rect().translated(targetCandidate->mapToGlobal(QPoint()));
+
+ // For focus proxies, the child widget handling the focus can have keypad navigation focus,
+ // but the owner of the proxy cannot.
+ // Additionally, empty widgets should be ignored.
+ if (targetCandidate->focusProxy() || targetCandidateRect.isEmpty())
+ continue;
+
if ( targetCandidate != sourceWidget
&& targetCandidate->focusPolicy() & Qt::TabFocus
&& !(direction == DirectionNorth && targetCandidateRect.bottom() > sourceRect.top())