From a9ba98942ccdacda37fa038fef46c478271aca22 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Mon, 1 Jun 2015 22:16:07 -0300 Subject: 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 Signed-off-by: Dirk Hohndel --- qt-ui/locationinformation.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'qt-ui') 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(); } -- cgit v1.2.3-70-g09d2