##// END OF EJS Templates
Updated a few ugly screenshots to prettier ones
Tero Ahola -
r1826:fe8c69d427ac
parent child
Show More
1 NO CONTENT: new file 100644, binary diff hidden
NO CONTENT: new file 100644, binary diff hidden
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
@@ -1,48 +1,49
1 /*!
1 /*!
2 \example examples/donut
2 \example examples/donut
3 \title Donut example
3 \title Donut example
4 \subtitle
4 \subtitle
5
5
6 This example shows how to use create a nested donuts chart using QPieSeries API.
6 This example shows how to use create a nested donuts chart using QPieSeries API.
7 \image examples_donutchart.png
7
8
8 Let's start by creating a QChartView instance and enabling the Antialiasing on it. Last line enables the animations of the chart.
9 Let's start by creating a QChartView instance and enabling the Antialiasing on it. Last line enables the animations of the chart.
9
10
10 \snippet ../examples/donut/widget.cpp 1
11 \snippet ../examples/donut/widget.cpp 1
11
12
12 Three variables are defined that will be used to define the donut chart. Min and max size define the relative size of the whole donut.
13 Three variables are defined that will be used to define the donut chart. Min and max size define the relative size of the whole donut.
13 minSize is the relative inner size of the smallest donut. maxSize is the relative outer size of the biggest donut.
14 minSize is the relative inner size of the smallest donut. maxSize is the relative outer size of the biggest donut.
14
15
15 \snippet ../examples/donut/widget.cpp 2
16 \snippet ../examples/donut/widget.cpp 2
16
17
17 Following block of code defines the individual donuts and their slices. First new QPieSeries object is created.
18 Following block of code defines the individual donuts and their slices. First new QPieSeries object is created.
18 Callign setDonut() changes pie into a donut. The number of slices in each donut is randomized.
19 Callign setDonut() changes pie into a donut. The number of slices in each donut is randomized.
19 The internal for loop creates the slices with a random value and label same as the value.
20 The internal for loop creates the slices with a random value and label same as the value.
20 Next the label of the slice is set to be visible and its color is set to white.
21 Next the label of the slice is set to be visible and its color is set to white.
21 To make the example more interesting the hovered signal of the slice is connected to widget's slot which inner workings are explained later.
22 To make the example more interesting the hovered signal of the slice is connected to widget's slot which inner workings are explained later.
22 Finally the slice is added to the donut. The donut's size is adjusted to achive the nesting of the donuts.
23 Finally the slice is added to the donut. The donut's size is adjusted to achive the nesting of the donuts.
23 Then the donut is added to the widget's list of donuts and to the chart.
24 Then the donut is added to the widget's list of donuts and to the chart.
24
25
25 \snippet ../examples/donut/widget.cpp 3
26 \snippet ../examples/donut/widget.cpp 3
26
27
27 Finally the widget is placed in a layout used by the application.
28 Finally the widget is placed in a layout used by the application.
28
29
29 \snippet ../examples/donut/widget.cpp 4
30 \snippet ../examples/donut/widget.cpp 4
30
31
31 To make the example more interesting the donuts are rotated randomly every 1.25 sec.
32 To make the example more interesting the donuts are rotated randomly every 1.25 sec.
32
33
33 \snippet ../examples/donut/widget.cpp 5
34 \snippet ../examples/donut/widget.cpp 5
34
35
35 The widget's updatedRotation slot is defined below.
36 The widget's updatedRotation slot is defined below.
36 It goes through all of the donuts and modifies thier current rotation by a random value.
37 It goes through all of the donuts and modifies thier current rotation by a random value.
37
38
38 \snippet ../examples/donut/widget.cpp 6
39 \snippet ../examples/donut/widget.cpp 6
39
40
40 The earlier mentioned explodeSlice slot code is provided below.
41 The earlier mentioned explodeSlice slot code is provided below.
41 If the slice is set to exploded then stop the timer that controls the donuts rotation.
42 If the slice is set to exploded then stop the timer that controls the donuts rotation.
42 Then the slice's start and end agles are obtained from the slice.
43 Then the slice's start and end agles are obtained from the slice.
43 To highlight the selected slice all the other donuts that lie outward from the one that contains the selected slice
44 To highlight the selected slice all the other donuts that lie outward from the one that contains the selected slice
44 have their start and end angles modified so that they wouldn't "block" the way for the hightlighted slice.
45 have their start and end angles modified so that they wouldn't "block" the way for the hightlighted slice.
45 If the slice is no longer selected return to the original state.
46 If the slice is no longer selected return to the original state.
46
47
47 \snippet ../examples/donut/widget.cpp 7
48 \snippet ../examples/donut/widget.cpp 7
48 */
49 */
General Comments 0
You need to be logged in to leave comments. Login now