Hi, I think I have spotted a documentation bug in the SDK.The example given in in Sailfish Silica Reference Documentation for the SilicaGridView uses the wrong data type in ListModel.
import QtQuick 2.0
import Sailfish.Silica 1.0
SilicaGridView {
width: 480; height: 800
model: ListModel {
ListItem { fruit: "jackfruit" }
ListItem { fruit: "orange" }
ListItem { fruit: "lemon" }
ListItem { fruit: "lychee" }
ListItem { fruit: "apricots" }
}
delegate: Item {
width: GridView.view.width
height: Theme.itemSizeSmall
Label { text: fruit }
}
}
fails with the following error: ListElement: cannot contain nested elements
I think it should rather read as:
import QtQuick 2.0
import Sailfish.Silica 1.0
SilicaGridView {
width: 480; height: 800
model: ListModel {
ListElement { fruit: "jackfruit" }
ListElement { fruit: "orange" }
ListElement { fruit: "lemon" }
ListElement { fruit: "lychee" }
ListElement { fruit: "apricots" }
}
delegate: Item {
width: GridView.view.width
height: Theme.itemSizeSmall
Label { text: fruit }
}
}
which seems to work and is consistant with QML ListModel documentation.
Regards,
Franck
smime.p7s
Description: Signature cryptographique S/MIME
_______________________________________________ SailfishOS.org Devel mailing list
