profile: convert the "ruler item" to qt-quick

Code is mostly based on the "tooltip item". The dragging code was
slightly reworked to be more logical. A "disk item" was added for
the handles.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2024-01-12 22:26:32 +01:00
parent b167e130a4
commit ea0085fef6
14 changed files with 313 additions and 228 deletions

View file

@ -13,6 +13,7 @@ class ProfileAnimation;
class ProfileScene;
class ToolTipItem;
struct picture;
class RulerItem;
class ProfileView : public ChartView {
Q_OBJECT
@ -40,6 +41,7 @@ public:
void clear();
void resetZoom();
void anim(double fraction);
void rulerDragged(); // Called by the RulterItem when a handle was dragged.
// For mobile
Q_INVOKABLE void pinchStart();
@ -84,6 +86,10 @@ private:
void updateTooltip(QPointF pos, bool plannerMode, int animSpeed);
std::unique_ptr<ProfileAnimation> tooltip_animation;
std::unique_ptr<RulerItem> ruler;
void updateRuler(int animSpeed);
std::unique_ptr<ProfileAnimation> ruler_animation;
QPointF previousHoverMovePosition;
// The list of pictures in this plot. The pictures are sorted by offset in seconds.