diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-02-25 16:20:45 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-02-25 16:20:45 (GMT) |
commit | c0d0257f305ad7bf265086e2e43ab9637f21d4d6 (patch) | |
tree | 30f436b6a2166d354350d26d0deaaf5789a929a7 /src/gui/itemviews | |
parent | 20aba4ffa2fdf7a7306424981049d430f7d88e5c (diff) | |
parent | 7574eafc7509a00c24b32e32cf2b8dd93bc7ace6 (diff) | |
download | Qt-c0d0257f305ad7bf265086e2e43ab9637f21d4d6.zip Qt-c0d0257f305ad7bf265086e2e43ab9637f21d4d6.tar.gz Qt-c0d0257f305ad7bf265086e2e43ab9637f21d4d6.tar.bz2 |
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/qt-s60-public into 4.6-integration
* '4.6' of scm.dev.nokia.troll.no:qt/qt-s60-public:
Removed an export that shouldn't be exported.
Reduced the code and memory footprint of the keymap.
Enabled Qt key events to work also when native key code is missing.
Crash in QGraphicsScenePrivate::setFocusItemHelper
Improvements to itemview keypad navigation in S60.
Fix SymbianMakefileGenerator::absolutizePath for clean builds
Misc fixes to FLM files
Diffstat (limited to 'src/gui/itemviews')
-rw-r--r-- | src/gui/itemviews/qabstractitemview.cpp | 41 |
1 files changed, 37 insertions, 4 deletions
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index adf3ce3..555555e 100644 --- a/src/gui/itemviews/qabstractitemview.cpp +++ b/src/gui/itemviews/qabstractitemview.cpp @@ -2119,6 +2119,11 @@ void QAbstractItemView::focusOutEvent(QFocusEvent *event) Q_D(QAbstractItemView); QAbstractScrollArea::focusOutEvent(event); d->viewport->update(); + +#ifdef QT_SOFTKEYS_ENABLED + if(!hasEditFocus()) + removeAction(d->doneSoftKey); +#endif } /*! @@ -2144,7 +2149,12 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event) if (!hasEditFocus()) { setEditFocus(true); #ifdef QT_SOFTKEYS_ENABLED - addAction(d->doneSoftKey); + // If we can't keypad navigate to any direction, there is no sense to add + // "Done" softkey, since it basically does nothing when there is + // only one widget in screen + if(QWidgetPrivate::canKeypadNavigate(Qt::Horizontal) + || QWidgetPrivate::canKeypadNavigate(Qt::Vertical)) + addAction(d->doneSoftKey); #endif return; } @@ -2160,6 +2170,26 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event) event->ignore(); } return; + case Qt::Key_Down: + case Qt::Key_Up: + // Let's ignore vertical navigation events, only if there is no other widget + // what can take the focus in vertical direction. This means widget can handle navigation events + // even the widget don't have edit focus, and there is no other widget in requested direction. + if(QApplication::keypadNavigationEnabled() && !hasEditFocus() + && QWidgetPrivate::canKeypadNavigate(Qt::Vertical)) { + event->ignore(); + return; + } + break; + case Qt::Key_Left: + case Qt::Key_Right: + // Similar logic as in up and down events + if(QApplication::keypadNavigationEnabled() && !hasEditFocus() + && (QWidgetPrivate::canKeypadNavigate(Qt::Horizontal) || QWidgetPrivate::inTabWidget(this))) { + event->ignore(); + return; + } + break; default: if (QApplication::keypadNavigationEnabled() && !hasEditFocus()) { event->ignore(); @@ -2245,7 +2275,7 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event) case Qt::Key_Down: case Qt::Key_Up: #ifdef QT_KEYPAD_NAVIGATION - if (QApplication::keypadNavigationEnabled()) { + if (QApplication::keypadNavigationEnabled() && QWidgetPrivate::canKeypadNavigate(Qt::Vertical)) { event->accept(); // don't change focus break; } @@ -2253,8 +2283,11 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event) case Qt::Key_Left: case Qt::Key_Right: #ifdef QT_KEYPAD_NAVIGATION - if (QApplication::navigationMode() == Qt::NavigationModeKeypadDirectional) { - event->accept(); // don't change horizontal focus in directional mode + int colCount = d->model->columnCount(d->root); + if (QApplication::navigationMode() == Qt::NavigationModeKeypadDirectional + && (QWidgetPrivate::canKeypadNavigate(Qt::Horizontal) + || (QWidgetPrivate::inTabWidget(this) && colCount > 1))) { + event->accept(); // don't change focus break; } #endif // QT_KEYPAD_NAVIGATION |