<table><tr><td style="">hein created this revision.<br />hein added reviewers: Plasma, davidedmundson, mart.<br />Restricted Application added a project: Plasma.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D8723" rel="noreferrer">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>This introduces the use of QQmlParserStatus to delay populating<br />
the model until all properties have been set, to avoid delegate<br />
churn.</p>

<p>TasksModel is also meant to be used by C++. There's no good way<br />
to determine whether an object is being instanciated by QML<br />
during construction time, therefore this patch also introduces a<br />
delay in initial population of the model after construction via<br />
a single-shot timer. At the time the slot is invoked we know if<br />
we're used by QML (because QQmlParserStatus::classBegin has<br />
either been called or not by then) so we can decide to populate<br />
or wait more for QQmlParserStatus::componentComplete.</p>

<p>I'm not super happy with this behavior change for C++ users,<br />
however as the model is usually used via QML currently, it's<br />
pragmatic to optimize performance for the common case, and it<br />
doesn't technically break QAbstractItemModel semantics, as model<br />
population isn't required to be sync.</p>

<p>There's a decent change this fixes a recently-reported crash as a<br />
by-product:<br />
CCBUG:386630</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R120 Plasma Workspace</div></div></div><br /><div><strong>BRANCH</strong><div><div>master</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D8723" rel="noreferrer">https://phabricator.kde.org/D8723</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>libtaskmanager/tasksmodel.cpp<br />
libtaskmanager/tasksmodel.h</div></div></div><br /><div><strong>To: </strong>hein, Plasma, davidedmundson, mart<br /><strong>Cc: </strong>plasma-devel, ZrenBot, progwolff, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart<br /></div>