summaryrefslogtreecommitdiff
path: root/src/charts/ChartMarker.h
blob: 1f3d81ebe6bc7e6e128f53084f2c33fed0b3f14e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#ifndef CHART_MARKER_H
#define CHART_MARKER_H

#include <QtWidgets>

class ChartToolTip;

class ChartMarker: public QGraphicsEllipseItem
{
public:
    ChartMarker(const QPointF& center, const QString& toolTipText);
    ~ChartMarker();
    void paint(QPainter* painter,
        const QStyleOptionGraphicsItem* option, QWidget* widget = 0);

protected:
    void hoverEnterEvent(QGraphicsSceneHoverEvent* event);
    void hoverLeaveEvent(QGraphicsSceneHoverEvent* event);

private:
    void createToolTip();

private:
    static const QColor Color;
    static const int HoverRadius = 15;
    static const int Radius = 2;
    static const int HighlightedRadius = 4;
    static const QPointF ToolTipOffset;

private:
    int radius;
    ChartToolTip* toolTip;
    QString toolTipText;
};

#endif