From 34a1438c4184afecc237fe0177ed4a536b2d5e43 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Sat, 3 Oct 2009 16:39:14 +0200 Subject: Adding comments. --- src/gui/kernel/qwidget.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index f62240a..2359812 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -11453,14 +11453,23 @@ QWidget *QWidgetPrivate::widgetInNavigationDirection(Direction direction) if (targetCandidate->focusProxy() || targetCandidateRect.isEmpty()) continue; + // Only navigate to a target widget that... if ( targetCandidate != sourceWidget + // ...takes the focus, && targetCandidate->focusPolicy() & Qt::TabFocus + // ...is above if DirectionNorth, && !(direction == DirectionNorth && targetCandidateRect.bottom() > sourceRect.top()) + // ...is on the right if DirectionEast, && !(direction == DirectionEast && targetCandidateRect.left() < sourceRect.right()) + // ...is below if DirectionSouth, && !(direction == DirectionSouth && targetCandidateRect.top() < sourceRect.bottom()) + // ...is on the left if DirectionWest, && !(direction == DirectionWest && targetCandidateRect.right() > sourceRect.left()) + // ...is enabled, && targetCandidate->isEnabled() + // ...is visible, && targetCandidate->isVisible() + // ...is in the same window, && targetCandidate->window() == sourceWindow) { const int targetCandidateDistance = pointToRect(sourcePoint, targetCandidateRect); if (targetCandidateDistance < shortestDistance) { -- cgit v0.12