summaryrefslogtreecommitdiffstats
path: root/qt-ui/profile/profilewidget2.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2014-03-09 10:59:31 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-03-09 08:50:54 -0700
commit24c5b2e3c1bda349c208a94cf8c17fa17af971db (patch)
treec54f66a6d36d3d43d74b84e9119fc4c507a36b7e /qt-ui/profile/profilewidget2.cpp
parentb6bbfdcc5f1d90d00ccc0244e5e9792558d25abd (diff)
downloadsubsurface-24c5b2e3c1bda349c208a94cf8c17fa17af971db.tar.gz
Code Cleanup ( that fix 2 bugs )
This code cleanup fixes the two issues that I raised on my last e-mail. hurrah. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/profile/profilewidget2.cpp')
-rw-r--r--qt-ui/profile/profilewidget2.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp
index 3b8a3d18a..d78b42057 100644
--- a/qt-ui/profile/profilewidget2.cpp
+++ b/qt-ui/profile/profilewidget2.cpp
@@ -209,6 +209,13 @@ void ProfileWidget2::setupItemOnScene()
heartBeatAxis->setLinesVisible(true);
}
+void ProfileWidget2::replot()
+{
+ int diveId = dataModel->id();
+ dataModel->clear();
+ plotDives(QList<dive *>() << getDiveById(diveId));
+}
+
void ProfileWidget2::setupItemSizes()
{
// Scene is *always* (double) 100 / 100.
@@ -431,9 +438,7 @@ void ProfileWidget2::settingsChanged()
}
if (s.value("zoomed_plot").toBool() != isPlotZoomed) {
isPlotZoomed = s.value("zoomed_plot").toBool();
- int diveId = dataModel->id();
- dataModel->clear();
- plotDives(QList<dive *>() << getDiveById(diveId));
+ replot();
}
if (currentState == PROFILE) {
@@ -681,8 +686,5 @@ void ProfileWidget2::changeGas()
fixup_dive(d);
MainWindow::instance()->information()->updateDiveInfo(selected_dive);
mark_divelist_changed(true);
- // force the redraw of the dive.
- //TODO: find a way to make this do not need a full redraw
- dataModel->clear();
- plotDives(QList<dive *>() << getDiveById(diveId));
+ replot();
}