Удаление дочерних элементов QML Grid

Я хочу пройтись по дочерним элементам QML Grid и уничтожить каждого из них с помощью Javascript.

Grid {
  id: contentGrid
  spacing: 10

  ImageItem { imageSource: "file:/foo.jpeg"  } // destroy this
  ImageItem { imageSource: "file:/bar.jpeg"  } // destroy this as well
}

Я пытался сделать что-то подобное, но пока не получается.

for(var i = 0; contentGrid.children.length() < i; i++) {
    contentGrid.childAt(i).destroy();
}
8
задан alex 13 January 2012 в 13:15
поделиться