diff options
author | Jens Bache-Wiig <jens.bache-wiig@digia.com> | 2013-12-13 14:03:31 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-12-21 11:32:02 +0100 |
commit | cd8eb15f5e37c843ed8b53f071b8ff11eba6986c (patch) | |
tree | 73dfb9e03ab4e4bd6fffc956cd835e53b9c6d4a9 | |
parent | ae380584de53cf927fe4a7bd62ffb41f73b1faa1 (diff) | |
download | qtquickcontrols-cd8eb15f5e37c843ed8b53f071b8ff11eba6986c.tar.gz |
Fixed: Regression in key navigation on TableView
It turns out the currentIndex/CurrentRow was updated but the selection,
was ignored for the last row in a TableView.
[ChangeLog][Qt Quick Controls][Fixed: TableView regression where
the last row in a TableView could not be selected by keyboard.]
Task-number: QTBUG-35572
Change-Id: Ifdf11f665733dd63ba56e12fe0dabdd7932a4ab9
Reviewed-by: Caroline Chao <caroline.chao@digia.com>
-rw-r--r-- | src/controls/TableView.qml | 2 | ||||
-rw-r--r-- | tests/auto/controls/data/tst_tableview.qml | 28 |
2 files changed, 29 insertions, 1 deletions
diff --git a/src/controls/TableView.qml b/src/controls/TableView.qml index 736ac6e3..595c13ca 100644 --- a/src/controls/TableView.qml +++ b/src/controls/TableView.qml @@ -696,7 +696,7 @@ ScrollView { model: root.model function keySelect(shiftPressed, row) { - if (row < 0 || row === rowCount - 1) + if (row < 0 || row > rowCount - 1) return if (shiftPressed && (selectionMode >= SelectionMode.ExtendedSelection)) { selection.__ranges = new Array() diff --git a/tests/auto/controls/data/tst_tableview.qml b/tests/auto/controls/data/tst_tableview.qml index 7f1b48dc..192e29b5 100644 --- a/tests/auto/controls/data/tst_tableview.qml +++ b/tests/auto/controls/data/tst_tableview.qml @@ -148,6 +148,34 @@ TestCase { verify(table.selection.contains(4)) verify(table.selection.contains(5)) verify(table.selection.count === 2) + + // Navigate to end using arrow keys + table.selectionMode = SelectionMode.SingleSelection + table.model = 3 + table.currentRow = -1 + keyClick(Qt.Key_Down); + verify(table.currentRow === 0) + verify(rangeTest([[0,0]], table)) + verify(table.selection.contains(0)) + keyClick(Qt.Key_Down); + verify(table.currentRow === 1) + verify(table.selection.contains(1)) + keyClick(Qt.Key_Down); + verify(table.currentRow === 2) + verify(table.selection.contains(2)) + keyClick(Qt.Key_Down); + verify(table.currentRow === 2) + verify(table.selection.contains(2)) + keyClick(Qt.Key_Up); + verify(table.currentRow === 1) + verify(table.selection.contains(1)) + keyClick(Qt.Key_Up); + verify(table.currentRow === 0) + verify(table.selection.contains(0)) + keyClick(Qt.Key_Up); + verify(table.currentRow === 0) + verify(table.selection.contains(0)) + table.destroy() } |