Definitely a bug. Please report at http://bugreports.qt.nokia.com
Martin. > -----Original Message----- > From: qt-qml-boun...@trolltech.com [mailto:qt-qml-boun...@trolltech.com] On > Behalf Of ext Johannes P > Sent: Thursday, 11 November 2010 11:18 PM > To: qt-qml@trolltech.com > Subject: [Qt-qml] ListView header and footer behavior > > Hi, > > I'm trying to build a listView with header and footer. When I enable > SnapToItem, the header is not shown anymore. It is there, but because the list > snaps to the first Item below the header, one can only flick downwards to see > the header. This is probably not the correct behavior, since a non-visible > header doesnt make much sense. When snapping is turned off, it works as > expected. Also, the behavior is correct with the footer. It snaps correctly, > regardless of SnapToItem. > > The following example reproduces the behavior. > > Thanks for any ideas or comments, > Johannes > > //###### Start Example ####### > import Qt 4.7 > > // In the following example, the header is not shown, i.e. is not in the view. > // The view doesnt snap to the header. If snapping is switched of it works. > > Rectangle { > width: 200 > height: 200 > ListView { > clip: true; spacing: 1 > width: parent.width > height: parent.height > // It works without Snapping > snapMode: ListView.SnapToItem > model: listModel > delegate: listDelegate > footer: footerAndHeader > header: footerAndHeader > } > > ListModel { > id: listModel > ListElement {name: "Dogs"} > ListElement {name: "Cats"} > ListElement {name: "Birds"} > ListElement {name: "Snails"} > ListElement {name: "Horses"} > ListElement {name: "Bugs?"} > } > Component { > id: listDelegate > Rectangle { > width: parent.width > height: 60 > gradient: Gradient { > GradientStop { > position: 0.00; > color: "#f9f9f9"; > } > GradientStop { > position: 1.00; > color: "#c4c4c4"; > } > } > Text { > anchors.centerIn: parent > text: name > } > } > } > Component { > id: footerAndHeader > Rectangle { > width: parent.width > height: 40 > gradient: Gradient { > GradientStop { > position: 0.00; > color: "#6d6d6d"; > } > GradientStop { > position: 1.00; > color: "#222222"; > } > } > } > } > > } > //###### End Example###### > _______________________________________________ > Qt-qml mailing list > Qt-qml@trolltech.com > http://lists.trolltech.com/mailman/listinfo/qt-qml _______________________________________________ Qt-qml mailing list Qt-qml@trolltech.com http://lists.trolltech.com/mailman/listinfo/qt-qml