From 7786daffde49e02372b72c91995c1f384d756c48 2014-05-05 10:33:01 From: Titta Heikkala Date: 2014-05-05 10:33:01 Subject: [PATCH] Add count property for QBoxPlotSeries Changed set count to property for QBoxPlotSeries. Task-number: QTRD-2504 Change-Id: Id65e0b2b6e43b3a6330fbb21c66e1cfa4d0db3d2 Reviewed-by: Miikka Heikkinen --- diff --git a/plugins/declarative/declarativeboxplotseries.cpp b/plugins/declarative/declarativeboxplotseries.cpp index 7cdcde6..a481af4 100644 --- a/plugins/declarative/declarativeboxplotseries.cpp +++ b/plugins/declarative/declarativeboxplotseries.cpp @@ -199,6 +199,10 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE This property configures the brush of the box-and-whiskers items. */ /*! + \qmlproperty int BoxPlotSeries::count + The count of sets in series. +*/ +/*! \qmlsignal BoxPlotSeries::onBoxOutlineVisibilityChanged() Signal is emitted when the middle box outline visibility is changed. */ diff --git a/plugins/quick2/plugins.qmltypes b/plugins/quick2/plugins.qmltypes index d0a9bd6..4233d81 100644 --- a/plugins/quick2/plugins.qmltypes +++ b/plugins/quick2/plugins.qmltypes @@ -1738,6 +1738,7 @@ Module { Property { name: "boxWidth"; type: "double" } Property { name: "pen"; type: "QPen" } Property { name: "brush"; type: "QBrush" } + Property { name: "count"; revision: 1; type: "int"; isReadonly: true } Signal { name: "clicked" Parameter { name: "boxset"; type: "QBoxSet"; isPointer: true } @@ -1747,7 +1748,6 @@ Module { Parameter { name: "status"; type: "bool" } Parameter { name: "boxset"; type: "QBoxSet"; isPointer: true } } - Signal { name: "countChanged" } Signal { name: "boxOutlineVisibilityChanged" } Signal { name: "boxsetsAdded" diff --git a/src/boxplotchart/qboxplotseries.cpp b/src/boxplotchart/qboxplotseries.cpp index 5dc6be1..a795b91 100644 --- a/src/boxplotchart/qboxplotseries.cpp +++ b/src/boxplotchart/qboxplotseries.cpp @@ -87,6 +87,10 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE \property QBoxPlotSeries::brush \brief This property configures the brush of the box-and-whiskers items. */ +/*! + \property QBoxPlotSeries::count + \brief The count of sets in series. +*/ /*! \qmlproperty QString BoxPlotSeries::brushFilename diff --git a/src/boxplotchart/qboxplotseries.h b/src/boxplotchart/qboxplotseries.h index 5517ed7..5aedd5a 100644 --- a/src/boxplotchart/qboxplotseries.h +++ b/src/boxplotchart/qboxplotseries.h @@ -36,6 +36,7 @@ class QTCOMMERCIALCHART_EXPORT QBoxPlotSeries : public QAbstractSeries Q_PROPERTY(qreal boxWidth READ boxWidth WRITE setBoxWidth NOTIFY boxWidthChanged) Q_PROPERTY(QPen pen READ pen WRITE setPen NOTIFY penChanged) Q_PROPERTY(QBrush brush READ brush WRITE setBrush NOTIFY brushChanged) + Q_PROPERTY(int count READ count NOTIFY countChanged REVISION 1) public: explicit QBoxPlotSeries(QObject *parent = 0); ~QBoxPlotSeries(); diff --git a/tests/auto/qml-qtquicktest/tst_boxplotseries.qml b/tests/auto/qml-qtquicktest/tst_boxplotseries.qml index 7a991a6..54252e0 100644 --- a/tests/auto/qml-qtquicktest/tst_boxplotseries.qml +++ b/tests/auto/qml-qtquicktest/tst_boxplotseries.qml @@ -44,6 +44,7 @@ Rectangle { } function test_append() { + boxPlotSeries.clear(); addedSpy.clear(); countChangedSpy.clear(); var count = 50; @@ -51,11 +52,12 @@ Rectangle { boxPlotSeries.append("boxplot" + i, Math.random()); compare(addedSpy.count, count); compare(countChangedSpy.count, count); - console.log("Check the series count once QTRD-2504 is implemented"); + compare(boxPlotSeries.count, count) boxPlotSeries.clear(); } function test_remove() { + boxPlotSeries.clear(); removedSpy.clear(); countChangedSpy.clear(); var count = 50; @@ -65,7 +67,7 @@ Rectangle { boxPlotSeries.remove(boxPlotSeries.at(0)); compare(removedSpy.count, count); compare(countChangedSpy.count, 2 * count); - console.log("Check the series count once QTRD-2504 is implemented"); + compare(boxPlotSeries.count, 0) } } diff --git a/tests/auto/qml-qtquicktest/tst_boxplotseries_1_3.qml b/tests/auto/qml-qtquicktest/tst_boxplotseries_1_3.qml index 28ae66f..9babadf 100644 --- a/tests/auto/qml-qtquicktest/tst_boxplotseries_1_3.qml +++ b/tests/auto/qml-qtquicktest/tst_boxplotseries_1_3.qml @@ -49,7 +49,6 @@ Rectangle { boxPlotSeries.append("boxplot" + i, Math.random()); compare(addedSpy.count, count); compare(countChangedSpy.count, count); - console.log("Check the series count once QTRD-2504 is implemented"); boxPlotSeries.clear(); } @@ -63,7 +62,6 @@ Rectangle { boxPlotSeries.remove(boxPlotSeries.at(0)); compare(removedSpy.count, count); compare(countChangedSpy.count, 2 * count); - console.log("Check the series count once QTRD-2504 is implemented"); } }