summaryrefslogtreecommitdiffstats
path: root/src/gui/itemviews/qabstractitemview.cpp
diff options
context:
space:
mode:
authorSami Merila <sami.merila@nokia.com>2010-02-25 15:10:18 (GMT)
committerSami Merila <sami.merila@nokia.com>2010-02-25 15:10:18 (GMT)
commit1b9f273c3d0e10cb14a35a9a058b379b8777b5d8 (patch)
tree704575e93d35698f55d359c843f310d20de2dab8 /src/gui/itemviews/qabstractitemview.cpp
parentd996f6707a8733a8d151dcad59981cbb0f2f03f1 (diff)
parentd8465414e6fd543cfc20e732030dedd8d2bc685f (diff)
downloadQt-1b9f273c3d0e10cb14a35a9a058b379b8777b5d8.zip
Qt-1b9f273c3d0e10cb14a35a9a058b379b8777b5d8.tar.gz
Qt-1b9f273c3d0e10cb14a35a9a058b379b8777b5d8.tar.bz2
Merge branch '4.6' of git@scm.dev.nokia.troll.no:qt/qt-s60-public into 4.6
Diffstat (limited to 'src/gui/itemviews/qabstractitemview.cpp')
-rw-r--r--src/gui/itemviews/qabstractitemview.cpp41
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