##// END OF EJS Templates
Plugged some memory leaks....
Plugged some memory leaks. Autotests were also made Valgrind friendly by adding a final one millisecond wait to the end of the test to allow pending deleteLaters to run. Also some minor cosmetic cleanup done to autotests. Change-Id: Ic3719167a22949f243eaf54614e174a681dbe34a Reviewed-by: Titta Heikkala <titta.heikkala@theqtcompany.com>

File last commit:

r2733:c6ed50e68438
r2733:c6ed50e68438
Show More
qlineseries.cpp
173 lines | 4.6 KiB | text/x-c | CppLexer
Jani Honkonen
Add license headers
r794 /****************************************************************************
**
Titta Heikkala
Update copyright year...
r2688 ** Copyright (C) 2014 Digia Plc
Jani Honkonen
Add license headers
r794 ** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
Miikka Heikkinen
Qt Commercial -> Qt Enterprise...
r2574 ** This file is part of the Qt Enterprise Charts Add-on.
Jani Honkonen
Add license headers
r794 **
** $QT_BEGIN_LICENSE$
Miikka Heikkinen
Qt Commercial -> Qt Enterprise...
r2574 ** Licensees holding valid Qt Enterprise licenses may use this file in
** accordance with the Qt Enterprise License Agreement provided with the
Jani Honkonen
Add license headers
r794 ** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia.
**
** If you have questions regarding the use of this file, please use
** contact form at http://qt.digia.com
** $QT_END_LICENSE$
**
****************************************************************************/
Titta Heikkala
Fix include syntax...
r2714 #include <QtCharts/QLineSeries>
#include <private/qlineseries_p.h>
#include <private/linechartitem_p.h>
#include <private/chartdataset_p.h>
#include <private/charttheme_p.h>
#include <private/qchart_p.h>
Titta Heikkala
Qt Charts project file structure change...
r2712 QT_CHARTS_BEGIN_NAMESPACE
Michal Klocek
Refactor current draft to fit int current design specs...
r21
Michal Klocek
Refactor documentation...
r331 /*!
Michal Klocek
fix docs of qlineseries
r350 \class QLineSeries
Titta Heikkala
Fix Charts documentation...
r2639 \inmodule Qt Charts
Michal Klocek
fix docs of qlineseries
r350 \brief The QLineSeries class is used for making line charts.
Michal Klocek
Refactor documentation...
r331
\mainclass
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 A line chart is used to show information as a series of data points
connected by straight lines.
Michal Klocek
Refactor documentation...
r331
Tero Ahola
Documentation fixes....
r995 \image examples_linechart.png
Michal Klocek
Refactor documentation...
r331
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 Creating basic line chart is simple:
\code
Tero Ahola
Documentation fixes....
r995 QLineSeries* series = new QLineSeries();
Jani Honkonen
rename functions add() -> append()
r796 series->append(0, 6);
series->append(2, 4);
Tero Ahola
Documentation fixes....
r995 ...
chart->addSeries(series);
Michal Klocek
Limit code presented on qlineseries docs
r369 \endcode
Michal Klocek
Refactor documentation...
r331 */
Titta Heikkala
Fix Charts documentation...
r2639 /*!
\qmltype LineSeries
\instantiates QLineSeries
Titta Heikkala
Qt Charts project file structure change...
r2712 \inqmlmodule QtCharts
Titta Heikkala
Fix Charts documentation...
r2639
Titta Heikkala
Qt Charts project file structure change...
r2712 \inherits XYSeries
\brief The LineSeries type is used for making line charts.
Tero Ahola
Documenting xy-series
r1491
Titta Heikkala
Qt Charts project file structure change...
r2712 The following QML shows how to create a simple line chart:
\snippet qmlchart/qml/qmlchart/View2.qml 1
\beginfloatleft
\image examples_qmlchart2.png
\endfloat
\clearfloat
Tero Ahola
Documenting xy-series
r1491 */
Michal Klocek
Refactor documentation...
r331
/*!
Michal Klocek
Fixes to API , QSeriesType -> SeriesType , add missing getters
r1107 \fn virtual SeriesType QLineSeries::type() const
Michal Klocek
Refactor documentation...
r331 \brief Returns type of series.
Michal Klocek
Fixes to API , QSeriesType -> SeriesType , add missing getters
r1107 \sa QAbstractSeries, SeriesType
Michal Klocek
Refactor documentation...
r331 */
Tero Ahola
Adding missing QML series API line/border properties
r1904 /*!
\qmlproperty real LineSeries::width
The width of the line. By default the width is 2.0.
*/
/*!
\qmlproperty Qt::PenStyle LineSeries::style
Controls the style of the line. Set to one of Qt.NoPen, Qt.SolidLine, Qt.DashLine, Qt.DotLine,
Qt.DashDotLine or Qt.DashDotDotLine. Using Qt.CustomDashLine is not supported in the QML API.
By default the style is Qt.SolidLine.
*/
/*!
\qmlproperty Qt::PenCapStyle LineSeries::capStyle
Controls the cap style of the line. Set to one of Qt.FlatCap, Qt.SquareCap or Qt.RoundCap. By
default the cap style is Qt.SquareCap.
*/
Michal Klocek
Adds replace,remove,add signals to qchartline
r374 /*!
Michal Klocek
Refactor scatter chart to fit the other classes...
r470 Constructs empty series object which is a child of \a parent.
Michal Klocek
Krazy reported errors...
r974 When series object is added to QChartView or QChart instance ownerships is transferred.
Michal Klocek
Refactor documentation...
r331 */
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 QLineSeries::QLineSeries(QObject *parent)
: QXYSeries(*new QLineSeriesPrivate(this), parent)
Michal Klocek
Adds big fat pimpl to series classes...
r938 {
}
Tero Ahola
Updated documentation, warnings from legend and area left
r973 /*!
\internal
*/
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 QLineSeries::QLineSeries(QLineSeriesPrivate &d, QObject *parent)
: QXYSeries(d, parent)
Michal Klocek
Refactor scatter chart to fit the other classes...
r470 {
Michal Klocek
Refactor documentation...
r331
Michal Klocek
Refactor scatter chart to fit the other classes...
r470 }
Michal Klocek
Adds updated handling for line series
r392 /*!
Michal Klocek
Refactor scatter chart to fit the other classes...
r470 Destroys the object. Series added to QChartView or QChart instances are owned by those,
and are deleted when mentioned object are destroyed.
Michal Klocek
Adds updated handling for line series
r392 */
Michal Klocek
Refactor scatter chart to fit the other classes...
r470 QLineSeries::~QLineSeries()
{
Michal Klocek
Bugfix for destruction of qlineseries
r1069 Q_D(QLineSeries);
Michal Klocek
Refactors internals...
r2273 if (d->m_chart)
d->m_chart->removeSeries(this);
Michal Klocek
Refactor scatter chart to fit the other classes...
r470 }
Michal Klocek
Adds updated handling for line series
r392
Michal Klocek
Fixes to API , QSeriesType -> SeriesType , add missing getters
r1107 QAbstractSeries::SeriesType QLineSeries::type() const
Michal Klocek
Refactor current draft to fit int current design specs...
r21 {
Tero Ahola
Renamed QSeries to QAbstractSeries
r988 return QAbstractSeries::SeriesTypeLine;
Michal Klocek
Refactor current draft to fit int current design specs...
r21 }
Michal Klocek
Adds big fat pimpl to series classes...
r938 /*
Michal Klocek
Rename QLineChartSeries to QLineSeries
r349 QDebug operator<< (QDebug debug, const QLineSeries series)
Michal Klocek
Refactor current draft to fit int current design specs...
r21 {
Michal Klocek
Adds big fat pimpl to series classes...
r938 Q_ASSERT(series.d_func()->m_x.size() == series.d_func()->m_y.size());
int size = series.d_func()->m_x.size();
sauimone
minor code review issues. indent, spaces, brackets etc.
r743 for (int i=0; i<size; i++) {
Michal Klocek
Adds big fat pimpl to series classes...
r938 debug.nospace() << "(" << series.d_func()->m_x.at(i) << ','<< series.d_func()->m_y.at(i) << ") ";
Michal Klocek
Refactor current draft to fit int current design specs...
r21 }
return debug.space();
}
Michal Klocek
Adds big fat pimpl to series classes...
r938 */
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Jani Honkonen
more coding style fixes for src-folder...
r2104 QLineSeriesPrivate::QLineSeriesPrivate(QLineSeries *q)
: QXYSeriesPrivate(q)
Michal Klocek
Adds big fat pimpl to series classes...
r938 {
Miikka Heikkinen
Plugged some memory leaks....
r2733 }
Michal Klocek
Refactor current draft to fit int current design specs...
r21
Michal Klocek
Refactors internals...
r2273 void QLineSeriesPrivate::initializeGraphics(QGraphicsItem *parent)
Michal Klocek
Refactor to use qseries private for implmentation interface...
r943 {
Q_Q(QLineSeries);
Michal Klocek
Refactors internals...
r2273 LineChartItem *line = new LineChartItem(q,parent);
m_item.reset(line);
QAbstractSeriesPrivate::initializeGraphics(parent);
}
void QLineSeriesPrivate::initializeTheme(int index, ChartTheme* theme, bool forced)
{
Q_Q(QLineSeries);
const QList<QColor> colors = theme->seriesColors();
Miikka Heikkinen
Fix explicitly set default pen/brush/font getting overridden by theme...
r2516 if (forced || QChartPrivate::defaultPen() == m_pen) {
QPen pen;
Michal Klocek
Refactors internals...
r2273 pen.setColor(colors.at(index % colors.size()));
pen.setWidthF(2);
q->setPen(pen);
}
Titta Heikkala
Added possibility to show series value...
r2689
if (forced || QChartPrivate::defaultPen().color() == m_pointLabelsColor) {
QColor color = theme->labelBrush().color();
q->setPointLabelsColor(color);
}
Michal Klocek
Refactor to use qseries private for implmentation interface...
r943 }
Tero Ahola
Scatter customization to QML api
r1276 #include "moc_qlineseries.cpp"
Titta Heikkala
Qt Charts project file structure change...
r2712 QT_CHARTS_END_NAMESPACE