diff options
author | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2010-03-09 17:14:52 (GMT) |
---|---|---|
committer | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2010-03-17 14:47:54 (GMT) |
commit | 77230f7ec9e78ec2d57629ea934ceb1d59eb391e (patch) | |
tree | 87ce66625cc5d5ed0ff3271f8674f11efae3ddb7 /src/gui/itemviews/qtreeview.cpp | |
parent | 90dfb5e5d8fc8cb841b0762cd88aa4b996c38312 (diff) | |
download | Qt-77230f7ec9e78ec2d57629ea934ceb1d59eb391e.zip Qt-77230f7ec9e78ec2d57629ea934ceb1d59eb391e.tar.gz Qt-77230f7ec9e78ec2d57629ea934ceb1d59eb391e.tar.bz2 |
Do not beep on Mac when pressing some keys.
When a key event is delivered to widgets, we should accept the event if the
widget reacted to it in any way - if either the current item has changed or if
the widget scrolled.
Task-number: QTBUG-6444
Reviewed-by: Prasanth
Diffstat (limited to 'src/gui/itemviews/qtreeview.cpp')
-rw-r--r-- | src/gui/itemviews/qtreeview.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp index fcdc429..95ba67c 100644 --- a/src/gui/itemviews/qtreeview.cpp +++ b/src/gui/itemviews/qtreeview.cpp @@ -2139,9 +2139,10 @@ QModelIndex QTreeView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifie return d->modelIndex(d->above(vi), current.column()); case MoveLeft: { QScrollBar *sb = horizontalScrollBar(); - if (vi < d->viewItems.count() && d->viewItems.at(vi).expanded && d->itemsExpandable && sb->value() == sb->minimum()) + if (vi < d->viewItems.count() && d->viewItems.at(vi).expanded && d->itemsExpandable && sb->value() == sb->minimum()) { d->collapse(vi, true); - else { + d->moveCursorUpdatedView = true; + } else { bool descend = style()->styleHint(QStyle::SH_ItemView_ArrowKeysNavigateIntoChildren, 0, this); if (descend) { QModelIndex par = current.parent(); @@ -2161,7 +2162,10 @@ QModelIndex QTreeView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifie return next; } + int oldValue = sb->value(); sb->setValue(sb->value() - sb->singleStep()); + if (oldValue != sb->value()) + d->moveCursorUpdatedView = true; } } @@ -2173,6 +2177,7 @@ QModelIndex QTreeView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifie if (vi < d->viewItems.count() && !d->viewItems.at(vi).expanded && d->itemsExpandable && d->hasVisibleChildren(d->viewItems.at(vi).index)) { d->expand(vi, true); + d->moveCursorUpdatedView = true; } else { bool descend = style()->styleHint(QStyle::SH_ItemView_ArrowKeysNavigateIntoChildren, 0, this); if (descend) { @@ -2195,7 +2200,10 @@ QModelIndex QTreeView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifie //last restort: we change the scrollbar value QScrollBar *sb = horizontalScrollBar(); + int oldValue = sb->value(); sb->setValue(sb->value() + sb->singleStep()); + if (oldValue != sb->value()) + d->moveCursorUpdatedView = true; } } updateGeometries(); |