@@ -27,7 +27,7 Rectangle { | |||||
27 | height: parent.height |
|
27 | height: parent.height | |
28 |
|
28 | |||
29 | ChartView { |
|
29 | ChartView { | |
30 | id: chart |
|
30 | id: chartView | |
31 | title: "Top-5 car brand shares in Finland" |
|
31 | title: "Top-5 car brand shares in Finland" | |
32 | anchors.fill: parent |
|
32 | anchors.fill: parent | |
33 | theme: ChartView.ChartThemeLight |
|
33 | theme: ChartView.ChartThemeLight | |
@@ -53,6 +53,7 Rectangle { | |||||
53 | BarSeries { |
|
53 | BarSeries { | |
54 | name: "Others" |
|
54 | name: "Others" | |
55 | barMargin: 0 |
|
55 | barMargin: 0 | |
|
56 | visible: false | |||
56 | HBarModelMapper { |
|
57 | HBarModelMapper { | |
57 | model: customModel |
|
58 | model: customModel | |
58 | firstBarSetRow: 6 |
|
59 | firstBarSetRow: 6 | |
@@ -62,10 +63,9 Rectangle { | |||||
62 | } |
|
63 | } | |
63 |
|
64 | |||
64 | LineSeries { |
|
65 | LineSeries { | |
65 | id: lineSeries |
|
|||
66 | name: "Volkswagen" |
|
66 | name: "Volkswagen" | |
|
67 | visible: false | |||
67 | HXYModelMapper { |
|
68 | HXYModelMapper { | |
68 | id: lineSeriesMapper |
|
|||
69 | model: customModel |
|
69 | model: customModel | |
70 | xRow: 0 |
|
70 | xRow: 0 | |
71 | yRow: 1 |
|
71 | yRow: 1 | |
@@ -73,6 +73,50 Rectangle { | |||||
73 | } |
|
73 | } | |
74 | } |
|
74 | } | |
75 |
|
75 | |||
|
76 | LineSeries { | |||
|
77 | name: "Toyota" | |||
|
78 | visible: false | |||
|
79 | HXYModelMapper { | |||
|
80 | model: customModel | |||
|
81 | xRow: 0 | |||
|
82 | yRow: 2 | |||
|
83 | first: 2 | |||
|
84 | } | |||
|
85 | } | |||
|
86 | ||||
|
87 | LineSeries { | |||
|
88 | name: "Ford" | |||
|
89 | visible: false | |||
|
90 | HXYModelMapper { | |||
|
91 | model: customModel | |||
|
92 | xRow: 0 | |||
|
93 | yRow: 2 | |||
|
94 | first: 2 | |||
|
95 | } | |||
|
96 | } | |||
|
97 | ||||
|
98 | LineSeries { | |||
|
99 | name: "Skoda" | |||
|
100 | visible: false | |||
|
101 | HXYModelMapper { | |||
|
102 | model: customModel | |||
|
103 | xRow: 0 | |||
|
104 | yRow: 3 | |||
|
105 | first: 2 | |||
|
106 | } | |||
|
107 | } | |||
|
108 | ||||
|
109 | LineSeries { | |||
|
110 | name: "Volvo" | |||
|
111 | visible: false | |||
|
112 | HXYModelMapper { | |||
|
113 | model: customModel | |||
|
114 | xRow: 0 | |||
|
115 | yRow: 4 | |||
|
116 | first: 2 | |||
|
117 | } | |||
|
118 | } | |||
|
119 | ||||
76 | PieSeries { |
|
120 | PieSeries { | |
77 | id: pieSeries |
|
121 | id: pieSeries | |
78 | size: 0.4 |
|
122 | size: 0.4 | |
@@ -80,15 +124,12 Rectangle { | |||||
80 | verticalPosition: 0.4 |
|
124 | verticalPosition: 0.4 | |
81 | onClicked: { |
|
125 | onClicked: { | |
82 | // Show the selection by exploding the slice |
|
126 | // Show the selection by exploding the slice | |
83 | for (var i = 0; i < pieSeries.count; i++) |
|
127 | slice.exploded = !slice.exploded; | |
84 | pieSeries.at(i).exploded = false; |
|
|||
85 | slice.exploded = true; |
|
|||
86 |
|
128 | |||
87 | // Update the line series to show the yearly data for this slice |
|
129 | // Update the line series to show the yearly data for this slice | |
88 | lineSeries.name = slice.label; |
|
130 | for (var i = 0; i < chartView.count; i++) { | |
89 | for (var j = 0; j < customModel.rowCount; j++) { |
|
131 | if (chartView.series(i).name == slice.label) { | |
90 | if (customModel.at(j, 1) == slice.label) { |
|
132 | chartView.series(i).visible = slice.exploded; | |
91 | lineSeriesMapper.yRow = j; |
|
|||
92 | } |
|
133 | } | |
93 | } |
|
134 | } | |
94 | } |
|
135 | } |
@@ -45,6 +45,7 AreaChartItem::AreaChartItem(QAreaSeries *areaSeries, ChartPresenter *presenter) | |||||
45 | m_lower = new AreaBoundItem(this,m_series->lowerSeries(),presenter); |
|
45 | m_lower = new AreaBoundItem(this,m_series->lowerSeries(),presenter); | |
46 |
|
46 | |||
47 | QObject::connect(m_series->d_func(),SIGNAL(updated()),this,SLOT(handleUpdated())); |
|
47 | QObject::connect(m_series->d_func(),SIGNAL(updated()),this,SLOT(handleUpdated())); | |
|
48 | QObject::connect(m_series, SIGNAL(visibleChanged()), this, SLOT(handleUpdated())); | |||
48 | QObject::connect(this,SIGNAL(clicked(QPointF)),areaSeries,SIGNAL(clicked(QPointF))); |
|
49 | QObject::connect(this,SIGNAL(clicked(QPointF)),areaSeries,SIGNAL(clicked(QPointF))); | |
49 |
|
50 | |||
50 | handleUpdated(); |
|
51 | handleUpdated(); | |
@@ -119,18 +120,20 void AreaChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *opt | |||||
119 | Q_UNUSED(widget) |
|
120 | Q_UNUSED(widget) | |
120 | Q_UNUSED(option) |
|
121 | Q_UNUSED(option) | |
121 |
|
122 | |||
122 | painter->save(); |
|
123 | if (m_series->isVisible()) { | |
123 |
painter->s |
|
124 | painter->save(); | |
124 |
painter->set |
|
125 | painter->setPen(m_linePen); | |
125 | painter->setClipRect(m_clipRect); |
|
126 | painter->setBrush(m_brush); | |
126 | painter->drawPath(m_path); |
|
127 | painter->setClipRect(m_clipRect); | |
127 | if (m_pointsVisible) { |
|
128 | painter->drawPath(m_path); | |
128 | painter->setPen(m_pointPen); |
|
129 | if (m_pointsVisible) { | |
129 | painter->drawPoints(m_upper->geometryPoints()); |
|
130 | painter->setPen(m_pointPen); | |
130 | if (m_lower) |
|
131 | painter->drawPoints(m_upper->geometryPoints()); | |
131 | painter->drawPoints(m_lower->geometryPoints()); |
|
132 | if (m_lower) | |
|
133 | painter->drawPoints(m_lower->geometryPoints()); | |||
|
134 | } | |||
|
135 | painter->restore(); | |||
132 | } |
|
136 | } | |
133 | painter->restore(); |
|
|||
134 | } |
|
137 | } | |
135 |
|
138 | |||
136 | void AreaChartItem::mousePressEvent(QGraphicsSceneMouseEvent *event) |
|
139 | void AreaChartItem::mousePressEvent(QGraphicsSceneMouseEvent *event) |
@@ -40,6 +40,7 BarChartItem::BarChartItem(QBarSeries *series, ChartPresenter *presenter) : | |||||
40 | connect(series->d_func(), SIGNAL(updatedBars()), this, SLOT(handleLayoutChanged())); |
|
40 | connect(series->d_func(), SIGNAL(updatedBars()), this, SLOT(handleLayoutChanged())); | |
41 | connect(series->d_func(), SIGNAL(labelsVisibleChanged(bool)), this, SLOT(handleLabelsVisibleChanged(bool))); |
|
41 | connect(series->d_func(), SIGNAL(labelsVisibleChanged(bool)), this, SLOT(handleLabelsVisibleChanged(bool))); | |
42 | connect(series->d_func(), SIGNAL(restructuredBars()), this, SLOT(handleDataStructureChanged())); |
|
42 | connect(series->d_func(), SIGNAL(restructuredBars()), this, SLOT(handleDataStructureChanged())); | |
|
43 | connect(series, SIGNAL(visibleChanged()), this, SLOT(handleLayoutChanged())); | |||
43 | setZValue(ChartPresenter::BarSeriesZValue); |
|
44 | setZValue(ChartPresenter::BarSeriesZValue); | |
44 | handleDataStructureChanged(); |
|
45 | handleDataStructureChanged(); | |
45 | } |
|
46 | } |
@@ -183,24 +183,6 QList<QBarSet*> QBarSeries::barSets() const | |||||
183 | } |
|
183 | } | |
184 |
|
184 | |||
185 | /*! |
|
185 | /*! | |
186 | Sets the visibility of series to \a visible |
|
|||
187 | */ |
|
|||
188 | void QBarSeries::setVisible(bool visible) |
|
|||
189 | { |
|
|||
190 | Q_D(QBarSeries); |
|
|||
191 | d->setVisible(visible); |
|
|||
192 | } |
|
|||
193 |
|
||||
194 | /*! |
|
|||
195 | Returns the visibility of series |
|
|||
196 | */ |
|
|||
197 | bool QBarSeries::isVisible() const |
|
|||
198 | { |
|
|||
199 | Q_D(const QBarSeries); |
|
|||
200 | return d->isVisible(); |
|
|||
201 | } |
|
|||
202 |
|
||||
203 | /*! |
|
|||
204 | Sets the visibility of labels in series to \a visible |
|
186 | Sets the visibility of labels in series to \a visible | |
205 | */ |
|
187 | */ | |
206 | void QBarSeries::setLabelsVisible(bool visible) |
|
188 | void QBarSeries::setLabelsVisible(bool visible) |
@@ -34,8 +34,7 class QTCOMMERCIALCHART_EXPORT QBarSeries : public QAbstractSeries | |||||
34 | { |
|
34 | { | |
35 | Q_OBJECT |
|
35 | Q_OBJECT | |
36 | Q_PROPERTY(qreal barMargin READ barMargin WRITE setBarMargin) |
|
36 | Q_PROPERTY(qreal barMargin READ barMargin WRITE setBarMargin) | |
37 |
Q_PROPERTY(int count READ barsetCount) |
|
37 | Q_PROPERTY(int count READ barsetCount) | |
38 | Q_PROPERTY(bool visible READ isVisible WRITE setVisible) |
|
|||
39 | Q_PROPERTY(bool labelsVisible READ isLabelsVisible WRITE setLabelsVisible) |
|
38 | Q_PROPERTY(bool labelsVisible READ isLabelsVisible WRITE setLabelsVisible) | |
40 |
|
39 | |||
41 | public: |
|
40 | public: | |
@@ -55,8 +54,6 public: | |||||
55 | QList<QBarSet*> barSets() const; |
|
54 | QList<QBarSet*> barSets() const; | |
56 | void clear(); |
|
55 | void clear(); | |
57 |
|
56 | |||
58 | void setVisible(bool visible = true); |
|
|||
59 | bool isVisible() const; |
|
|||
60 | void setLabelsVisible(bool visible = true); |
|
57 | void setLabelsVisible(bool visible = true); | |
61 | bool isLabelsVisible() const; |
|
58 | bool isLabelsVisible() const; | |
62 |
|
59 |
@@ -37,6 +37,7 m_pointsVisible(false) | |||||
37 | { |
|
37 | { | |
38 | setZValue(ChartPresenter::LineChartZValue); |
|
38 | setZValue(ChartPresenter::LineChartZValue); | |
39 | QObject::connect(series->d_func(),SIGNAL(updated()),this,SLOT(handleUpdated())); |
|
39 | QObject::connect(series->d_func(),SIGNAL(updated()),this,SLOT(handleUpdated())); | |
|
40 | QObject::connect(series, SIGNAL(visibleChanged()), this, SLOT(handleUpdated())); | |||
40 | handleUpdated(); |
|
41 | handleUpdated(); | |
41 | } |
|
42 | } | |
42 |
|
43 | |||
@@ -90,15 +91,17 void LineChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *opt | |||||
90 | Q_UNUSED(widget) |
|
91 | Q_UNUSED(widget) | |
91 | Q_UNUSED(option) |
|
92 | Q_UNUSED(option) | |
92 |
|
93 | |||
93 | painter->save(); |
|
94 | if (m_series->isVisible()) { | |
94 |
painter->s |
|
95 | painter->save(); | |
95 |
painter->set |
|
96 | painter->setPen(m_linePen); | |
96 | painter->drawPath(m_path); |
|
97 | painter->setClipRect(clipRect()); | |
97 | if(m_pointsVisible){ |
|
98 | painter->drawPath(m_path); | |
98 | painter->setPen(m_pointPen); |
|
99 | if(m_pointsVisible){ | |
99 | painter->drawPoints(geometryPoints()); |
|
100 | painter->setPen(m_pointPen); | |
|
101 | painter->drawPoints(geometryPoints()); | |||
|
102 | } | |||
|
103 | painter->restore(); | |||
100 | } |
|
104 | } | |
101 | painter->restore(); |
|
|||
102 | } |
|
105 | } | |
103 |
|
106 | |||
104 | void LineChartItem::mousePressEvent(QGraphicsSceneMouseEvent *event) |
|
107 | void LineChartItem::mousePressEvent(QGraphicsSceneMouseEvent *event) |
@@ -100,7 +100,7 void QAbstractSeries::setName(const QString& name) | |||||
100 | { |
|
100 | { | |
101 | if (name != d_ptr->m_name) { |
|
101 | if (name != d_ptr->m_name) { | |
102 | d_ptr->m_name = name; |
|
102 | d_ptr->m_name = name; | |
103 | nameChanged(); |
|
103 | emit nameChanged(); | |
104 | } |
|
104 | } | |
105 | } |
|
105 | } | |
106 |
|
106 | |||
@@ -114,6 +114,25 QString QAbstractSeries::name() const | |||||
114 | } |
|
114 | } | |
115 |
|
115 | |||
116 | /*! |
|
116 | /*! | |
|
117 | Sets the visibility of series to \a visible | |||
|
118 | */ | |||
|
119 | void QAbstractSeries::setVisible(bool visible) | |||
|
120 | { | |||
|
121 | if (visible != d_ptr->m_visible) { | |||
|
122 | d_ptr->m_visible = visible; | |||
|
123 | emit visibleChanged(); | |||
|
124 | } | |||
|
125 | } | |||
|
126 | ||||
|
127 | /*! | |||
|
128 | Returns the visibility of series | |||
|
129 | */ | |||
|
130 | bool QAbstractSeries::isVisible() const | |||
|
131 | { | |||
|
132 | return d_ptr->m_visible; | |||
|
133 | } | |||
|
134 | ||||
|
135 | /*! | |||
117 | \brief Returns the chart where series belongs to. |
|
136 | \brief Returns the chart where series belongs to. | |
118 |
|
137 | |||
119 | Set automatically when the series is added to the chart |
|
138 | Set automatically when the series is added to the chart | |
@@ -129,7 +148,8 QChart* QAbstractSeries::chart() const | |||||
129 | QAbstractSeriesPrivate::QAbstractSeriesPrivate(QAbstractSeries* q): |
|
148 | QAbstractSeriesPrivate::QAbstractSeriesPrivate(QAbstractSeries* q): | |
130 | q_ptr(q), |
|
149 | q_ptr(q), | |
131 | m_chart(0), |
|
150 | m_chart(0), | |
132 | m_dataset(0) |
|
151 | m_dataset(0), | |
|
152 | m_visible(true) | |||
133 | { |
|
153 | { | |
134 | } |
|
154 | } | |
135 |
|
155 |
@@ -34,6 +34,7 class QTCOMMERCIALCHART_EXPORT QAbstractSeries : public QObject | |||||
34 | { |
|
34 | { | |
35 | Q_OBJECT |
|
35 | Q_OBJECT | |
36 | Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) |
|
36 | Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) | |
|
37 | Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged) | |||
37 | Q_ENUMS(SeriesType) |
|
38 | Q_ENUMS(SeriesType) | |
38 |
|
39 | |||
39 | public: |
|
40 | public: | |
@@ -57,10 +58,13 public: | |||||
57 | virtual SeriesType type() const = 0; |
|
58 | virtual SeriesType type() const = 0; | |
58 | void setName(const QString& name); |
|
59 | void setName(const QString& name); | |
59 | QString name() const; |
|
60 | QString name() const; | |
|
61 | void setVisible(bool visible = true); | |||
|
62 | bool isVisible() const; | |||
60 | QChart* chart() const; |
|
63 | QChart* chart() const; | |
61 |
|
64 | |||
62 | Q_SIGNALS: |
|
65 | Q_SIGNALS: | |
63 | void nameChanged(); |
|
66 | void nameChanged(); | |
|
67 | void visibleChanged(); | |||
64 |
|
68 | |||
65 | protected: |
|
69 | protected: | |
66 | QScopedPointer<QAbstractSeriesPrivate> d_ptr; |
|
70 | QScopedPointer<QAbstractSeriesPrivate> d_ptr; |
@@ -57,6 +57,7 protected: | |||||
57 | QChart *m_chart; |
|
57 | QChart *m_chart; | |
58 | ChartDataSet *m_dataset; |
|
58 | ChartDataSet *m_dataset; | |
59 | QString m_name; |
|
59 | QString m_name; | |
|
60 | bool m_visible; | |||
60 |
|
61 | |||
61 | friend class QAbstractSeries; |
|
62 | friend class QAbstractSeries; | |
62 | friend class ChartDataSet; |
|
63 | friend class ChartDataSet; |
@@ -30,14 +30,15 | |||||
30 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
30 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
31 |
|
31 | |||
32 | ScatterChartItem::ScatterChartItem(QScatterSeries *series, ChartPresenter *presenter) : |
|
32 | ScatterChartItem::ScatterChartItem(QScatterSeries *series, ChartPresenter *presenter) : | |
33 | XYChart(series,presenter), |
|
33 | XYChart(series,presenter), | |
34 | QGraphicsItem(presenter ? presenter->rootItem() : 0), |
|
34 | QGraphicsItem(presenter ? presenter->rootItem() : 0), | |
35 | m_series(series), |
|
35 | m_series(series), | |
36 | m_items(this), |
|
36 | m_items(this), | |
37 | m_shape(QScatterSeries::MarkerShapeRectangle), |
|
37 | m_shape(QScatterSeries::MarkerShapeRectangle), | |
38 | m_size(15) |
|
38 | m_size(15) | |
39 | { |
|
39 | { | |
40 | QObject::connect(m_series->d_func(),SIGNAL(updated()), this, SLOT(handleUpdated())); |
|
40 | QObject::connect(m_series->d_func(),SIGNAL(updated()), this, SLOT(handleUpdated())); | |
|
41 | QObject::connect(series, SIGNAL(visibleChanged()), this, SLOT(handleUpdated())); | |||
41 |
|
42 | |||
42 | setZValue(ChartPresenter::ScatterSeriesZValue); |
|
43 | setZValue(ChartPresenter::ScatterSeriesZValue); | |
43 | setFlags(QGraphicsItem::ItemClipsChildrenToShape); |
|
44 | setFlags(QGraphicsItem::ItemClipsChildrenToShape); |
@@ -28,14 +28,15 | |||||
28 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
28 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
29 |
|
29 | |||
30 | SplineChartItem::SplineChartItem(QSplineSeries *series, ChartPresenter *presenter) : |
|
30 | SplineChartItem::SplineChartItem(QSplineSeries *series, ChartPresenter *presenter) : | |
31 | XYChart(series, presenter), |
|
31 | XYChart(series, presenter), | |
32 | QGraphicsItem(presenter ? presenter->rootItem() : 0), |
|
32 | QGraphicsItem(presenter ? presenter->rootItem() : 0), | |
33 | m_series(series), |
|
33 | m_series(series), | |
34 | m_pointsVisible(false), |
|
34 | m_pointsVisible(false), | |
35 | m_animation(0) |
|
35 | m_animation(0) | |
36 | { |
|
36 | { | |
37 | setZValue(ChartPresenter::LineChartZValue); |
|
37 | setZValue(ChartPresenter::LineChartZValue); | |
38 | QObject::connect(m_series->d_func(),SIGNAL(updated()),this,SLOT(handleUpdated())); |
|
38 | QObject::connect(m_series->d_func(),SIGNAL(updated()),this,SLOT(handleUpdated())); | |
|
39 | QObject::connect(series, SIGNAL(visibleChanged()), this, SLOT(handleUpdated())); | |||
39 | handleUpdated(); |
|
40 | handleUpdated(); | |
40 | } |
|
41 | } | |
41 |
|
42 | |||
@@ -147,15 +148,17 void SplineChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *o | |||||
147 | { |
|
148 | { | |
148 | Q_UNUSED(widget) |
|
149 | Q_UNUSED(widget) | |
149 | Q_UNUSED(option) |
|
150 | Q_UNUSED(option) | |
150 | painter->save(); |
|
151 | if (m_series->isVisible()) { | |
151 | painter->setClipRect(clipRect()); |
|
152 | painter->save(); | |
152 |
painter->set |
|
153 | painter->setClipRect(clipRect()); | |
153 | painter->drawPath(m_path); |
|
154 | painter->setPen(m_linePen); | |
154 | if (m_pointsVisible) { |
|
155 | painter->drawPath(m_path); | |
155 | painter->setPen(m_pointPen); |
|
156 | if (m_pointsVisible) { | |
156 |
painter-> |
|
157 | painter->setPen(m_pointPen); | |
|
158 | painter->drawPoints(geometryPoints()); | |||
|
159 | } | |||
|
160 | painter->restore(); | |||
157 | } |
|
161 | } | |
158 | painter->restore(); |
|
|||
159 | } |
|
162 | } | |
160 |
|
163 | |||
161 | void SplineChartItem::mousePressEvent(QGraphicsSceneMouseEvent *event) |
|
164 | void SplineChartItem::mousePressEvent(QGraphicsSceneMouseEvent *event) |
@@ -90,8 +90,8 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
90 | */ |
|
90 | */ | |
91 | QXYSeries::QXYSeries(QXYSeriesPrivate &d,QObject *parent) : QAbstractSeries(d, parent) |
|
91 | QXYSeries::QXYSeries(QXYSeriesPrivate &d,QObject *parent) : QAbstractSeries(d, parent) | |
92 | { |
|
92 | { | |
93 |
|
||||
94 | } |
|
93 | } | |
|
94 | ||||
95 | /*! |
|
95 | /*! | |
96 | Destroys the object. Series added to QChartView or QChart instances are owned by those, |
|
96 | Destroys the object. Series added to QChartView or QChart instances are owned by those, | |
97 | and are deleted when mentioned object are destroyed. |
|
97 | and are deleted when mentioned object are destroyed. |
@@ -401,7 +401,6 void tst_QBarSet::customize() | |||||
401 | // Test adding data to the sets |
|
401 | // Test adding data to the sets | |
402 | *set1 << 1 << 2 << 1 << 3; |
|
402 | *set1 << 1 << 2 << 1 << 3; | |
403 | *set2 << 2 << 1 << 3 << 1; |
|
403 | *set2 << 2 << 1 << 3 << 1; | |
404 | QTest::qWait(3000); |
|
|||
405 | } |
|
404 | } | |
406 |
|
405 | |||
407 | QTEST_MAIN(tst_QBarSet) |
|
406 | QTEST_MAIN(tst_QBarSet) |
@@ -348,3 +348,15 void tst_QXYSeries::pointsVisible_raw() | |||||
348 | TRY_COMPARE(spy0.count(), 0); |
|
348 | TRY_COMPARE(spy0.count(), 0); | |
349 | QCOMPARE(m_series->pointsVisible(), pointsVisible); |
|
349 | QCOMPARE(m_series->pointsVisible(), pointsVisible); | |
350 | } |
|
350 | } | |
|
351 | ||||
|
352 | void tst_QXYSeries::changedSignals() | |||
|
353 | { | |||
|
354 | QSignalSpy visibleSpy(m_series, SIGNAL(visibleChanged())); | |||
|
355 | ||||
|
356 | m_series->setVisible(false); | |||
|
357 | m_series->setVisible(false); | |||
|
358 | TRY_COMPARE(visibleSpy.count(), 1); | |||
|
359 | m_series->setVisible(true); | |||
|
360 | TRY_COMPARE(visibleSpy.count(), 2); | |||
|
361 | } | |||
|
362 |
@@ -74,6 +74,7 private slots: | |||||
74 | void replace_chart(); |
|
74 | void replace_chart(); | |
75 | void replace_chart_animation_data(); |
|
75 | void replace_chart_animation_data(); | |
76 | void replace_chart_animation(); |
|
76 | void replace_chart_animation(); | |
|
77 | void changedSignals(); | |||
77 | protected: |
|
78 | protected: | |
78 | void append_data(); |
|
79 | void append_data(); | |
79 | void count_data(); |
|
80 | void count_data(); |
@@ -29,6 +29,10 Flow { | |||||
29 | property variant series |
|
29 | property variant series | |
30 |
|
30 | |||
31 | Button { |
|
31 | Button { | |
|
32 | text: "visible" | |||
|
33 | onClicked: series.visible = !series.visible; | |||
|
34 | } | |||
|
35 | Button { | |||
32 | text: "color" |
|
36 | text: "color" | |
33 | onClicked: series.color = main.nextColor(); |
|
37 | onClicked: series.color = main.nextColor(); | |
34 | } |
|
38 | } |
@@ -28,18 +28,6 Flow { | |||||
28 | property variant series |
|
28 | property variant series | |
29 |
|
29 | |||
30 | Button { |
|
30 | Button { | |
31 | text: "set 1 color" |
|
|||
32 | onClicked: series.at(0).color = main.nextColor(); |
|
|||
33 | } |
|
|||
34 | Button { |
|
|||
35 | text: "set 1 border color" |
|
|||
36 | onClicked: series.at(0).borderColor = main.nextColor(); |
|
|||
37 | } |
|
|||
38 | Button { |
|
|||
39 | text: "set 1 label color" |
|
|||
40 | onClicked: series.at(0).labelColor = main.nextColor(); |
|
|||
41 | } |
|
|||
42 | Button { |
|
|||
43 | text: "visible" |
|
31 | text: "visible" | |
44 | onClicked: series.visible = !series.visible; |
|
32 | onClicked: series.visible = !series.visible; | |
45 | } |
|
33 | } | |
@@ -56,6 +44,18 Flow { | |||||
56 | onClicked: series.barMargin -= 0.1; |
|
44 | onClicked: series.barMargin -= 0.1; | |
57 | } |
|
45 | } | |
58 | Button { |
|
46 | Button { | |
|
47 | text: "set 1 color" | |||
|
48 | onClicked: series.at(0).color = main.nextColor(); | |||
|
49 | } | |||
|
50 | Button { | |||
|
51 | text: "set 1 border color" | |||
|
52 | onClicked: series.at(0).borderColor = main.nextColor(); | |||
|
53 | } | |||
|
54 | Button { | |||
|
55 | text: "set 1 label color" | |||
|
56 | onClicked: series.at(0).labelColor = main.nextColor(); | |||
|
57 | } | |||
|
58 | Button { | |||
59 | text: "set 1 font size +" |
|
59 | text: "set 1 font size +" | |
60 | onClicked: series.at(0).labelFont.pixelSize += 1; |
|
60 | onClicked: series.at(0).labelFont.pixelSize += 1; | |
61 | } |
|
61 | } |
@@ -29,6 +29,10 Flow { | |||||
29 | property variant series |
|
29 | property variant series | |
30 |
|
30 | |||
31 | Button { |
|
31 | Button { | |
|
32 | text: "visible" | |||
|
33 | onClicked: series.visible = !series.visible; | |||
|
34 | } | |||
|
35 | Button { | |||
32 | text: "color" |
|
36 | text: "color" | |
33 | onClicked: series.color = main.nextColor(); |
|
37 | onClicked: series.color = main.nextColor(); | |
34 | } |
|
38 | } |
@@ -28,6 +28,50 Flow { | |||||
28 | property variant series |
|
28 | property variant series | |
29 |
|
29 | |||
30 | Button { |
|
30 | Button { | |
|
31 | text: "visible" | |||
|
32 | onClicked: series.visible = !series.visible; | |||
|
33 | } | |||
|
34 | Button { | |||
|
35 | text: "series hpos +" | |||
|
36 | onClicked: series.horizontalPosition += 0.1; | |||
|
37 | } | |||
|
38 | Button { | |||
|
39 | text: "series hpos -" | |||
|
40 | onClicked: series.horizontalPosition -= 0.1; | |||
|
41 | } | |||
|
42 | Button { | |||
|
43 | text: "series vpos +" | |||
|
44 | onClicked: series.verticalPosition += 0.1; | |||
|
45 | } | |||
|
46 | Button { | |||
|
47 | text: "series vpos -" | |||
|
48 | onClicked: series.verticalPosition -= 0.1; | |||
|
49 | } | |||
|
50 | Button { | |||
|
51 | text: "series size +" | |||
|
52 | onClicked: series.size += 0.1; | |||
|
53 | } | |||
|
54 | Button { | |||
|
55 | text: "series size -" | |||
|
56 | onClicked: series.size -= 0.1; | |||
|
57 | } | |||
|
58 | Button { | |||
|
59 | text: "series start angle +" | |||
|
60 | onClicked: series.startAngle += 0.1; | |||
|
61 | } | |||
|
62 | Button { | |||
|
63 | text: "series start angle -" | |||
|
64 | onClicked: series.startAngle -= 0.1; | |||
|
65 | } | |||
|
66 | Button { | |||
|
67 | text: "series end angle +" | |||
|
68 | onClicked: series.endAngle += 0.1; | |||
|
69 | } | |||
|
70 | Button { | |||
|
71 | text: "series end angle -" | |||
|
72 | onClicked: series.endAngle -= 0.1; | |||
|
73 | } | |||
|
74 | Button { | |||
31 | text: "slice color" |
|
75 | text: "slice color" | |
32 | onClicked: series.at(0).color = main.nextColor(); |
|
76 | onClicked: series.at(0).color = main.nextColor(); | |
33 | } |
|
77 | } | |
@@ -71,44 +115,4 Flow { | |||||
71 | text: "slice explode dist -" |
|
115 | text: "slice explode dist -" | |
72 | onClicked: series.at(0).explodeDistanceFactor -= 0.1; |
|
116 | onClicked: series.at(0).explodeDistanceFactor -= 0.1; | |
73 | } |
|
117 | } | |
74 | Button { |
|
|||
75 | text: "series hpos +" |
|
|||
76 | onClicked: series.horizontalPosition += 0.1; |
|
|||
77 | } |
|
|||
78 | Button { |
|
|||
79 | text: "series hpos -" |
|
|||
80 | onClicked: series.horizontalPosition -= 0.1; |
|
|||
81 | } |
|
|||
82 | Button { |
|
|||
83 | text: "series vpos +" |
|
|||
84 | onClicked: series.verticalPosition += 0.1; |
|
|||
85 | } |
|
|||
86 | Button { |
|
|||
87 | text: "series vpos -" |
|
|||
88 | onClicked: series.verticalPosition -= 0.1; |
|
|||
89 | } |
|
|||
90 | Button { |
|
|||
91 | text: "series size +" |
|
|||
92 | onClicked: series.size += 0.1; |
|
|||
93 | } |
|
|||
94 | Button { |
|
|||
95 | text: "series size -" |
|
|||
96 | onClicked: series.size -= 0.1; |
|
|||
97 | } |
|
|||
98 | Button { |
|
|||
99 | text: "series start angle +" |
|
|||
100 | onClicked: series.startAngle += 0.1; |
|
|||
101 | } |
|
|||
102 | Button { |
|
|||
103 | text: "series start angle -" |
|
|||
104 | onClicked: series.startAngle -= 0.1; |
|
|||
105 | } |
|
|||
106 | Button { |
|
|||
107 | text: "series end angle +" |
|
|||
108 | onClicked: series.endAngle += 0.1; |
|
|||
109 | } |
|
|||
110 | Button { |
|
|||
111 | text: "series end angle -" |
|
|||
112 | onClicked: series.endAngle -= 0.1; |
|
|||
113 | } |
|
|||
114 | } |
|
118 | } |
@@ -29,6 +29,10 Flow { | |||||
29 | property variant series |
|
29 | property variant series | |
30 |
|
30 | |||
31 | Button { |
|
31 | Button { | |
|
32 | text: "visible" | |||
|
33 | onClicked: series.visible = !series.visible; | |||
|
34 | } | |||
|
35 | Button { | |||
32 | text: "color" |
|
36 | text: "color" | |
33 | onClicked: series.color = main.nextColor(); |
|
37 | onClicked: series.color = main.nextColor(); | |
34 | } |
|
38 | } |
General Comments 0
You need to be logged in to leave comments.
Login now