@@ -223,7 +223,7 void ChartTheme::decorate(QPieSeries* series, int index, bool force) | |||
|
223 | 223 | QColor brushColor = colorAt(m_seriesGradients.at(index % m_seriesGradients.size()), pos); |
|
224 | 224 | |
|
225 | 225 | QPieSlice *s = series->slices().at(i); |
|
226 |
PieSliceData data = |
|
|
226 | PieSliceData data = PieSliceData::data(s); | |
|
227 | 227 | |
|
228 | 228 | if (data.m_slicePen.isThemed() || force) { |
|
229 | 229 | data.m_slicePen = penColor; |
@@ -245,9 +245,9 void ChartTheme::decorate(QPieSeries* series, int index, bool force) | |||
|
245 | 245 | data.m_labelFont.setThemed(true); |
|
246 | 246 | } |
|
247 | 247 | |
|
248 |
if ( |
|
|
249 |
|
|
|
250 |
emit s |
|
|
248 | if (PieSliceData::data(s) != data) { | |
|
249 | PieSliceData::data(s) = data; | |
|
250 | emit PieSliceData::data(s).emitChangedSignal(s); | |
|
251 | 251 | } |
|
252 | 252 | } |
|
253 | 253 | } |
@@ -147,7 +147,7 void PieChartItem::calculatePieLayout() | |||
|
147 | 147 | PieSliceData PieChartItem::sliceData(QPieSlice *slice) |
|
148 | 148 | { |
|
149 | 149 | // TODO: This function is kid of useless now. Refactor. |
|
150 |
PieSliceData sliceData = |
|
|
150 | PieSliceData sliceData = PieSliceData::data(slice); | |
|
151 | 151 | sliceData.m_center = PieSliceItem::sliceCenter(m_pieCenter, m_pieRadius, slice); |
|
152 | 152 | sliceData.m_radius = m_pieRadius; |
|
153 | 153 | return sliceData; |
@@ -110,6 +110,12 public: | |||
|
110 | 110 | emit s->changed(); |
|
111 | 111 | } |
|
112 | 112 | |
|
113 | static PieSliceData &data(QPieSlice *slice) | |
|
114 | { | |
|
115 | Q_ASSERT(slice); | |
|
116 | return *slice->d; | |
|
117 | } | |
|
118 | ||
|
113 | 119 | qreal m_value; |
|
114 | 120 | |
|
115 | 121 | Themed<QPen> m_slicePen; |
@@ -69,21 +69,21 void QPieSeriesPrivate::updateDerivativeData() | |||
|
69 | 69 | QVector<QPieSlice*> changed; |
|
70 | 70 | foreach (QPieSlice* s, m_slices) { |
|
71 | 71 | |
|
72 |
PieSliceData data = |
|
|
72 | PieSliceData data = PieSliceData::data(s); | |
|
73 | 73 | data.m_percentage = s->value() / m_total; |
|
74 | 74 | data.m_angleSpan = pieSpan * data.m_percentage; |
|
75 | 75 | data.m_startAngle = sliceAngle; |
|
76 | 76 | sliceAngle += data.m_angleSpan; |
|
77 | 77 | |
|
78 |
if ( |
|
|
79 |
|
|
|
78 | if (PieSliceData::data(s) != data) { | |
|
79 | PieSliceData::data(s) = data; | |
|
80 | 80 | changed << s; |
|
81 | 81 | } |
|
82 | 82 | } |
|
83 | 83 | |
|
84 | 84 | // emit signals |
|
85 | 85 | foreach (QPieSlice* s, changed) |
|
86 |
s |
|
|
86 | PieSliceData::data(s).emitChangedSignal(s); | |
|
87 | 87 | } |
|
88 | 88 | |
|
89 | 89 | void QPieSeriesPrivate::sliceChanged() |
General Comments 0
You need to be logged in to leave comments.
Login now