// Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only import QtQuick 2.0 Rectangle { height: 400 width: 300 property int sets: 1 ListModel { id: listmodel Component.onCompleted: addNames() } ListView { id: listview model: listmodel height: 300 width: 200 clip: true anchors.centerIn: parent section.delegate: del1 section.criteria: ViewSection.FirstCharacter section.property: "name" delegate: Rectangle { height: 50 width: 200 color: "gold" border.color: "black" Text { anchors.centerIn: parent text: model.name+" ["+model.id+"]" color: "black" font.bold: true } } } function addNames() { var names = ["Alpha","Bravo","Charlie","Delta","Echo","Foxtrot", "Golf","Hotel","India","Juliet","Kilo","Lima","Mike", "November","Oscar","Papa","Quebec","Romeo","Sierra","Tango", "Uniform","Victor","Whiskey","XRay","Yankee","Zulu"]; for (var i=0;i