diff options
-rw-r--r-- | desktop-widgets/mainwindow.cpp | 7 | ||||
-rw-r--r-- | desktop-widgets/printer.cpp | 2 | ||||
-rw-r--r-- | profile-widget/profilewidget2.cpp | 10 | ||||
-rw-r--r-- | profile-widget/profilewidget2.h | 2 |
4 files changed, 8 insertions, 13 deletions
diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp index a0a0dded0..efe83ad9b 100644 --- a/desktop-widgets/mainwindow.cpp +++ b/desktop-widgets/mainwindow.cpp @@ -453,13 +453,12 @@ void MainWindow::selectionChanged() if (!current_dive) { mainTab->clearTabs(); mainTab->updateDiveInfo(); - graphics->setEmptyState(); } else { - graphics->plotDive(nullptr, false, true); mainTab->updateDiveInfo(); configureToolbar(); enableDisableOtherDCsActions(); } + graphics->plotDive(current_dive, false, true); MapWidget::instance()->selectionChanged(); } @@ -1112,7 +1111,7 @@ void MainWindow::on_actionPreviousDC_triggered() unsigned nrdc = number_of_computers(current_dive); dc_number = (dc_number + nrdc - 1) % nrdc; configureToolbar(); - graphics->plotDive(nullptr, false, true); + graphics->plotDive(current_dive, false, true); mainTab->updateDiveInfo(); } @@ -1121,7 +1120,7 @@ void MainWindow::on_actionNextDC_triggered() unsigned nrdc = number_of_computers(current_dive); dc_number = (dc_number + 1) % nrdc; configureToolbar(); - graphics->plotDive(nullptr, false, true); + graphics->plotDive(current_dive, false, true); mainTab->updateDiveInfo(); } diff --git a/desktop-widgets/printer.cpp b/desktop-widgets/printer.cpp index 9de1e41be..cd7c11345 100644 --- a/desktop-widgets/printer.cpp +++ b/desktop-widgets/printer.cpp @@ -185,7 +185,7 @@ void Printer::render(int Pages = 0) qPrefDisplay::set_animation_speed(animationOriginal); //replot the dive after returning the settings - profile->plotDive(0, true, true); + profile->plotDive(current_dive, true, true); } //value: ranges from 0 : 100 and shows the progress of the templating engine diff --git a/profile-widget/profilewidget2.cpp b/profile-widget/profilewidget2.cpp index f0afc0e73..71db3d66f 100644 --- a/profile-widget/profilewidget2.cpp +++ b/profile-widget/profilewidget2.cpp @@ -381,8 +381,7 @@ void ProfileWidget2::setupItemOnScene() void ProfileWidget2::replot() { - dataModel->clear(); - plotDive(nullptr, true, false); + plotDive(current_dive, true, false); } void ProfileWidget2::createPPGas(PartialPressureGasItem *item, int verticalColumn, color_index_t color, color_index_t colorAlert, @@ -566,11 +565,8 @@ void ProfileWidget2::plotDive(const struct dive *d, bool force, bool doClearPict #endif if (currentState != ADD && currentState != PLAN) { if (!d) { - if (!current_dive) { - setEmptyState(); - return; - } - d = current_dive; // display the current dive + setEmptyState(); + return; } // No need to do this again if we are already showing the same dive diff --git a/profile-widget/profilewidget2.h b/profile-widget/profilewidget2.h index 2e530261d..96191a1d6 100644 --- a/profile-widget/profilewidget2.h +++ b/profile-widget/profilewidget2.h @@ -76,7 +76,7 @@ public: ~ProfileWidget2(); void resetZoom(); void scale(qreal sx, qreal sy); - void plotDive(const struct dive *d = 0, bool force = false, bool clearPictures = false, bool instant = false); + void plotDive(const struct dive *d, bool force = false, bool clearPictures = false, bool instant = false); void setupItem(AbstractProfilePolygonItem *item, DiveCartesianAxis *vAxis, int vData, int hData, int zValue); void setPrintMode(bool mode, bool grayscale = false); bool getPrintMode(); |