##// END OF EJS Templates
Added missing QML properties to AreaSeries
Tero Ahola -
r1906:125444d74d9f
parent child
Show More
@@ -50,6 +50,21 DeclarativeLineSeries* DeclarativeAreaSeries::lowerSeries() const
50 return qobject_cast<DeclarativeLineSeries *>(QAreaSeries::lowerSeries());
50 return qobject_cast<DeclarativeLineSeries *>(QAreaSeries::lowerSeries());
51 }
51 }
52
52
53 qreal DeclarativeAreaSeries::borderWidth() const
54 {
55 return pen().widthF();
56 }
57
58 void DeclarativeAreaSeries::setBorderWidth(qreal width)
59 {
60 if (width != pen().widthF()) {
61 QPen p = pen();
62 p.setWidthF(width);
63 setPen(p);
64 emit borderWidthChanged(width);
65 }
66 }
67
53 #include "moc_declarativeareaseries.cpp"
68 #include "moc_declarativeareaseries.cpp"
54
69
55 QTCOMMERCIALCHART_END_NAMESPACE
70 QTCOMMERCIALCHART_END_NAMESPACE
@@ -33,6 +33,7 class DeclarativeAreaSeries : public QAreaSeries
33 Q_PROPERTY(DeclarativeLineSeries *lowerSeries READ lowerSeries WRITE setLowerSeries)
33 Q_PROPERTY(DeclarativeLineSeries *lowerSeries READ lowerSeries WRITE setLowerSeries)
34 Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION 1)
34 Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION 1)
35 Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION 1)
35 Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION 1)
36 Q_PROPERTY(qreal borderWidth READ borderWidth WRITE setBorderWidth NOTIFY borderWidthChanged REVISION 1)
36
37
37 public:
38 public:
38 explicit DeclarativeAreaSeries(QObject *parent = 0);
39 explicit DeclarativeAreaSeries(QObject *parent = 0);
@@ -44,10 +45,13 public:
44 void setAxisX(QAbstractAxis *axis) { m_axisX = axis; emit axisXChanged(axis); }
45 void setAxisX(QAbstractAxis *axis) { m_axisX = axis; emit axisXChanged(axis); }
45 QAbstractAxis *axisY() { return m_axisY; }
46 QAbstractAxis *axisY() { return m_axisY; }
46 void setAxisY(QAbstractAxis *axis) { m_axisY = axis; emit axisYChanged(axis); }
47 void setAxisY(QAbstractAxis *axis) { m_axisY = axis; emit axisYChanged(axis); }
48 qreal borderWidth() const;
49 void setBorderWidth(qreal borderWidth);
47
50
48 Q_SIGNALS:
51 Q_SIGNALS:
49 Q_REVISION(1) void axisXChanged(QAbstractAxis *axis);
52 Q_REVISION(1) void axisXChanged(QAbstractAxis *axis);
50 Q_REVISION(1) void axisYChanged(QAbstractAxis *axis);
53 Q_REVISION(1) void axisYChanged(QAbstractAxis *axis);
54 Q_REVISION(1) void borderWidthChanged(qreal width);
51
55
52 private:
56 private:
53 QAbstractAxis *m_axisX;
57 QAbstractAxis *m_axisX;
@@ -97,6 +97,11 QTCOMMERCIALCHART_BEGIN_NAMESPACE
97 */
97 */
98
98
99 /*!
99 /*!
100 \qmlproperty real AreaSeries::borderWidth
101 The width of the border line. By default the width is 2.0.
102 */
103
104 /*!
100 \fn QPen QAreaSeries::pen() const
105 \fn QPen QAreaSeries::pen() const
101 \brief Returns the pen used to draw line for this series.
106 \brief Returns the pen used to draw line for this series.
102 \sa setPen()
107 \sa setPen()
@@ -67,6 +67,7 ChartView {
67 onSelected: console.log(name + ".onSelected");
67 onSelected: console.log(name + ".onSelected");
68 onColorChanged: console.log(name + ".onColorChanged: " + color);
68 onColorChanged: console.log(name + ".onColorChanged: " + color);
69 onBorderColorChanged: console.log(name + ".onBorderColorChanged: " + borderColor);
69 onBorderColorChanged: console.log(name + ".onBorderColorChanged: " + borderColor);
70 onBorderWidthChanged: console.log(name + ".onBorderChanged: " + borderWidth);
70 // onCountChanged: console.log(name + ".onCountChanged: " + count);
71 // onCountChanged: console.log(name + ".onCountChanged: " + count);
71 }
72 }
72
73
@@ -39,6 +39,14 Flow {
39 onClicked: series.borderColor = main.nextColor();
39 onClicked: series.borderColor = main.nextColor();
40 }
40 }
41 Button {
41 Button {
42 text: "borderWidth + (" + series.borderWidth + ")"
43 onClicked: series.borderWidth += 0.5;
44 }
45 Button {
46 text: "borderWidth - (" + series.borderWidth + ")"
47 onClicked: series.borderWidth -= 0.5;
48 }
49 Button {
42 id: upperButton
50 id: upperButton
43 text: "upper series"
51 text: "upper series"
44 unpressedColor: "#79bd8f"
52 unpressedColor: "#79bd8f"
General Comments 0
You need to be logged in to leave comments. Login now