##// END OF EJS Templates
Rest of the pie, bar, area and scatter properties to QML property tester
Tero Ahola -
r1308:dde391dc31a2
parent child
Show More
@@ -0,0 +1,55
1 /****************************************************************************
2 **
3 ** Copyright (C) 2012 Digia Plc
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 **
7 ** This file is part of the Qt Commercial Charts Add-on.
8 **
9 ** $QT_BEGIN_LICENSE$
10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 ** accordance with the Qt Commercial License Agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia.
14 **
15 ** If you have questions regarding the use of this file, please use
16 ** contact form at http://qt.digia.com
17 ** $QT_END_LICENSE$
18 **
19 ****************************************************************************/
20
21 import QtQuick 1.0
22 import QtCommercial.Chart 1.0
23
24
25 Flow {
26 id: flow
27 spacing: 5
28 flow: Flow.TopToBottom
29 property variant series
30
31 Button {
32 text: "color"
33 onClicked: series.color = main.nextColor();
34 }
35 Button {
36 text: "borderColor"
37 onClicked: series.borderColor = main.nextColor();
38 }
39 Button {
40 text: "upper color"
41 onClicked: series.upperSeries.color = main.nextColor();
42 }
43 Button {
44 text: "lower color"
45 onClicked: series.lowerSeries.color = main.nextColor();
46 }
47 Button {
48 text: "upper points visible"
49 onClicked: series.upperSeries.pointsVisible = !series.pointsVisible;
50 }
51 Button {
52 text: "lower points visible"
53 onClicked: series.lowerSeries.pointsVisible = !series.pointsVisible;
54 }
55 }
@@ -0,0 +1,51
1 /****************************************************************************
2 **
3 ** Copyright (C) 2012 Digia Plc
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 **
7 ** This file is part of the Qt Commercial Charts Add-on.
8 **
9 ** $QT_BEGIN_LICENSE$
10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 ** accordance with the Qt Commercial License Agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia.
14 **
15 ** If you have questions regarding the use of this file, please use
16 ** contact form at http://qt.digia.com
17 ** $QT_END_LICENSE$
18 **
19 ****************************************************************************/
20
21 import QtQuick 1.0
22 import QtCommercial.Chart 1.0
23
24
25 Flow {
26 id: flow
27 spacing: 5
28 flow: Flow.TopToBottom
29 property variant series
30
31 Button {
32 text: "color"
33 onClicked: series.color = main.nextColor();
34 }
35 Button {
36 text: "borderColor"
37 onClicked: series.borderColor = main.nextColor();
38 }
39 Button {
40 text: "markerSize +"
41 onClicked: series.markerSize += 1.0;
42 }
43 Button {
44 text: "markerSize -"
45 onClicked: series.markerSize -= 1.0;
46 }
47 Button {
48 text: "markerShape"
49 onClicked: series.markerShape = ((series.markerShape + 1) % 2);
50 }
51 }
@@ -50,6 +50,30 DeclarativeLineSeries* DeclarativeAreaSeries::lowerSeries() const
50 return qobject_cast<DeclarativeLineSeries *>(QAreaSeries::lowerSeries());
50 return qobject_cast<DeclarativeLineSeries *>(QAreaSeries::lowerSeries());
51 }
51 }
52
52
53 QColor DeclarativeAreaSeries::penColor() const
54 {
55 return pen().color();
56 }
57
58 void DeclarativeAreaSeries::setPenColor(QColor color)
59 {
60 QPen p = pen();
61 p.setColor(color);
62 setPen(p);
63 }
64
65 QColor DeclarativeAreaSeries::brushColor() const
66 {
67 return brush().color();
68 }
69
70 void DeclarativeAreaSeries::setBrushColor(QColor color)
71 {
72 QBrush b = brush();
73 b.setColor(color);
74 setBrush(b);
75 }
76
53 #include "moc_declarativeareaseries.cpp"
77 #include "moc_declarativeareaseries.cpp"
54
78
55 QTCOMMERCIALCHART_END_NAMESPACE
79 QTCOMMERCIALCHART_END_NAMESPACE
@@ -32,18 +32,19 class DeclarativeAreaSeries : public QAreaSeries
32 Q_OBJECT
32 Q_OBJECT
33 Q_PROPERTY(DeclarativeLineSeries *upperSeries READ upperSeries WRITE setUpperSeries)
33 Q_PROPERTY(DeclarativeLineSeries *upperSeries READ upperSeries WRITE setUpperSeries)
34 Q_PROPERTY(DeclarativeLineSeries *lowerSeries READ lowerSeries WRITE setLowerSeries)
34 Q_PROPERTY(DeclarativeLineSeries *lowerSeries READ lowerSeries WRITE setLowerSeries)
35 Q_PROPERTY(QColor color READ brushColor WRITE setBrushColor)
36 Q_PROPERTY(QColor borderColor READ penColor WRITE setPenColor)
35
37
36 public:
38 public:
37 explicit DeclarativeAreaSeries(QObject *parent = 0);
39 explicit DeclarativeAreaSeries(QObject *parent = 0);
38
39 public:
40 QXYModelMapper* upperModelMapper() const;
41 QXYModelMapper* lowerModelMapper() const;
42 public:
43 void setUpperSeries(DeclarativeLineSeries* series);
40 void setUpperSeries(DeclarativeLineSeries* series);
44 DeclarativeLineSeries* upperSeries() const;
41 DeclarativeLineSeries* upperSeries() const;
45 void setLowerSeries(DeclarativeLineSeries* series);
42 void setLowerSeries(DeclarativeLineSeries* series);
46 DeclarativeLineSeries* lowerSeries() const;
43 DeclarativeLineSeries* lowerSeries() const;
44 QColor penColor() const;
45 void setPenColor(QColor color);
46 QColor brushColor() const;
47 void setBrushColor(QColor color);
47 };
48 };
48
49
49 QTCOMMERCIALCHART_END_NAMESPACE
50 QTCOMMERCIALCHART_END_NAMESPACE
@@ -58,7 +58,6 void DeclarativeXySeries::componentComplete()
58 }
58 }
59 }
59 }
60
60
61
62 QColor DeclarativeXySeries::penColor()
61 QColor DeclarativeXySeries::penColor()
63 {
62 {
64 // All the inherited objects must be of type QXYSeries, so it is safe to cast
63 // All the inherited objects must be of type QXYSeries, so it is safe to cast
@@ -33,6 +33,7 class QAreaSeriesPrivate;
33 class QTCOMMERCIALCHART_EXPORT QAreaSeries : public QAbstractSeries
33 class QTCOMMERCIALCHART_EXPORT QAreaSeries : public QAbstractSeries
34 {
34 {
35 Q_OBJECT
35 Q_OBJECT
36
36 public:
37 public:
37 explicit QAreaSeries(QObject *parent = 0);
38 explicit QAreaSeries(QObject *parent = 0);
38 explicit QAreaSeries(QLineSeries *upperSeries, QLineSeries *lowerSeries = 0);
39 explicit QAreaSeries(QLineSeries *upperSeries, QLineSeries *lowerSeries = 0);
@@ -36,7 +36,9 class QBarSeriesPrivate;
36 class QTCOMMERCIALCHART_EXPORT QBarSeries : public QAbstractSeries
36 class QTCOMMERCIALCHART_EXPORT QBarSeries : public QAbstractSeries
37 {
37 {
38 Q_OBJECT
38 Q_OBJECT
39 Q_PROPERTY(qreal barMargin READ barMargin WRITE setBarMargin)
39 Q_PROPERTY(int count READ barsetCount) // TODO: categoryCount to be removed
40 Q_PROPERTY(int count READ barsetCount) // TODO: categoryCount to be removed
41 Q_PROPERTY(bool visible READ isVisible WRITE setVisible)
40 Q_PROPERTY(bool labelsVisible READ isLabelsVisible WRITE setLabelsVisible)
42 Q_PROPERTY(bool labelsVisible READ isLabelsVisible WRITE setLabelsVisible)
41
43
42 public:
44 public:
@@ -33,6 +33,10 class QTCOMMERCIALCHART_EXPORT QBarSet : public QObject
33 {
33 {
34 Q_OBJECT
34 Q_OBJECT
35 Q_PROPERTY(QString name READ name WRITE setName)
35 Q_PROPERTY(QString name READ name WRITE setName)
36 Q_PROPERTY(QPen pen READ pen WRITE setPen)
37 Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
38 Q_PROPERTY(QBrush labelBrush READ labelBrush WRITE setLabelBrush)
39 Q_PROPERTY(QFont labelFont READ labelFont WRITE setLabelFont)
36
40
37 public:
41 public:
38 explicit QBarSet(const QString name, QObject *parent = 0);
42 explicit QBarSet(const QString name, QObject *parent = 0);
@@ -37,6 +37,7 class QTCOMMERCIALCHART_EXPORT QXYSeries : public QAbstractSeries
37 {
37 {
38 Q_OBJECT
38 Q_OBJECT
39 Q_PROPERTY(bool pointsVisible READ pointsVisible WRITE setPointsVisible)
39 Q_PROPERTY(bool pointsVisible READ pointsVisible WRITE setPointsVisible)
40 Q_PROPERTY(int count READ count)
40
41
41 protected:
42 protected:
42 explicit QXYSeries(QXYSeriesPrivate &d,QObject *parent = 0);
43 explicit QXYSeries(QXYSeriesPrivate &d,QObject *parent = 0);
@@ -24,6 +24,7 import QtCommercial.Chart 1.0
24 Flow {
24 Flow {
25 id: flow
25 id: flow
26 spacing: 5
26 spacing: 5
27 flow: Flow.TopToBottom
27 property variant series
28 property variant series
28
29
29 Button {
30 Button {
@@ -39,7 +40,27 Flow {
39 onClicked: series.at(0).labelColor = main.nextColor();
40 onClicked: series.at(0).labelColor = main.nextColor();
40 }
41 }
41 Button {
42 Button {
43 text: "visible"
44 onClicked: series.visible = !series.visible;
45 }
46 Button {
42 text: "labels visible"
47 text: "labels visible"
43 onClicked: series.labelsVisible = !series.labelsVisible;
48 onClicked: series.labelsVisible = !series.labelsVisible;
44 }
49 }
50 Button {
51 text: "bar margin +"
52 onClicked: series.barMargin += 0.1;
53 }
54 Button {
55 text: "bar margin -"
56 onClicked: series.barMargin -= 0.1;
57 }
58 Button {
59 text: "set 1 font size +"
60 onClicked: series.at(0).labelFont.pixelSize += 1;
61 }
62 Button {
63 text: "set 1 font size -"
64 onClicked: series.at(0).labelFont.pixelSize -= 1;
65 }
45 }
66 }
@@ -22,8 +22,8 import QtQuick 1.0
22
22
23 Rectangle {
23 Rectangle {
24 id: button
24 id: button
25 height: 45
25 height: 25
26 width: 165
26 width: 110
27 color: "#afafaf"
27 color: "#afafaf"
28 radius: 5
28 radius: 5
29
29
@@ -25,6 +25,7 import QtCommercial.Chart 1.0
25 Flow {
25 Flow {
26 id: flow
26 id: flow
27 spacing: 5
27 spacing: 5
28 flow: Flow.TopToBottom
28 property variant series
29 property variant series
29
30
30 Button {
31 Button {
@@ -24,6 +24,7 import QtCommercial.Chart 1.0
24 Flow {
24 Flow {
25 id: flow
25 id: flow
26 spacing: 5
26 spacing: 5
27 flow: Flow.TopToBottom
27 property variant series
28 property variant series
28
29
29 Button {
30 Button {
@@ -47,6 +48,14 Flow {
47 onClicked: series.at(0).labelVisible = !series.at(0).labelVisible;
48 onClicked: series.at(0).labelVisible = !series.at(0).labelVisible;
48 }
49 }
49 Button {
50 Button {
51 text: "slice label arm len +"
52 onClicked: series.at(0).labelArmLengthFactor += 0.1;
53 }
54 Button {
55 text: "slice label arm len -"
56 onClicked: series.at(0).labelArmLengthFactor -= 0.1;
57 }
58 Button {
50 text: "slice label color"
59 text: "slice label color"
51 onClicked: series.at(0).labelColor = main.nextColor();
60 onClicked: series.at(0).labelColor = main.nextColor();
52 }
61 }
@@ -54,4 +63,52 Flow {
54 text: "slice exploded"
63 text: "slice exploded"
55 onClicked: series.at(0).exploded = !series.at(0).exploded;
64 onClicked: series.at(0).exploded = !series.at(0).exploded;
56 }
65 }
66 Button {
67 text: "slice explode dist +"
68 onClicked: series.at(0).explodeDistanceFactor += 0.1;
69 }
70 Button {
71 text: "slice explode dist -"
72 onClicked: series.at(0).explodeDistanceFactor -= 0.1;
73 }
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 }
57 }
114 }
@@ -48,10 +48,10 Rectangle {
48 editorLoader.source = "LineEditor.qml";
48 editorLoader.source = "LineEditor.qml";
49 } else if (viewNumber == 3) {
49 } else if (viewNumber == 3) {
50 chartLoader.source = "ScatterChart.qml";
50 chartLoader.source = "ScatterChart.qml";
51 editorLoader.source = "LineEditor.qml"; // TODO: scatter specific properties
51 editorLoader.source = "ScatterEditor.qml";
52 } else if (viewNumber == 4) {
52 } else if (viewNumber == 4) {
53 chartLoader.source = "AreaChart.qml";
53 chartLoader.source = "AreaChart.qml";
54 editorLoader.source = "LineEditor.qml"; // TODO: area specific properties
54 editorLoader.source = "AreaEditor.qml";
55 } else if (viewNumber == 5) {
55 } else if (viewNumber == 5) {
56 chartLoader.source = "BarChart.qml";
56 chartLoader.source = "BarChart.qml";
57 editorLoader.source = "BarEditor.qml";
57 editorLoader.source = "BarEditor.qml";
@@ -80,7 +80,7 Rectangle {
80
80
81 Loader {
81 Loader {
82 id: editorLoader
82 id: editorLoader
83 width: 150
83 width: 230
84 height: parent.height
84 height: parent.height
85 source: "PieEditor.qml"
85 source: "PieEditor.qml"
86 onStatusChanged: {
86 onStatusChanged: {
@@ -91,15 +91,6 Rectangle {
91 }
91 }
92 }
92 }
93
93
94 // Loader {
95 // id: loader
96 // anchors.top: parent.top
97 // anchors.bottom: buttonRow.top
98 // anchors.left: parent.left
99 // anchors.right: parent.right
100 // source: "View" + viewNumber + ".qml";
101 // }
102
103 Row {
94 Row {
104 id: buttonRow
95 id: buttonRow
105 height: 100
96 height: 100
@@ -12,5 +12,7
12 <file>qml/qmlchartproperties/AreaChart.qml</file>
12 <file>qml/qmlchartproperties/AreaChart.qml</file>
13 <file>qml/qmlchartproperties/BarChart.qml</file>
13 <file>qml/qmlchartproperties/BarChart.qml</file>
14 <file>qml/qmlchartproperties/BarEditor.qml</file>
14 <file>qml/qmlchartproperties/BarEditor.qml</file>
15 <file>qml/qmlchartproperties/ScatterEditor.qml</file>
16 <file>qml/qmlchartproperties/AreaEditor.qml</file>
15 </qresource>
17 </qresource>
16 </RCC>
18 </RCC>
General Comments 0
You need to be logged in to leave comments. Login now