Originally we do not consider actual addition places for room timeline, and cheat by telling Qt everything is inserted at the latest end of the timeline. This causes problems for item-reuse in the list view, and scrolling to the early end of the timeline ("up") will sometimes cause items to jump. Now we implement a diff algorithm for the model. When the cursor is updated, the internal state will be updated according to Qt's expectations.
Our diff algorithm takes O(N) time, and the application of the diff takes effectively O(C logN) time, where N is the length of timeline and C is the number of changes. However, the time for Qt to update the model indices is O(CN). We cannot avoid this cost unless we implement our own list view. This is possible but we shall now postpone it for further work.
Type: add