List view section from QStringList
-
Hi,
i made a list view in qml, which uses for model a QStinrgList like "this example":http://developer.qt.nokia.com/doc/qt-4.8/declarative-modelviews-stringlistmodel.html
and i want to make sections in the view for the first letter of the string item in the list, how can i do that ?
-
well, i added the following on the previous example and didn't work
@section.criteria: ViewSection.FirstCharacter
section.property: myModel[0]
section.delegate: Rectangle{color: "green"; width: parent.width; height: 20}
@ -
well, i don't understand what you mean exactly
but i tried to replace myModel with modelData and it got me and error -
here you are
@import QtQuick 1.0
ListView {
width: 100; height: 100
anchors.fill: parentmodel: myModel section.criteria: ViewSection.FirstCharacter section.property: medelData[0] section.delegate: Rectangle{color: "green"; width: parent.width; height: 20} delegate: Rectangle { height: 25 width: 100 Text { text: modelData } }}@
-
try this out
@import QtQuick 1.0ListView {
width: 100; height: 100
anchors.fill: parent
model: myModelsection.criteria: ViewSection.FirstCharacter section.property: "modelData" section.delegate: Rectangle{color: "green"; width: parent.width; height: 20} delegate: Rectangle { height: 25 width: 100 Text { text: modelData } }}@
-
no errors, but also no sections appear