aboutsummaryrefslogtreecommitdiffstats
path: root/qt-models/divelocationmodel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qt-models/divelocationmodel.cpp')
-rw-r--r--qt-models/divelocationmodel.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/qt-models/divelocationmodel.cpp b/qt-models/divelocationmodel.cpp
index 05d68c27d..d45df349c 100644
--- a/qt-models/divelocationmodel.cpp
+++ b/qt-models/divelocationmodel.cpp
@@ -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;
+}