diff options
author | Tomaz Canabrava <tomaz.canabrava@gmail.com> | 2015-06-01 22:16:07 -0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-06-01 21:31:16 -0700 |
commit | a9ba98942ccdacda37fa038fef46c478271aca22 (patch) | |
tree | 992f603753a72262bad8d79dbe3cbc651bfeff28 /qt-ui/locationinformation.cpp | |
parent | 64753e0682d1fd008d9cdf573e78fe5ea862dcef (diff) | |
download | subsurface-a9ba98942ccdacda37fa038fef46c478271aca22.tar.gz |
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>
Diffstat (limited to 'qt-ui/locationinformation.cpp')
-rw-r--r-- | qt-ui/locationinformation.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/qt-ui/locationinformation.cpp b/qt-ui/locationinformation.cpp index b6c4f7fa9..25d3ddecb 100644 --- a/qt-ui/locationinformation.cpp +++ b/qt-ui/locationinformation.cpp @@ -202,9 +202,12 @@ void LocationInformationWidget::on_diveSiteDescription_textChanged(const QString void LocationInformationWidget::on_diveSiteName_textChanged(const QString& text) { - if (!currentDs || !same_string(qPrintable(text), currentDs->name)) { - free(displayed_dive_site.name); - displayed_dive_site.name = copy_string(qPrintable(text)); + if (currentDs && text != currentDs->name) { + // This needs to be changed directly into the model so that + // the changes are replyed on the ComboBox with the current selection. + + QModelIndex idx = ui.currentLocation->model()->index(ui.currentLocation->currentIndex(),0); + LocationInformationModel::instance()->setData(idx, text, Qt::EditRole); markChangedWidget(ui.diveSiteName); emit coordinatesChanged(); } |