D8723: When used by QML, only populate after component is complete

Eike Hein noreply at phabricator.kde.org
Wed Nov 8 14:15:22 UTC 2017


hein created this revision.
hein added reviewers: Plasma, davidedmundson, mart.
Restricted Application added a project: Plasma.

REVISION SUMMARY
  This introduces the use of QQmlParserStatus to delay populating
  the model until all properties have been set, to avoid delegate
  churn.
  
  TasksModel is also meant to be used by C++. There's no good way
  to determine whether an object is being instanciated by QML
  during construction time, therefore this patch also introduces a
  delay in initial population of the model after construction via
  a single-shot timer. At the time the slot is invoked we know if
  we're used by QML (because QQmlParserStatus::classBegin has
  either been called or not by then) so we can decide to populate
  or wait more for QQmlParserStatus::componentComplete.
  
  I'm not super happy with this behavior change for C++ users,
  however as the model is usually used via QML currently, it's
  pragmatic to optimize performance for the common case, and it
  doesn't technically break QAbstractItemModel semantics, as model
  population isn't required to be sync.
  
  There's a decent change this fixes a recently-reported crash as a
  by-product:
  CCBUG:386630

REPOSITORY
  R120 Plasma Workspace

BRANCH
  master

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

AFFECTED FILES
  libtaskmanager/tasksmodel.cpp
  libtaskmanager/tasksmodel.h

To: hein, #plasma, davidedmundson, mart
Cc: plasma-devel, ZrenBot, progwolff, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20171108/9cc35efe/attachment-0001.html>


More information about the Plasma-devel mailing list