Sorting words from SQLite into alphabetical sections
Unsolved
QML and Qt Quick
-
Hi,
I have the following code which is supposed to list the words from an SQLite db into an alphabetized section list (each section corresponds to one letter of the alphabet):import Felgo 3.0 import QtQuick 2.9 import QtQuick.Controls 2.5 import QtQuick.Controls.Styles 1.4 import QtQuick.LocalStorage 2.12 import "Database.js" as JS App { AppListView { anchors.fill: parent // model holds item grouped in sections model: ListModel { id: listModel } // add sections as regular list items delegate: Item { width: parent.width height: contentCol.height // each list-entry holds the section header + section items Column { id: contentCol width: parent.width // header SimpleSection { // manually set otherwise induced section title property string section: model.sectionField width: parent.width enabled: true // clickable sections. onSelected: { sectionItems.visible = !sectionItems.visible } } // items Column { id: sectionItems width: parent.width // show all items of section with repeater Repeater { model: listModel delegate: SimpleRow { text: model.wordField } } } } } Component.onCompleted: { JS.dbGetWordList() } } }
Everything works fine except all words appear under each section regardless of their first character:
Image
How can I fix this?
Thank you for your help.