quotient-im / Quaternion

A Qt-based IM client for Matrix
https://matrix.org/ecosystem/clients/quaternion/
GNU General Public License v3.0
642 stars 107 forks source link

Make TimelineItem lighter #801

Closed KitsuneRal closed 2 years ago

KitsuneRal commented 2 years ago

TimelineItem grew to be a pretty big component for a ListView delegate that is supposed to be lightweight. Most of its content belongs to it; but some things really don't, mainly things that don't depend on a particular item context (basically, everything that doesn't depend on model roles) and things that could be calculated on C++ side instead of doing it in JavaScript. This PR moves things around to make item instantiation lighter.

There's yet another problem with the TimelineItem - it's stateful in the part of showing/hiding the details. This is counter to Qt guidelines, which strongly advise to not put any kind of state in a delegate. This problem should be addressed separately.