tests/auto/quick/qquickrepeater/data/asynchronousMove.qml
raw| 1 | import QtQuick 2.3 |
| 2 | import QtQuick.Window 2.2 |
| 3 | |
| 4 | Item { |
| 5 | property bool finished: loader.status === Loader.Ready && loader.progress === 1 |
| 6 | |
| 7 | ListModel { |
| 8 | id: listModel |
| 9 | ListElement { i:0 } |
| 10 | ListElement { i:1 } |
| 11 | ListElement { i:2 } |
| 12 | ListElement { i:3 } |
| 13 | } |
| 14 | |
| 15 | Timer { |
| 16 | running: true |
| 17 | interval: 1 |
| 18 | repeat: count < 5 |
| 19 | property int count : 0 |
| 20 | |
| 21 | onTriggered: { |
| 22 | listModel.move(listModel.count - 1, listModel.count - 2, 1) |
| 23 | ++count |
| 24 | } |
| 25 | } |
| 26 | |
| 27 | Loader { |
| 28 | id: loader |
| 29 | asynchronous: true |
| 30 | sourceComponent: Row { |
| 31 | spacing: 4 |
| 32 | Repeater { |
| 33 | model: listModel |
| 34 | delegate: Column { |
| 35 | spacing: 4 |
| 36 | Repeater { |
| 37 | model: 4 |
| 38 | delegate: Rectangle { |
| 39 | width: 30 |
| 40 | height: 30 |
| 41 | color: "blue" |
| 42 | Component.onCompleted: { |
| 43 | ctrl.wait() |
| 44 | } |
| 45 | } |
| 46 | } |
| 47 | } |
| 48 | } |
| 49 | } |
| 50 | } |
| 51 | } |