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 ?
-
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 } }
}@