From b0faf2e4b1e586224f6400d6d8b889503710a18f Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Mon, 27 Sep 2021 09:37:15 +0200 Subject: [PATCH] profile: remove DiveCartesianAxis::sizeChanged() signal This was used to animate the position of the dive event items when the size of the axis changed. However, that doesn't work since quite some time. The axes size are changed when 1) switching dives 2) resizing the drawing area In the first case, the dive event items are fully recalculated. In the second case, animation speed is set to instant, since resizing of windows is done continuously on any reasonably modern desktop anyway. It might make sense on mobile, where size changes are discontinuous, but there we use static profiles anyway. Moreover, I checked a few applications and none of them had animations when switching orientation of my tablet. Let's just remove this disfunctional thing and replace it later, should someone complain. Signed-off-by: Berthold Stoeger --- profile-widget/divecartesianaxis.cpp | 1 - profile-widget/divecartesianaxis.h | 3 --- profile-widget/diveeventitem.cpp | 16 +++++----------- profile-widget/diveeventitem.h | 4 +--- 4 files changed, 6 insertions(+), 18 deletions(-) diff --git a/profile-widget/divecartesianaxis.cpp b/profile-widget/divecartesianaxis.cpp index 8e2b0aa68..d418e3ced 100644 --- a/profile-widget/divecartesianaxis.cpp +++ b/profile-widget/divecartesianaxis.cpp @@ -311,7 +311,6 @@ void DiveCartesianAxis::animateChangeLine(const QRectF &rectIn, int animSpeed) break; } updateTicks(animSpeed); - sizeChanged(); } double DiveCartesianAxis::Transform::to(double x) const diff --git a/profile-widget/divecartesianaxis.h b/profile-widget/divecartesianaxis.h index 2d9115cba..d9edd4277 100644 --- a/profile-widget/divecartesianaxis.h +++ b/profile-widget/divecartesianaxis.h @@ -52,9 +52,6 @@ public: double width() const; // only for vertical axes double height() const; // only for horizontal axes -signals: - void sizeChanged(); - protected: Position position; int fractionalDigits; diff --git a/profile-widget/diveeventitem.cpp b/profile-widget/diveeventitem.cpp index 3ad5765ab..f756e2f33 100644 --- a/profile-widget/diveeventitem.cpp +++ b/profile-widget/diveeventitem.cpp @@ -27,10 +27,7 @@ DiveEventItem::DiveEventItem(const struct dive *d, struct event *ev, struct gasm setupPixmap(lastgasmix, pixmaps); setupToolTipString(lastgasmix); - recalculatePos(0); - - connect(vAxis, &DiveCartesianAxis::sizeChanged, this, - [speed, this] { recalculatePos(speed); }); + recalculatePos(); } DiveEventItem::~DiveEventItem() @@ -228,7 +225,7 @@ bool DiveEventItem::shouldBeHidden() return false; } -void DiveEventItem::recalculatePos(int speed) +void DiveEventItem::recalculatePos() { if (!ev) return; @@ -238,10 +235,7 @@ void DiveEventItem::recalculatePos(int speed) return; } setVisible(!shouldBeHidden()); - qreal x = hAxis->posAtValue(ev->time.seconds); - qreal y = vAxis->posAtValue(depth); - if (speed > 0) - Animations::moveTo(this, speed, x, y); - else - setPos(x, y); + double x = hAxis->posAtValue(ev->time.seconds); + double y = vAxis->posAtValue(depth); + setPos(x, y); } diff --git a/profile-widget/diveeventitem.h b/profile-widget/diveeventitem.h index 2ddabade5..82e1773fb 100644 --- a/profile-widget/diveeventitem.h +++ b/profile-widget/diveeventitem.h @@ -24,13 +24,11 @@ public: bool shouldBeHidden(); static bool isInteresting(const struct dive *d, const struct divecomputer *dc, const struct event *ev, const struct plot_info &pi); -public -slots: - void recalculatePos(int animationSpeed); private: void setupToolTipString(struct gasmix lastgasmix); void setupPixmap(struct gasmix lastgasmix, const DivePixmaps &pixmaps); + void recalculatePos(); DiveCartesianAxis *vAxis; DiveCartesianAxis *hAxis; struct event *ev;