@@ -86,12 +86,12 void PieSliceItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* /*op | |||
|
86 | 86 | |
|
87 | 87 | void PieSliceItem::hoverEnterEvent(QGraphicsSceneHoverEvent* /*event*/) |
|
88 | 88 | { |
|
89 | emit hoverEnter(); | |
|
89 | emit hoverEnter(); // TODO: refactor emit hover(somebooleanvalue) | |
|
90 | 90 | } |
|
91 | 91 | |
|
92 | 92 | void PieSliceItem::hoverLeaveEvent(QGraphicsSceneHoverEvent* /*event*/) |
|
93 | 93 | { |
|
94 | emit hoverLeave(); | |
|
94 | emit hoverLeave(); // TODO: refactor emit hover(somebooleanvalue) | |
|
95 | 95 | } |
|
96 | 96 | |
|
97 | 97 | void PieSliceItem::mousePressEvent(QGraphicsSceneMouseEvent *event) |
@@ -35,12 +35,16 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||
|
35 | 35 | \class QPieSeries |
|
36 | 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 | 39 | The slices can have any values as the QPieSeries will calculate its relative value to the sum of all slices. |
|
40 | 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 | 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 | 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 | 228 | void QPieSeries::remove(QPieSlice* slice) |
|
225 | 229 | { |
@@ -382,7 +386,7 void QPieSeries::setLabelsVisible(bool visible) | |||
|
382 | 386 | /*! |
|
383 | 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 | 391 | qreal QPieSeries::sum() const |
|
388 | 392 | { |
@@ -27,11 +27,15 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||
|
27 | 27 | \class QPieSlice |
|
28 | 28 | \brief Defines a slice in pie series. |
|
29 | 29 | |
|
30 |
|
|
|
31 | to modify slice data and customize the visual appearance of the slice. | |
|
30 | This object defines the properties of a single slice in a QPieSeries. | |
|
32 | 31 | |
|
33 | It also provides the means to customize user interaction with the slice by | |
|
34 | providing signals for clicking and hover events. | |
|
32 | In addition to the obvious value and label properties the user can also control | |
|
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 | 48 | \property QPieSlice::value |
|
45 | 49 | |
|
46 | 50 | Value of the slice. |
|
51 | ||
|
52 | \sa percentage(), QPieSeries::sum() | |
|
47 | 53 | */ |
|
48 | 54 | |
|
49 | 55 | /*! |
|
50 | 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. | |
|
53 | ||
|
54 | \sa QPieSeries::replace(), QPieSeries::append() | |
|
58 | \sa QPieSeries::append(), QPieSeries::insert(), QPieSeries::replace() | |
|
55 | 59 | */ |
|
56 | 60 | QPieSlice::QPieSlice(QObject *parent) |
|
57 | 61 | :QObject(parent), |
@@ -62,8 +66,7 QPieSlice::QPieSlice(QObject *parent) | |||
|
62 | 66 | |
|
63 | 67 | /*! |
|
64 | 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. | |
|
66 | \sa QPieSeries::replace(), QPieSeries::append() | |
|
69 | \sa QPieSeries::append(), QPieSeries::insert(), QPieSeries::replace() | |
|
67 | 70 | */ |
|
68 | 71 | QPieSlice::QPieSlice(qreal value, QString label, QObject *parent) |
|
69 | 72 | :QObject(parent), |
@@ -112,7 +115,7 bool QPieSlice::isLabelVisible() const | |||
|
112 | 115 | |
|
113 | 116 | /*! |
|
114 | 117 | Returns true if slice is exloded from the pie. |
|
115 | \sa setExploded(), setExplodeDistanceFactor() | |
|
118 | \sa setExploded(), explodeDistanceFactor(), setExplodeDistanceFactor() | |
|
116 | 119 | */ |
|
117 | 120 | bool QPieSlice::isExploded() const |
|
118 | 121 | { |
@@ -128,7 +131,7 bool QPieSlice::isExploded() const | |||
|
128 | 131 | |
|
129 | 132 | Default value is 0.15. |
|
130 | 133 | |
|
131 | \sa setExplodeDistanceFactor() | |
|
134 | \sa setExplodeDistanceFactor(), isExploded(), setExploded() | |
|
132 | 135 | */ |
|
133 | 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 | 143 | The returned value ranges from 0 to 1.0. |
|
141 | 144 | |
|
142 | 145 | Updated internally after the slice is added to the series. |
|
146 | ||
|
147 | \sa QPieSeries::sum() | |
|
143 | 148 | */ |
|
144 | 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. | |
|
300 | \sa isExploded(), explodeDistanceFactor() | |
|
304 | Sets this slices \a exploded state. | |
|
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 | 310 | void QPieSlice::setExploded(bool exploded) |
|
303 | 311 | { |
@@ -316,7 +324,7 void QPieSlice::setExploded(bool exploded) | |||
|
316 | 324 | |
|
317 | 325 | Default value is 0.15 |
|
318 | 326 | |
|
319 | \sa explodeDistanceFactor() | |
|
327 | \sa explodeDistanceFactor(), isExploded(), setExploded() | |
|
320 | 328 | */ |
|
321 | 329 | void QPieSlice::setExplodeDistanceFactor(qreal factor) |
|
322 | 330 | { |
@@ -328,7 +336,9 void QPieSlice::setExplodeDistanceFactor(qreal factor) | |||
|
328 | 336 | |
|
329 | 337 | /*! |
|
330 | 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 | 342 | \sa pen() |
|
333 | 343 | */ |
|
334 | 344 | void QPieSlice::setPen(const QPen &pen) |
@@ -342,7 +352,9 void QPieSlice::setPen(const QPen &pen) | |||
|
342 | 352 | |
|
343 | 353 | /*! |
|
344 | 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 | 358 | \sa brush() |
|
347 | 359 | */ |
|
348 | 360 | void QPieSlice::setBrush(const QBrush &brush) |
@@ -356,7 +368,9 void QPieSlice::setBrush(const QBrush &brush) | |||
|
356 | 368 | |
|
357 | 369 | /*! |
|
358 | 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 | 374 | \sa labelPen() |
|
361 | 375 | */ |
|
362 | 376 | void QPieSlice::setLabelPen(const QPen &pen) |
@@ -370,7 +384,9 void QPieSlice::setLabelPen(const QPen &pen) | |||
|
370 | 384 | |
|
371 | 385 | /*! |
|
372 | 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 | 390 | \sa labelFont() |
|
375 | 391 | */ |
|
376 | 392 | void QPieSlice::setLabelFont(const QFont &font) |
General Comments 0
You need to be logged in to leave comments.
Login now