@@ -86,12 +86,12 void PieSliceItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* /*op | |||||
86 |
|
86 | |||
87 | void PieSliceItem::hoverEnterEvent(QGraphicsSceneHoverEvent* /*event*/) |
|
87 | void PieSliceItem::hoverEnterEvent(QGraphicsSceneHoverEvent* /*event*/) | |
88 | { |
|
88 | { | |
89 | emit hoverEnter(); |
|
89 | emit hoverEnter(); // TODO: refactor emit hover(somebooleanvalue) | |
90 | } |
|
90 | } | |
91 |
|
91 | |||
92 | void PieSliceItem::hoverLeaveEvent(QGraphicsSceneHoverEvent* /*event*/) |
|
92 | void PieSliceItem::hoverLeaveEvent(QGraphicsSceneHoverEvent* /*event*/) | |
93 | { |
|
93 | { | |
94 | emit hoverLeave(); |
|
94 | emit hoverLeave(); // TODO: refactor emit hover(somebooleanvalue) | |
95 | } |
|
95 | } | |
96 |
|
96 | |||
97 | void PieSliceItem::mousePressEvent(QGraphicsSceneMouseEvent *event) |
|
97 | void PieSliceItem::mousePressEvent(QGraphicsSceneMouseEvent *event) |
@@ -35,12 +35,16 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
35 | \class QPieSeries |
|
35 | \class QPieSeries | |
36 | \brief Pie series API for QtCommercial Charts |
|
36 | \brief Pie series API for QtCommercial Charts | |
37 |
|
37 | |||
38 | The pie series defines a pie chart which consists of pie slices which are QPieSlice objects. |
|
38 | The pie series defines a pie chart which consists of pie slices which are defined as QPieSlice objects. | |
39 | The slices can have any values as the QPieSeries will calculate its relative value to the sum of all slices. |
|
39 | The slices can have any values as the QPieSeries will calculate its relative value to the sum of all slices. | |
40 | The actual slice size is determined by that relative value. |
|
40 | The actual slice size is determined by that relative value. | |
41 |
|
41 | |||
42 | By default the pie is defined as a full pie but it can be a partial pie. |
|
42 | Pie size and position on the chart is controlled by using relative values which range from 0.0 to 1.0 | |
|
43 | These relate to the actual chart rectangle. | |||
|
44 | ||||
|
45 | By default the pie is defined as a full pie but it can also be a partial pie. | |||
43 | This can be done by setting a starting angle and angle span to the series. |
|
46 | This can be done by setting a starting angle and angle span to the series. | |
|
47 | Full pie is 360 degrees where 0 is at 12 a'clock. | |||
44 | */ |
|
48 | */ | |
45 |
|
49 | |||
46 | /*! |
|
50 | /*! | |
@@ -219,7 +223,7 void QPieSeries::insert(int index, QPieSlice* slice) | |||||
219 | /*! |
|
223 | /*! | |
220 | Removes a single \a slice from the series and deletes the slice. |
|
224 | Removes a single \a slice from the series and deletes the slice. | |
221 |
|
225 | |||
222 |
Do not reference th |
|
226 | Do not reference the pointer after this call. | |
223 | */ |
|
227 | */ | |
224 | void QPieSeries::remove(QPieSlice* slice) |
|
228 | void QPieSeries::remove(QPieSlice* slice) | |
225 | { |
|
229 | { | |
@@ -382,7 +386,7 void QPieSeries::setLabelsVisible(bool visible) | |||||
382 | /*! |
|
386 | /*! | |
383 | Returns the sum of all slice values in this series. |
|
387 | Returns the sum of all slice values in this series. | |
384 |
|
388 | |||
385 | \sa QPieSlice::value(), QPieSlice::setValue() |
|
389 | \sa QPieSlice::value(), QPieSlice::setValue(), QPieSlice::percentage() | |
386 | */ |
|
390 | */ | |
387 | qreal QPieSeries::sum() const |
|
391 | qreal QPieSeries::sum() const | |
388 | { |
|
392 | { |
@@ -27,11 +27,15 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
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 |
|
|
30 | This object defines the properties of a single slice in a QPieSeries. | |
31 | to modify slice data and customize the visual appearance of the slice. |
|
|||
32 |
|
31 | |||
33 | It also provides the means to customize user interaction with the slice by |
|
32 | In addition to the obvious value and label properties the user can also control | |
34 | providing signals for clicking and hover events. |
|
33 | the visual appearance of a slice. By modifying the visual appearance also means that | |
|
34 | the user is overriding the default appearance set by the theme. Even if the theme is | |||
|
35 | changed users settings will persist. | |||
|
36 | ||||
|
37 | To enable user interaction customization with the slices some basic signals | |||
|
38 | are provided about clicking and hovering. | |||
35 | */ |
|
39 | */ | |
36 |
|
40 | |||
37 | /*! |
|
41 | /*! | |
@@ -44,14 +48,14 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
44 | \property QPieSlice::value |
|
48 | \property QPieSlice::value | |
45 |
|
49 | |||
46 | Value of the slice. |
|
50 | Value of the slice. | |
|
51 | ||||
|
52 | \sa percentage(), QPieSeries::sum() | |||
47 | */ |
|
53 | */ | |
48 |
|
54 | |||
49 | /*! |
|
55 | /*! | |
50 | Constructs an empty slice with a \a parent. |
|
56 | Constructs an empty slice with a \a parent. | |
51 |
|
57 | |||
52 | Note that QPieSeries takes ownership of the slice when it is set/added. |
|
58 | \sa QPieSeries::append(), QPieSeries::insert(), QPieSeries::replace() | |
53 |
|
||||
54 | \sa QPieSeries::replace(), QPieSeries::append() |
|
|||
55 | */ |
|
59 | */ | |
56 | QPieSlice::QPieSlice(QObject *parent) |
|
60 | QPieSlice::QPieSlice(QObject *parent) | |
57 | :QObject(parent), |
|
61 | :QObject(parent), | |
@@ -62,8 +66,7 QPieSlice::QPieSlice(QObject *parent) | |||||
62 |
|
66 | |||
63 | /*! |
|
67 | /*! | |
64 | Constructs an empty slice with given \a value, \a label and a \a parent. |
|
68 | 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. |
|
69 | \sa QPieSeries::append(), QPieSeries::insert(), QPieSeries::replace() | |
66 | \sa QPieSeries::replace(), QPieSeries::append() |
|
|||
67 | */ |
|
70 | */ | |
68 | QPieSlice::QPieSlice(qreal value, QString label, QObject *parent) |
|
71 | QPieSlice::QPieSlice(qreal value, QString label, QObject *parent) | |
69 | :QObject(parent), |
|
72 | :QObject(parent), | |
@@ -112,7 +115,7 bool QPieSlice::isLabelVisible() const | |||||
112 |
|
115 | |||
113 | /*! |
|
116 | /*! | |
114 | Returns true if slice is exloded from the pie. |
|
117 | Returns true if slice is exloded from the pie. | |
115 | \sa setExploded(), setExplodeDistanceFactor() |
|
118 | \sa setExploded(), explodeDistanceFactor(), setExplodeDistanceFactor() | |
116 | */ |
|
119 | */ | |
117 | bool QPieSlice::isExploded() const |
|
120 | bool QPieSlice::isExploded() const | |
118 | { |
|
121 | { | |
@@ -128,7 +131,7 bool QPieSlice::isExploded() const | |||||
128 |
|
131 | |||
129 | Default value is 0.15. |
|
132 | Default value is 0.15. | |
130 |
|
133 | |||
131 | \sa setExplodeDistanceFactor() |
|
134 | \sa setExplodeDistanceFactor(), isExploded(), setExploded() | |
132 | */ |
|
135 | */ | |
133 | qreal QPieSlice::explodeDistanceFactor() const |
|
136 | qreal QPieSlice::explodeDistanceFactor() const | |
134 | { |
|
137 | { | |
@@ -136,10 +139,12 qreal QPieSlice::explodeDistanceFactor() const | |||||
136 | } |
|
139 | } | |
137 |
|
140 | |||
138 | /*! |
|
141 | /*! | |
139 | Returns the percentage of this slice compared to all slices in the same series. |
|
142 | Returns the percentage of this slice compared to the sum of all slices in the same series. | |
140 | The returned value ranges from 0 to 1.0. |
|
143 | The returned value ranges from 0 to 1.0. | |
141 |
|
144 | |||
142 | Updated internally after the slice is added to the series. |
|
145 | Updated internally after the slice is added to the series. | |
|
146 | ||||
|
147 | \sa QPieSeries::sum() | |||
143 | */ |
|
148 | */ | |
144 | qreal QPieSlice::percentage() const |
|
149 | qreal QPieSlice::percentage() const | |
145 | { |
|
150 | { | |
@@ -296,8 +301,11 void QPieSlice::setLabelVisible(bool visible) | |||||
296 | } |
|
301 | } | |
297 |
|
302 | |||
298 | /*! |
|
303 | /*! | |
299 | Sets this slice \a exploded. |
|
304 | Sets this slices \a exploded state. | |
300 | \sa isExploded(), explodeDistanceFactor() |
|
305 | ||
|
306 | If the slice is exploded it is moved away from the pie center. The distance is defined by the explode distance factor. | |||
|
307 | ||||
|
308 | \sa isExploded(), explodeDistanceFactor(), setExplodeDistanceFactor() | |||
301 | */ |
|
309 | */ | |
302 | void QPieSlice::setExploded(bool exploded) |
|
310 | void QPieSlice::setExploded(bool exploded) | |
303 | { |
|
311 | { | |
@@ -316,7 +324,7 void QPieSlice::setExploded(bool exploded) | |||||
316 |
|
324 | |||
317 | Default value is 0.15 |
|
325 | Default value is 0.15 | |
318 |
|
326 | |||
319 | \sa explodeDistanceFactor() |
|
327 | \sa explodeDistanceFactor(), isExploded(), setExploded() | |
320 | */ |
|
328 | */ | |
321 | void QPieSlice::setExplodeDistanceFactor(qreal factor) |
|
329 | void QPieSlice::setExplodeDistanceFactor(qreal factor) | |
322 | { |
|
330 | { | |
@@ -328,7 +336,9 void QPieSlice::setExplodeDistanceFactor(qreal factor) | |||||
328 |
|
336 | |||
329 | /*! |
|
337 | /*! | |
330 | Sets the \a pen used to draw this slice. |
|
338 | Sets the \a pen used to draw this slice. | |
331 | Note that applying a theme will override this. |
|
339 | ||
|
340 | Overrides the pen set by the theme. | |||
|
341 | ||||
332 | \sa pen() |
|
342 | \sa pen() | |
333 | */ |
|
343 | */ | |
334 | void QPieSlice::setPen(const QPen &pen) |
|
344 | void QPieSlice::setPen(const QPen &pen) | |
@@ -342,7 +352,9 void QPieSlice::setPen(const QPen &pen) | |||||
342 |
|
352 | |||
343 | /*! |
|
353 | /*! | |
344 | Sets the \a brush used to draw this slice. |
|
354 | Sets the \a brush used to draw this slice. | |
345 | Note that applying a theme will override this. |
|
355 | ||
|
356 | Overrides the brush set by the theme. | |||
|
357 | ||||
346 | \sa brush() |
|
358 | \sa brush() | |
347 | */ |
|
359 | */ | |
348 | void QPieSlice::setBrush(const QBrush &brush) |
|
360 | void QPieSlice::setBrush(const QBrush &brush) | |
@@ -356,7 +368,9 void QPieSlice::setBrush(const QBrush &brush) | |||||
356 |
|
368 | |||
357 | /*! |
|
369 | /*! | |
358 | Sets the \a pen used to draw the label in this slice. |
|
370 | Sets the \a pen used to draw the label in this slice. | |
359 | Note that applying a theme will override this. |
|
371 | ||
|
372 | Overrides the pen set by the theme. | |||
|
373 | ||||
360 | \sa labelPen() |
|
374 | \sa labelPen() | |
361 | */ |
|
375 | */ | |
362 | void QPieSlice::setLabelPen(const QPen &pen) |
|
376 | void QPieSlice::setLabelPen(const QPen &pen) | |
@@ -370,7 +384,9 void QPieSlice::setLabelPen(const QPen &pen) | |||||
370 |
|
384 | |||
371 | /*! |
|
385 | /*! | |
372 | Sets the \a font used to draw the label in this slice. |
|
386 | Sets the \a font used to draw the label in this slice. | |
373 | Note that applying a theme will override this. |
|
387 | ||
|
388 | Overrides the font set by the theme. | |||
|
389 | ||||
374 | \sa labelFont() |
|
390 | \sa labelFont() | |
375 | */ |
|
391 | */ | |
376 | void QPieSlice::setLabelFont(const QFont &font) |
|
392 | void QPieSlice::setLabelFont(const QFont &font) |
General Comments 0
You need to be logged in to leave comments.
Login now