summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/controls/TableView.qml4
-rw-r--r--tests/auto/controls/data/tst_tableview.qml24
2 files changed, 27 insertions, 1 deletions
diff --git a/src/controls/TableView.qml b/src/controls/TableView.qml
index c621236d..b225408f 100644
--- a/src/controls/TableView.qml
+++ b/src/controls/TableView.qml
@@ -792,9 +792,11 @@ ScrollView {
root.activated(currentRow);
}
- delegate: Item {
+ delegate: FocusScope {
id: rowItemContainer
+ activeFocusOnTab: false
+
property Item rowItem
// We recycle instantiated row items to speed up list scrolling
diff --git a/tests/auto/controls/data/tst_tableview.qml b/tests/auto/controls/data/tst_tableview.qml
index b63b5b5f..8e11d9e4 100644
--- a/tests/auto/controls/data/tst_tableview.qml
+++ b/tests/auto/controls/data/tst_tableview.qml
@@ -875,6 +875,13 @@ TestCase {
return undefined // no matching child found
}
+ Component {
+ id: textFieldDelegate
+ TextField {
+ objectName: "delegate-" + styleData.row + "-" + styleData.column
+ }
+ }
+
function test_activeFocusOnTab() {
if (!SystemInfo.tabAllWidgets)
skip("This function doesn't support NOT iterating all.")
@@ -926,6 +933,23 @@ TestCase {
verify(control.control1.activeFocus)
verify(!control.control2.activeFocus)
verify(!control.control3.activeFocus)
+
+ control.control2.itemDelegate = textFieldDelegate
+
+ keyPress(Qt.Key_Tab)
+ verify(!control.control1.activeFocus)
+ verify(control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+
+ for (var row = 0; row < 3; ++row) {
+ for (var col = 0; col < 2; ++col) {
+ keyPress(Qt.Key_Tab)
+ var delegate = findAChild(control.control2.__currentRowItem, "delegate-" + row + "-" + col)
+ verify(delegate)
+ verify(delegate.activeFocus)
+ }
+ }
+
control.destroy()
}
}