View Single Post
marxian's Avatar
Posts: 2,448 | Thanked: 9,523 times | Joined on Aug 2010 @ Wigan, UK
#7
Originally Posted by Bundyo View Post
Added sources and the Go 1.6 patch.

Btw, I have an issue with the SilicaGridView - the model changes underneath and the changes propagate to the QML, but sometimes the QML elements inside the delegate don't change their visibility until you scroll out of the view and then return. The GridView forceLayout method doesn't seem to help much and seems like a rendering bug. Any ideas?
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
}
__________________
'Men of high position are allowed, by a special act of grace, to accomodate their reasoning to the answer they need. Logic is only required in those of lesser rank.' - J K Galbraith

My website

GitHub

Last edited by marxian; 2016-05-09 at 13:43.
 

The Following User Says Thank You to marxian For This Useful Post: