summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSami Merilä <sami.merila@nokia.com>2009-09-30 09:16:56 (GMT)
committerSami Merilä <sami.merila@nokia.com>2009-09-30 09:16:56 (GMT)
commit7171983e8c9ca106952ecc09e540da4aab8b8b0d (patch)
treee3e800628d5f986cc0e4eaa2c2dfe09fc61e45c1
parent4b4bea046f3a7e26f1c4bff97065a06b2d7f9dc1 (diff)
downloadQt-7171983e8c9ca106952ecc09e540da4aab8b8b0d.zip
Qt-7171983e8c9ca106952ecc09e540da4aab8b8b0d.tar.gz
Qt-7171983e8c9ca106952ecc09e540da4aab8b8b0d.tar.bz2
Ftp example application crashes (due to keypad navigation)
Keypad navigation tries to calculate the minimal distance of next widget to the direction of pressed navigation key. This calculation in QWidgetPrivate::widgetInNavigationDirection dies not take into account that some widgets might have focusProxy setup. In the reported case, ignoring focus proxy means that QDialogButtonBox gets the focus and it hands it over to first button in its tab order. Unfortunately, this button is disabled 'Download' button. Now, when Select key is pressed, button action is triggered causing a crash. Solution is to skip widgets that have focus proxies in widgetInNavigationDirection. Task-number: QT-2177 Reviewed-by: Alessandro Portale
-rw-r--r--src/gui/kernel/qwidget.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index 08fe5b9..e2de148 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -11454,6 +11454,10 @@ 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()));
if ( targetCandidate != sourceWidget
&& targetCandidate->focusPolicy() & Qt::TabFocus