diff options
-rw-r--r-- | qt-ui/maintab.cpp | 16 | ||||
-rw-r--r-- | qt-ui/maintab.h | 2 | ||||
-rw-r--r-- | qt-ui/mainwindow.cpp | 1 |
3 files changed, 19 insertions, 0 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index 8d196a872..84f29e6e8 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -60,6 +60,22 @@ void MainTab::clearStats() ui->shortestAllText->setText(QString()); } +void MainTab::updateDiveInfo(int dive) +{ + // So, this is what happens now: + // Every tab should be populated from this method, + // it will be called whenever a new dive is selected + // I'm already populating the 'notes' box + // to show how it can be done. + // If you are unsure what's the name of anything, + // open the file maintab.ui on the designer + // click on the item and check its objectName, + // the access is ui->objectName from here on. + + struct dive *d = get_dive(dive); + ui->notes->setText(d->notes); +} + void MainTab::on_addCylinder_clicked() { if (cylindersModel->rowCount() >= MAX_CYLINDERS) diff --git a/qt-ui/maintab.h b/qt-ui/maintab.h index cf83e0dfe..e09781362 100644 --- a/qt-ui/maintab.h +++ b/qt-ui/maintab.h @@ -35,6 +35,8 @@ public Q_SLOTS: void on_editWeight_clicked(); void on_delWeight_clicked(); + void updateDiveInfo(int dive); + private: Ui::MainTab *ui; WeightModel *weightModel; diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index f29c82588..e8fe80460 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -94,6 +94,7 @@ void MainWindow::dive_selection_changed(const QItemSelection& newSelection, cons select_dive(get_divenr(d)); } ui->ProfileWidget->plot(get_dive(selected_dive)); + ui->InfoWidget->updateDiveInfo(selected_dive); } void MainWindow::on_actionSave_triggered() |