profile: don't use scene for zooming

We were using the QGraphicsScene machinery to zoom into the
plot. This not only zoomed into the dive, but into the whole
thing. In general, one couldn't see the axes anymore.

Instead, adjust the range of the time-axis according to the
zoom-level and position.

Of course, the code isn't adapted to that and the result
is comical. The chart features will have to be fixed
one-by-one. Oh joy.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2021-10-06 21:01:58 +02:00 committed by Dirk Hohndel
parent 7d3e246680
commit c09382036f
4 changed files with 36 additions and 64 deletions

View file

@ -46,7 +46,6 @@ public:
ProfileWidget2(DivePlannerPointsModel *plannerModel, double dpr, QWidget *parent = 0);
~ProfileWidget2();
void resetZoom();
void scale(qreal sx, qreal sy);
void plotDive(const struct dive *d, int dc, bool clearPictures = false, bool instant = false);
void setProfileState(const struct dive *d, int dc);
void setPlanState(const struct dive *d, int dc);
@ -111,8 +110,8 @@ private:
void dragMoveEvent(QDragMoveEvent *event) override;
void replot();
void setZoom(int level);
void changeGas(int tank, int seconds);
void scrollViewTo(const QPoint &pos);
void setupSceneAndFlags();
void addItemsToScene();
void setupItemOnScene();
@ -136,6 +135,7 @@ private:
DivePlannerPointsModel *plannerModel; // If null, no planning supported.
int zoomLevel;
double zoomedPosition; // Position, when zoomed: 0.0 = beginning, 1.0 = end.
#ifndef SUBSURFACE_MOBILE
ToolTipItem *toolTipItem;
#endif