@@ -44,7 +44,7 QVariantList DeclarativeBarSet::values() | |||
|
44 | 44 | { |
|
45 | 45 | QVariantList values; |
|
46 | 46 | for (int i(0); i < count(); i++) |
|
47 | values.append(QVariant(at(i))); | |
|
47 | values.append(QVariant(QBarSet::at(i))); | |
|
48 | 48 | return values; |
|
49 | 49 | } |
|
50 | 50 | |
@@ -55,7 +55,9 void DeclarativeBarSet::setValues(QVariantList values) | |||
|
55 | 55 | |
|
56 | 56 | for (int i(0); i < values.count(); i++) { |
|
57 | 57 | if (values.at(i).canConvert(QVariant::Double)) |
|
58 | append(values[i].toDouble()); | |
|
58 | QBarSet::append(values[i].toDouble()); | |
|
59 | else if (values.at(i).canConvert(QVariant::PointF)) | |
|
60 | QBarSet::append(values[i].toPointF()); | |
|
59 | 61 | } |
|
60 | 62 | } |
|
61 | 63 |
@@ -47,6 +47,10 public: | |||
|
47 | 47 | public: // From QBarSet |
|
48 | 48 | Q_INVOKABLE void append(qreal value) { QBarSet::append(value); } |
|
49 | 49 | Q_INVOKABLE void append(qreal x, qreal y) { QBarSet::append(QPointF(x, y)); } |
|
50 | Q_INVOKABLE bool remove(const int index, const int count = 1) { return QBarSet::remove(index, count); } | |
|
51 | Q_INVOKABLE void replace(int index, qreal value) { QBarSet::replace(index, value); } | |
|
52 | Q_INVOKABLE void replace(int index, qreal x, qreal y) { QBarSet::replace(index, QPointF(x, y)); } | |
|
53 | Q_INVOKABLE QPointF at(int index) { return QBarSet::at(index); } | |
|
50 | 54 | |
|
51 | 55 | Q_SIGNALS: |
|
52 | 56 | void countChanged(int count); |
@@ -36,10 +36,18 ChartView { | |||
|
36 | 36 | BarSet { label: "Bob"; values: [4, 7, 3, 10, 5, 6] |
|
37 | 37 | onClicked: console.log("barset.onClicked: " + index); |
|
38 | 38 | onHovered: console.log("barset.onHovered: " + status); |
|
39 | onPenChanged: console.log("barset.onPenChanged: " + pen); | |
|
40 | onBrushChanged: console.log("barset.onBrushChanged: " + brush); | |
|
41 | onLabelChanged: console.log("barset.onLabelChanged: " + label); | |
|
42 | onLabelBrushChanged: console.log("barset.onLabelBrushChanged: " + labelBrush); | |
|
43 | onLabelFontChanged: console.log("barset.onLabelFontChanged: " + labelFont); | |
|
39 | 44 | onColorChanged: console.log("barset.onColorChanged: " + color); |
|
40 | 45 | onBorderColorChanged: console.log("barset.onBorderColorChanged: " + color); |
|
41 | 46 | onLabelColorChanged: console.log("barset.onLabelColorChanged: " + color); |
|
42 | 47 | onCountChanged: console.log("barset.onCountChanged: " + count); |
|
48 | onValuesAdded: console.log("barset.onValuesAdded: " + index + ", " + count); | |
|
49 | onValuesRemoved: console.log("barset.onValuesRemoved: " + index + ", " + count); | |
|
50 | onValueChanged: console.log("barset.onValuesChanged: " + index); | |
|
43 | 51 | } |
|
44 | 52 | BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 8] } |
|
45 | 53 | BarSet { label: "James"; values: [3, 5, 8, 5, 4, 7] } |
@@ -65,6 +65,20 Flow { | |||
|
65 | 65 | text: "clear sets" |
|
66 | 66 | onClicked: series.clear(); |
|
67 | 67 | } |
|
68 | ||
|
69 | Button { | |
|
70 | text: "set 1 append" | |
|
71 | onClicked: series.at(0).append(series.at(0).count + 1); | |
|
72 | } | |
|
73 | Button { | |
|
74 | text: "set 1 replace" | |
|
75 | onClicked: series.at(0).replace(series.at(0).count - 1, series.at(0).at(series.at(0).count - 1).y + 0.5); | |
|
76 | } | |
|
77 | Button { | |
|
78 | text: "set 1 remove" | |
|
79 | onClicked: series.at(0).remove(series.at(0).count - 1); | |
|
80 | } | |
|
81 | ||
|
68 | 82 | Button { |
|
69 | 83 | text: "set 1 color" |
|
70 | 84 | onClicked: series.at(0).color = main.nextColor(); |
@@ -36,10 +36,18 ChartView { | |||
|
36 | 36 | BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] |
|
37 | 37 | onClicked: console.log("barset.onClicked: " + index); |
|
38 | 38 | onHovered: console.log("barset.onHovered: " + status); |
|
39 | onPenChanged: console.log("barset.onPenChanged: " + pen); | |
|
40 | onBrushChanged: console.log("barset.onBrushChanged: " + brush); | |
|
41 | onLabelChanged: console.log("barset.onLabelChanged: " + label); | |
|
42 | onLabelBrushChanged: console.log("barset.onLabelBrushChanged: " + labelBrush); | |
|
43 | onLabelFontChanged: console.log("barset.onLabelFontChanged: " + labelFont); | |
|
39 | 44 | onColorChanged: console.log("barset.onColorChanged: " + color); |
|
40 | 45 | onBorderColorChanged: console.log("barset.onBorderColorChanged: " + color); |
|
41 | 46 | onLabelColorChanged: console.log("barset.onLabelColorChanged: " + color); |
|
42 | 47 | onCountChanged: console.log("barset.onCountChanged: " + count); |
|
48 | onValuesAdded: console.log("barset.onValuesAdded: " + index + ", " + count); | |
|
49 | onValuesRemoved: console.log("barset.onValuesRemoved: " + index + ", " + count); | |
|
50 | onValueChanged: console.log("barset.onValuesChanged: " + index); | |
|
43 | 51 | } |
|
44 | 52 | BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] } |
|
45 | 53 | BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] } |
@@ -36,10 +36,18 ChartView { | |||
|
36 | 36 | BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] |
|
37 | 37 | onClicked: console.log("barset.onClicked: " + index); |
|
38 | 38 | onHovered: console.log("barset.onHovered: " + status); |
|
39 | onPenChanged: console.log("barset.onPenChanged: " + pen); | |
|
40 | onBrushChanged: console.log("barset.onBrushChanged: " + brush); | |
|
41 | onLabelChanged: console.log("barset.onLabelChanged: " + label); | |
|
42 | onLabelBrushChanged: console.log("barset.onLabelBrushChanged: " + labelBrush); | |
|
43 | onLabelFontChanged: console.log("barset.onLabelFontChanged: " + labelFont); | |
|
39 | 44 | onColorChanged: console.log("barset.onColorChanged: " + color); |
|
40 | 45 | onBorderColorChanged: console.log("barset.onBorderColorChanged: " + color); |
|
41 | 46 | onLabelColorChanged: console.log("barset.onLabelColorChanged: " + color); |
|
42 | 47 | onCountChanged: console.log("barset.onCountChanged: " + count); |
|
48 | onValuesAdded: console.log("barset.onValuesAdded: " + index + ", " + count); | |
|
49 | onValuesRemoved: console.log("barset.onValuesRemoved: " + index + ", " + count); | |
|
50 | onValueChanged: console.log("barset.onValuesChanged: " + index); | |
|
43 | 51 | } |
|
44 | 52 | BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] } |
|
45 | 53 | BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] } |
@@ -36,10 +36,18 ChartView { | |||
|
36 | 36 | BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] |
|
37 | 37 | onClicked: console.log("barset.onClicked: " + index); |
|
38 | 38 | onHovered: console.log("barset.onHovered: " + status); |
|
39 | onPenChanged: console.log("barset.onPenChanged: " + pen); | |
|
40 | onBrushChanged: console.log("barset.onBrushChanged: " + brush); | |
|
41 | onLabelChanged: console.log("barset.onLabelChanged: " + label); | |
|
42 | onLabelBrushChanged: console.log("barset.onLabelBrushChanged: " + labelBrush); | |
|
43 | onLabelFontChanged: console.log("barset.onLabelFontChanged: " + labelFont); | |
|
39 | 44 | onColorChanged: console.log("barset.onColorChanged: " + color); |
|
40 | 45 | onBorderColorChanged: console.log("barset.onBorderColorChanged: " + color); |
|
41 | 46 | onLabelColorChanged: console.log("barset.onLabelColorChanged: " + color); |
|
42 | 47 | onCountChanged: console.log("barset.onCountChanged: " + count); |
|
48 | onValuesAdded: console.log("barset.onValuesAdded: " + index + ", " + count); | |
|
49 | onValuesRemoved: console.log("barset.onValuesRemoved: " + index + ", " + count); | |
|
50 | onValueChanged: console.log("barset.onValuesChanged: " + index); | |
|
43 | 51 | } |
|
44 | 52 | BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] } |
|
45 | 53 | BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] } |
General Comments 0
You need to be logged in to leave comments.
Login now