##// END OF EJS Templates
Fixes mouse handling in base class of chartseries
Michal Klocek -
r1747:19ac79b0cec7
parent child
Show More
@@ -143,6 +143,7 void AreaChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *opt
143 143 void AreaChartItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
144 144 {
145 145 emit clicked(m_upper->calculateDomainPoint(event->pos()));
146 ChartItem::mousePressEvent(event);
146 147 }
147 148
148 149 #include "moc_areachartitem_p.cpp"
@@ -45,6 +45,7 void Bar::mousePressEvent(QGraphicsSceneMouseEvent *event)
45 45 {
46 46 Q_UNUSED(event)
47 47 emit clicked(m_index, m_barset);
48 QGraphicsItem::mousePressEvent(event);
48 49 }
49 50
50 51 void Bar::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
@@ -52,6 +53,7 void Bar::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
52 53 Q_UNUSED(event)
53 54 m_hovering = true;
54 55 emit hovered(true, m_barset);
56
55 57 }
56 58
57 59 void Bar::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
@@ -53,15 +53,17 class ChartPresenter: public QObject
53 53 public:
54 54 enum ZValues {
55 55 BackgroundZValue = -1,
56 ShadesZValue,
56 ShadesZValue ,
57 57 GridZValue,
58 58 SeriesZValue,
59 59 LineChartZValue = SeriesZValue,
60 SplineChartZValue = SeriesZValue,
60 61 BarSeriesZValue = SeriesZValue,
61 62 ScatterSeriesZValue = SeriesZValue,
62 63 PieSeriesZValue = SeriesZValue,
63 64 AxisZValue,
64 LegendZValue
65 LegendZValue,
66 TopMostZValue
65 67 };
66 68
67 69 enum State {
@@ -107,6 +107,7 void LineChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *opt
107 107 void LineChartItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
108 108 {
109 109 emit XYChart::clicked(calculateDomainPoint(event->pos()));
110 QGraphicsItem::mousePressEvent(event);
110 111 }
111 112
112 113 #include "moc_linechartitem_p.cpp"
@@ -132,6 +132,7 void PieSliceItem::hoverLeaveEvent(QGraphicsSceneHoverEvent* /*event*/)
132 132 void PieSliceItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
133 133 {
134 134 emit clicked(event->buttons());
135 QGraphicsItem::mousePressEvent(event);
135 136 }
136 137
137 138 void PieSliceItem::setLayout(const PieSliceData &sliceData)
@@ -68,14 +68,14 void ScatterChartItem::createPoints(int count)
68 68
69 69 switch (m_shape) {
70 70 case QScatterSeries::MarkerShapeCircle: {
71 QGraphicsEllipseItem* i = new QGraphicsEllipseItem(0,0,m_size,m_size);
71 QGraphicsEllipseItem* i = new QGraphicsEllipseItem(0,0,m_size,m_size,this);
72 72 const QRectF& rect = i->boundingRect();
73 73 i->setPos(-rect.width()/2,-rect.height()/2);
74 74 item = new Marker(i,this);
75 75 break;
76 76 }
77 77 case QScatterSeries::MarkerShapeRectangle: {
78 QGraphicsRectItem* i = new QGraphicsRectItem(0,0,m_size,m_size);
78 QGraphicsRectItem* i = new QGraphicsRectItem(0,0,m_size,m_size,this);
79 79 i->setPos(-m_size/2,-m_size/2);
80 80 item = new Marker(i,this);
81 81 break;
@@ -198,6 +198,7 void ScatterChartItem::handleUpdated()
198 198 void ScatterChartItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
199 199 {
200 200 emit XYChart::clicked(calculateDomainPoint(event->pos()));
201 QGraphicsItem::mousePressEvent(event);
201 202 }
202 203
203 204 #include "moc_scatterchartitem_p.cpp"
@@ -138,6 +138,7 protected:
138 138 {
139 139 Q_UNUSED(event)
140 140 m_parent->markerSelected(this);
141 QAbstractGraphicsShapeItem::mousePressEvent(event);
141 142 }
142 143
143 144 private:
@@ -34,7 +34,7 SplineChartItem::SplineChartItem(QSplineSeries *series, ChartPresenter *presente
34 34 m_pointsVisible(false),
35 35 m_animation(0)
36 36 {
37 setZValue(ChartPresenter::LineChartZValue);
37 setZValue(ChartPresenter::SplineChartZValue);
38 38 QObject::connect(m_series->d_func(),SIGNAL(updated()),this,SLOT(handleUpdated()));
39 39 QObject::connect(series, SIGNAL(visibleChanged()), this, SLOT(handleUpdated()));
40 40 handleUpdated();
@@ -169,6 +169,7 void SplineChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *o
169 169 void SplineChartItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
170 170 {
171 171 emit XYChart::clicked(calculateDomainPoint(event->pos()));
172 QGraphicsItem::mousePressEvent(event);
172 173 }
173 174
174 175 #include "moc_splinechartitem_p.cpp"
General Comments 0
You need to be logged in to leave comments. Login now