diff options
Diffstat (limited to 'tests/auto/quick/qquickitem2/data/keynavigationtest_repeater.qml')
-rw-r--r-- | tests/auto/quick/qquickitem2/data/keynavigationtest_repeater.qml | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/auto/quick/qquickitem2/data/keynavigationtest_repeater.qml b/tests/auto/quick/qquickitem2/data/keynavigationtest_repeater.qml new file mode 100644 index 0000000000..12ce10e139 --- /dev/null +++ b/tests/auto/quick/qquickitem2/data/keynavigationtest_repeater.qml @@ -0,0 +1,37 @@ +import QtQuick 2.0 + +Grid { + property var textModel: ["1", "2", "3", "4", "5"] + columns: 5 + width: 50*textModel.length + + Repeater { + id: repeater + model: textModel.length + Rectangle { + width: 50 + height: 50 + color: focus ? "red" : "lightgrey" + focus: index == 2 + Text { + id: t + text: textModel[index] + } + KeyNavigation.left: repeater.itemAt(index - 1) + KeyNavigation.right: repeater.itemAt(index + 1) + } + } + + function verify() { + for (var i = 0; i < repeater.count; i++) { + var item = repeater.itemAt(i); + var prev = repeater.itemAt(i - 1); + var next = repeater.itemAt(i + 1); + if (item.KeyNavigation.left != prev || item.KeyNavigation.right != next) + return false; + } + + return true; + } +} + |