@@ -1,149 +1,149 | |||||
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 NOTIFY labelPositionChanged) |
|
41 | Q_PROPERTY(LabelPosition labelPosition READ labelPosition WRITE setLabelPosition NOTIFY labelPositionChanged) | |
42 | Q_PROPERTY(bool exploded READ isExploded WRITE setExploded NOTIFY explodedChanged) |
|
42 | Q_PROPERTY(bool exploded READ isExploded WRITE setExploded NOTIFY explodedChanged) | |
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 NOTIFY labelArmLengthFactorChanged) | |
52 | Q_PROPERTY(qreal explodeDistanceFactor READ explodeDistanceFactor WRITE setExplodeDistanceFactor) |
|
52 | Q_PROPERTY(qreal explodeDistanceFactor READ explodeDistanceFactor WRITE setExplodeDistanceFactor NOTIFY explodeDistanceFactorChanged) | |
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 | LabelInside |
|
60 | LabelInside | |
61 | }; |
|
61 | }; | |
62 |
|
62 | |||
63 | public: |
|
63 | public: | |
64 | explicit QPieSlice(QObject *parent = 0); |
|
64 | explicit QPieSlice(QObject *parent = 0); | |
65 | QPieSlice(QString label, qreal value, QObject *parent = 0); |
|
65 | QPieSlice(QString label, qreal value, QObject *parent = 0); | |
66 | virtual ~QPieSlice(); |
|
66 | virtual ~QPieSlice(); | |
67 |
|
67 | |||
68 | void setLabel(QString label); |
|
68 | void setLabel(QString label); | |
69 | QString label() const; |
|
69 | QString label() const; | |
70 |
|
70 | |||
71 | void setValue(qreal value); |
|
71 | void setValue(qreal value); | |
72 | qreal value() const; |
|
72 | qreal value() const; | |
73 |
|
73 | |||
74 | void setLabelVisible(bool visible = true); |
|
74 | void setLabelVisible(bool visible = true); | |
75 | bool isLabelVisible() const; |
|
75 | bool isLabelVisible() const; | |
76 |
|
76 | |||
77 | LabelPosition labelPosition(); |
|
77 | LabelPosition labelPosition(); | |
78 | void setLabelPosition(LabelPosition position); |
|
78 | void setLabelPosition(LabelPosition position); | |
79 |
|
79 | |||
80 | void setExploded(bool exploded = true); |
|
80 | void setExploded(bool exploded = true); | |
81 | bool isExploded() const; |
|
81 | bool isExploded() const; | |
82 |
|
82 | |||
83 | void setPen(const QPen &pen); |
|
83 | void setPen(const QPen &pen); | |
84 | QPen pen() const; |
|
84 | QPen pen() const; | |
85 |
|
85 | |||
86 | QColor borderColor(); |
|
86 | QColor borderColor(); | |
87 | void setBorderColor(QColor color); |
|
87 | void setBorderColor(QColor color); | |
88 |
|
88 | |||
89 | int borderWidth(); |
|
89 | int borderWidth(); | |
90 | void setBorderWidth(int width); |
|
90 | void setBorderWidth(int width); | |
91 |
|
91 | |||
92 | void setBrush(const QBrush &brush); |
|
92 | void setBrush(const QBrush &brush); | |
93 | QBrush brush() const; |
|
93 | QBrush brush() const; | |
94 |
|
94 | |||
95 | QColor color(); |
|
95 | QColor color(); | |
96 | void setColor(QColor color); |
|
96 | void setColor(QColor color); | |
97 |
|
97 | |||
98 | void setLabelBrush(const QBrush &brush); |
|
98 | void setLabelBrush(const QBrush &brush); | |
99 | QBrush labelBrush() const; |
|
99 | QBrush labelBrush() const; | |
100 |
|
100 | |||
101 | QColor labelColor(); |
|
101 | QColor labelColor(); | |
102 | void setLabelColor(QColor color); |
|
102 | void setLabelColor(QColor color); | |
103 |
|
103 | |||
104 | void setLabelFont(const QFont &font); |
|
104 | void setLabelFont(const QFont &font); | |
105 | QFont labelFont() const; |
|
105 | QFont labelFont() const; | |
106 |
|
106 | |||
107 | void setLabelArmLengthFactor(qreal factor); |
|
107 | void setLabelArmLengthFactor(qreal factor); | |
108 | qreal labelArmLengthFactor() const; |
|
108 | qreal labelArmLengthFactor() const; | |
109 |
|
109 | |||
110 | void setExplodeDistanceFactor(qreal factor); |
|
110 | void setExplodeDistanceFactor(qreal factor); | |
111 | qreal explodeDistanceFactor() const; |
|
111 | qreal explodeDistanceFactor() const; | |
112 |
|
112 | |||
113 | qreal percentage() const; |
|
113 | qreal percentage() const; | |
114 | qreal startAngle() const; |
|
114 | qreal startAngle() const; | |
115 | qreal angleSpan() const; |
|
115 | qreal angleSpan() const; | |
116 |
|
116 | |||
117 | QPieSeries *series() const; |
|
117 | QPieSeries *series() const; | |
118 |
|
118 | |||
119 | Q_SIGNALS: |
|
119 | Q_SIGNALS: | |
120 | void labelChanged(); |
|
120 | void labelChanged(); | |
121 | void valueChanged(); |
|
121 | void valueChanged(); | |
122 | void labelVisibleChanged(); |
|
122 | void labelVisibleChanged(); | |
123 | void labelPositionChanged(); |
|
123 | void labelPositionChanged(); | |
124 | void explodedChanged(); |
|
124 | void explodedChanged(); | |
125 | void penChanged(); |
|
125 | void penChanged(); | |
126 | void brushChanged(); |
|
126 | void brushChanged(); | |
127 | void labelBrushChanged(); |
|
127 | void labelBrushChanged(); | |
128 | void labelFontChanged(); |
|
128 | void labelFontChanged(); | |
129 | void labelArmLengthFactorChanged(); |
|
129 | void labelArmLengthFactorChanged(); | |
130 | void explodeDistanceFactorChanged(); |
|
130 | void explodeDistanceFactorChanged(); | |
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 | void clicked(); |
|
138 | void clicked(); | |
139 | void hovered(bool state); |
|
139 | void hovered(bool state); | |
140 |
|
140 | |||
141 | private: |
|
141 | private: | |
142 | QPieSlicePrivate * const d_ptr; |
|
142 | QPieSlicePrivate * const d_ptr; | |
143 | Q_DECLARE_PRIVATE(QPieSlice) |
|
143 | Q_DECLARE_PRIVATE(QPieSlice) | |
144 | Q_DISABLE_COPY(QPieSlice) |
|
144 | Q_DISABLE_COPY(QPieSlice) | |
145 | }; |
|
145 | }; | |
146 |
|
146 | |||
147 | QTCOMMERCIALCHART_END_NAMESPACE |
|
147 | QTCOMMERCIALCHART_END_NAMESPACE | |
148 |
|
148 | |||
149 | #endif // QPIESLICE_H |
|
149 | #endif // QPIESLICE_H |
General Comments 0
You need to be logged in to leave comments.
Login now