モデルやデリゲート、またはレイアウト (項目が重複している...) に問題がある可能性があります。これは問題なく動作します:
import QtQuick 2.0;
Rectangle {
width: 400;
height: 300;
Timer {
running: true;
repeat: true;
interval: 1000;
onTriggered: { modelTest.append ({ "bg" : Qt.hsla (Math.random (), 0.85, 0.45, 1.0).toString () }); }
}
Flow {
anchors.fill: parent;
Repeater {
model: ListModel {
id: modelTest;
}
delegate: Rectangle {
id: rect;
color: model.bg;
width: 50;
height: width;
scale: 0.0;
PropertyAnimation {
target: rect;
property: "scale";
from: 0.0;
to: 1.0;
duration: 450;
running: true;
loops: 1;
}
}
}
}
}
ListModel と QAbstractListModel のみが、デリゲート全体をリセットせずに動的に新しいアイテムを追加できることに注意してください。その他 (バリアント リスト、JS 配列、数値) では、モデルの変更ごとにすべてのデリゲートが再インスタンス化されます...