Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Only store room pointer in the model
When `ChatRoomWidget::setRoom()` is called, it also (naturally) calls `MessageEventModel::changeRoom()`, which in turn resets the model, with appropriate `beginResetModel()`/`endResetModel()` brackets. Some actions in QML are connected to both `modelAboutToBeReset` and `modelReset`, respectively - at the time, it's just "parking" the read marker visuals that don't depend on room for the former; but more is coming that does depend on the room. Now the problem is that if `ChatRoomWidget` has its own snapshot of the current room pointer there's no way to order `MEM::changeRoom()` and the reset of `CRW::setRoom()` logic (that, notably, sets the `room` context property in QML!) so that `room` in QML had the correct value in both signal handlers, just before and after resetting the model. The solution is to put the one true current room pointer to where it belongs - the model - and provide a means for `ChatRoomWidget` (`MessageEventModel::room()` method) and QML (`room` Q_PROPERTY) to access it.
- Loading branch information