profile: move axis animation code to ProfileView

This feels quite a bit slower than the non-QtQuick version. This
makes sense, as there is an additional level of indirection. Instead
of painting directly, we paint into an QImage and turn that into
a QSGTexture.

Ultimately one would think that we should render directly using
QtQuick. Alas, we can't, since that would mean no more printing/
exporting of profiles. How sad.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2023-05-20 15:22:02 +02:00
parent 15ea0440ad
commit 196a33ba4b
4 changed files with 58 additions and 49 deletions

View file

@ -6,6 +6,7 @@
#include <memory>
class ChartGraphicsSceneItem;
class ProfileAnimation;
class ProfileScene;
class ProfileView : public ChartView {
@ -25,6 +26,7 @@ public:
void plotDive(const struct dive *d, int dc, int flags = RenderFlags::None);
void clear();
void anim(double fraction);
private:
const struct dive *d;
int dc;
@ -32,8 +34,10 @@ private:
double zoomedPosition; // Position when zoomed: 0.0 = beginning, 1.0 = end.
bool empty; // No dive shown.
bool shouldCalculateMax; // Calculate maximum time and depth (default). False when dragging handles.
QColor background;
std::unique_ptr<ProfileScene> profileScene;
ChartItemPtr<ChartGraphicsSceneItem> profileItem;
std::unique_ptr<ProfileAnimation> animation;
void plotAreaChanged(const QSizeF &size) override;
void resetPointers() override;