summaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2014-06-26 14:57:25 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-06-26 15:48:49 -0700
commit81fd56b16fd4678626a9cadec7311fffbccec502 (patch)
treeea85b3572448cbc392da4e65c0a41512f2d04f9c /qt-ui
parent1e2349e7945b0f56fef503179dd0550db0137495 (diff)
downloadsubsurface-81fd56b16fd4678626a9cadec7311fffbccec502.tar.gz
Fixed changing dates with the new date widget.
The maintab was connecting with an invalid slot on the new date widget, QDateTime instead of QDate Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/maintab.cpp10
-rw-r--r--qt-ui/maintab.h2
2 files changed, 7 insertions, 5 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index 15759d7ec..d46f364fb 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -948,13 +948,14 @@ void MainTab::validate_temp_field(QLineEdit *tempField, const QString &text)
}
}
-void MainTab::on_dateEdit_dateChanged(const QDateTime &datetime)
+void MainTab::on_dateEdit_dateChanged(const QDate &date)
{
if (editMode == NONE)
return;
- QDateTime dateTimeUtc(datetime);
- dateTimeUtc.setTimeSpec(Qt::UTC);
- editedDive.when = dateTimeUtc.toTime_t();
+ QDateTime dateTime = QDateTime::fromTime_t(editedDive.when);
+ dateTime.setTimeSpec(Qt::UTC);
+ dateTime.setDate(date);
+ editedDive.when = dateTime.toTime_t();
markChangedWidget(ui.dateEdit);
}
@@ -963,6 +964,7 @@ void MainTab::on_timeEdit_timeChanged(const QTime &time)
if (editMode == NONE)
return;
QDateTime dateTime = QDateTime::fromTime_t(editedDive.when);
+ dateTime.setTimeSpec(Qt::UTC);
dateTime.setTime(time);
editedDive.when = dateTime.toTime_t();
markChangedWidget(ui.timeEdit);
diff --git a/qt-ui/maintab.h b/qt-ui/maintab.h
index 1e7b5d3a3..f20af8477 100644
--- a/qt-ui/maintab.h
+++ b/qt-ui/maintab.h
@@ -68,7 +68,7 @@ slots:
void on_airtemp_textChanged(const QString &text);
void on_watertemp_textChanged(const QString &text);
void validate_temp_field(QLineEdit *tempField, const QString &text);
- void on_dateEdit_dateChanged(const QDateTime &datetime);
+ void on_dateEdit_dateChanged(const QDate &date);
void on_timeEdit_timeChanged(const QTime & time);
void on_rating_valueChanged(int value);
void on_visibility_valueChanged(int value);