@@ -115,6 +115,14 MainWidget::MainWidget(QWidget* parent) | |||
|
115 | 115 | m_endAngle->setValue(m_series->pieEndAngle()); |
|
116 | 116 | m_endAngle->setSingleStep(1); |
|
117 | 117 | |
|
118 | m_isDonut = new QCheckBox(); | |
|
119 | ||
|
120 | m_donutInnerSize = new QDoubleSpinBox(); | |
|
121 | m_donutInnerSize->setMinimum(0.0); | |
|
122 | m_donutInnerSize->setMaximum(1.0); | |
|
123 | m_donutInnerSize->setSingleStep(0.1); | |
|
124 | m_donutInnerSize->setValue(m_series->donutInnerSize()); | |
|
125 | ||
|
118 | 126 | QPushButton *appendSlice = new QPushButton("Append slice"); |
|
119 | 127 | QPushButton *insertSlice = new QPushButton("Insert slice"); |
|
120 | 128 | QPushButton *removeSlice = new QPushButton("Remove selected slice"); |
@@ -125,6 +133,8 MainWidget::MainWidget(QWidget* parent) | |||
|
125 | 133 | seriesSettingsLayout->addRow("Size factor", m_sizeFactor); |
|
126 | 134 | seriesSettingsLayout->addRow("Start angle", m_startAngle); |
|
127 | 135 | seriesSettingsLayout->addRow("End angle", m_endAngle); |
|
136 | seriesSettingsLayout->addRow("Is donut", m_isDonut); | |
|
137 | seriesSettingsLayout->addRow("Donut inner size", m_donutInnerSize); | |
|
128 | 138 | seriesSettingsLayout->addRow(appendSlice); |
|
129 | 139 | seriesSettingsLayout->addRow(insertSlice); |
|
130 | 140 | seriesSettingsLayout->addRow(removeSlice); |
@@ -136,6 +146,8 MainWidget::MainWidget(QWidget* parent) | |||
|
136 | 146 | connect(m_sizeFactor, SIGNAL(valueChanged(double)), this, SLOT(updateSerieSettings())); |
|
137 | 147 | connect(m_startAngle, SIGNAL(valueChanged(double)), this, SLOT(updateSerieSettings())); |
|
138 | 148 | connect(m_endAngle, SIGNAL(valueChanged(double)), this, SLOT(updateSerieSettings())); |
|
149 | connect(m_isDonut, SIGNAL(toggled(bool)), this, SLOT(updateSerieSettings())); | |
|
150 | connect(m_donutInnerSize, SIGNAL(valueChanged(double)), this, SLOT(updateSerieSettings())); | |
|
139 | 151 | connect(appendSlice, SIGNAL(clicked()), this, SLOT(appendSlice())); |
|
140 | 152 | connect(insertSlice, SIGNAL(clicked()), this, SLOT(insertSlice())); |
|
141 | 153 | connect(removeSlice, SIGNAL(clicked()), this, SLOT(removeSlice())); |
@@ -239,6 +251,8 void MainWidget::updateSerieSettings() | |||
|
239 | 251 | m_series->setPieSize(m_sizeFactor->value()); |
|
240 | 252 | m_series->setPieStartAngle(m_startAngle->value()); |
|
241 | 253 | m_series->setPieEndAngle(m_endAngle->value()); |
|
254 | m_series->setDonut(m_isDonut->isChecked()); | |
|
255 | m_series->setDonutInnerSize(m_donutInnerSize->value()); | |
|
242 | 256 | } |
|
243 | 257 | |
|
244 | 258 | void MainWidget::updateSliceSettings() |
@@ -72,6 +72,8 private: | |||
|
72 | 72 | QDoubleSpinBox* m_sizeFactor; |
|
73 | 73 | QDoubleSpinBox* m_startAngle; |
|
74 | 74 | QDoubleSpinBox* m_endAngle; |
|
75 | QCheckBox* m_isDonut; | |
|
76 | QDoubleSpinBox* m_donutInnerSize; | |
|
75 | 77 | |
|
76 | 78 | QLineEdit* m_sliceName; |
|
77 | 79 | QDoubleSpinBox* m_sliceValue; |
@@ -60,8 +60,11 ChartAnimation* PieAnimation::addSlice(PieSliceItem *sliceItem, const PieSliceDa | |||
|
60 | 60 | else |
|
61 | 61 | startValue.m_startAngle = sliceData.m_startAngle + (sliceData.m_angleSpan / 2); |
|
62 | 62 | startValue.m_angleSpan = 0; |
|
63 | animation->setValue(startValue, sliceData); | |
|
64 | 63 | |
|
64 | if (sliceData.m_donut) | |
|
65 | startValue.m_radius = sliceData.m_innerRadius; | |
|
66 | ||
|
67 | animation->setValue(startValue, sliceData); | |
|
65 | 68 | animation->setDuration(ChartAnimationDuration); |
|
66 | 69 | animation->setEasingCurve(QEasingCurve::OutQuart); |
|
67 | 70 | |
@@ -75,7 +78,10 ChartAnimation* PieAnimation::removeSlice(PieSliceItem *sliceItem) | |||
|
75 | 78 | animation->stop(); |
|
76 | 79 | |
|
77 | 80 | PieSliceData endValue = animation->currentSliceValue(); |
|
78 |
endValue.m_ |
|
|
81 | if (endValue.m_donut) | |
|
82 | endValue.m_radius = endValue.m_innerRadius; | |
|
83 | else | |
|
84 | endValue.m_radius = 0; | |
|
79 | 85 | endValue.m_startAngle = endValue.m_startAngle + endValue.m_angleSpan; |
|
80 | 86 | endValue.m_angleSpan = 0; |
|
81 | 87 | endValue.m_isLabelVisible = false; |
@@ -110,6 +110,7 QVariant PieSliceAnimation::interpolated(const QVariant &start, const QVariant & | |||
|
110 | 110 | result.m_angleSpan = linearPos(startValue.m_angleSpan, endValue.m_angleSpan, progress); |
|
111 | 111 | result.m_slicePen = linearPos(startValue.m_slicePen, endValue.m_slicePen, progress); |
|
112 | 112 | result.m_sliceBrush = linearPos(startValue.m_sliceBrush, endValue.m_sliceBrush, progress); |
|
113 | result.m_innerRadius = linearPos(startValue.m_innerRadius, endValue.m_innerRadius, progress); | |
|
113 | 114 | |
|
114 | 115 | return qVariantFromValue(result); |
|
115 | 116 | } |
General Comments 0
You need to be logged in to leave comments.
Login now