mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 23:03:23 +00:00
Mobile: return dive-id directly from DiveListModel
We don't want to generate a DiveObjectHelper numerous times for every item in the dive list. Therefore, return this datum directly from the model. In this case, don't remove from DiveObjectHelper, as this datum might be used by grantlee templates. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
c6b3309d13
commit
bf081866e9
3 changed files with 8 additions and 5 deletions
|
@ -229,11 +229,11 @@ Kirigami.ScrollablePage {
|
|||
copyButtonVisible = false
|
||||
pasteButtonVisible = false
|
||||
timer.stop()
|
||||
manager.copyDiveData(dive.id)
|
||||
manager.copyDiveData(id)
|
||||
}
|
||||
onPressAndHold: {
|
||||
globalDrawer.close()
|
||||
manager.copyDiveData(dive.id)
|
||||
manager.copyDiveData(id)
|
||||
pageStack.push(settingsCopyWindow)
|
||||
}
|
||||
}
|
||||
|
@ -270,7 +270,7 @@ Kirigami.ScrollablePage {
|
|||
copyButtonVisible = false
|
||||
pasteButtonVisible = false
|
||||
timer.stop()
|
||||
manager.pasteDiveData(dive.id)
|
||||
manager.pasteDiveData(id)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -307,7 +307,7 @@ Kirigami.ScrollablePage {
|
|||
copyButtonVisible = false
|
||||
pasteButtonVisible = false
|
||||
timer.stop()
|
||||
manager.deleteDive(dive.id)
|
||||
manager.deleteDive(id)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -254,6 +254,7 @@ QVariant DiveListModel::data(const QModelIndex &index, int role) const
|
|||
return QStringLiteral("%1 %2").arg(localTime.date().toString(prefs.date_format_short),
|
||||
localTime.time().toString(prefs.time_format));
|
||||
}
|
||||
case IdRole: return d->id;
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
@ -266,6 +267,7 @@ QHash<int, QByteArray> DiveListModel::roleNames() const
|
|||
roles[TripIdRole] = "tripId";
|
||||
roles[TripNrDivesRole] = "tripNrDives";
|
||||
roles[DateTimeRole] = "dateTime";
|
||||
roles[IdRole] = "id";
|
||||
return roles;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,8 @@ public:
|
|||
DiveDateRole,
|
||||
TripIdRole,
|
||||
TripNrDivesRole,
|
||||
DateTimeRole
|
||||
DateTimeRole,
|
||||
IdRole
|
||||
};
|
||||
|
||||
static DiveListModel *instance();
|
||||
|
|
Loading…
Add table
Reference in a new issue