##// END OF EJS Templates
Fixed isVisible implementation in XY series
Tero Ahola -
r1346:4fe424a18505
parent child
Show More
@@ -90,6 +90,7 void AreaChartItem::updatePath()
90 90
91 91 void AreaChartItem::handleUpdated()
92 92 {
93 setVisible(m_series->isVisible());
93 94 m_pointsVisible = m_series->pointsVisible();
94 95 m_linePen = m_series->pen();
95 96 m_brush = m_series->brush();
@@ -120,7 +121,6 void AreaChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *opt
120 121 Q_UNUSED(widget)
121 122 Q_UNUSED(option)
122 123
123 if (m_series->isVisible()) {
124 124 painter->save();
125 125 painter->setPen(m_linePen);
126 126 painter->setBrush(m_brush);
@@ -134,7 +134,6 void AreaChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *opt
134 134 }
135 135 painter->restore();
136 136 }
137 }
138 137
139 138 void AreaChartItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
140 139 {
@@ -30,7 +30,8 QTCOMMERCIALCHART_BEGIN_NAMESPACE
30 30
31 31 //TODO: optimize : remove points which are not visible
32 32
33 LineChartItem::LineChartItem(QLineSeries* series,ChartPresenter *presenter):XYChart(series,presenter),
33 LineChartItem::LineChartItem(QLineSeries* series,ChartPresenter *presenter):
34 XYChart(series, presenter),
34 35 QGraphicsItem(presenter ? presenter->rootItem() : 0),
35 36 m_series(series),
36 37 m_pointsVisible(false)
@@ -77,6 +78,7 void LineChartItem::updateGeometry()
77 78
78 79 void LineChartItem::handleUpdated()
79 80 {
81 setVisible(m_series->isVisible());
80 82 m_pointsVisible = m_series->pointsVisible();
81 83 m_linePen = m_series->pen();
82 84 m_pointPen = m_series->pen();
@@ -91,7 +93,6 void LineChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *opt
91 93 Q_UNUSED(widget)
92 94 Q_UNUSED(option)
93 95
94 if (m_series->isVisible()) {
95 96 painter->save();
96 97 painter->setPen(m_linePen);
97 98 painter->setClipRect(clipRect());
@@ -102,7 +103,6 void LineChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *opt
102 103 }
103 104 painter->restore();
104 105 }
105 }
106 106
107 107 void LineChartItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
108 108 {
@@ -34,6 +34,7 ScatterChartItem::ScatterChartItem(QScatterSeries *series, ChartPresenter *prese
34 34 QGraphicsItem(presenter ? presenter->rootItem() : 0),
35 35 m_series(series),
36 36 m_items(this),
37 m_visible(true),
37 38 m_shape(QScatterSeries::MarkerShapeRectangle),
38 39 m_size(15)
39 40 {
@@ -132,7 +133,7 void ScatterChartItem::updateGeometry()
132 133 const QRectF& rect = item->boundingRect();
133 134 item->setPoint(point);
134 135 item->setPos(point.x()-rect.width()/2,point.y()-rect.height()/2);
135 if(!clipRect().contains(point)) {
136 if(!m_visible || !clipRect().contains(point)) {
136 137 item->setVisible(false);
137 138 }
138 139 else {
@@ -172,8 +173,11 void ScatterChartItem::handleUpdated()
172 173
173 174 if(count==0) return;
174 175
175 bool recreate = m_size != m_series->markerSize() || m_shape != m_series->markerShape();
176 bool recreate = m_visible != m_series->isVisible()
177 || m_size != m_series->markerSize()
178 || m_shape != m_series->markerShape();
176 179
180 m_visible = m_series->isVisible();
177 181 m_size = m_series->markerSize();
178 182 m_shape = m_series->markerShape();
179 183
@@ -62,6 +62,7 protected:
62 62 private:
63 63 QScatterSeries *m_series;
64 64 QGraphicsItemGroup m_items;
65 bool m_visible;
65 66 int m_shape;
66 67 int m_size;
67 68 QRectF m_rect;
@@ -135,6 +135,7 void SplineChartItem::updateGeometry()
135 135
136 136 void SplineChartItem::handleUpdated()
137 137 {
138 setVisible(m_series->isVisible());
138 139 m_pointsVisible = m_series->pointsVisible();
139 140 m_linePen = m_series->pen();
140 141 m_pointPen = m_series->pen();
@@ -148,7 +149,7 void SplineChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *o
148 149 {
149 150 Q_UNUSED(widget)
150 151 Q_UNUSED(option)
151 if (m_series->isVisible()) {
152
152 153 painter->save();
153 154 painter->setClipRect(clipRect());
154 155 painter->setPen(m_linePen);
@@ -159,7 +160,6 void SplineChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *o
159 160 }
160 161 painter->restore();
161 162 }
162 }
163 163
164 164 void SplineChartItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
165 165 {
General Comments 0
You need to be logged in to leave comments. Login now