Skip to content

Commit

Permalink
Only store room pointer in the model
Browse files Browse the repository at this point in the history
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
KitsuneRal committed Aug 30, 2021
1 parent 74728df commit a78ec9e
Show file tree
Hide file tree
Showing 5 changed files with 131 additions and 139 deletions.
Loading

0 comments on commit a78ec9e

Please sign in to comment.