[SailfishDevel] Documentation bug in SailfishSDK

Franck Routier (perso) alci at mecadu.org
Fri Oct 4 08:16:19 UTC 2013


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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.sailfishos.org/pipermail/devel/attachments/20131004/d0abf548/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4237 bytes
Desc: Signature cryptographique S/MIME
URL: <https://lists.sailfishos.org/pipermail/devel/attachments/20131004/d0abf548/attachment.bin>


More information about the Devel mailing list