← Back to team overview

touch-packages team mailing list archive

[Bug 1485674] Re: SortFilterModel doesn’t work with custom roles whose keys don’t start at 0

 

** Branch linked: lp:ubuntu/wily-proposed/ubuntu-ui-toolkit

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to ubuntu-ui-toolkit in
Ubuntu.
https://bugs.launchpad.net/bugs/1485674

Title:
  SortFilterModel doesn’t work with custom roles whose keys don’t start
  at 0

Status in ubuntu-ui-toolkit package in Ubuntu:
  In Progress

Bug description:
  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.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/ubuntu-ui-toolkit/+bug/1485674/+subscriptions


References