Public bug reported:
I wanted to replace a custom C++ model in webbrowser-app by a QML
SortFilterModel. My custom model simply does sorting by descending order
on a given role, but this didn’t work. I figured out the reason for
this: the source model being sorted has custom roles, and their keys
don’t start at 0. They are defined using an enum like so:
enum Roles {
Domain = Qt::UserRole + 1,
LastVisit,
LastVisitDate,
LastVisitedTitle,
LastVisitedIcon,
Entries
};
(see http://bazaar.launchpad.net/~phablet-team/webbrowser-
app/trunk/view/head:/src/app/webbrowser/history-domainlist-model.h#L42
and http://bazaar.launchpad.net/~phablet-team/webbrowser-
app/trunk/view/head:/src/app/webbrowser/history-domainlist-
model.cpp#L48).
The implementation of SortFilterModel has a
QSortFilterProxyModelQML::roleByName() method which incorrectly assumes
that role keys start at 0 (see http://bazaar.launchpad.net/~ubuntu-sdk-
team/ubuntu-ui-
toolkit/trunk/view/head:/src/Ubuntu/Components/plugin/sortfiltermodel.cpp#L112).
This method should be fixed to account for custom keys.
** Affects: ubuntu-ui-toolkit (Ubuntu)
Importance: Undecided
Status: New
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1485674
Title:
SortFilterModel doesn’t work with custom roles whose keys don’t start
at 0
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/ubuntu-ui-toolkit/+bug/1485674/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs