@@ -26,8 +26,8 int main(int argc, char *argv[]) | |||||
26 | //! [1] |
|
26 | //! [1] | |
27 |
|
27 | |||
28 | //! [2] |
|
28 | //! [2] | |
29 |
series-> |
|
29 | series->setHoverHighlighting(); | |
30 |
series-> |
|
30 | series->setClickExplodes(); | |
31 | //! [2] |
|
31 | //! [2] | |
32 |
|
32 | |||
33 | window.setCentralWidget(chartView); |
|
33 | window.setCentralWidget(chartView); |
@@ -106,18 +106,13 bool QPieSeries::ChangeSet::isEmpty() const | |||||
106 |
|
106 | |||
107 | The pie series defines a pie chart which consists of pie slices which are QPieSlice objects. |
|
107 | The pie series defines a pie chart which consists of pie slices which are QPieSlice objects. | |
108 | The slices can have any values as the QPieSeries will calculate its relative value to the sum of all slices. |
|
108 | The slices can have any values as the QPieSeries will calculate its relative value to the sum of all slices. | |
109 |
The actual slice size |
|
109 | The actual slice size is determined by that relative value. | |
110 |
|
110 | |||
111 | By default the pie is defined as full but it can be a partial pie. |
|
111 | By default the pie is defined as a full pie but it can be a partial pie. | |
112 | This can be done by setting a starting angle and angle span to the series. |
|
112 | This can be done by setting a starting angle and angle span to the series. | |
113 |
|
113 | |||
114 | Example on how to create a chart with pie series: |
|
114 | To help with the most common user interaction scenarions there some convenience functions. | |
115 | \snippet ../example/piechart/main.cpp 1 |
|
115 | Like exploding a slice when clicked and higlighting when user hovers over a slice. | |
116 |
|
||||
117 | To help with the most common user intercation scenarions there some convenience functions. Specifically |
|
|||
118 | exploding and higlighting: |
|
|||
119 | \snippet ../example/piechart/main.cpp 2 |
|
|||
120 |
|
||||
121 | */ |
|
116 | */ | |
122 |
|
117 | |||
123 | /*! |
|
118 | /*! | |
@@ -341,7 +336,7 void QPieSeries::setLabelsVisible(bool visible) | |||||
341 |
|
336 | |||
342 | \sa QPieSlice::isExploded(), QPieSlice::setExploded(), QPieSlice::setExplodeDistance() |
|
337 | \sa QPieSlice::isExploded(), QPieSlice::setExploded(), QPieSlice::setExplodeDistance() | |
343 | */ |
|
338 | */ | |
344 |
void QPieSeries:: |
|
339 | void QPieSeries::setClickExplodes(bool enable) | |
345 | { |
|
340 | { | |
346 | if (enable) |
|
341 | if (enable) | |
347 | connect(this, SIGNAL(clicked(QPieSlice*)), this, SLOT(toggleExploded(QPieSlice*))); |
|
342 | connect(this, SIGNAL(clicked(QPieSlice*)), this, SLOT(toggleExploded(QPieSlice*))); | |
@@ -357,7 +352,7 void QPieSeries::enableClickExplodes(bool enable) | |||||
357 | \sa QPieSlice::isExploded(), QPieSlice::setExploded() |
|
352 | \sa QPieSlice::isExploded(), QPieSlice::setExploded() | |
358 | */ |
|
353 | */ | |
359 |
|
354 | |||
360 |
void QPieSeries:: |
|
355 | void QPieSeries::setHoverHighlighting(bool enable) | |
361 | { |
|
356 | { | |
362 | if (enable) { |
|
357 | if (enable) { | |
363 | connect(this, SIGNAL(hoverEnter(QPieSlice*)), this, SLOT(highlightOn(QPieSlice*))); |
|
358 | connect(this, SIGNAL(hoverEnter(QPieSlice*)), this, SLOT(highlightOn(QPieSlice*))); |
@@ -66,20 +66,17 public: | |||||
66 | void clear(); |
|
66 | void clear(); | |
67 |
|
67 | |||
68 | int count() const; |
|
68 | int count() const; | |
69 |
|
||||
70 | QList<QPieSlice*> slices() const; |
|
69 | QList<QPieSlice*> slices() const; | |
71 |
|
70 | |||
72 | void setSizeFactor(qreal sizeFactor); |
|
71 | void setSizeFactor(qreal sizeFactor); | |
73 | qreal sizeFactor() const; |
|
72 | qreal sizeFactor() const; | |
74 |
|
||||
75 | void setPosition(PiePosition position); |
|
73 | void setPosition(PiePosition position); | |
76 | PiePosition position() const; |
|
74 | PiePosition position() const; | |
77 |
|
||||
78 | void setSpan(qreal startAngle, qreal angleSpan); |
|
75 | void setSpan(qreal startAngle, qreal angleSpan); | |
79 |
|
76 | |||
80 | void setLabelsVisible(bool visible); |
|
77 | void setLabelsVisible(bool visible = true); | |
81 |
void |
|
78 | void setClickExplodes(bool enable = true); | |
82 |
void |
|
79 | void setHoverHighlighting(bool enable = true); | |
83 |
|
80 | |||
84 | // TODO: find slices? |
|
81 | // TODO: find slices? | |
85 | // QList<QPieSlice*> findByValue(qreal value); |
|
82 | // QList<QPieSlice*> findByValue(qreal value); |
@@ -135,6 +135,7 qreal QPieSlice::explodeDistance() const | |||||
135 |
|
135 | |||
136 | /*! |
|
136 | /*! | |
137 | Returns the percentage of this slice compared to all slices in the same series. |
|
137 | Returns the percentage of this slice compared to all slices in the same series. | |
|
138 | The returned value ranges from 0 to 1.0. | |||
138 |
|
139 | |||
139 | Updated internally after the slice is added to the series. |
|
140 | Updated internally after the slice is added to the series. | |
140 | */ |
|
141 | */ | |
@@ -283,7 +284,7 void QPieSlice::setLabelVisible(bool visible) | |||||
283 |
|
284 | |||
284 | /*! |
|
285 | /*! | |
285 | Sets this slice \a exploded. |
|
286 | Sets this slice \a exploded. | |
286 |
\sa isExploded(), setExplodeDistance(), QPieSeries:: |
|
287 | \sa isExploded(), setExplodeDistance(), QPieSeries::setClickExplodes() | |
287 | */ |
|
288 | */ | |
288 | void QPieSlice::setExploded(bool exploded) |
|
289 | void QPieSlice::setExploded(bool exploded) | |
289 | { |
|
290 | { | |
@@ -296,7 +297,7 void QPieSlice::setExploded(bool exploded) | |||||
296 | /*! |
|
297 | /*! | |
297 | Sets the explosion \a distance of this slice. |
|
298 | Sets the explosion \a distance of this slice. | |
298 | It is the distance the slice is moved away from the pie center. |
|
299 | It is the distance the slice is moved away from the pie center. | |
299 |
\sa explodeDistance(), isExploded(), QPieSeries:: |
|
300 | \sa explodeDistance(), isExploded(), QPieSeries::setClickExplodes() | |
300 | */ |
|
301 | */ | |
301 | void QPieSlice::setExplodeDistance(qreal distance) |
|
302 | void QPieSlice::setExplodeDistance(qreal distance) | |
302 | { |
|
303 | { |
General Comments 0
You need to be logged in to leave comments.
Login now