subsurface/profile-widget/tooltipitem.h
Berthold Stoeger ea0085fef6 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>
2024-09-12 15:17:14 +02:00

32 lines
716 B
C++

// SPDX-License-Identifier: GPL-2.0
#ifndef PROFILE_TOOLTIPITEM_H
#define PROFILE_TOOLTIPITEM_H
#include "qt-quick/chartitem.h"
#include <QFont>
#include <QFontMetrics>
#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