Create sub a ListModel
-
-
It could, if your data doesn't come from within QML. If you can get your data from the C++ side, you can use this approach. The problem is that you can not use a QSortFilterProxyModel on a model that comes from QML, but only on a QAbstractItemModel-derived model.
-
Is this what you're looking for?
@
import QtQuick 1.0Rectangle {
id: mainwidth: 400 height: 600 ListModel { id: myModel ListElement { name: "element 0" } ListElement { name: "element 1" } ListElement { name: "element 2" } ListElement { name: "element 3" } } ListModel { id: subList } ListView { id: listView anchors.fill: parent spacing: 8 model: subList delegate: Text { text: name; width: listView.width } } Text { text: "Update list" anchors.right: parent.right; anchors.bottom: parent.bottom; anchors.margins: 5 MouseArea { anchors.fill: parent onClicked: updateSubList(1, 2) } } function updateSubList(begin, end) { subList.clear() end = Math.min(end, myModel.count-1) for (var i = begin; i <= end ; i++) { subList.append(myModel.get(i)) } }
}
@