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