Merge lp:~osomon/ubuntu-ui-toolkit/fix-SortFilterModel-1485674-staging into lp:ubuntu-ui-toolkit/staging

Proposed by Olivier Tilloy on 2015-08-20
Status: Merged
Approved by: Zsombor Egri on 2015-08-20
Approved revision: 1614
Merged at revision: 1614
Proposed branch: lp:~osomon/ubuntu-ui-toolkit/fix-SortFilterModel-1485674-staging
Merge into: lp:ubuntu-ui-toolkit/staging
Diff against target: 18 lines (+6/-3)
1 file modified
src/Ubuntu/Components/plugin/sortfiltermodel.cpp (+6/-3)
To merge this branch: bzr merge lp:~osomon/ubuntu-ui-toolkit/fix-SortFilterModel-1485674-staging
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve on 2015-08-20
Zsombor Egri 2015-08-20 Approve on 2015-08-20
Review via email: mp+268627@code.launchpad.net

Commit message

Take custom key indexes into account to allow sorting on custom roles.

To post a comment you must log in.
Zsombor Egri (zsombi) wrote :

It was reviewed before, approving.

review: Approve
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Ubuntu/Components/plugin/sortfiltermodel.cpp'
2--- src/Ubuntu/Components/plugin/sortfiltermodel.cpp 2015-03-03 13:47:48 +0000
3+++ src/Ubuntu/Components/plugin/sortfiltermodel.cpp 2015-08-20 17:10:36 +0000
4@@ -113,9 +113,12 @@
5 QSortFilterProxyModelQML::roleByName(const QString& roleName) const
6 {
7 const QHash<int, QByteArray> roles = roleNames();
8- for(int role = 0; role < roles.count(); role++)
9- if (roles[role] == roleName)
10- return role;
11+ QHashIterator<int, QByteArray> i(roles);
12+ while (i.hasNext()) {
13+ i.next();
14+ if (i.value() == roleName)
15+ return i.key();
16+ }
17 return 0;
18 }
19

Subscribers

People subscribed via source and target branches