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