D17725: [RFC] Fix model updates in RunnerMatchesModel

David Edmundson noreply at phabricator.kde.org
Fri Dec 21 22:44:22 GMT 2018


davidedmundson created this revision.
davidedmundson added a reviewer: Plasma.
Herald added a project: Plasma.
Herald added a subscriber: plasma-devel.
davidedmundson requested review of this revision.

REVISION SUMMARY
  RunnerMatchesModel is backed by a list. When this list changes
  RunnerManagerModel added/removed the new number of rows then called
  dataChanged on everything that remained.
  
  It's a common pattern, but not a great one. Especially with QtQuick
  where moving a delegate is faster than updating all the properties of an
  existing one - unfortunately I can't find a nice solution to do this
  properly in linear time.
  
  The problem with the current code is we update the entire list in the
  insert/remove rows. This is a violation of the model rules as we're
  updating rows outside the rows listed inside begin/remove rows.
  
  It works, but Qt's model test fails.
  
  We also have a lot of duplicates of a crash in QtQuick after runner
  model changes, bug 369430. I think it could be related, but can't 
  prove anything.
  
  This patch updates the rows that exist in both the before and after
  models before adding/removing the remaining rows.
  
  BUG: 402439

TEST PLAN
  Added Qt model tester in https://phabricator.kde.org/P283
  It now passes.

REPOSITORY
  R119 Plasma Desktop

BRANCH
  master

REVISION DETAIL
  https://phabricator.kde.org/D17725

AFFECTED FILES
  applets/kicker/plugin/runnermatchesmodel.cpp

To: davidedmundson, #plasma
Cc: plasma-devel, GB_2, ragreen, Pitel, ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20181221/78a15ffb/attachment-0001.html>


More information about the Plasma-devel mailing list