Stack With Friends Demo
import QtQuick 2.0
import Felgo 3.0
Flickable {
id: levelList
contentWidth: grid.width
contentHeight: grid.height+offset.height
flickableDirection: Flickable.VerticalFlick
property variant levelMetaDataArray: levelScene.levelArrayFromState()
property alias levelColumn: grid
property Component levelItemDelegate: LevelItem {}
signal nextPageClicked
signal prevPageClicked
onLevelMetaDataArrayChanged: {
updateList()
}
function updateList() {
levelListRepeater.model = null
isLoading = true
changeModel.start()
}
function nextPage() {
if(page>=pageCount) return;
page++
nextPageClicked()
}
function prevPage() {
if(page<=1) return;
page--
prevPageClicked()
}
property int pageSize: -1
property int page: 1
property int pageCount: 1
property alias isLoading: loading.visible
Timer {
id: changeModel
interval: 100
onTriggered: {
if(levelMetaDataArray) {
levelListRepeater.model = levelMetaDataArray
} else {
isLoading = false
}
}
}
MultiResolutionImage {
id: loading
source: "../../assets/img/splash-text.png"
anchors.centerIn: parent
visible: false
}
Grid {
id: grid
columns: 5
spacing: 5
Repeater {
id: levelListRepeater
delegate: levelItemDelegate
onModelChanged: {
console.debug("LevelList: listModel changed to", model, ", stringified:", JSON.stringify(model))
isLoading = false
}
}
}
Item {
id: offset
width: parent.width