@@ -26,8 +26,8 int main(int argc, char *argv[]) | |||
|
26 | 26 | //! [1] |
|
27 | 27 | |
|
28 | 28 | //! [2] |
|
29 |
series-> |
|
|
30 |
series-> |
|
|
29 | series->setHoverHighlighting(); | |
|
30 | series->setClickExplodes(); | |
|
31 | 31 | //! [2] |
|
32 | 32 | |
|
33 | 33 | window.setCentralWidget(chartView); |
@@ -106,18 +106,13 bool QPieSeries::ChangeSet::isEmpty() const | |||
|
106 | 106 | |
|
107 | 107 | The pie series defines a pie chart which consists of pie slices which are QPieSlice objects. |
|
108 | 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 | 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: | |
|
115 | \snippet ../example/piechart/main.cpp 1 | |
|
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 | ||
|
114 | To help with the most common user interaction scenarions there some convenience functions. | |
|
115 | Like exploding a slice when clicked and higlighting when user hovers over a slice. | |
|
121 | 116 | */ |
|
122 | 117 | |
|
123 | 118 | /*! |
@@ -341,7 +336,7 void QPieSeries::setLabelsVisible(bool visible) | |||
|
341 | 336 | |
|
342 | 337 | \sa QPieSlice::isExploded(), QPieSlice::setExploded(), QPieSlice::setExplodeDistance() |
|
343 | 338 | */ |
|
344 |
void QPieSeries:: |
|
|
339 | void QPieSeries::setClickExplodes(bool enable) | |
|
345 | 340 | { |
|
346 | 341 | if (enable) |
|
347 | 342 | connect(this, SIGNAL(clicked(QPieSlice*)), this, SLOT(toggleExploded(QPieSlice*))); |
@@ -357,7 +352,7 void QPieSeries::enableClickExplodes(bool enable) | |||
|
357 | 352 | \sa QPieSlice::isExploded(), QPieSlice::setExploded() |
|
358 | 353 | */ |
|
359 | 354 | |
|
360 |
void QPieSeries:: |
|
|
355 | void QPieSeries::setHoverHighlighting(bool enable) | |
|
361 | 356 | { |
|
362 | 357 | if (enable) { |
|
363 | 358 | connect(this, SIGNAL(hoverEnter(QPieSlice*)), this, SLOT(highlightOn(QPieSlice*))); |
@@ -66,20 +66,17 public: | |||
|
66 | 66 | void clear(); |
|
67 | 67 | |
|
68 | 68 | int count() const; |
|
69 | ||
|
70 | 69 | QList<QPieSlice*> slices() const; |
|
71 | 70 | |
|
72 | 71 | void setSizeFactor(qreal sizeFactor); |
|
73 | 72 | qreal sizeFactor() const; |
|
74 | ||
|
75 | 73 | void setPosition(PiePosition position); |
|
76 | 74 | PiePosition position() const; |
|
77 | ||
|
78 | 75 | void setSpan(qreal startAngle, qreal angleSpan); |
|
79 | 76 | |
|
80 | void setLabelsVisible(bool visible); | |
|
81 |
void |
|
|
82 |
void |
|
|
77 | void setLabelsVisible(bool visible = true); | |
|
78 | void setClickExplodes(bool enable = true); | |
|
79 | void setHoverHighlighting(bool enable = true); | |
|
83 | 80 | |
|
84 | 81 | // TODO: find slices? |
|
85 | 82 | // QList<QPieSlice*> findByValue(qreal value); |
@@ -135,6 +135,7 qreal QPieSlice::explodeDistance() const | |||
|
135 | 135 | |
|
136 | 136 | /*! |
|
137 | 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 | 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 | 286 | Sets this slice \a exploded. |
|
286 |
\sa isExploded(), setExplodeDistance(), QPieSeries:: |
|
|
287 | \sa isExploded(), setExplodeDistance(), QPieSeries::setClickExplodes() | |
|
287 | 288 | */ |
|
288 | 289 | void QPieSlice::setExploded(bool exploded) |
|
289 | 290 | { |
@@ -296,7 +297,7 void QPieSlice::setExploded(bool exploded) | |||
|
296 | 297 | /*! |
|
297 | 298 | Sets the explosion \a distance of this slice. |
|
298 | 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 | 302 | void QPieSlice::setExplodeDistance(qreal distance) |
|
302 | 303 | { |
General Comments 0
You need to be logged in to leave comments.
Login now