@@ -1,103 +1,102 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2012 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | 21 | #ifndef PIESERIES_H |
|
22 | 22 | #define PIESERIES_H |
|
23 | 23 | |
|
24 | 24 | #include <qabstractseries.h> |
|
25 | 25 | #include <QPieSlice> |
|
26 | 26 | |
|
27 | 27 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
28 | 28 | class QPieSeriesPrivate; |
|
29 | 29 | |
|
30 | 30 | class QTCOMMERCIALCHART_EXPORT QPieSeries : public QAbstractSeries |
|
31 | 31 | { |
|
32 | 32 | Q_OBJECT |
|
33 | 33 | Q_PROPERTY(qreal horizontalPosition READ horizontalPosition WRITE setHorizontalPosition) |
|
34 | 34 | Q_PROPERTY(qreal verticalPosition READ verticalPosition WRITE setVerticalPosition) |
|
35 | 35 | Q_PROPERTY(qreal size READ pieSize WRITE setPieSize) |
|
36 | 36 | Q_PROPERTY(qreal startAngle READ pieStartAngle WRITE setPieStartAngle) |
|
37 | 37 | Q_PROPERTY(qreal endAngle READ pieEndAngle WRITE setPieEndAngle) |
|
38 | 38 | Q_PROPERTY(int count READ count NOTIFY countChanged) |
|
39 | 39 | Q_PROPERTY(qreal sum READ sum NOTIFY sumChanged) |
|
40 | 40 | Q_PROPERTY(qreal holeSize READ holeSize WRITE setHoleSize) |
|
41 | // Q_PROPERTY(bool donut READ donut WRITE setDonut) | |
|
42 | 41 | |
|
43 | 42 | public: |
|
44 | 43 | explicit QPieSeries(QObject *parent = 0); |
|
45 | 44 | virtual ~QPieSeries(); |
|
46 | 45 | |
|
47 | 46 | QAbstractSeries::SeriesType type() const; |
|
48 | 47 | |
|
49 | 48 | bool append(QPieSlice* slice); |
|
50 | 49 | bool append(QList<QPieSlice*> slices); |
|
51 | 50 | QPieSeries& operator << (QPieSlice* slice); |
|
52 | 51 | QPieSlice* append(QString label, qreal value); |
|
53 | 52 | |
|
54 | 53 | bool insert(int index, QPieSlice* slice); |
|
55 | 54 | |
|
56 | 55 | bool remove(QPieSlice* slice); |
|
57 | 56 | bool take(QPieSlice* slice); |
|
58 | 57 | void clear(); |
|
59 | 58 | |
|
60 | 59 | QList<QPieSlice*> slices() const; |
|
61 | 60 | int count() const; |
|
62 | 61 | |
|
63 | 62 | bool isEmpty() const; |
|
64 | 63 | |
|
65 | 64 | qreal sum() const; |
|
66 | 65 | |
|
67 | 66 | void setHoleSize(qreal holeSize); |
|
68 | 67 | qreal holeSize() const; |
|
69 | 68 | |
|
70 | 69 | void setHorizontalPosition(qreal relativePosition); |
|
71 | 70 | qreal horizontalPosition() const; |
|
72 | 71 | |
|
73 | 72 | void setVerticalPosition(qreal relativePosition); |
|
74 | 73 | qreal verticalPosition() const; |
|
75 | 74 | |
|
76 | 75 | void setPieSize(qreal relativeSize); |
|
77 | 76 | qreal pieSize() const; |
|
78 | 77 | |
|
79 | 78 | void setPieStartAngle(qreal startAngle); |
|
80 | 79 | qreal pieStartAngle() const; |
|
81 | 80 | |
|
82 | 81 | void setPieEndAngle(qreal endAngle); |
|
83 | 82 | qreal pieEndAngle() const; |
|
84 | 83 | |
|
85 | 84 | void setLabelsVisible(bool visible = true); |
|
86 | 85 | void setLabelsPosition(QPieSlice::LabelPosition position); |
|
87 | 86 | |
|
88 | 87 | Q_SIGNALS: |
|
89 | 88 | void added(QList<QPieSlice*> slices); |
|
90 | 89 | void removed(QList<QPieSlice*> slices); |
|
91 | 90 | void clicked(QPieSlice* slice); |
|
92 | 91 | void hovered(QPieSlice* slice, bool state); |
|
93 | 92 | void countChanged(); |
|
94 | 93 | void sumChanged(); |
|
95 | 94 | |
|
96 | 95 | private: |
|
97 | 96 | Q_DECLARE_PRIVATE(QPieSeries) |
|
98 | 97 | Q_DISABLE_COPY(QPieSeries) |
|
99 | 98 | }; |
|
100 | 99 | |
|
101 | 100 | QTCOMMERCIALCHART_END_NAMESPACE |
|
102 | 101 | |
|
103 | 102 | #endif // PIESERIES_H |
@@ -1,147 +1,147 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2012 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | 21 | #ifndef QPIESLICE_H |
|
22 | 22 | #define QPIESLICE_H |
|
23 | 23 | |
|
24 | 24 | #include <qchartglobal.h> |
|
25 | 25 | #include <QObject> |
|
26 | 26 | #include <QPen> |
|
27 | 27 | #include <QBrush> |
|
28 | 28 | #include <QFont> |
|
29 | 29 | |
|
30 | 30 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
31 | 31 | class QPieSlicePrivate; |
|
32 | 32 | class QPieSeries; |
|
33 | 33 | |
|
34 | 34 | class QTCOMMERCIALCHART_EXPORT QPieSlice : public QObject |
|
35 | 35 | { |
|
36 | 36 | Q_OBJECT |
|
37 | 37 | Q_ENUMS(LabelPosition) |
|
38 | 38 | Q_PROPERTY(QString label READ label WRITE setLabel NOTIFY labelChanged) |
|
39 | 39 | Q_PROPERTY(qreal value READ value WRITE setValue NOTIFY valueChanged) |
|
40 | 40 | Q_PROPERTY(bool labelVisible READ isLabelVisible WRITE setLabelVisible NOTIFY labelVisibleChanged) |
|
41 | 41 | Q_PROPERTY(LabelPosition labelPosition READ labelPosition WRITE setLabelPosition) |
|
42 | 42 | Q_PROPERTY(bool exploded READ isExploded WRITE setExploded) |
|
43 | 43 | Q_PROPERTY(QPen pen READ pen WRITE setPen NOTIFY penChanged) |
|
44 | 44 | Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor NOTIFY borderColorChanged) |
|
45 | 45 | Q_PROPERTY(int borderWidth READ borderWidth WRITE setBorderWidth NOTIFY borderWidthChanged) |
|
46 | 46 | Q_PROPERTY(QBrush brush READ brush WRITE setBrush NOTIFY brushChanged) |
|
47 | 47 | Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged) |
|
48 | 48 | Q_PROPERTY(QBrush labelBrush READ labelBrush WRITE setLabelBrush NOTIFY labelBrushChanged) |
|
49 | 49 | Q_PROPERTY(QColor labelColor READ labelColor WRITE setLabelColor NOTIFY labelColorChanged) |
|
50 | 50 | Q_PROPERTY(QFont labelFont READ labelFont WRITE setLabelFont NOTIFY labelFontChanged) |
|
51 | 51 | Q_PROPERTY(qreal labelArmLengthFactor READ labelArmLengthFactor WRITE setLabelArmLengthFactor) |
|
52 | 52 | Q_PROPERTY(qreal explodeDistanceFactor READ explodeDistanceFactor WRITE setExplodeDistanceFactor) |
|
53 | 53 | Q_PROPERTY(qreal percentage READ percentage NOTIFY percentageChanged) |
|
54 | 54 | Q_PROPERTY(qreal startAngle READ startAngle NOTIFY startAngleChanged) |
|
55 | 55 | Q_PROPERTY(qreal angleSpan READ angleSpan NOTIFY angleSpanChanged) |
|
56 | 56 | |
|
57 | 57 | public: |
|
58 | 58 | enum LabelPosition { |
|
59 | 59 | LabelOutside, |
|
60 | 60 | LabelInsideHorizontal, |
|
61 |
LabelInsideTangential, |
|
|
62 |
LabelInsideNormal |
|
|
61 | LabelInsideTangential, | |
|
62 | LabelInsideNormal | |
|
63 | 63 | }; |
|
64 | 64 | |
|
65 | 65 | public: |
|
66 | 66 | explicit QPieSlice(QObject *parent = 0); |
|
67 | 67 | QPieSlice(QString label, qreal value, QObject *parent = 0); |
|
68 | 68 | virtual ~QPieSlice(); |
|
69 | 69 | |
|
70 | 70 | void setLabel(QString label); |
|
71 | 71 | QString label() const; |
|
72 | 72 | |
|
73 | 73 | void setValue(qreal value); |
|
74 | 74 | qreal value() const; |
|
75 | 75 | |
|
76 | 76 | void setLabelVisible(bool visible = true); |
|
77 | 77 | bool isLabelVisible() const; |
|
78 | 78 | |
|
79 | 79 | LabelPosition labelPosition(); |
|
80 | 80 | void setLabelPosition(LabelPosition position); |
|
81 | 81 | |
|
82 | 82 | void setExploded(bool exploded = true); |
|
83 | 83 | bool isExploded() const; |
|
84 | 84 | |
|
85 | 85 | void setPen(const QPen &pen); |
|
86 | 86 | QPen pen() const; |
|
87 | 87 | |
|
88 | 88 | QColor borderColor(); |
|
89 | 89 | void setBorderColor(QColor color); |
|
90 | 90 | |
|
91 | 91 | int borderWidth(); |
|
92 | 92 | void setBorderWidth(int width); |
|
93 | 93 | |
|
94 | 94 | void setBrush(const QBrush &brush); |
|
95 | 95 | QBrush brush() const; |
|
96 | 96 | |
|
97 | 97 | QColor color(); |
|
98 | 98 | void setColor(QColor color); |
|
99 | 99 | |
|
100 | 100 | void setLabelBrush(const QBrush &brush); |
|
101 | 101 | QBrush labelBrush() const; |
|
102 | 102 | |
|
103 | 103 | QColor labelColor(); |
|
104 | 104 | void setLabelColor(QColor color); |
|
105 | 105 | |
|
106 | 106 | void setLabelFont(const QFont &font); |
|
107 | 107 | QFont labelFont() const; |
|
108 | 108 | |
|
109 | 109 | void setLabelArmLengthFactor(qreal factor); |
|
110 | 110 | qreal labelArmLengthFactor() const; |
|
111 | 111 | |
|
112 | 112 | void setExplodeDistanceFactor(qreal factor); |
|
113 | 113 | qreal explodeDistanceFactor() const; |
|
114 | 114 | |
|
115 | 115 | qreal percentage() const; |
|
116 | 116 | qreal startAngle() const; |
|
117 | 117 | qreal angleSpan() const; |
|
118 | 118 | |
|
119 | 119 | QPieSeries *series() const; |
|
120 | 120 | |
|
121 | 121 | Q_SIGNALS: |
|
122 | 122 | void clicked(); |
|
123 | 123 | void hovered(bool state); |
|
124 | 124 | void labelChanged(); |
|
125 | 125 | void valueChanged(); |
|
126 | 126 | void labelVisibleChanged(); |
|
127 | 127 | void penChanged(); |
|
128 | 128 | void brushChanged(); |
|
129 | 129 | void labelBrushChanged(); |
|
130 | 130 | void labelFontChanged(); |
|
131 | 131 | void percentageChanged(); |
|
132 | 132 | void startAngleChanged(); |
|
133 | 133 | void angleSpanChanged(); |
|
134 | 134 | void colorChanged(); |
|
135 | 135 | void borderColorChanged(); |
|
136 | 136 | void borderWidthChanged(); |
|
137 | 137 | void labelColorChanged(); |
|
138 | 138 | |
|
139 | 139 | private: |
|
140 | 140 | QPieSlicePrivate * const d_ptr; |
|
141 | 141 | Q_DECLARE_PRIVATE(QPieSlice) |
|
142 | 142 | Q_DISABLE_COPY(QPieSlice) |
|
143 | 143 | }; |
|
144 | 144 | |
|
145 | 145 | QTCOMMERCIALCHART_END_NAMESPACE |
|
146 | 146 | |
|
147 | 147 | #endif // QPIESLICE_H |
General Comments 0
You need to be logged in to leave comments.
Login now