How can sort QStringListModel?
Thanks a lot.
An alternative to the QStringListModel::sort()
method is to use the QStringList::sort()
method on the string list stored into the model. This approach is not as efficient as using the QStringListModel::sort()
.
QStringList list = stringListModel->stringList();
list.sort();
stringListModel->setStringList(list);