mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
QML UI: correctly update the model
In order to trigger the redraw of an edited dive we need to make sure the model realizes that it has been updated. So far the only way to make sure this happens reliably appears to be to remove the item and re-insert it. Seems weird, but with this the bug of not redrawing the profile after an edit appears fixed. Fixes #1419 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
f638b7ef80
commit
dde2049027
1 changed files with 4 additions and 2 deletions
|
@ -94,8 +94,10 @@ void DiveListModel::removeDiveById(int id)
|
|||
void DiveListModel::updateDive(int i, dive *d)
|
||||
{
|
||||
DiveObjectHelper *newDive = new DiveObjectHelper(d);
|
||||
m_dives.replace(i, newDive);
|
||||
emit dataChanged(createIndex(i, 0), createIndex(i, 0));
|
||||
// we need to make sure that QML knows that this dive has changed -
|
||||
// the only reliable way I've found is to remove and re-insert it
|
||||
removeDive(i);
|
||||
insertDive(i, newDive);
|
||||
}
|
||||
|
||||
void DiveListModel::clear()
|
||||
|
|
Loading…
Add table
Reference in a new issue