diff --git a/doc/src/qml.qdoc b/doc/src/qml.qdoc
index f95242a..37729db 100644
--- a/doc/src/qml.qdoc
+++ b/doc/src/qml.qdoc
@@ -20,6 +20,7 @@
+ - XYSeries
- LineSeries
- AreaSeries
- ScatterSeries
diff --git a/plugins/declarative/declarativebarseries.cpp b/plugins/declarative/declarativebarseries.cpp
index 2b36a4a..9cfef5b 100644
--- a/plugins/declarative/declarativebarseries.cpp
+++ b/plugins/declarative/declarativebarseries.cpp
@@ -126,10 +126,16 @@ DeclarativeBarSet *DeclarativeBarSeries::at(int index)
DeclarativeBarSet *DeclarativeBarSeries::insert(int index, QString label, QVariantList values)
{
+ int insertIndex = index;
+ if (insertIndex < 0)
+ insertIndex = 0;
+ else if (insertIndex > count())
+ insertIndex = count();
+
DeclarativeBarSet *barset = new DeclarativeBarSet(this);
barset->setLabel(label);
barset->setValues(values);
- if (QBarSeries::insert(index, barset))
+ if (QBarSeries::insert(insertIndex, barset))
return barset;
delete barset;
return 0;
diff --git a/plugins/declarative/declarativechart.cpp b/plugins/declarative/declarativechart.cpp
index 645dee9..8bbe6aa 100644
--- a/plugins/declarative/declarativechart.cpp
+++ b/plugins/declarative/declarativechart.cpp
@@ -107,9 +107,58 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE
*/
/*!
+ \qmlmethod AbstractSeries ChartView::series(int index)
+ Returns the series with \a index on the chart. This allows you to loop through the series of a chart together with
+ the count property of the chart.
+*/
+
+/*!
+ \qmlmethod AbstractSeries ChartView::series(string name)
+ Returns the first series on the chart with \a name. If there is no series with that name, returns null.
+*/
+
+/*!
+ \qmlmethod AbstractSeries ChartView::createSeries(SeriesType type, string name)
+ Creates a series object of \a type to the chart. For example:
+ \code
+ var scatter = chartView.createSeries(ChartView.SeriesTypeScatter, "scatter series");
+ scatter.markerSize = 22;
+ scatter.append(1.1, 2.0);
+ \endcode
+*/
+
+/*!
\qmlmethod Axis ChartView::axisY(QAbstractSeries *series)
- The y-axis of the series. This is the same as the default y-axis of the chart, unless you have
- explicitly defined the series to have a non-default y-axis.
+ The y-axis of the series. This is the same as the default y-axis of the chart as multiple y-axes are not yet supported.
+*/
+
+/*!
+ \qmlmethod ChartView::zoomY(real factor)
+ Zooms in by \a factor on the center of the chart.
+*/
+
+/*!
+ \qmlmethod ChartView::scrollLeft(real pixels)
+ Scrolls to left by \a pixels. This is a convenience function that suits for example for key navigation.
+ \sa Axis::min, Axis::max
+*/
+
+/*!
+ \qmlmethod ChartView::scrollRight(real pixels)
+ Scrolls to right by \a pixels. This is a convenience function that suits for example for key navigation.
+ \sa Axis::min, Axis::max
+*/
+
+/*!
+ \qmlmethod ChartView::scrollUp(real pixels)
+ Scrolls up by \a pixels. This is a convenience function that suits for example for key navigation.
+ \sa Axis::min, Axis::max
+*/
+
+/*!
+ \qmlmethod ChartView::scrollDown(real pixels)
+ Scrolls down by \a pixels. This is a convenience function that suits for example for key navigation.
+ \sa Axis::min, Axis::max
*/
DeclarativeChart::DeclarativeChart(QDeclarativeItem *parent)
diff --git a/plugins/declarative/declarativechart.h b/plugins/declarative/declarativechart.h
index cca3f61..f257325 100644
--- a/plugins/declarative/declarativechart.h
+++ b/plugins/declarative/declarativechart.h
@@ -100,7 +100,6 @@ public:
void setTitle(QString title);
QString title();
QAxis *axisX();
- Q_INVOKABLE QAxis *axisY(QAbstractSeries *series = 0);
QLegend *legend();
QVariantList axisXLabels();
void setAxisXLabels(QVariantList list);
@@ -113,14 +112,17 @@ public:
int count();
void setDropShadowEnabled(bool enabled);
bool dropShadowEnabled();
+
+public:
+ Q_INVOKABLE QAbstractSeries *series(int index);
+ Q_INVOKABLE QAbstractSeries *series(QString seriesName);
+ Q_INVOKABLE QAbstractSeries *createSeries(DeclarativeChart::SeriesType type, QString name = "");
+ Q_INVOKABLE QAxis *axisY(QAbstractSeries *series = 0);
Q_INVOKABLE void zoom(qreal factor);
Q_INVOKABLE void scrollLeft(qreal pixels);
Q_INVOKABLE void scrollRight(qreal pixels);
Q_INVOKABLE void scrollUp(qreal pixels);
Q_INVOKABLE void scrollDown(qreal pixels);
- Q_INVOKABLE QAbstractSeries *series(int index);
- Q_INVOKABLE QAbstractSeries *series(QString seriesName);
- Q_INVOKABLE QAbstractSeries *createSeries(DeclarativeChart::SeriesType type, QString name = "");
Q_SIGNALS:
void axisLabelsChanged();
diff --git a/plugins/declarative/declarativelineseries.h b/plugins/declarative/declarativelineseries.h
index 53932ce..eaf3d3c 100644
--- a/plugins/declarative/declarativelineseries.h
+++ b/plugins/declarative/declarativelineseries.h
@@ -47,13 +47,13 @@ public: // from QDeclarativeParserStatus
void classBegin() { DeclarativeXySeries::classBegin(); }
void componentComplete() { DeclarativeXySeries::componentComplete(); }
-public: // from QLineSeries
- Q_INVOKABLE void append(qreal x, qreal y) { QLineSeries::append(x, y); }
- Q_INVOKABLE void replace(qreal oldX, qreal oldY, qreal newX, qreal newY) { QLineSeries::replace(oldX, oldY, newX, newY); }
- Q_INVOKABLE void remove(qreal x, qreal y) { QLineSeries::remove(x, y); }
- Q_INVOKABLE void insert(int index, qreal x, qreal y) { QLineSeries::insert(index, QPointF(x, y)); }
- Q_INVOKABLE void clear() { QLineSeries::clear(); }
- Q_INVOKABLE DeclarativeXyPoint *at(int index) { return DeclarativeXySeries::at(index); }
+public:
+ Q_INVOKABLE void append(qreal x, qreal y) { DeclarativeXySeries::append(x, y); }
+ Q_INVOKABLE void replace(qreal oldX, qreal oldY, qreal newX, qreal newY) { DeclarativeXySeries::replace(oldX, oldY, newX, newY); }
+ Q_INVOKABLE void remove(qreal x, qreal y) { DeclarativeXySeries::remove(x, y); }
+ Q_INVOKABLE void insert(int index, qreal x, qreal y) { DeclarativeXySeries::insert(index, x, y); }
+ Q_INVOKABLE void clear() { DeclarativeXySeries::clear(); }
+ Q_INVOKABLE QPointF at(int index) { return DeclarativeXySeries::at(index); }
Q_SIGNALS:
void countChanged(int count);
diff --git a/plugins/declarative/declarativescatterseries.h b/plugins/declarative/declarativescatterseries.h
index 5450882..fb3261d 100644
--- a/plugins/declarative/declarativescatterseries.h
+++ b/plugins/declarative/declarativescatterseries.h
@@ -46,13 +46,13 @@ public: // from QDeclarativeParserStatus
void classBegin() { DeclarativeXySeries::classBegin(); }
void componentComplete() { DeclarativeXySeries::componentComplete(); }
-public: // from QScatterSeries
- Q_INVOKABLE void append(qreal x, qreal y) { QScatterSeries::append(x, y); }
- Q_INVOKABLE void replace(qreal oldX, qreal oldY, qreal newX, qreal newY) { QScatterSeries::replace(oldX, oldY, newX, newY); }
- Q_INVOKABLE void remove(qreal x, qreal y) { QScatterSeries::remove(x, y); }
- Q_INVOKABLE void clear() { QScatterSeries::clear(); }
- Q_INVOKABLE void insert(int index, qreal x, qreal y) { QScatterSeries::insert(index, QPointF(x, y)); }
- Q_INVOKABLE DeclarativeXyPoint *at(int index) { return DeclarativeXySeries::at(index); }
+public:
+ Q_INVOKABLE void append(qreal x, qreal y) { DeclarativeXySeries::append(x, y); }
+ Q_INVOKABLE void replace(qreal oldX, qreal oldY, qreal newX, qreal newY) { DeclarativeXySeries::replace(oldX, oldY, newX, newY); }
+ Q_INVOKABLE void remove(qreal x, qreal y) { DeclarativeXySeries::remove(x, y); }
+ Q_INVOKABLE void insert(int index, qreal x, qreal y) { DeclarativeXySeries::insert(index, x, y); }
+ Q_INVOKABLE void clear() { DeclarativeXySeries::clear(); }
+ Q_INVOKABLE QPointF at(int index) { return DeclarativeXySeries::at(index); }
Q_SIGNALS:
void countChanged(int count);
diff --git a/plugins/declarative/declarativesplineseries.h b/plugins/declarative/declarativesplineseries.h
index e9ee4ee..c7d6f1a 100644
--- a/plugins/declarative/declarativesplineseries.h
+++ b/plugins/declarative/declarativesplineseries.h
@@ -47,13 +47,13 @@ public: // from QDeclarativeParserStatus
void classBegin() { DeclarativeXySeries::classBegin(); }
void componentComplete() { DeclarativeXySeries::componentComplete(); }
-public: // from QSplineSeries
- Q_INVOKABLE void append(qreal x, qreal y) { QSplineSeries::append(x, y); }
- Q_INVOKABLE void replace(qreal oldX, qreal oldY, qreal newX, qreal newY) { QSplineSeries::replace(oldX, oldY, newX, newY); }
- Q_INVOKABLE void remove(qreal x, qreal y) { QSplineSeries::remove(x, y); }
- Q_INVOKABLE void clear() { QSplineSeries::clear(); }
- Q_INVOKABLE void insert(int index, qreal x, qreal y) { QSplineSeries::insert(index, QPointF(x, y)); }
- Q_INVOKABLE DeclarativeXyPoint *at(int index) { return DeclarativeXySeries::at(index); }
+public:
+ Q_INVOKABLE void append(qreal x, qreal y) { DeclarativeXySeries::append(x, y); }
+ Q_INVOKABLE void replace(qreal oldX, qreal oldY, qreal newX, qreal newY) { DeclarativeXySeries::replace(oldX, oldY, newX, newY); }
+ Q_INVOKABLE void remove(qreal x, qreal y) { DeclarativeXySeries::remove(x, y); }
+ Q_INVOKABLE void insert(int index, qreal x, qreal y) { DeclarativeXySeries::insert(index, x, y); }
+ Q_INVOKABLE void clear() { DeclarativeXySeries::clear(); }
+ Q_INVOKABLE QPointF at(int index) { return DeclarativeXySeries::at(index); }
Q_SIGNALS:
void countChanged(int count);
diff --git a/plugins/declarative/declarativexyseries.cpp b/plugins/declarative/declarativexyseries.cpp
index d07dc26..8070baf 100644
--- a/plugins/declarative/declarativexyseries.cpp
+++ b/plugins/declarative/declarativexyseries.cpp
@@ -59,19 +59,48 @@ void DeclarativeXySeries::componentComplete()
}
}
-DeclarativeXyPoint *DeclarativeXySeries::at(int index)
+void DeclarativeXySeries::append(qreal x, qreal y)
{
QXYSeries *series = qobject_cast(xySeries());
Q_ASSERT(series);
- if (index < series->count()) {
- QPointF point = series->points().at(index);
- DeclarativeXyPoint *xyPoint = new DeclarativeXyPoint(series);
- xyPoint->setX(point.x());
- xyPoint->setY(point.y());
- return xyPoint;
- }
- return 0;
+ series->append(x, y);
}
+void DeclarativeXySeries::replace(qreal oldX, qreal oldY, qreal newX, qreal newY)
+{
+ QXYSeries *series = qobject_cast(xySeries());
+ Q_ASSERT(series);
+ series->replace(oldX, oldY, newX, newY);
+}
+
+void DeclarativeXySeries::remove(qreal x, qreal y)
+{
+ QXYSeries *series = qobject_cast(xySeries());
+ Q_ASSERT(series);
+ series->remove(x, y);
+}
+
+void DeclarativeXySeries::insert(int index, qreal x, qreal y)
+{
+ QXYSeries *series = qobject_cast(xySeries());
+ Q_ASSERT(series);
+ series->insert(index, QPointF(x, y));
+}
+
+void DeclarativeXySeries::clear()
+{
+ QXYSeries *series = qobject_cast(xySeries());
+ Q_ASSERT(series);
+ series->clear();
+}
+
+QPointF DeclarativeXySeries::at(int index)
+{
+ QXYSeries *series = qobject_cast(xySeries());
+ Q_ASSERT(series);
+ if (index >= 0 || index < series->count())
+ return series->points().at(index);
+ return QPointF(0, 0);
+}
QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/plugins/declarative/declarativexyseries.h b/plugins/declarative/declarativexyseries.h
index 0665a70..84a1e68 100644
--- a/plugins/declarative/declarativexyseries.h
+++ b/plugins/declarative/declarativexyseries.h
@@ -41,7 +41,13 @@ public:
void classBegin();
void componentComplete();
virtual QXYSeries *xySeries() = 0;
- DeclarativeXyPoint *at(int index);
+
+ void append(qreal x, qreal y);
+ void replace(qreal oldX, qreal oldY, qreal newX, qreal newY);
+ void remove(qreal x, qreal y);
+ void insert(int index, qreal x, qreal y);
+ void clear();
+ QPointF at(int index);
};
QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/barchart/qbarseries.cpp b/src/barchart/qbarseries.cpp
index 20b33dc..f39ac83 100644
--- a/src/barchart/qbarseries.cpp
+++ b/src/barchart/qbarseries.cpp
@@ -47,14 +47,15 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE
*/
/*!
\qmlclass BarSeries QBarSeries
+ \inherits AbstractSeries
+
+ The following QML shows how to create a simple bar chart:
+ \snippet ../demos/qmlchart/qml/qmlchart/View6.qml 1
\beginfloatleft
\image demos_qmlchart6.png
\endfloat
\clearfloat
-
- The following QML shows how to create a simple bar chart:
- \snippet ../demos/qmlchart/qml/qmlchart/View6.qml 1
*/
/*!
@@ -155,6 +156,39 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE
*/
/*!
+ \qmlmethod BarSet BarSeries::at(int index)
+ Returns bar set at \a index. Returns null if the index is not valid.
+*/
+
+/*!
+ \qmlmethod BarSet BarSeries::append(string label, VariantList values)
+ Adds a new bar set with \a label and \a values to \a index. Values can be a list of reals or a list of XyPoints.
+ For example:
+ \code
+ myBarSeries.append("set 1", [0, 0.2, 0.2, 0.5, 0.4, 1.5, 0.9]);
+ myBarSeries.append("set 2", [Qt.point(0, 1), Qt.point(2, 2.5), Qt.point(3.5, 2.2)]);
+ \endcode
+*/
+
+/*!
+ \qmlmethod BarSet BarSeries::insert(int index, string label, VariantList values)
+ Inserts a new bar set with \a label and \a values to \a index. Values can be a list of reals or a list of XyPoints.
+ If index is zero or smaller, the new barset is prepended. If the index is count or bigger, the new barset is
+ appended.
+ \sa BarSeries::append()
+*/
+
+/*!
+ \qmlmethod bool BarSeries::remove(BarSet barset)
+ Removes the barset from the series. Returns true if successfull, false otherwise.
+*/
+
+/*!
+ \qmlmethod BarSeries::clear()
+ Removes all barsets from the series.
+*/
+
+/*!
Constructs empty QBarSeries.
QBarSeries is QObject which is a child of a \a parent.
*/
diff --git a/src/piechart/qpieseries.cpp b/src/piechart/qpieseries.cpp
index 8f79e29..3d22637 100644
--- a/src/piechart/qpieseries.cpp
+++ b/src/piechart/qpieseries.cpp
@@ -50,6 +50,7 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE
*/
/*!
\qmlclass PieSeries QPieSeries
+ \inherits AbstractSeries
The following QML shows how to create a simple pie chart.
@@ -271,6 +272,31 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE
*/
/*!
+ \qmlmethod PieSlice PieSeries::at(int index)
+ Returns slice at \a index. Returns null if the index is not valid.
+*/
+
+/*!
+ \qmlmethod PieSlice PieSeries::find(string label)
+ Returns the first slice with \a label. Returns null if the index is not valid.
+*/
+
+/*!
+ \qmlmethod PieSlice PieSeries::append(string label, real value)
+ Adds a new slice with \a label and \a value to the pie.
+*/
+
+/*!
+ \qmlmethod bool PieSeries::remove(PieSlice slice)
+ Removes the \a slice from the pie. Returns true if the removal was successfull, false otherwise.
+*/
+
+/*!
+ \qmlmethod PieSeries::clear()
+ Removes all slices from the pie.
+*/
+
+/*!
Constructs a series object which is a child of \a parent.
*/
QPieSeries::QPieSeries(QObject *parent) :
diff --git a/src/qabstractseries.cpp b/src/qabstractseries.cpp
index 7638a42..9105aa4 100644
--- a/src/qabstractseries.cpp
+++ b/src/qabstractseries.cpp
@@ -33,6 +33,11 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE
\sa QXYSeries, QLineSeries, QSplineSeries, QScatterSeries, QAreaSeries, QBarSeries, QStackedBarSeries,
QPercentBarSeries, QPieSeries
*/
+/*!
+ \qmlclass AbstractSeries
+ AbstractSeries is the base class for all series.
+ The class cannot be instantiated by the user.
+*/
/*!
\enum QAbstractSeries::SeriesType
@@ -54,18 +59,27 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE
\property QAbstractSeries::type
The type of the series.
*/
+/*!
+ \qmlproperty ChartView.SeriesType AbstractSeries::type
+ The type of the series.
+*/
/*!
\property QAbstractSeries::name
- \brief name of the series property
+ \brief name of the series property. The name is shown in legend for QXYSeries.
+*/
+/*!
+ \qmlproperty string AbstractSeries::name
+ Name of the series. The name is shown in legend for QXYSeries.
*/
/*!
\fn void QAbstractSeries::nameChanged()
-
This signal is emitted when the series name changes.
-
- \sa name
+*/
+/*!
+ \qmlsignal AbstractSeries::nameChanged()
+ This signal is emitted when the series name changes.
*/
/*!
@@ -96,14 +110,6 @@ QAbstractSeries::~QAbstractSeries()
if(d_ptr->m_dataset) qFatal("Still binded series detected !");
}
-/*!
- \brief Sets a \a name for the series.
-
- The name of a series is shown in the legend for QXYSeries.
- \sa QChart::setTitle()
- \sa QPieSlice::setLabel()
- \sa QBarSet::setName()
-*/
void QAbstractSeries::setName(const QString& name)
{
if (name != d_ptr->m_name) {
@@ -112,10 +118,6 @@ void QAbstractSeries::setName(const QString& name)
}
}
-/*!
- \brief Returns the name of the series.
- \sa setName()
-*/
QString QAbstractSeries::name() const
{
return d_ptr->m_name;
diff --git a/src/xychart/qxyseries.cpp b/src/xychart/qxyseries.cpp
index 6c96741..6ce6ecc 100644
--- a/src/xychart/qxyseries.cpp
+++ b/src/xychart/qxyseries.cpp
@@ -31,7 +31,8 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE
*/
/*!
\qmlclass XYSeries
- \brief The XYSeries class is a base class for line, spline and scatter series.
+ \inherits AbstractSeries
+ The XYSeries class is a base class for line, spline and scatter series.
The class cannot be instantiated directly.
*/
@@ -130,7 +131,30 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE
*/
/*!
- \qmlmethod XyPoint XYSeries::at(int index)
+ \qmlmethod XYSeries::append(real x, real y)
+ Append point (\a x, \a y) to the series
+*/
+
+/*!
+ \qmlmethod XYSeries::replace(real oldX, real oldY, real newX, real newY)
+ Replaces point (\a oldX, \a oldY) with point (\a newX, \a newY). Does nothing, if point (oldX, oldY) does not
+ exist.
+*/
+
+/*!
+ \qmlmethod XYSeries::remove(real x, real y)
+ Removes point (\a x, \a y) from the series. Does nothing, if point (x, y) does not exist.
+*/
+
+/*!
+ \qmlmethod XYSeries::insert(int index, real x, real y)
+ Inserts point (\a x, \a y) to the \a index. If index is 0 or smaller than 0 the point is prepended to the list of
+ points. If index is the same as or bigger than count, the point is appended to the list of points.
+*/
+
+/*!
+ \qmlmethod QPointF XYSeries::at(int index)
+ Returns point at \a index. Returns (0, 0) if the index is not valid.
*/
/*!
diff --git a/tests/auto/qxyseries/tst_qxyseries.cpp b/tests/auto/qxyseries/tst_qxyseries.cpp
index e067840..21d8264 100644
--- a/tests/auto/qxyseries/tst_qxyseries.cpp
+++ b/tests/auto/qxyseries/tst_qxyseries.cpp
@@ -44,6 +44,25 @@ void tst_QXYSeries::cleanup()
m_series = 0;
}
+void tst_QXYSeries::seriesName()
+{
+ QSignalSpy nameSpy(m_series, SIGNAL(nameChanged()));
+ QCOMPARE(m_series->name(), QString());
+ m_series->setName("seriesname");
+ QCOMPARE(m_series->name(), QString("seriesname"));
+ TRY_COMPARE(nameSpy.count(), 1);
+}
+
+void tst_QXYSeries::seriesVisible()
+{
+ QSignalSpy visibleSpy(m_series, SIGNAL(visibleChanged()));
+ QCOMPARE(m_series->isVisible(), true);
+ m_series->setVisible(false);
+ QCOMPARE(m_series->isVisible(), false);
+ m_series->setVisible(true);
+ TRY_COMPARE(visibleSpy.count(), 2);
+}
+
void tst_QXYSeries::append_data()
{
QTest::addColumn< QList >("points");
@@ -61,8 +80,10 @@ void tst_QXYSeries::append_raw()
{
QFETCH(QList, points);
QSignalSpy spy0(m_series, SIGNAL(clicked(QPointF const&)));
+ QSignalSpy addedSpy(m_series, SIGNAL(pointAdded(int)));
m_series->append(points);
TRY_COMPARE(spy0.count(), 0);
+ TRY_COMPARE(addedSpy.count(), points.count());
QCOMPARE(m_series->points(), points);
}
@@ -233,13 +254,18 @@ void tst_QXYSeries::replace_raw_data()
void tst_QXYSeries::replace_raw()
{
QFETCH(QList, points);
- QSignalSpy spy0(m_series, SIGNAL(clicked(QPointF const&)));
+ QSignalSpy replacedSpy(m_series, SIGNAL(pointReplaced(int)));
m_series->append(points);
- TRY_COMPARE(spy0.count(), 0);
+ TRY_COMPARE(replacedSpy.count(), 0);
QCOMPARE(m_series->points(), points);
- foreach(const QPointF& point,points)
+ foreach(const QPointF& point, points)
m_series->replace(point.x(),point.y(),point.x(),0);
+ TRY_COMPARE(replacedSpy.count(), points.count());
+
+ // Replace a point that does not exist
+ m_series->replace(-123, 999, 0, 0);
+ TRY_COMPARE(replacedSpy.count(), points.count());
QList newPoints = m_series->points();
@@ -276,6 +302,27 @@ void tst_QXYSeries::replace_chart_animation()
replace_chart();
}
+void tst_QXYSeries::insert_data()
+{
+ append_data();
+}
+
+void tst_QXYSeries::insert()
+{
+ QFETCH(QList, points);
+ m_series->append(points);
+
+ QSignalSpy addedSpy(m_series, SIGNAL(pointAdded(int)));
+
+ m_series->insert(0, QPointF(5, 5));
+ TRY_COMPARE(addedSpy.count(), 1);
+ QCOMPARE(m_series->points().count(), points.count() + 1);
+
+ m_series->insert(m_series->count(), QPointF(6, 6));
+ TRY_COMPARE(addedSpy.count(), 2);
+ QCOMPARE(m_series->points().count(), points.count() + 2);
+}
+
void tst_QXYSeries::oper_data()
{
append_data();
diff --git a/tests/auto/qxyseries/tst_qxyseries.h b/tests/auto/qxyseries/tst_qxyseries.h
index cb53d37..f05a054 100644
--- a/tests/auto/qxyseries/tst_qxyseries.h
+++ b/tests/auto/qxyseries/tst_qxyseries.h
@@ -40,6 +40,8 @@ public slots:
virtual void cleanup();
private slots:
+ void seriesName();
+ void seriesVisible();
void oper_data();
void oper();
void pen_data();
@@ -74,6 +76,8 @@ private slots:
void replace_chart();
void replace_chart_animation_data();
void replace_chart_animation();
+ void insert_data();
+ void insert();
void changedSignals();
protected:
void append_data();
diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/LineEditor.qml b/tests/qmlchartproperties/qml/qmlchartproperties/LineEditor.qml
index 37cd1de..2cf0e1d 100644
--- a/tests/qmlchartproperties/qml/qmlchartproperties/LineEditor.qml
+++ b/tests/qmlchartproperties/qml/qmlchartproperties/LineEditor.qml
@@ -57,7 +57,7 @@ Flow {
}
Button {
text: "insert point"
- onClicked: series.insert(0, series.count - 1, series.count - 1);
+ onClicked: series.insert(series.count - 2, series.count - 2, series.count - 2);
}
Button {
text: "clear"
diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/ScatterEditor.qml b/tests/qmlchartproperties/qml/qmlchartproperties/ScatterEditor.qml
index fefa6b1..f996ae0 100644
--- a/tests/qmlchartproperties/qml/qmlchartproperties/ScatterEditor.qml
+++ b/tests/qmlchartproperties/qml/qmlchartproperties/ScatterEditor.qml
@@ -69,7 +69,7 @@ Flow {
}
Button {
text: "insert point"
- onClicked: series.insert(0, series.count - 1, series.count - 1);
+ onClicked: series.insert(series.count - 2, series.count - 2, series.count - 2);
}
Button {
text: "clear"
|