##// END OF EJS Templates
review fixes
review fixes

File last commit:

r360:6630f89603b4
r363:373497ad80ef
Show More
qscatterseries.cpp
225 lines | 4.7 KiB | text/x-c | CppLexer
Tero Ahola
Integrated scatter type series...
r42 #include "qscatterseries.h"
Tero Ahola
Moved scatter impl into a subfolder
r194 #include "scatterseries_p.h"
Tero Ahola
Integrated scatter type series...
r42 #include "qchart.h"
Tero Ahola
Scatter series documentation; now uses snippets
r300 /*!
\class QScatterSeries
\brief QtCommercial Chart series API for showing scatter series.
Tero Ahola
Integrated scatter type series...
r42
Tero Ahola
Scatter series documentation; now uses snippets
r300 \mainclass
Example on how to create a chart with scatter series:
\snippet ../example/scatter/main.cpp 1
The example code would result the following:
\image scatter_example1.jpg
*/
Tero Ahola
Integrated scatter type series...
r42
Tero Ahola
Documenting QScatterSeries
r261 /*!
\enum QScatterSeries::MarkerShape
This enum describes the shape used when rendering marker items.
\value MarkerShapeDefault
\value MarkerShapePoint
\value MarkerShapeX
\value MarkerShapeRectangle
\value MarkerShapeTiltedRectangle
\value MarkerShapeTriangle
\value MarkerShapeCircle
*/
Tero Ahola
QDoc to use style sheets...
r260 /*!
Tero Ahola
Scatter series documentation; now uses snippets
r300 \fn QChartSeriesType QScatterSeries::type() const
\brief Returns QChartSeries::SeriesTypeScatter.
*/
Tero Ahola
QDoc to use style sheets...
r260
Tero Ahola
Scatter series documentation; now uses snippets
r300 /*!
\fn void QScatterSeries::clicked()
\brief TODO
*/
Tero Ahola
QDoc to use style sheets...
r260
Tero Ahola
Scatter series documentation; now uses snippets
r300 /*!
\fn void QScatterSeries::changed()
\brief TODO
*/
QTCOMMERCIALCHART_BEGIN_NAMESPACE
QScatterSeriesPrivate::QScatterSeriesPrivate() :
m_data(QList<QPointF>()),
m_markerPen(QPen()),
m_markerBrush(QBrush()),
m_markerShape(QScatterSeries::MarkerShapeDefault)
{
// Initialize pen color to invalid to use a theme color by default
m_markerPen.setColor(QColor::Invalid);
m_markerBrush.setColor(QColor::Invalid);
}
Tero Ahola
Documenting QScatterSeries
r261 /*!
Constructs a series object which is a child of \a parent.
*/
Tero Ahola
Integrated scatter again. Missing functionality....
r158 QScatterSeries::QScatterSeries(QObject *parent) :
Michal Klocek
Rename QChartSeries to QSeries
r360 QSeries(parent),
Tero Ahola
Integrated scatter again. Missing functionality....
r158 d(new QScatterSeriesPrivate())
Tero Ahola
Integrated scatter type series...
r42 {
}
Tero Ahola
QDoc to use style sheets...
r260 /*!
Tero Ahola
Documenting QScatterSeries
r261 Destroys the object. Note that adding series to QChart transfers the ownership to the chart.
Tero Ahola
QDoc to use style sheets...
r260 */
Tero Ahola
Integrated scatter again. Missing functionality....
r158 QScatterSeries::~QScatterSeries()
Tero Ahola
Integrated scatter type series...
r42 {
Tero Ahola
Integrated scatter again. Missing functionality....
r158 delete d;
Tero Ahola
Resizing of QGraphicItems now possible by resize signal from QChart
r48 }
Tero Ahola
Fixing review findings in QScatterSeries
r358 /*!
Add single data point with \a x and \a y coordinates to the series.
*/
void QScatterSeries::add(qreal x, qreal y)
{
d->m_data.append(QPointF(x, y));
emit changed();
}
Tero Ahola
QDoc to use style sheets...
r260 /*!
Tero Ahola
Scatter series documentation; now uses snippets
r300 Add single data point with \a value to the series.
Tero Ahola
QDoc to use style sheets...
r260 */
Tero Ahola
Fixing review findings in QScatterSeries
r358 void QScatterSeries::add(QPointF value)
Tero Ahola
Refactored series creation with QChart
r61 {
Tero Ahola
added stream operator to scatter series
r180 d->m_data.append(value);
emit changed();
}
Tero Ahola
QDoc to use style sheets...
r260 /*!
Tero Ahola
Scatter series documentation; now uses snippets
r300 Add list of \a points to the series.
*/
Tero Ahola
Fixing review findings in QScatterSeries
r358 void QScatterSeries::add(QList<QPointF> points)
Tero Ahola
Scatter series documentation; now uses snippets
r300 {
Tero Ahola
Fixed stupid build error in QScatterSeries
r301 d->m_data.append(points);
Tero Ahola
Scatter series documentation; now uses snippets
r300 emit changed();
}
Tero Ahola
QDoc to use style sheets...
r260
Tero Ahola
Scatter series documentation; now uses snippets
r300 /*!
Stream operator for adding a data point with \a value to the series.
Tero Ahola
Fixing review findings in QScatterSeries
r358 \sa add()
Tero Ahola
QDoc to use style sheets...
r260
Tero Ahola
Scatter series documentation; now uses snippets
r300 For example:
\snippet ../example/scatter/main.cpp 3
Tero Ahola
QDoc to use style sheets...
r260 */
Tero Ahola
added stream operator to scatter series
r180 QScatterSeries& QScatterSeries::operator << (const QPointF &value)
{
d->m_data.append(value);
Tero Ahola
Modifying QScatterSeries API
r179 emit changed();
Tero Ahola
added stream operator to scatter series
r180 return *this;
Tero Ahola
Modifying QScatterSeries API
r179 }
Tero Ahola
Integrated scatter again. Missing functionality....
r158
Tero Ahola
QDoc to use style sheets...
r260 /*!
Tero Ahola
Scatter series documentation; now uses snippets
r300 Stream operator for adding a list of points to the series.
Tero Ahola
Fixing review findings in QScatterSeries
r358 \sa add()
Tero Ahola
Scatter series documentation; now uses snippets
r300 */
QScatterSeries& QScatterSeries::operator << (QList<QPointF> value)
{
d->m_data.append(value);
emit changed();
return *this;
}
/*!
Replaces the data of the series with the given list of data \a points.
Tero Ahola
QDoc to use style sheets...
r260 */
Tero Ahola
Scatter series documentation; now uses snippets
r300 void QScatterSeries::setData(QList<QPointF> points)
Tero Ahola
Modifying QScatterSeries API
r179 {
Tero Ahola
Fixed stupid build error in QScatterSeries
r301 d->m_data = points;
Tero Ahola
Integrated scatter again. Missing functionality....
r158 emit changed();
Tero Ahola
Refactored series creation with QChart
r61 }
Tero Ahola
QDoc to use style sheets...
r260 /*!
Tero Ahola
Documenting QScatterSeries
r261 Returns the current list of data points of the series.
Tero Ahola
QDoc to use style sheets...
r260 */
Tero Ahola
Integrated scatter again. Missing functionality....
r158 QList<QPointF> QScatterSeries::data()
Tero Ahola
Draft implementation for setting color themes for a chart
r64 {
Tero Ahola
Integrated scatter again. Missing functionality....
r158 return d->m_data;
Tero Ahola
Draft implementation for setting color themes for a chart
r64 }
Tero Ahola
QDoc to use style sheets...
r260 /*!
Tero Ahola
Scatter series documentation; now uses snippets
r300 Overrides the default pen used for drawing a marker item with a user defined \a pen. The
default pen is defined by chart theme setting.
Tero Ahola
Documenting QScatterSeries
r261
For example:
Tero Ahola
Scatter series documentation; now uses snippets
r300 \snippet ../example/scatter/main.cpp 5
Tero Ahola
Documenting QScatterSeries
r261
Tero Ahola
Scatter series documentation; now uses snippets
r300 Would present your scatter markers with an opaque, uglyish green outlines instead of the
beatiful markers defined by the chart's theme:
Tero Ahola
Documenting QScatterSeries
r261 \image scatter_example_pen.jpg
Tero Ahola
Fixing review findings in QScatterSeries
r358 \sa setBrush()
Tero Ahola
Scatter series documentation; now uses snippets
r300 \sa QChart::setChartTheme()
Tero Ahola
QDoc to use style sheets...
r260 */
Tero Ahola
Fixing review findings in QScatterSeries
r358 void QScatterSeries::setPen(QPen pen)
Tero Ahola
Color themes now enabled for scatter, pie and line series.
r75 {
Tero Ahola
Modifying QScatterSeries API
r179 d->m_markerPen = pen;
Tero Ahola
Color themes now enabled for scatter, pie and line series.
r75 }
Tero Ahola
QDoc to use style sheets...
r260 /*!
Tero Ahola
Documenting QScatterSeries
r261 Returns the pen used for drawing markers.
Tero Ahola
QDoc to use style sheets...
r260 */
Tero Ahola
Fixing review findings in QScatterSeries
r358 QPen QScatterSeries::pen()
Tero Ahola
Integrated scatter type series...
r42 {
Tero Ahola
Modifying QScatterSeries API
r179 return d->m_markerPen;
Tero Ahola
Integrated scatter type series...
r42 }
Tero Ahola
Documenting QScatterSeries
r261 /*!
Tero Ahola
Scatter series documentation; now uses snippets
r300 Overrides the default brush of the marker items with a user defined \a brush. The default brush
is defined by chart theme setting.
Tero Ahola
Documenting QScatterSeries
r261
For example:
Tero Ahola
Scatter series documentation; now uses snippets
r300 \snippet ../example/scatter/main.cpp 4
Tero Ahola
Documenting QScatterSeries
r261
Would fill your scatter markers with an opaque red color:
\image scatter_example_brush.jpg
Tero Ahola
Fixing review findings in QScatterSeries
r358 \sa setPen()
Tero Ahola
Scatter series documentation; now uses snippets
r300 \sa QChart::setChartTheme()
Tero Ahola
Documenting QScatterSeries
r261 */
Tero Ahola
Fixing review findings in QScatterSeries
r358 void QScatterSeries::setBrush(QBrush brush)
Tero Ahola
Scatter series marker visuals
r195 {
d->m_markerBrush = brush;
}
Tero Ahola
Documenting QScatterSeries
r261 /*!
Returns the brush used for drawing markers.
*/
Tero Ahola
Fixing review findings in QScatterSeries
r358 QBrush QScatterSeries::brush()
Tero Ahola
Scatter series marker visuals
r195 {
return d->m_markerBrush;
}
Tero Ahola
Documenting QScatterSeries
r261 /*!
Tero Ahola
Scatter series documentation; now uses snippets
r300 Overrides the default shape of the marker items with a user defined \a shape. The default shape
is defined by chart theme setting.
Tero Ahola
Documenting QScatterSeries
r261
For example:
Tero Ahola
Scatter series documentation; now uses snippets
r300 \snippet ../example/scatter/main.cpp 6
Tero Ahola
Documenting QScatterSeries
r261
Would make your scatter marker items rectangle:
\image scatter_example_shape.jpg
*/
Tero Ahola
Fixing review findings in QScatterSeries
r358 void QScatterSeries::setShape(MarkerShape shape)
Tero Ahola
Scatter series marker visuals
r195 {
d->m_markerShape = shape;
}
Tero Ahola
Documenting QScatterSeries
r261 /*!
Returns the shape used for drawing markers.
*/
Tero Ahola
Fixing review findings in QScatterSeries
r358 QScatterSeries::MarkerShape QScatterSeries::shape()
Tero Ahola
Scatter series marker visuals
r195 {
return (QScatterSeries::MarkerShape) d->m_markerShape;
}
Tero Ahola
Integrated scatter type series...
r42 #include "moc_qscatterseries.cpp"
QTCOMMERCIALCHART_END_NAMESPACE