##// END OF EJS Templates
Fixed drawing issues in Scatter
Tero Ahola -
r375:cfa1350263ea
parent child
Show More
@@ -1,67 +1,74
1 #ifndef CHARTPRESENTER_H_
1 #ifndef CHARTPRESENTER_H_
2 #define CHARTPRESENTER_H_
2 #define CHARTPRESENTER_H_
3
3
4 #include "qchartglobal.h"
4 #include "qchartglobal.h"
5 #include "qchart.h" //becouse of QChart::ChartThemeId //TODO
5 #include "qchart.h" //becouse of QChart::ChartThemeId //TODO
6 #include "qchartaxis.h"
6 #include "qchartaxis.h"
7 #include <QRectF>
7 #include <QRectF>
8
8
9 QTCOMMERCIALCHART_BEGIN_NAMESPACE
9 QTCOMMERCIALCHART_BEGIN_NAMESPACE
10
10
11 class ChartItem;
11 class ChartItem;
12 class QSeries;
12 class QSeries;
13 class ChartDataSet;
13 class ChartDataSet;
14 //class QChart;
14 //class QChart;
15 class Domain;
15 class Domain;
16 class AxisItem;
16 class AxisItem;
17 class ChartTheme;
17 class ChartTheme;
18
18
19 class ChartPresenter: public QObject
19 class ChartPresenter: public QObject
20 {
20 {
21 Q_OBJECT
21 Q_OBJECT
22 public:
22 public:
23 enum ZValues { BackgroundZValue = -1 , ShadesZValue, GridZValue, AxisZValue , LineChartZValue };
23 enum ZValues {
24 BackgroundZValue = -1,
25 ShadesZValue,
26 GridZValue,
27 AxisZValue,
28 LineChartZValue,
29 ScatterSeriesZValue
30 };
24
31
25 ChartPresenter(QChart* chart,ChartDataSet *dataset);
32 ChartPresenter(QChart* chart,ChartDataSet *dataset);
26 virtual ~ChartPresenter();
33 virtual ~ChartPresenter();
27
34
28 void setMargin(int margin);
35 void setMargin(int margin);
29 int margin() const;
36 int margin() const;
30
37
31 QRectF geometry() const;
38 QRectF geometry() const;
32
39
33 void setChartTheme(QChart::ChartTheme theme);
40 void setChartTheme(QChart::ChartTheme theme);
34 QChart::ChartTheme chartTheme();
41 QChart::ChartTheme chartTheme();
35
42
36 void setAnimationOptions(QChart::AnimationOptions options);
43 void setAnimationOptions(QChart::AnimationOptions options);
37 QChart::AnimationOptions animationOptions() const;
44 QChart::AnimationOptions animationOptions() const;
38
45
39 private:
46 private:
40 void createConnections();
47 void createConnections();
41
48
42 public slots:
49 public slots:
43 void handleSeriesAdded(QSeries* series);
50 void handleSeriesAdded(QSeries* series);
44 void handleSeriesRemoved(QSeries* series);
51 void handleSeriesRemoved(QSeries* series);
45 void handleAxisAdded(QChartAxis* axis);
52 void handleAxisAdded(QChartAxis* axis);
46 void handleAxisRemoved(QChartAxis* axis);
53 void handleAxisRemoved(QChartAxis* axis);
47 void handleSeriesDomainChanged(QSeries* series, const Domain& domain);
54 void handleSeriesDomainChanged(QSeries* series, const Domain& domain);
48 void handleAxisLabelsChanged(QChartAxis* axis, const QStringList& labels);
55 void handleAxisLabelsChanged(QChartAxis* axis, const QStringList& labels);
49 void handleSeriesChanged(QSeries* series);
56 void handleSeriesChanged(QSeries* series);
50 void handleGeometryChanged();
57 void handleGeometryChanged();
51 signals:
58 signals:
52 void geometryChanged(const QRectF& rect);
59 void geometryChanged(const QRectF& rect);
53 private:
60 private:
54 QMap<QSeries*,ChartItem*> m_chartItems;
61 QMap<QSeries*,ChartItem*> m_chartItems;
55 QMap<QChartAxis*,AxisItem*> m_axisItems;
62 QMap<QChartAxis*,AxisItem*> m_axisItems;
56 QChart* m_chart;
63 QChart* m_chart;
57 ChartDataSet* m_dataset;
64 ChartDataSet* m_dataset;
58 ChartTheme *m_chartTheme;
65 ChartTheme *m_chartTheme;
59 int m_marginSize;
66 int m_marginSize;
60 QRectF m_rect;
67 QRectF m_rect;
61 QChart::AnimationOptions m_options;
68 QChart::AnimationOptions m_options;
62
69
63 };
70 };
64
71
65 QTCOMMERCIALCHART_END_NAMESPACE
72 QTCOMMERCIALCHART_END_NAMESPACE
66
73
67 #endif /* CHARTPRESENTER_H_ */
74 #endif /* CHARTPRESENTER_H_ */
@@ -1,225 +1,222
1 #include "qscatterseries.h"
1 #include "qscatterseries.h"
2 #include "scatterseries_p.h"
2 #include "scatterseries_p.h"
3 #include "qchart.h"
3 #include "qchart.h"
4
4
5 /*!
5 /*!
6 \class QScatterSeries
6 \class QScatterSeries
7 \brief QtCommercial Chart series API for showing scatter series.
7 \brief QtCommercial Chart series API for showing scatter series.
8
8
9 \mainclass
9 \mainclass
10
10
11 Example on how to create a chart with scatter series:
11 Example on how to create a chart with scatter series:
12 \snippet ../example/scatter/main.cpp 1
12 \snippet ../example/scatter/main.cpp 1
13
13
14 The example code would result the following:
14 The example code would result the following:
15
15
16 \image scatter_example1.jpg
16 \image scatter_example1.jpg
17 */
17 */
18
18
19 /*!
19 /*!
20 \enum QScatterSeries::MarkerShape
20 \enum QScatterSeries::MarkerShape
21
21
22 This enum describes the shape used when rendering marker items.
22 This enum describes the shape used when rendering marker items.
23
23
24 \value MarkerShapeDefault
24 \value MarkerShapeDefault
25 \value MarkerShapePoint
25 \value MarkerShapePoint
26 \value MarkerShapeX
26 \value MarkerShapeX
27 \value MarkerShapeRectangle
27 \value MarkerShapeRectangle
28 \value MarkerShapeTiltedRectangle
28 \value MarkerShapeTiltedRectangle
29 \value MarkerShapeTriangle
29 \value MarkerShapeTriangle
30 \value MarkerShapeCircle
30 \value MarkerShapeCircle
31 */
31 */
32
32
33 /*!
33 /*!
34 \fn QChartSeriesType QScatterSeries::type() const
34 \fn QChartSeriesType QScatterSeries::type() const
35 \brief Returns QChartSeries::SeriesTypeScatter.
35 \brief Returns QChartSeries::SeriesTypeScatter.
36 */
36 */
37
37
38 /*!
38 /*!
39 \fn void QScatterSeries::clicked()
39 \fn void QScatterSeries::clicked()
40 \brief TODO
40 \brief TODO
41 */
41 */
42
42
43 /*!
43 /*!
44 \fn void QScatterSeries::changed()
44 \fn void QScatterSeries::changed()
45 \brief TODO
45 \brief TODO
46 */
46 */
47
47
48 QTCOMMERCIALCHART_BEGIN_NAMESPACE
48 QTCOMMERCIALCHART_BEGIN_NAMESPACE
49
49
50 QScatterSeriesPrivate::QScatterSeriesPrivate() :
50 QScatterSeriesPrivate::QScatterSeriesPrivate() :
51 m_data(QList<QPointF>()),
51 m_data(QList<QPointF>()),
52 m_markerPen(QPen()),
52 m_markerPen(QPen(QColor::Invalid)),
53 m_markerBrush(QBrush()),
53 m_markerBrush(QBrush(QColor::Invalid)),
54 m_markerShape(QScatterSeries::MarkerShapeDefault)
54 m_markerShape(QScatterSeries::MarkerShapeDefault)
55 {
55 {
56 // Initialize pen color to invalid to use a theme color by default
57 m_markerPen.setColor(QColor::Invalid);
58 m_markerBrush.setColor(QColor::Invalid);
59 }
56 }
60
57
61 /*!
58 /*!
62 Constructs a series object which is a child of \a parent.
59 Constructs a series object which is a child of \a parent.
63 */
60 */
64 QScatterSeries::QScatterSeries(QObject *parent) :
61 QScatterSeries::QScatterSeries(QObject *parent) :
65 QSeries(parent),
62 QSeries(parent),
66 d(new QScatterSeriesPrivate())
63 d(new QScatterSeriesPrivate())
67 {
64 {
68 }
65 }
69
66
70 /*!
67 /*!
71 Destroys the object. Note that adding series to QChart transfers the ownership to the chart.
68 Destroys the object. Note that adding series to QChart transfers the ownership to the chart.
72 */
69 */
73 QScatterSeries::~QScatterSeries()
70 QScatterSeries::~QScatterSeries()
74 {
71 {
75 delete d;
72 delete d;
76 }
73 }
77
74
78 /*!
75 /*!
79 Add single data point with \a x and \a y coordinates to the series.
76 Add single data point with \a x and \a y coordinates to the series.
80 */
77 */
81 void QScatterSeries::add(qreal x, qreal y)
78 void QScatterSeries::add(qreal x, qreal y)
82 {
79 {
83 d->m_data.append(QPointF(x, y));
80 d->m_data.append(QPointF(x, y));
84 emit changed();
81 emit changed();
85 }
82 }
86
83
87 /*!
84 /*!
88 Add single data point with \a value to the series.
85 Add single data point with \a value to the series.
89 */
86 */
90 void QScatterSeries::add(QPointF value)
87 void QScatterSeries::add(QPointF value)
91 {
88 {
92 d->m_data.append(value);
89 d->m_data.append(value);
93 emit changed();
90 emit changed();
94 }
91 }
95
92
96 /*!
93 /*!
97 Add list of \a points to the series.
94 Add list of \a points to the series.
98 */
95 */
99 void QScatterSeries::add(QList<QPointF> points)
96 void QScatterSeries::add(QList<QPointF> points)
100 {
97 {
101 d->m_data.append(points);
98 d->m_data.append(points);
102 emit changed();
99 emit changed();
103 }
100 }
104
101
105 /*!
102 /*!
106 Stream operator for adding a data point with \a value to the series.
103 Stream operator for adding a data point with \a value to the series.
107 \sa add()
104 \sa add()
108
105
109 For example:
106 For example:
110 \snippet ../example/scatter/main.cpp 3
107 \snippet ../example/scatter/main.cpp 3
111 */
108 */
112 QScatterSeries& QScatterSeries::operator << (const QPointF &value)
109 QScatterSeries& QScatterSeries::operator << (const QPointF &value)
113 {
110 {
114 d->m_data.append(value);
111 d->m_data.append(value);
115 emit changed();
112 emit changed();
116 return *this;
113 return *this;
117 }
114 }
118
115
119 /*!
116 /*!
120 Stream operator for adding a list of points to the series.
117 Stream operator for adding a list of points to the series.
121 \sa add()
118 \sa add()
122 */
119 */
123 QScatterSeries& QScatterSeries::operator << (QList<QPointF> value)
120 QScatterSeries& QScatterSeries::operator << (QList<QPointF> value)
124 {
121 {
125 d->m_data.append(value);
122 d->m_data.append(value);
126 emit changed();
123 emit changed();
127 return *this;
124 return *this;
128 }
125 }
129
126
130 /*!
127 /*!
131 Replaces the data of the series with the given list of data \a points.
128 Replaces the data of the series with the given list of data \a points.
132 */
129 */
133 void QScatterSeries::setData(QList<QPointF> points)
130 void QScatterSeries::setData(QList<QPointF> points)
134 {
131 {
135 d->m_data = points;
132 d->m_data = points;
136 emit changed();
133 emit changed();
137 }
134 }
138
135
139 /*!
136 /*!
140 Returns the current list of data points of the series.
137 Returns the current list of data points of the series.
141 */
138 */
142 QList<QPointF> QScatterSeries::data()
139 QList<QPointF> QScatterSeries::data()
143 {
140 {
144 return d->m_data;
141 return d->m_data;
145 }
142 }
146
143
147 /*!
144 /*!
148 Overrides the default pen used for drawing a marker item with a user defined \a pen. The
145 Overrides the default pen used for drawing a marker item with a user defined \a pen. The
149 default pen is defined by chart theme setting.
146 default pen is defined by chart theme setting.
150
147
151 For example:
148 For example:
152 \snippet ../example/scatter/main.cpp 5
149 \snippet ../example/scatter/main.cpp 5
153
150
154 Would present your scatter markers with an opaque, uglyish green outlines instead of the
151 Would present your scatter markers with an opaque, uglyish green outlines instead of the
155 beatiful markers defined by the chart's theme:
152 beatiful markers defined by the chart's theme:
156 \image scatter_example_pen.jpg
153 \image scatter_example_pen.jpg
157
154
158 \sa setBrush()
155 \sa setBrush()
159 \sa QChart::setChartTheme()
156 \sa QChart::setChartTheme()
160 */
157 */
161 void QScatterSeries::setPen(QPen pen)
158 void QScatterSeries::setPen(QPen pen)
162 {
159 {
163 d->m_markerPen = pen;
160 d->m_markerPen = pen;
164 }
161 }
165
162
166 /*!
163 /*!
167 Returns the pen used for drawing markers.
164 Returns the pen used for drawing markers.
168 */
165 */
169 QPen QScatterSeries::pen()
166 QPen QScatterSeries::pen()
170 {
167 {
171 return d->m_markerPen;
168 return d->m_markerPen;
172 }
169 }
173
170
174 /*!
171 /*!
175 Overrides the default brush of the marker items with a user defined \a brush. The default brush
172 Overrides the default brush of the marker items with a user defined \a brush. The default brush
176 is defined by chart theme setting.
173 is defined by chart theme setting.
177
174
178 For example:
175 For example:
179 \snippet ../example/scatter/main.cpp 4
176 \snippet ../example/scatter/main.cpp 4
180
177
181 Would fill your scatter markers with an opaque red color:
178 Would fill your scatter markers with an opaque red color:
182 \image scatter_example_brush.jpg
179 \image scatter_example_brush.jpg
183
180
184 \sa setPen()
181 \sa setPen()
185 \sa QChart::setChartTheme()
182 \sa QChart::setChartTheme()
186 */
183 */
187 void QScatterSeries::setBrush(QBrush brush)
184 void QScatterSeries::setBrush(QBrush brush)
188 {
185 {
189 d->m_markerBrush = brush;
186 d->m_markerBrush = brush;
190 }
187 }
191
188
192 /*!
189 /*!
193 Returns the brush used for drawing markers.
190 Returns the brush used for drawing markers.
194 */
191 */
195 QBrush QScatterSeries::brush()
192 QBrush QScatterSeries::brush()
196 {
193 {
197 return d->m_markerBrush;
194 return d->m_markerBrush;
198 }
195 }
199
196
200 /*!
197 /*!
201 Overrides the default shape of the marker items with a user defined \a shape. The default shape
198 Overrides the default shape of the marker items with a user defined \a shape. The default shape
202 is defined by chart theme setting.
199 is defined by chart theme setting.
203
200
204 For example:
201 For example:
205 \snippet ../example/scatter/main.cpp 6
202 \snippet ../example/scatter/main.cpp 6
206
203
207 Would make your scatter marker items rectangle:
204 Would make your scatter marker items rectangle:
208 \image scatter_example_shape.jpg
205 \image scatter_example_shape.jpg
209 */
206 */
210 void QScatterSeries::setShape(MarkerShape shape)
207 void QScatterSeries::setShape(MarkerShape shape)
211 {
208 {
212 d->m_markerShape = shape;
209 d->m_markerShape = shape;
213 }
210 }
214
211
215 /*!
212 /*!
216 Returns the shape used for drawing markers.
213 Returns the shape used for drawing markers.
217 */
214 */
218 QScatterSeries::MarkerShape QScatterSeries::shape()
215 QScatterSeries::MarkerShape QScatterSeries::shape()
219 {
216 {
220 return (QScatterSeries::MarkerShape) d->m_markerShape;
217 return (QScatterSeries::MarkerShape) d->m_markerShape;
221 }
218 }
222
219
223 #include "moc_qscatterseries.cpp"
220 #include "moc_qscatterseries.cpp"
224
221
225 QTCOMMERCIALCHART_END_NAMESPACE
222 QTCOMMERCIALCHART_END_NAMESPACE
@@ -1,124 +1,146
1 #include "scatterpresenter_p.h"
1 #include "scatterpresenter_p.h"
2 #include "qscatterseries.h"
2 #include "qscatterseries.h"
3 #include "chartpresenter_p.h"
3 #include <QPen>
4 #include <QPen>
4 #include <QPainter>
5 #include <QPainter>
5 #include <QGraphicsScene>
6 #include <QGraphicsScene>
6 #include <QGraphicsSceneMouseEvent>
7 #include <QGraphicsSceneMouseEvent>
7 #include <QGraphicsDropShadowEffect>
8 #include <QGraphicsDropShadowEffect>
8 #include <QDebug>
9 #include <QDebug>
9 #include <QTime>
10 #include <QTime>
10
11
11 QTCOMMERCIALCHART_BEGIN_NAMESPACE
12 QTCOMMERCIALCHART_BEGIN_NAMESPACE
12
13
13 ScatterPresenter::ScatterPresenter(QScatterSeries *series, QGraphicsObject *parent) :
14 ScatterPresenter::ScatterPresenter(QScatterSeries *series, QGraphicsObject *parent) :
14 ChartItem(parent),
15 ChartItem(parent),
15 m_series(series),
16 m_series(series),
16 m_boundingRect(),
17 m_boundingRect(),
17 m_visibleChartArea()
18 m_visibleChartArea()
18 {
19 {
19 if (parent)
20 if (parent)
20 m_boundingRect = parent->boundingRect();
21 m_boundingRect = parent->boundingRect();
21
22
22 if (series) {
23 if (series) {
23 connect(series, SIGNAL(changed()), this, SLOT(handleModelChanged()));
24 connect(series, SIGNAL(changed()), this, SLOT(handleModelChanged()));
24 }
25 }
25
26
26 QGraphicsDropShadowEffect *dropShadow = new QGraphicsDropShadowEffect();
27 setZValue(ChartPresenter::ScatterSeriesZValue);
27 dropShadow->setOffset(2.0);
28
28 dropShadow->setBlurRadius(2.0);
29 // TODO: how to draw a drop shadow?
29 setGraphicsEffect(dropShadow);
30 // QGraphicsDropShadowEffect *dropShadow = new QGraphicsDropShadowEffect();
31 // dropShadow->setOffset(2.0);
32 // dropShadow->setBlurRadius(2.0);
33 // setGraphicsEffect(dropShadow);
30 }
34 }
31
35
32 void ScatterPresenter::handleDomainChanged(const Domain& domain)
36 void ScatterPresenter::handleDomainChanged(const Domain& domain)
33 {
37 {
34 m_visibleChartArea = domain;
38 m_visibleChartArea = domain;
35 changeGeometry();
39 changeGeometry();
36 }
40 }
37
41
38 void ScatterPresenter::handleGeometryChanged(const QRectF& rect)
42 void ScatterPresenter::handleGeometryChanged(const QRectF& rect)
39 {
43 {
40 m_boundingRect = rect;
44 m_boundingRect = rect;
41 changeGeometry();
45 changeGeometry();
42 }
46 }
43
47
44 void ScatterPresenter::handleModelChanged()
48 void ScatterPresenter::handleModelChanged()
45 {
49 {
46 // TODO: more fine grained modelChanged signaling
50 // TODO: more fine grained modelChanged signaling
47 changeGeometry();
51 changeGeometry();
48 }
52 }
49
53
50 void ScatterPresenter::paint(QPainter *painter, const QStyleOptionGraphicsItem */*option*/, QWidget */*widget*/)
54 void ScatterPresenter::paint(QPainter *painter, const QStyleOptionGraphicsItem */*option*/, QWidget */*widget*/)
51 {
55 {
52 painter->save();
56 painter->save();
53 painter->setClipRect(m_boundingRect);
57 painter->setClipRect(m_boundingRect);
54
58
59 // TODO: how to draw a drop shadow?
60 // Now using a custom implementation for drop shadow instead of QGraphicsDropShadowEffect.
61 // It seems QGraphicsDropShadowEffect is quite heavy, at least on windows without open gl.
62 QPen dropShadowPen(QColor(0, 0, 0, 70));
63 dropShadowPen.setWidth(3);
64 painter->setPen(dropShadowPen);
65 painter->setBrush(dropShadowPen.color());
66 // painter->setRenderHint(QPainter::Antialiasing);
67 painter->drawPath(m_path.translated(2, 2));
68
55 // Paint the shape
69 // Paint the shape
56 // The custom settings in series override those defined by the theme
70 // The custom settings in series override those defined by the theme
57 QPen pen = m_markerPen;
71 QPen pen = m_markerPen;
58 if (m_series->pen().color().isValid())
72 if (m_series->pen().color().isValid())
59 pen = m_series->pen();
73 pen = m_series->pen();
74 painter->setPen(pen);
60 if (m_series->brush().color().isValid())
75 if (m_series->brush().color().isValid())
61 painter->setBrush(m_series->brush());
76 painter->setBrush(m_series->brush());
62 else
77 else
63 painter->setBrush(m_markerBrush);
78 painter->setBrush(m_markerBrush);
64 painter->setPen(pen);
79
65 painter->drawPath(m_path);
80 // If either pen or brush is opaque, we need to draw the polygons one-by-one
81 if (painter->pen().color().alpha() < 255 || painter->brush().color().alpha() < 255) {
82 foreach (QPolygonF pol, m_path.toSubpathPolygons())
83 painter->drawPolygon(pol);
84 } else {
85 painter->drawPath(m_path);
86 }
66
87
67 painter->restore();
88 painter->restore();
68 }
89 }
69
90
70 void ScatterPresenter::mousePressEvent(QGraphicsSceneMouseEvent *event)
91 void ScatterPresenter::mousePressEvent(QGraphicsSceneMouseEvent *event)
71 {
92 {
72 qDebug() << "ScatterPresenter::mousePressEvent" << event << " cont: "
93 qDebug() << "ScatterPresenter::mousePressEvent" << event << " cont: "
73 << m_path.contains(event->lastPos());
94 << m_path.contains(event->lastPos());
74
95
75 if (m_path.contains(event->lastPos()))
96 if (m_path.contains(event->lastPos()))
76 emit clicked();
97 emit clicked();
77 }
98 }
78
99
79 void ScatterPresenter::changeGeometry()
100 void ScatterPresenter::changeGeometry()
80 {
101 {
81 if (m_boundingRect.isValid()) {
102 if (m_boundingRect.isValid()) {
82 prepareGeometryChange();
103 prepareGeometryChange();
83 qreal scalex = m_boundingRect.width() / m_visibleChartArea.spanX();
104 qreal scalex = m_boundingRect.width() / m_visibleChartArea.spanX();
84 qreal scaley = m_boundingRect.height() / m_visibleChartArea.spanY();
105 qreal scaley = m_boundingRect.height() / m_visibleChartArea.spanY();
85
106
86 int shape = m_series->shape();
107 int shape = m_series->shape();
87 m_path = QPainterPath();
108 m_path = QPainterPath();
109 m_path.setFillRule(Qt::WindingFill);
88
110
89 foreach (QPointF point, m_series->data()) {
111 foreach (QPointF point, m_series->data()) {
90 // Convert relative coordinates to absolute pixel coordinates that can be used for drawing
112 // Convert relative coordinates to absolute pixel coordinates that can be used for drawing
91 qreal x = m_boundingRect.left() + point.x() * scalex - m_visibleChartArea.m_minX * scalex;
113 qreal x = m_boundingRect.left() + point.x() * scalex - m_visibleChartArea.m_minX * scalex;
92 qreal y = m_boundingRect.bottom() - point.y() * scaley + m_visibleChartArea.m_minY * scaley;
114 qreal y = m_boundingRect.bottom() - point.y() * scaley + m_visibleChartArea.m_minY * scaley;
93
115
94 if (scene()->width() > x && scene()->height() > y) {
116 if (scene()->width() > x && scene()->height() > y) {
95 switch (shape) {
117 switch (shape) {
96 case QScatterSeries::MarkerShapeDefault:
118 case QScatterSeries::MarkerShapeDefault:
97 // Fallthrough, defaults to circle
119 // Fallthrough, defaults to circle
98 case QScatterSeries::MarkerShapeCircle:
120 case QScatterSeries::MarkerShapeCircle:
99 m_path.addEllipse(x, y, 9, 9);
121 m_path.addEllipse(x, y, 9, 9);
100 break;
122 break;
101 case QScatterSeries::MarkerShapePoint:
123 case QScatterSeries::MarkerShapePoint:
102 m_path.addEllipse(x, y, 2, 2);
124 m_path.addEllipse(x, y, 2, 2);
103 break;
125 break;
104 case QScatterSeries::MarkerShapeRectangle:
126 case QScatterSeries::MarkerShapeRectangle:
105 m_path.addRect(x, y, 9, 9);
127 m_path.addRect(x, y, 9, 9);
106 break;
128 break;
107 case QScatterSeries::MarkerShapeTiltedRectangle: {
129 case QScatterSeries::MarkerShapeTiltedRectangle: {
108 // TODO: tilt the rectangle
130 // TODO: tilt the rectangle
109 m_path.addRect(x, y, 9, 9);
131 m_path.addRect(x, y, 9, 9);
110 break;
132 break;
111 }
133 }
112 default:
134 default:
113 // TODO: implement the rest of the shapes
135 // TODO: implement the rest of the shapes
114 Q_ASSERT(false);
136 Q_ASSERT(false);
115 break;
137 break;
116 }
138 }
117 }
139 }
118 }
140 }
119 }
141 }
120 }
142 }
121
143
122 #include "moc_scatterpresenter_p.cpp"
144 #include "moc_scatterpresenter_p.cpp"
123
145
124 QTCOMMERCIALCHART_END_NAMESPACE
146 QTCOMMERCIALCHART_END_NAMESPACE
General Comments 0
You need to be logged in to leave comments. Login now