subsurface/profile-widget/tooltipitem.h
Berthold Stoeger d0c26f42d7 profile: implement animation of the tooltip item
To do so, generalize the animation routine.

This seems to expose a QtQuick bug: we get spurious
hover-events when the tooltip item is updated in the
animation. We have to check for that to prevent
en endless loop (until the user moves the mouse out
of the profile window).

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-09-12 15:15:32 +02:00

31 lines
692 B
C++

// SPDX-License-Identifier: GPL-2.0
#ifndef PROFILE_TOOLTIPITEM_H
#define PROFILE_TOOLTIPITEM_H
#include "qt-quick/chartitem.h"
#include <QFont>
#include <QPixmap>
struct dive;
struct plot_info;
class ToolTipItem : public AnimatedChartRectItem {
public:
ToolTipItem(ChartView &view, double dpr);
void update(const dive *d, double dpr, int time, const plot_info &pInfo,
const std::vector<std::pair<QString, QPixmap>> &events, bool inPlanner, int animSpeed);
private:
QFont font;
QFontMetrics fm;
double fontHeight;
QPixmap title;
double width, height;
QPixmap stringToPixmap(const QString &s) const;
void stopDrag(QPointF pos) override;
};
#endif // PROFILE_TOOLTIPITEM