summaryrefslogtreecommitdiff
path: root/src/charts/ChartMarker.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/charts/ChartMarker.h')
-rw-r--r--src/charts/ChartMarker.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/charts/ChartMarker.h b/src/charts/ChartMarker.h
new file mode 100644
index 0000000..1f3d81e
--- /dev/null
+++ b/src/charts/ChartMarker.h
@@ -0,0 +1,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