@@ -0,0 +1,7 | |||||
|
1 | /*! | |||
|
2 | \example examples/piechartdrilldown | |||
|
3 | \title Piechart drilldown example | |||
|
4 | \subtitle | |||
|
5 | ||||
|
6 | The example shows how to implement a piechart with drilldown effect. | |||
|
7 | */ |
@@ -1,9 +1,7 | |||||
1 | /*! |
|
1 | /*! | |
2 | \example examples/piechart |
|
2 | \example examples/piechart | |
3 |
\title |
|
3 | \title Piechart Example | |
4 | \subtitle |
|
4 | \subtitle | |
5 |
|
5 | |||
6 | The example shows how to create simple pie chart. |
|
6 | The example shows how to create simple pie chart and do some customizations to a pie slice. | |
7 |
|
7 | */ | ||
8 | ... |
|
|||
9 | */ No newline at end of file |
|
@@ -1,32 +1,33 | |||||
1 | /*! |
|
1 | /*! | |
2 | \page examples.html |
|
2 | \page examples.html | |
3 | \title Examples |
|
3 | \title Examples | |
4 | \keyword Examples |
|
4 | \keyword Examples | |
5 |
|
5 | |||
6 | \raw HTML |
|
6 | \raw HTML | |
7 | <table cellpadding="2" cellspacing="1" border="0" width="100%" class="indextable"> |
|
7 | <table cellpadding="2" cellspacing="1" border="0" width="100%" class="indextable"> | |
8 | <tr> |
|
8 | <tr> | |
9 | <th class="titleheader" width="33%"> |
|
9 | <th class="titleheader" width="33%"> | |
10 | List of examples |
|
10 | List of examples | |
11 | </th> |
|
11 | </th> | |
12 | </tr> |
|
12 | </tr> | |
13 | <tr> |
|
13 | <tr> | |
14 | <td valign="top"> |
|
14 | <td valign="top"> | |
15 | <ul> |
|
15 | <ul> | |
16 |
<li><a href="examples-areachart.html">Area |
|
16 | <li><a href="examples-areachart.html">Area chart example</a></li> | |
17 |
<li><a href="examples-barchart.html">Bar |
|
17 | <li><a href="examples-barchart.html">Bar chart example</a></li> | |
18 |
<li><a href="examples-linechart.html">Line |
|
18 | <li><a href="examples-linechart.html">Line chart example</a></li> | |
19 |
<li><a href="examples-percentbarchart.html">Percent |
|
19 | <li><a href="examples-percentbarchart.html">Percent bar chart example</a></li> | |
20 |
<li><a href="examples-piechart.html">Pie |
|
20 | <li><a href="examples-piechart.html">Pie chart example</a></li> | |
21 |
<li><a href="examples-p |
|
21 | <li><a href="examples-piechartdrilldown.html">Pie chart drilldown example</a></li> | |
22 |
<li><a href="examples- |
|
22 | <li><a href="examples-presenterchart.html">Presenter chart example</a></li> | |
23 |
<li><a href="examples-s |
|
23 | <li><a href="examples-scatterchart.html">Scatter chart example</a></li> | |
24 |
<li><a href="examples-s |
|
24 | <li><a href="examples-splinechart.html">Spline chart example</a></li> | |
25 |
<li><a href="examples-stackedbarchart |
|
25 | <li><a href="examples-stackedbarchart.html">Stacked bar chart example</a></li> | |
|
26 | <li><a href="examples-stackedbarchartdrilldown.html">Stacked bar chart drilldown example</a></li> | |||
26 | <li><a href="examples-customcolors.html">Customizing colors example</a></li> |
|
27 | <li><a href="examples-customcolors.html">Customizing colors example</a></li> | |
27 | </ul> |
|
28 | </ul> | |
28 | </td> |
|
29 | </td> | |
29 | </tr> |
|
30 | </tr> | |
30 | </table> |
|
31 | </table> | |
31 | \endraw |
|
32 | \endraw | |
32 | */ |
|
33 | */ |
@@ -1,65 +1,69 | |||||
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 | #include <QApplication> |
|
21 | #include <QApplication> | |
22 | #include <QMainWindow> |
|
22 | #include <QMainWindow> | |
23 | #include <QChartView> |
|
23 | #include <QChartView> | |
24 | #include <QPieSeries> |
|
24 | #include <QPieSeries> | |
25 | #include <QPieSlice> |
|
25 | #include <QPieSlice> | |
26 |
|
26 | |||
27 | QTCOMMERCIALCHART_USE_NAMESPACE |
|
27 | QTCOMMERCIALCHART_USE_NAMESPACE | |
28 |
|
28 | |||
29 | int main(int argc, char *argv[]) |
|
29 | int main(int argc, char *argv[]) | |
30 | { |
|
30 | { | |
31 | QApplication a(argc, argv); |
|
31 | QApplication a(argc, argv); | |
32 |
|
32 | |||
33 | //![1] |
|
33 | //![1] | |
34 | QPieSeries *series = new QPieSeries(); |
|
34 | QPieSeries *series = new QPieSeries(); | |
35 | series->append(1, "Slice 1"); |
|
35 | series->append(1, "Slice 1"); | |
36 | series->append(2, "Slice 2"); |
|
36 | series->append(2, "Slice 2"); | |
37 | series->append(3, "Slice 3"); |
|
37 | series->append(3, "Slice 3"); | |
38 | series->append(4, "Slice 4"); |
|
38 | series->append(4, "Slice 4"); | |
39 | series->append(5, "Slice 5"); |
|
39 | series->append(5, "Slice 5"); | |
40 | //![1] |
|
40 | //![1] | |
41 |
|
41 | |||
42 | //![2] |
|
42 | //![2] | |
43 | QPieSlice *slice = series->slices().first(); |
|
43 | QPieSlice *slice = series->slices().first(); | |
44 | slice->setExploded(); |
|
44 | slice->setExploded(); | |
45 | slice->setLabelVisible(); |
|
45 | slice->setLabelVisible(); | |
46 | slice->setPen(QPen(Qt::darkGreen, 2)); |
|
46 | slice->setPen(QPen(Qt::darkGreen, 2)); | |
47 | slice->setBrush(Qt::green); |
|
47 | slice->setBrush(Qt::green); | |
48 | //![2] |
|
48 | //![2] | |
|
49 | ||||
49 | //![3] |
|
50 | //![3] | |
50 | QChart* chart = new QChart(); |
|
51 | QChart* chart = new QChart(); | |
51 | chart->addSeries(series); |
|
52 | chart->addSeries(series); | |
52 | chart->setTitle("Simple piechart example"); |
|
53 | chart->setTitle("Simple piechart example"); | |
53 | //![3] |
|
54 | //![3] | |
|
55 | ||||
54 | //![4] |
|
56 | //![4] | |
55 | QChartView* chartView = new QChartView(chart); |
|
57 | QChartView* chartView = new QChartView(chart); | |
56 | chartView->setRenderHint(QPainter::Antialiasing); |
|
58 | chartView->setRenderHint(QPainter::Antialiasing); | |
57 | //![4] |
|
59 | //![4] | |
|
60 | ||||
58 | //![5] |
|
61 | //![5] | |
59 | QMainWindow window; |
|
62 | QMainWindow window; | |
60 | window.setCentralWidget(chartView); |
|
63 | window.setCentralWidget(chartView); | |
61 | window.resize(400, 300); |
|
64 | window.resize(400, 300); | |
62 | window.show(); |
|
65 | window.show(); | |
63 | //![5] |
|
66 | //![5] | |
|
67 | ||||
64 | return a.exec(); |
|
68 | return a.exec(); | |
65 | } |
|
69 | } |
@@ -1,402 +1,400 | |||||
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 | #include "qpieslice.h" |
|
21 | #include "qpieslice.h" | |
22 | #include "pieslicedata_p.h" |
|
22 | #include "pieslicedata_p.h" | |
23 |
|
23 | |||
24 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
24 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
25 |
|
25 | |||
26 | /*! |
|
26 | /*! | |
27 | \class QPieSlice |
|
27 | \class QPieSlice | |
28 | \brief Defines a slice in pie series. |
|
28 | \brief Defines a slice in pie series. | |
29 |
|
29 | |||
30 | Holds all the data of a single slice in a QPieSeries and provides the means |
|
30 | Holds all the data of a single slice in a QPieSeries and provides the means | |
31 | to modify slice data and customize the visual appearance of the slice. |
|
31 | to modify slice data and customize the visual appearance of the slice. | |
32 |
|
32 | |||
33 | It also provides the means to customize user interaction with the slice by |
|
33 | It also provides the means to customize user interaction with the slice by | |
34 | providing signals for clicking and hover events. |
|
34 | providing signals for clicking and hover events. | |
35 | */ |
|
35 | */ | |
36 |
|
36 | |||
37 | /*! |
|
37 | /*! | |
38 | \property QPieSlice::label |
|
38 | \property QPieSlice::label | |
39 |
|
39 | |||
40 | Label of the slice. |
|
40 | Label of the slice. | |
41 | */ |
|
41 | */ | |
42 |
|
42 | |||
43 | /*! |
|
43 | /*! | |
44 | \property QPieSlice::value |
|
44 | \property QPieSlice::value | |
45 |
|
45 | |||
46 | Value of the slice. |
|
46 | Value of the slice. | |
47 | */ |
|
47 | */ | |
48 |
|
48 | |||
49 | /*! |
|
49 | /*! | |
50 | Constructs an empty slice with a \a parent. |
|
50 | Constructs an empty slice with a \a parent. | |
51 |
|
51 | |||
52 | Note that QPieSeries takes ownership of the slice when it is set/added. |
|
52 | Note that QPieSeries takes ownership of the slice when it is set/added. | |
53 |
|
53 | |||
54 | \sa QPieSeries::replace(), QPieSeries::append() |
|
54 | \sa QPieSeries::replace(), QPieSeries::append() | |
55 | */ |
|
55 | */ | |
56 | QPieSlice::QPieSlice(QObject *parent) |
|
56 | QPieSlice::QPieSlice(QObject *parent) | |
57 | :QObject(parent), |
|
57 | :QObject(parent), | |
58 | d(new PieSliceData()) |
|
58 | d(new PieSliceData()) | |
59 | { |
|
59 | { | |
60 |
|
60 | |||
61 | } |
|
61 | } | |
62 |
|
62 | |||
63 | /*! |
|
63 | /*! | |
64 | Constructs an empty slice with given \a value, \a label and a \a parent. |
|
64 | Constructs an empty slice with given \a value, \a label and a \a parent. | |
65 | Note that QPieSeries takes ownership of the slice when it is set/added. |
|
65 | Note that QPieSeries takes ownership of the slice when it is set/added. | |
66 | \sa QPieSeries::replace(), QPieSeries::append() |
|
66 | \sa QPieSeries::replace(), QPieSeries::append() | |
67 | */ |
|
67 | */ | |
68 | QPieSlice::QPieSlice(qreal value, QString label, QObject *parent) |
|
68 | QPieSlice::QPieSlice(qreal value, QString label, QObject *parent) | |
69 | :QObject(parent), |
|
69 | :QObject(parent), | |
70 | d(new PieSliceData()) |
|
70 | d(new PieSliceData()) | |
71 | { |
|
71 | { | |
72 | d->m_value = value; |
|
72 | d->m_value = value; | |
73 | d->m_labelText = label; |
|
73 | d->m_labelText = label; | |
74 | } |
|
74 | } | |
75 |
|
75 | |||
76 | /*! |
|
76 | /*! | |
77 | Destroys the slice. |
|
77 | Destroys the slice. | |
78 | User should not delete the slice if it has been added to the series. |
|
78 | User should not delete the slice if it has been added to the series. | |
79 | */ |
|
79 | */ | |
80 | QPieSlice::~QPieSlice() |
|
80 | QPieSlice::~QPieSlice() | |
81 | { |
|
81 | { | |
82 | delete d; |
|
82 | delete d; | |
83 | } |
|
83 | } | |
84 |
|
84 | |||
85 | /*! |
|
85 | /*! | |
86 | Gets the value of the slice. |
|
86 | Gets the value of the slice. | |
87 | Note that all values in the series |
|
87 | Note that all values in the series | |
88 | \sa setValue() |
|
88 | \sa setValue() | |
89 | */ |
|
89 | */ | |
90 | qreal QPieSlice::value() const |
|
90 | qreal QPieSlice::value() const | |
91 | { |
|
91 | { | |
92 | return d->m_value; |
|
92 | return d->m_value; | |
93 | } |
|
93 | } | |
94 |
|
94 | |||
95 | /*! |
|
95 | /*! | |
96 | Gets the label of the slice. |
|
96 | Gets the label of the slice. | |
97 | \sa setLabel() |
|
97 | \sa setLabel() | |
98 | */ |
|
98 | */ | |
99 | QString QPieSlice::label() const |
|
99 | QString QPieSlice::label() const | |
100 | { |
|
100 | { | |
101 | return d->m_labelText; |
|
101 | return d->m_labelText; | |
102 | } |
|
102 | } | |
103 |
|
103 | |||
104 | /*! |
|
104 | /*! | |
105 | Returns true if label is set as visible. |
|
105 | Returns true if label is set as visible. | |
106 | \sa setLabelVisible() |
|
106 | \sa setLabelVisible() | |
107 | */ |
|
107 | */ | |
108 | bool QPieSlice::isLabelVisible() const |
|
108 | bool QPieSlice::isLabelVisible() const | |
109 | { |
|
109 | { | |
110 | return d->m_isLabelVisible; |
|
110 | return d->m_isLabelVisible; | |
111 | } |
|
111 | } | |
112 |
|
112 | |||
113 | /*! |
|
113 | /*! | |
114 | Returns true if slice is exloded from the pie. |
|
114 | Returns true if slice is exloded from the pie. | |
115 | \sa setExploded(), setExplodeDistanceFactor() |
|
115 | \sa setExploded(), setExplodeDistanceFactor() | |
116 | */ |
|
116 | */ | |
117 | bool QPieSlice::isExploded() const |
|
117 | bool QPieSlice::isExploded() const | |
118 | { |
|
118 | { | |
119 | return d->m_isExploded; |
|
119 | return d->m_isExploded; | |
120 | } |
|
120 | } | |
121 |
|
121 | |||
122 | /*! |
|
122 | /*! | |
123 | Returns the explode distance factor. |
|
123 | Returns the explode distance factor. | |
124 |
|
124 | |||
125 | The factor is relative to pie radius. For example: |
|
125 | The factor is relative to pie radius. For example: | |
126 | 1.0 means the distance is the same as the radius. |
|
126 | 1.0 means the distance is the same as the radius. | |
127 | 0.5 means the distance is half of the radius. |
|
127 | 0.5 means the distance is half of the radius. | |
128 |
|
128 | |||
129 | Default value is 0.15. |
|
129 | Default value is 0.15. | |
130 |
|
130 | |||
131 | \sa setExplodeDistanceFactor() |
|
131 | \sa setExplodeDistanceFactor() | |
132 | */ |
|
132 | */ | |
133 | qreal QPieSlice::explodeDistanceFactor() const |
|
133 | qreal QPieSlice::explodeDistanceFactor() const | |
134 | { |
|
134 | { | |
135 | return d->m_explodeDistanceFactor; |
|
135 | return d->m_explodeDistanceFactor; | |
136 | } |
|
136 | } | |
137 |
|
137 | |||
138 | /*! |
|
138 | /*! | |
139 | Returns the percentage of this slice compared to all slices in the same series. |
|
139 | Returns the percentage of this slice compared to all slices in the same series. | |
140 | The returned value ranges from 0 to 1.0. |
|
140 | The returned value ranges from 0 to 1.0. | |
141 |
|
141 | |||
142 | Updated internally after the slice is added to the series. |
|
142 | Updated internally after the slice is added to the series. | |
143 | */ |
|
143 | */ | |
144 | qreal QPieSlice::percentage() const |
|
144 | qreal QPieSlice::percentage() const | |
145 | { |
|
145 | { | |
146 | return d->m_percentage; |
|
146 | return d->m_percentage; | |
147 | } |
|
147 | } | |
148 |
|
148 | |||
149 | /*! |
|
149 | /*! | |
150 | Returns the starting angle of this slice in the series it belongs to. |
|
150 | Returns the starting angle of this slice in the series it belongs to. | |
151 |
|
151 | |||
152 | Full pie is 360 degrees where 0 degrees is at 12 a'clock. |
|
152 | Full pie is 360 degrees where 0 degrees is at 12 a'clock. | |
153 |
|
153 | |||
154 | Updated internally after the slice is added to the series. |
|
154 | Updated internally after the slice is added to the series. | |
155 | */ |
|
155 | */ | |
156 | qreal QPieSlice::startAngle() const |
|
156 | qreal QPieSlice::startAngle() const | |
157 | { |
|
157 | { | |
158 | return d->m_startAngle; |
|
158 | return d->m_startAngle; | |
159 | } |
|
159 | } | |
160 |
|
160 | |||
161 | /*! |
|
161 | /*! | |
162 | Returns the end angle of this slice in the series it belongs to. |
|
162 | Returns the end angle of this slice in the series it belongs to. | |
163 |
|
163 | |||
164 | Full pie is 360 degrees where 0 degrees is at 12 a'clock. |
|
164 | Full pie is 360 degrees where 0 degrees is at 12 a'clock. | |
165 |
|
165 | |||
166 | Updated internally after the slice is added to the series. |
|
166 | Updated internally after the slice is added to the series. | |
167 | */ |
|
167 | */ | |
168 | qreal QPieSlice::endAngle() const |
|
168 | qreal QPieSlice::endAngle() const | |
169 | { |
|
169 | { | |
170 | return d->m_startAngle + d->m_angleSpan; |
|
170 | return d->m_startAngle + d->m_angleSpan; | |
171 | } |
|
171 | } | |
172 |
|
172 | |||
173 | /*! |
|
173 | /*! | |
174 | Returns the pen used to draw this slice. |
|
174 | Returns the pen used to draw this slice. | |
175 | \sa setPen() |
|
175 | \sa setPen() | |
176 | */ |
|
176 | */ | |
177 | QPen QPieSlice::pen() const |
|
177 | QPen QPieSlice::pen() const | |
178 | { |
|
178 | { | |
179 | return d->m_slicePen; |
|
179 | return d->m_slicePen; | |
180 | } |
|
180 | } | |
181 |
|
181 | |||
182 | /*! |
|
182 | /*! | |
183 | Returns the brush used to draw this slice. |
|
183 | Returns the brush used to draw this slice. | |
184 | \sa setBrush() |
|
184 | \sa setBrush() | |
185 | */ |
|
185 | */ | |
186 | QBrush QPieSlice::brush() const |
|
186 | QBrush QPieSlice::brush() const | |
187 | { |
|
187 | { | |
188 | return d->m_sliceBrush; |
|
188 | return d->m_sliceBrush; | |
189 | } |
|
189 | } | |
190 |
|
190 | |||
191 | /*! |
|
191 | /*! | |
192 | Returns the pen used to draw the label in this slice. |
|
192 | Returns the pen used to draw the label in this slice. | |
193 | \sa setLabelPen() |
|
193 | \sa setLabelPen() | |
194 | */ |
|
194 | */ | |
195 | QPen QPieSlice::labelPen() const |
|
195 | QPen QPieSlice::labelPen() const | |
196 | { |
|
196 | { | |
197 | return d->m_labelPen; |
|
197 | return d->m_labelPen; | |
198 | } |
|
198 | } | |
199 |
|
199 | |||
200 | /*! |
|
200 | /*! | |
201 | Returns the font used to draw label in this slice. |
|
201 | Returns the font used to draw label in this slice. | |
202 | \sa setLabelFont() |
|
202 | \sa setLabelFont() | |
203 | */ |
|
203 | */ | |
204 | QFont QPieSlice::labelFont() const |
|
204 | QFont QPieSlice::labelFont() const | |
205 | { |
|
205 | { | |
206 | return d->m_labelFont; |
|
206 | return d->m_labelFont; | |
207 | } |
|
207 | } | |
208 |
|
208 | |||
209 | /*! |
|
209 | /*! | |
210 | Gets the label arm length factor. |
|
210 | Gets the label arm length factor. | |
211 |
|
211 | |||
212 | The factor is relative to pie radius. For example: |
|
212 | The factor is relative to pie radius. For example: | |
213 | 1.0 means the length is the same as the radius. |
|
213 | 1.0 means the length is the same as the radius. | |
214 | 0.5 means the length is half of the radius. |
|
214 | 0.5 means the length is half of the radius. | |
215 |
|
215 | |||
216 | Default value is 0.15 |
|
216 | Default value is 0.15 | |
217 |
|
217 | |||
218 | \sa setLabelArmLengthFactor() |
|
218 | \sa setLabelArmLengthFactor() | |
219 | */ |
|
219 | */ | |
220 | qreal QPieSlice::labelArmLengthFactor() const |
|
220 | qreal QPieSlice::labelArmLengthFactor() const | |
221 | { |
|
221 | { | |
222 | return d->m_labelArmLengthFactor; |
|
222 | return d->m_labelArmLengthFactor; | |
223 | } |
|
223 | } | |
224 |
|
224 | |||
225 | /*! |
|
225 | /*! | |
226 | \fn void QPieSlice::clicked(Qt::MouseButtons buttons) |
|
226 | \fn void QPieSlice::clicked(Qt::MouseButtons buttons) | |
227 |
|
227 | |||
228 | This signal is emitted when user has clicked the slice. |
|
228 | This signal is emitted when user has clicked the slice. | |
229 |
|
229 | |||
230 | \sa QPieSeries::clicked() |
|
230 | \sa QPieSeries::clicked() | |
231 | */ |
|
231 | */ | |
232 |
|
232 | |||
233 | /*! |
|
233 | /*! | |
234 | \fn void QPieSlice::hoverEnter() |
|
234 | \fn void QPieSlice::hoverEnter() | |
235 |
|
235 | |||
236 | This signal is emitted when user has hovered over the slice. |
|
236 | This signal is emitted when user has hovered over the slice. | |
237 |
|
237 | |||
238 | \sa QPieSeries::hoverEnter() |
|
238 | \sa QPieSeries::hoverEnter() | |
239 | */ |
|
239 | */ | |
240 |
|
240 | |||
241 | /*! |
|
241 | /*! | |
242 | \fn void QPieSlice::hoverLeave() |
|
242 | \fn void QPieSlice::hoverLeave() | |
243 |
|
243 | |||
244 | This signal is emitted when user has hovered away from the slice. |
|
244 | This signal is emitted when user has hovered away from the slice. | |
245 |
|
245 | |||
246 | \sa QPieSeries::hoverLeave() |
|
246 | \sa QPieSeries::hoverLeave() | |
247 | */ |
|
247 | */ | |
248 |
|
248 | |||
249 | /*! |
|
249 | /*! | |
250 | \fn void QPieSlice::changed() |
|
250 | \fn void QPieSlice::changed() | |
251 |
|
251 | |||
252 | This signal emitted when something has changed in the slice. |
|
252 | This signal emitted when something has changed in the slice. | |
253 |
|
||||
254 | \sa QPieSeries::changed() |
|
|||
255 | */ |
|
253 | */ | |
256 |
|
254 | |||
257 | /*! |
|
255 | /*! | |
258 | Sets the \a value of this slice. |
|
256 | Sets the \a value of this slice. | |
259 | \sa value() |
|
257 | \sa value() | |
260 | */ |
|
258 | */ | |
261 | void QPieSlice::setValue(qreal value) |
|
259 | void QPieSlice::setValue(qreal value) | |
262 | { |
|
260 | { | |
263 | if (!qFuzzyIsNull(d->m_value - value)) { |
|
261 | if (!qFuzzyIsNull(d->m_value - value)) { | |
264 | d->m_value = value; |
|
262 | d->m_value = value; | |
265 | emit changed(); |
|
263 | emit changed(); | |
266 | } |
|
264 | } | |
267 | } |
|
265 | } | |
268 |
|
266 | |||
269 | /*! |
|
267 | /*! | |
270 | Sets the \a label of the slice. |
|
268 | Sets the \a label of the slice. | |
271 | \sa label() |
|
269 | \sa label() | |
272 | */ |
|
270 | */ | |
273 | void QPieSlice::setLabel(QString label) |
|
271 | void QPieSlice::setLabel(QString label) | |
274 | { |
|
272 | { | |
275 | if (d->m_labelText != label) { |
|
273 | if (d->m_labelText != label) { | |
276 | d->m_labelText = label; |
|
274 | d->m_labelText = label; | |
277 | emit changed(); |
|
275 | emit changed(); | |
278 | } |
|
276 | } | |
279 | } |
|
277 | } | |
280 |
|
278 | |||
281 | /*! |
|
279 | /*! | |
282 | Sets the label \a visible in this slice. |
|
280 | Sets the label \a visible in this slice. | |
283 | \sa isLabelVisible(), QPieSeries::setLabelsVisible() |
|
281 | \sa isLabelVisible(), QPieSeries::setLabelsVisible() | |
284 | */ |
|
282 | */ | |
285 | void QPieSlice::setLabelVisible(bool visible) |
|
283 | void QPieSlice::setLabelVisible(bool visible) | |
286 | { |
|
284 | { | |
287 | if (d->m_isLabelVisible != visible) { |
|
285 | if (d->m_isLabelVisible != visible) { | |
288 | d->m_isLabelVisible = visible; |
|
286 | d->m_isLabelVisible = visible; | |
289 | emit changed(); |
|
287 | emit changed(); | |
290 | } |
|
288 | } | |
291 | } |
|
289 | } | |
292 |
|
290 | |||
293 | /*! |
|
291 | /*! | |
294 | Sets this slice \a exploded. |
|
292 | Sets this slice \a exploded. | |
295 | \sa isExploded(), explodeDistanceFactor() |
|
293 | \sa isExploded(), explodeDistanceFactor() | |
296 | */ |
|
294 | */ | |
297 | void QPieSlice::setExploded(bool exploded) |
|
295 | void QPieSlice::setExploded(bool exploded) | |
298 | { |
|
296 | { | |
299 | if (d->m_isExploded != exploded) { |
|
297 | if (d->m_isExploded != exploded) { | |
300 | d->m_isExploded = exploded; |
|
298 | d->m_isExploded = exploded; | |
301 | emit changed(); |
|
299 | emit changed(); | |
302 | } |
|
300 | } | |
303 | } |
|
301 | } | |
304 |
|
302 | |||
305 | /*! |
|
303 | /*! | |
306 | Sets the explode distance \a factor. |
|
304 | Sets the explode distance \a factor. | |
307 |
|
305 | |||
308 | The factor is relative to pie radius. For example: |
|
306 | The factor is relative to pie radius. For example: | |
309 | 1.0 means the distance is the same as the radius. |
|
307 | 1.0 means the distance is the same as the radius. | |
310 | 0.5 means the distance is half of the radius. |
|
308 | 0.5 means the distance is half of the radius. | |
311 |
|
309 | |||
312 | Default value is 0.15 |
|
310 | Default value is 0.15 | |
313 |
|
311 | |||
314 | \sa explodeDistanceFactor() |
|
312 | \sa explodeDistanceFactor() | |
315 | */ |
|
313 | */ | |
316 | void QPieSlice::setExplodeDistanceFactor(qreal factor) |
|
314 | void QPieSlice::setExplodeDistanceFactor(qreal factor) | |
317 | { |
|
315 | { | |
318 | if (!qFuzzyIsNull(d->m_explodeDistanceFactor - factor)) { |
|
316 | if (!qFuzzyIsNull(d->m_explodeDistanceFactor - factor)) { | |
319 | d->m_explodeDistanceFactor = factor; |
|
317 | d->m_explodeDistanceFactor = factor; | |
320 | emit changed(); |
|
318 | emit changed(); | |
321 | } |
|
319 | } | |
322 | } |
|
320 | } | |
323 |
|
321 | |||
324 | /*! |
|
322 | /*! | |
325 | Sets the \a pen used to draw this slice. |
|
323 | Sets the \a pen used to draw this slice. | |
326 | Note that applying a theme will override this. |
|
324 | Note that applying a theme will override this. | |
327 | \sa pen() |
|
325 | \sa pen() | |
328 | */ |
|
326 | */ | |
329 | void QPieSlice::setPen(const QPen &pen) |
|
327 | void QPieSlice::setPen(const QPen &pen) | |
330 | { |
|
328 | { | |
331 | if (d->m_slicePen != pen) { |
|
329 | if (d->m_slicePen != pen) { | |
332 | d->m_slicePen = pen; |
|
330 | d->m_slicePen = pen; | |
333 | d->m_slicePen.setThemed(false); |
|
331 | d->m_slicePen.setThemed(false); | |
334 | emit changed(); |
|
332 | emit changed(); | |
335 | } |
|
333 | } | |
336 | } |
|
334 | } | |
337 |
|
335 | |||
338 | /*! |
|
336 | /*! | |
339 | Sets the \a brush used to draw this slice. |
|
337 | Sets the \a brush used to draw this slice. | |
340 | Note that applying a theme will override this. |
|
338 | Note that applying a theme will override this. | |
341 | \sa brush() |
|
339 | \sa brush() | |
342 | */ |
|
340 | */ | |
343 | void QPieSlice::setBrush(const QBrush &brush) |
|
341 | void QPieSlice::setBrush(const QBrush &brush) | |
344 | { |
|
342 | { | |
345 | if (d->m_sliceBrush != brush) { |
|
343 | if (d->m_sliceBrush != brush) { | |
346 | d->m_sliceBrush = brush; |
|
344 | d->m_sliceBrush = brush; | |
347 | d->m_sliceBrush.setThemed(false); |
|
345 | d->m_sliceBrush.setThemed(false); | |
348 | emit changed(); |
|
346 | emit changed(); | |
349 | } |
|
347 | } | |
350 | } |
|
348 | } | |
351 |
|
349 | |||
352 | /*! |
|
350 | /*! | |
353 | Sets the \a pen used to draw the label in this slice. |
|
351 | Sets the \a pen used to draw the label in this slice. | |
354 | Note that applying a theme will override this. |
|
352 | Note that applying a theme will override this. | |
355 | \sa labelPen() |
|
353 | \sa labelPen() | |
356 | */ |
|
354 | */ | |
357 | void QPieSlice::setLabelPen(const QPen &pen) |
|
355 | void QPieSlice::setLabelPen(const QPen &pen) | |
358 | { |
|
356 | { | |
359 | if (d->m_labelPen != pen) { |
|
357 | if (d->m_labelPen != pen) { | |
360 | d->m_labelPen = pen; |
|
358 | d->m_labelPen = pen; | |
361 | d->m_labelPen.setThemed(false); |
|
359 | d->m_labelPen.setThemed(false); | |
362 | emit changed(); |
|
360 | emit changed(); | |
363 | } |
|
361 | } | |
364 | } |
|
362 | } | |
365 |
|
363 | |||
366 | /*! |
|
364 | /*! | |
367 | Sets the \a font used to draw the label in this slice. |
|
365 | Sets the \a font used to draw the label in this slice. | |
368 | Note that applying a theme will override this. |
|
366 | Note that applying a theme will override this. | |
369 | \sa labelFont() |
|
367 | \sa labelFont() | |
370 | */ |
|
368 | */ | |
371 | void QPieSlice::setLabelFont(const QFont &font) |
|
369 | void QPieSlice::setLabelFont(const QFont &font) | |
372 | { |
|
370 | { | |
373 | if (d->m_labelFont != font) { |
|
371 | if (d->m_labelFont != font) { | |
374 | d->m_labelFont = font; |
|
372 | d->m_labelFont = font; | |
375 | d->m_labelFont.setThemed(false); |
|
373 | d->m_labelFont.setThemed(false); | |
376 | emit changed(); |
|
374 | emit changed(); | |
377 | } |
|
375 | } | |
378 | } |
|
376 | } | |
379 |
|
377 | |||
380 | /*! |
|
378 | /*! | |
381 | Sets the label arm length \a factor. |
|
379 | Sets the label arm length \a factor. | |
382 |
|
380 | |||
383 | The factor is relative to pie radius. For example: |
|
381 | The factor is relative to pie radius. For example: | |
384 | 1.0 means the length is the same as the radius. |
|
382 | 1.0 means the length is the same as the radius. | |
385 | 0.5 means the length is half of the radius. |
|
383 | 0.5 means the length is half of the radius. | |
386 |
|
384 | |||
387 | Default value is 0.15 |
|
385 | Default value is 0.15 | |
388 |
|
386 | |||
389 | \sa labelArmLengthFactor() |
|
387 | \sa labelArmLengthFactor() | |
390 | */ |
|
388 | */ | |
391 | void QPieSlice::setLabelArmLengthFactor(qreal factor) |
|
389 | void QPieSlice::setLabelArmLengthFactor(qreal factor) | |
392 | { |
|
390 | { | |
393 | if (!qFuzzyIsNull(d->m_labelArmLengthFactor - factor)) { |
|
391 | if (!qFuzzyIsNull(d->m_labelArmLengthFactor - factor)) { | |
394 | d->m_labelArmLengthFactor = factor; |
|
392 | d->m_labelArmLengthFactor = factor; | |
395 | emit changed(); |
|
393 | emit changed(); | |
396 | } |
|
394 | } | |
397 | } |
|
395 | } | |
398 |
|
396 | |||
399 | QTCOMMERCIALCHART_END_NAMESPACE |
|
397 | QTCOMMERCIALCHART_END_NAMESPACE | |
400 |
|
398 | |||
401 | QTCOMMERCIALCHART_USE_NAMESPACE |
|
399 | QTCOMMERCIALCHART_USE_NAMESPACE | |
402 | #include "moc_qpieslice.cpp" |
|
400 | #include "moc_qpieslice.cpp" |
General Comments 0
You need to be logged in to leave comments.
Login now