From 45395fd466a8d71a1600cf182d08d4aa45d3b892 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Wed, 16 May 2018 15:25:57 +0200 Subject: Dive pictures: Don't plot pictures twice when changing current dive In MainWindow::current_dive_changed() first plotDive() is called, which replots all the pictures by calling plotPictures(). This is pointess, because it plots the pictures of the previous dive. Then, updateDiveInfo() is called, which resets the dive pictures and automatically replots them. Thus, switching between dives both with hundreds of pictures is way slower than necessary. Switching the plotDive() and updateDiveInfo() calls doesn't work. The reason is not 100% clear, but it doesn't make sense to plot pictures of the new dive as long as the profile still shows the old dive anyway. As a quick-fix, add a flag to plotDive(), which tells the function to clear the pictures list instead of redrawing it. Ultimately, plotDive() should probably be split in two functions. One for the callers who update the pictures themselves and one for the others. Signed-off-by: Berthold Stoeger --- profile-widget/profilewidget2.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'profile-widget/profilewidget2.h') diff --git a/profile-widget/profilewidget2.h b/profile-widget/profilewidget2.h index d13ff194b..545c6475d 100644 --- a/profile-widget/profilewidget2.h +++ b/profile-widget/profilewidget2.h @@ -73,7 +73,7 @@ public: ProfileWidget2(QWidget *parent = 0); void resetZoom(); - void plotDive(struct dive *d = 0, bool force = false); + void plotDive(struct dive *d = 0, bool force = false, bool clearPictures = false); void setupItem(AbstractProfilePolygonItem *item, DiveCartesianAxis *vAxis, int vData, int hData, int zValue); void setPrintMode(bool mode, bool grayscale = false); bool getPrintMode(); -- cgit v1.2.3-70-g09d2