[SailfishDevel] Build a Model with "fixed" items + "dynamic" ones

Mykola Vovchok nicovov at gmail.com
Mon Apr 20 12:22:02 UTC 2015


Hi,

I suggest to put fixed items in ListView header. It seems, it is simpler 
than C++ proxy model.
You could try something like this:

SilicaListView {

     header: Column {
                 width: parent.width

                 PageHeader {
                     title: "Page Title"
                 }

                 Column {
                     width: parent.width

                     Repeater {
                         model: ["Today", "Overdue", "Completed", 
"Trash", "...", "..."]

                         ListItem {
                             height: Theme.itemSizeSmall

                             onClicked: {
                                 // ...
                             }

                             Label {
                                 anchors.verticalCenter: 
parent.verticalCenter
                                 width: parent.width

                                 text: modelData
                             }
                         }
                     }
                 }
     }

     delegate: ListItem {
             height: Theme.itemSizeSmall

             onClicked: {
                 // ...
             }

             Label {
                 anchors.verticalCenter: parent.verticalCenter
                 width: parent.width

                 text: model.dbValue
             }
     }


     model: dbModel
}




More information about the Devel mailing list