mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Correctly change the dive_site name
Correctly change and update the dive_site, updating the name on the combobox or other attached views. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
64753e0682
commit
a9ba98942c
3 changed files with 22 additions and 4 deletions
|
|
@ -60,3 +60,18 @@ int32_t LocationInformationModel::addDiveSite(const QString& name, int lon, int
|
|||
update();
|
||||
return uuid;
|
||||
}
|
||||
|
||||
bool LocationInformationModel::setData(const QModelIndex &index, const QVariant &value, int role)
|
||||
{
|
||||
if (!index.isValid())
|
||||
return false;
|
||||
|
||||
if (role != Qt::EditRole)
|
||||
return false;
|
||||
|
||||
struct dive_site *ds = get_dive_site(index.row());
|
||||
free(ds->name);
|
||||
ds->name = copy_string(qPrintable(value.toString()));
|
||||
emit dataChanged(index, index);
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue