aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/maintab.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qt-ui/maintab.cpp')
-rw-r--r--qt-ui/maintab.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index c64ef5b14..15759d7ec 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -75,6 +75,7 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
ui.airtemp->installEventFilter(this);
ui.watertemp->installEventFilter(this);
ui.dateEdit->installEventFilter(this);
+ ui.timeEdit->installEventFilter(this);
ui.tagWidget->installEventFilter(this);
QList<QObject *> statisticsTabWidgets = ui.statisticsTab->children();
@@ -391,7 +392,7 @@ void MainTab::updateDiveInfo(int dive)
if (d) {
updateGpsCoordinates(d);
ui.dateEdit->setDate(QDateTime::fromTime_t(d->when).date());
- //TODO: set also the time when the widget is ready.
+ ui.timeEdit->setTime(QDateTime::fromTime_t(d->when).time());
if (MainWindow::instance() && MainWindow::instance()->dive_list()->selectedTrips().count() == 1) {
setTabText(0, tr("Trip Notes"));
// only use trip relevant fields
@@ -789,6 +790,7 @@ void MainTab::resetPallete()
ui.airtemp->setPalette(p);
ui.watertemp->setPalette(p);
ui.dateEdit->setPalette(p);
+ ui.timeEdit->setPalette(p);
ui.tagWidget->setPalette(p);
}
@@ -956,6 +958,16 @@ void MainTab::on_dateEdit_dateChanged(const QDateTime &datetime)
markChangedWidget(ui.dateEdit);
}
+void MainTab::on_timeEdit_timeChanged(const QTime &time)
+{
+ if (editMode == NONE)
+ return;
+ QDateTime dateTime = QDateTime::fromTime_t(editedDive.when);
+ dateTime.setTime(time);
+ editedDive.when = dateTime.toTime_t();
+ markChangedWidget(ui.timeEdit);
+}
+
bool MainTab::tagsChanged(dive *a, dive *b)
{
char bufA[1024], bufB[1024];