View Single Post
Bundyo's Avatar
Posts: 4,708 | Thanked: 4,649 times | Joined on Oct 2007 @ Bulgaria
#8
Originally Posted by marxian View Post
Your data model is not updated when the image status changes, so these status changes will not be reflected in the delegate, and you are using a function call that depends on the index only, so the function will only be re-evaluated when the index changes.

To fix this, you could use either QAbstractItemModel or QML ListModel and either have the bridge update the model when the image status changes, or use signal/slot connections, e.g:

Code:
ListModel {
    id: model
}

Connections {
    target: bridge
    onImageStatusChanged: model.setProperty(index, "status", status) // 'index' and 'status' (e.g 'Downloading' or 'Downloaded') are signal parameters
}
EDIT: Another possible solution is to use the array of images as the model, then you could bind to the 'dowloading' property via 'modelData', e.g:

Code:
....
model: bridge.fileList
delegate: Item {
    someProperty: modelData.downloading
    otherProperty: modelData.downloaded
}
Unfortunately Go-QML doesn't support array model binding I'll try the rest.
__________________
Technically, there are three determinate states the cat could be in: Alive, Dead, and Bloody Furious.