SortFilterModel: Do not sort by default

It seems QML sets properties to their default value at startup and thus
calls setSortRole(QString()), which causes SortFilterModel to sort by
default.

CCMAIL: mart@kde.org
This commit is contained in:
Aurélien Gâteau 2012-06-13 23:56:13 +02:00
parent 01b7135299
commit 5c1e49fa76

View File

@ -103,9 +103,16 @@ QString SortFilterModel::filterRole() const
void SortFilterModel::setSortRole(const QString &role)
{
QSortFilterProxyModel::setSortRole(roleNameToId(role));
if (m_sortRole == role) {
return;
}
m_sortRole = role;
sort(0, sortOrder());
if (role.isEmpty()) {
sort(-1, Qt::AscendingOrder);
} else {
QSortFilterProxyModel::setSortRole(roleNameToId(role));
sort(0, sortOrder());
}
}
QString SortFilterModel::sortRole() const