diff --git a/declarativeimports/core/datamodel.cpp b/declarativeimports/core/datamodel.cpp index 80974893f..d257e5e5e 100644 --- a/declarativeimports/core/datamodel.cpp +++ b/declarativeimports/core/datamodel.cpp @@ -47,17 +47,17 @@ SortFilterModel::~SortFilterModel() void SortFilterModel::syncRoleNames() { - if (!sourceModel() || sourceModel()->roleNames() == roleNames()) { + if (!sourceModel()) { return; } m_roleIds.clear(); - - setRoleNames(sourceModel()->roleNames()); QHash::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); }