[SailfishDevel] ListView with SectionDelegate (Strange Behaviour)

christopher.lamb at thurweb.ch christopher.lamb at thurweb.ch
Wed Jan 29 18:56:07 UTC 2014


Hi all

I have come across some more strange behaviour.

This time it is a ListView / SilicaListVew with a SectionDelegate  
based on FirstCharacter.

For the items initially displayed this works well, with the section  
headers exactly where I would expect them (e.g between Anne and Babs  
in the code below)

But as I flick up, I then a section header between each item (e.g  
between Gargantua and Gilbert).

The code below demonstrates this on the emulator.

Grüsse

Chris


import QtQuick 2.0
import Sailfish.Silica 1.0

Page {
     id: page

     SilicaListView {
         id:  contactList
         anchors.fill: parent
         model: contactModel
         delegate: Label {
             text: model.displayLabel
             width: page.width
         }
         section.property: "displayLabel"
         section.criteria: ViewSection.FirstCharacter
         section.delegate: Rectangle {
             height: 10
             width: page.width
             color: "lightblue"
         }
     }

     ListModel {
         id: contactModel
         ListElement {
             displayLabel: "Achim"
         }
         ListElement {
             displayLabel: "Ana"
         }
         ListElement {
             displayLabel: "Anne"
         }
         ListElement {
             displayLabel: "Babs"
         }
         ListElement {
             displayLabel: "Barnie"
         }
         ListElement {
             displayLabel: "Barry"
         }
         ListElement {
             displayLabel: "Bezelbub"
         }
         ListElement {
             displayLabel: "Billy"
         }
         ListElement {
             displayLabel: "Boris"
         }
         ListElement {
             displayLabel: "Carrie"
         }
         ListElement {
             displayLabel: "Cassie"
         }
         ListElement {
             displayLabel: "Charlie"
         }
         ListElement {
             displayLabel: "Chris"
         }
         ListElement {
             displayLabel: "Diana"
         }
         ListElement {
             displayLabel: "Donald"
         }
         ListElement {
             displayLabel: "Doris"
         }
         ListElement {
             displayLabel: "Egbert"
         }
         ListElement {
             displayLabel: "Ethel"
         }
         ListElement {
             displayLabel: "Eziekiel"
         }
         ListElement {
             displayLabel: "Franzi"
         }
         ListElement {
             displayLabel: "Freddy"
         }
         ListElement {
             displayLabel: "Gargantua"
         }
         ListElement {
             displayLabel: "Gilbert"
         }
         ListElement {
             displayLabel: "Giles"
         }
         ListElement {
             displayLabel: "Gog"
         }
         ListElement {
             displayLabel: "Mabel"
         }
         ListElement {
             displayLabel: "Magog"
         }
     }
}






More information about the Devel mailing list