##// END OF EJS Templates
Added hovered support to scatter series
Marek Rosa -
r2261:f149ef311d71
parent child
Show More
@@ -96,6 +96,11 void ScatterChartItem::markerSelected(QGraphicsItem *marker)
96 96 emit XYChart::clicked(calculateDomainPoint(m_markerMap[marker]));
97 97 }
98 98
99 void ScatterChartItem::markerHovered(QGraphicsItem *marker, bool state)
100 {
101 emit XYChart::hovered(calculateDomainPoint(m_markerMap[marker]), state);
102 }
103
99 104 void ScatterChartItem::updateGeometry()
100 105 {
101 106
@@ -55,6 +55,7 public:
55 55 void setBrush(const QBrush &brush);
56 56
57 57 void markerSelected(QGraphicsItem *item);
58 void markerHovered(QGraphicsItem *item, bool state);
58 59
59 60 public Q_SLOTS:
60 61 void handleUpdated();
@@ -84,6 +85,7 public:
84 85 : QGraphicsEllipseItem(x, y, w, h, parent),
85 86 m_parent(parent)
86 87 {
88 setAcceptHoverEvents(true);
87 89 }
88 90
89 91 protected:
@@ -92,6 +94,16 protected:
92 94 m_parent->markerSelected(this);
93 95 QGraphicsEllipseItem::mousePressEvent(event);
94 96 }
97 void hoverEnterEvent(QGraphicsSceneHoverEvent *event)
98 {
99 m_parent->markerHovered(this, true);
100 QGraphicsEllipseItem::hoverEnterEvent(event);
101 }
102 void hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
103 {
104 m_parent->markerHovered(this, false);
105 QGraphicsEllipseItem::hoverLeaveEvent(event);
106 }
95 107
96 108 private:
97 109 ScatterChartItem *m_parent;
@@ -105,6 +117,7 public:
105 117 : QGraphicsRectItem(x, y, w, h, parent),
106 118 m_parent(parent)
107 119 {
120 setAcceptHoverEvents(true);
108 121 }
109 122
110 123 protected:
@@ -113,6 +126,16 protected:
113 126 m_parent->markerSelected(this);
114 127 QGraphicsRectItem::mousePressEvent(event);
115 128 }
129 void hoverEnterEvent(QGraphicsSceneHoverEvent *event)
130 {
131 m_parent->markerHovered(this, true);
132 QGraphicsRectItem::hoverEnterEvent(event);
133 }
134 void hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
135 {
136 m_parent->markerHovered(this, false);
137 QGraphicsRectItem::hoverLeaveEvent(event);
138 }
116 139
117 140 private:
118 141 ScatterChartItem *m_parent;
General Comments 0
You need to be logged in to leave comments. Login now