turns out we have to set the role names constantly to make sorting actually work

even just setting the sort/filter roles is not enough. role names must also be set again!
gaaaah. thankfully this seems to be very fast, though would still be nice to avoid it if
possible somehow.

CCBUG:308101
This commit is contained in:
Aaron Seigo 2012-10-09 11:29:30 +02:00
parent 19a7d82ed9
commit c42d979a56

View File

@ -47,17 +47,17 @@ SortFilterModel::~SortFilterModel()
void SortFilterModel::syncRoleNames()
{
if (!sourceModel() || sourceModel()->roleNames() == roleNames()) {
if (!sourceModel()) {
return;
}
m_roleIds.clear();
setRoleNames(sourceModel()->roleNames());
QHash<int, QByteArray>::const_iterator i;
for (i = roleNames().constBegin(); i != roleNames().constEnd(); ++i) {
m_roleIds[i.value()] = i.key();
}
setRoleNames(sourceModel()->roleNames());
setFilterRole(m_filterRole);
setSortRole(m_sortRole);
}