qscatterseries.cpp
85 lines
| 1.6 KiB
| text/x-c
|
CppLexer
Tero Ahola
|
r42 | #include "qscatterseries.h" | ||
Tero Ahola
|
r194 | #include "scatterseries_p.h" | ||
Tero Ahola
|
r42 | #include "qchart.h" | ||
QTCOMMERCIALCHART_BEGIN_NAMESPACE | ||||
Tero Ahola
|
r158 | QScatterSeriesPrivate::QScatterSeriesPrivate() : | ||
Tero Ahola
|
r195 | m_data(QList<QPointF>()), | ||
m_markerPen(QPen()), | ||||
m_markerBrush(QBrush()), | ||||
m_markerShape(QScatterSeries::MarkerShapeDefault) | ||||
Tero Ahola
|
r42 | { | ||
Tero Ahola
|
r195 | // Initialize pen color to invalid to use a theme color by default | ||
m_markerPen.setColor(QColor::Invalid); | ||||
m_markerBrush.setColor(QColor::Invalid); | ||||
Tero Ahola
|
r42 | } | ||
Tero Ahola
|
r158 | QScatterSeries::QScatterSeries(QObject *parent) : | ||
QChartSeries(parent), | ||||
d(new QScatterSeriesPrivate()) | ||||
Tero Ahola
|
r42 | { | ||
} | ||||
Tero Ahola
|
r158 | QScatterSeries::~QScatterSeries() | ||
Tero Ahola
|
r42 | { | ||
Tero Ahola
|
r158 | delete d; | ||
Tero Ahola
|
r48 | } | ||
Tero Ahola
|
r180 | void QScatterSeries::addData(QPointF value) | ||
Tero Ahola
|
r61 | { | ||
Tero Ahola
|
r180 | d->m_data.append(value); | ||
emit changed(); | ||||
} | ||||
QScatterSeries& QScatterSeries::operator << (const QPointF &value) | ||||
{ | ||||
d->m_data.append(value); | ||||
Tero Ahola
|
r179 | emit changed(); | ||
Tero Ahola
|
r180 | return *this; | ||
Tero Ahola
|
r179 | } | ||
Tero Ahola
|
r158 | |||
Tero Ahola
|
r180 | void QScatterSeries::setData(QList<QPointF> data) | ||
Tero Ahola
|
r179 | { | ||
Tero Ahola
|
r180 | d->m_data = data; | ||
Tero Ahola
|
r158 | emit changed(); | ||
Tero Ahola
|
r61 | } | ||
Tero Ahola
|
r158 | QList<QPointF> QScatterSeries::data() | ||
Tero Ahola
|
r64 | { | ||
Tero Ahola
|
r158 | return d->m_data; | ||
Tero Ahola
|
r64 | } | ||
Tero Ahola
|
r179 | void QScatterSeries::setMarkerPen(QPen pen) | ||
Tero Ahola
|
r75 | { | ||
Tero Ahola
|
r179 | d->m_markerPen = pen; | ||
Tero Ahola
|
r75 | } | ||
Tero Ahola
|
r179 | QPen QScatterSeries::markerPen() | ||
Tero Ahola
|
r42 | { | ||
Tero Ahola
|
r179 | return d->m_markerPen; | ||
Tero Ahola
|
r42 | } | ||
Tero Ahola
|
r195 | void QScatterSeries::setMarkerBrush(QBrush brush) | ||
{ | ||||
d->m_markerBrush = brush; | ||||
} | ||||
QBrush QScatterSeries::markerBrush() | ||||
{ | ||||
return d->m_markerBrush; | ||||
} | ||||
void QScatterSeries::setMarkerShape(MarkerShape shape) | ||||
{ | ||||
d->m_markerShape = shape; | ||||
} | ||||
QScatterSeries::MarkerShape QScatterSeries::markerShape() | ||||
{ | ||||
return (QScatterSeries::MarkerShape) d->m_markerShape; | ||||
} | ||||
Tero Ahola
|
r42 | #include "moc_qscatterseries.cpp" | ||
QTCOMMERCIALCHART_END_NAMESPACE | ||||