@@ -415,9 +415,8 void QLegendPrivate::handleSeriesAdded(QAbstractSeries *series, Domain *domain) | |||
|
415 | 415 | if(series->type() == QAbstractSeries::SeriesTypePie) |
|
416 | 416 | { |
|
417 | 417 | QPieSeries *pieSeries = static_cast<QPieSeries *>(series); |
|
418 | QPieSeriesPrivate *d = QPieSeriesPrivate::seriesData(*pieSeries); | |
|
419 |
QObject::connect( |
|
|
420 | QObject::connect(d, SIGNAL(removed(QList<QPieSlice*>)), this, SLOT(handleUpdatePieSeries())); | |
|
418 | QObject::connect(pieSeries, SIGNAL(added(QList<QPieSlice*>)), this, SLOT(handleUpdatePieSeries())); | |
|
419 | QObject::connect(pieSeries, SIGNAL(removed(QList<QPieSlice*>)), this, SLOT(handleUpdatePieSeries())); | |
|
421 | 420 | } |
|
422 | 421 | |
|
423 | 422 | updateLayout(); |
@@ -438,9 +437,8 void QLegendPrivate::handleSeriesRemoved(QAbstractSeries *series) | |||
|
438 | 437 | if(series->type() == QAbstractSeries::SeriesTypePie) |
|
439 | 438 | { |
|
440 | 439 | QPieSeries *pieSeries = static_cast<QPieSeries *>(series); |
|
441 | QPieSeriesPrivate *d = QPieSeriesPrivate::seriesData(*pieSeries); | |
|
442 |
QObject::disconnect( |
|
|
443 | QObject::disconnect(d, SIGNAL(removed(QList<QPieSlice*>)), this, SLOT(handleUpdatePieSeries())); | |
|
440 | QObject::disconnect(pieSeries, SIGNAL(added(QList<QPieSlice*>)), this, SLOT(handleUpdatePieSeries())); | |
|
441 | QObject::disconnect(pieSeries, SIGNAL(removed(QList<QPieSlice*>)), this, SLOT(handleUpdatePieSeries())); | |
|
444 | 442 | } |
|
445 | 443 | |
|
446 | 444 | updateLayout(); |
@@ -449,10 +447,10 void QLegendPrivate::handleSeriesRemoved(QAbstractSeries *series) | |||
|
449 | 447 | void QLegendPrivate::handleUpdatePieSeries() |
|
450 | 448 | { |
|
451 | 449 | //TODO: reimplement to be optimal |
|
452 |
QPieSeries |
|
|
453 |
Q_ASSERT( |
|
|
454 |
handleSeriesRemoved( |
|
|
455 |
handleSeriesAdded( |
|
|
450 | QPieSeries* series = qobject_cast<QPieSeries *> (sender()); | |
|
451 | Q_ASSERT(series); | |
|
452 | handleSeriesRemoved(series); | |
|
453 | handleSeriesAdded(series, 0); | |
|
456 | 454 | } |
|
457 | 455 | |
|
458 | 456 | #include "moc_qlegend.cpp" |
@@ -37,9 +37,9 PieChartItem::PieChartItem(QPieSeries *series, ChartPresenter* presenter) | |||
|
37 | 37 | { |
|
38 | 38 | Q_ASSERT(series); |
|
39 | 39 | |
|
40 | connect(series, SIGNAL(added(QList<QPieSlice*>)), this, SLOT(handleSlicesAdded(QList<QPieSlice*>))); | |
|
41 | connect(series, SIGNAL(removed(QList<QPieSlice*>)), this, SLOT(handleSlicesRemoved(QList<QPieSlice*>))); | |
|
40 | 42 | QPieSeriesPrivate *d = QPieSeriesPrivate::seriesData(*series); |
|
41 | connect(d, SIGNAL(added(QList<QPieSlice*>)), this, SLOT(handleSlicesAdded(QList<QPieSlice*>))); | |
|
42 | connect(d, SIGNAL(removed(QList<QPieSlice*>)), this, SLOT(handleSlicesRemoved(QList<QPieSlice*>))); | |
|
43 | 43 | connect(d, SIGNAL(piePositionChanged()), this, SLOT(updateLayout())); |
|
44 | 44 | connect(d, SIGNAL(pieSizeChanged()), this, SLOT(updateLayout())); |
|
45 | 45 |
@@ -165,7 +165,7 bool QPieSeries::append(QList<QPieSlice*> slices) | |||
|
165 | 165 | connect(s, SIGNAL(hovered(bool)), d, SLOT(sliceHovered(bool))); |
|
166 | 166 | } |
|
167 | 167 | |
|
168 |
emit |
|
|
168 | emit added(slices); | |
|
169 | 169 | |
|
170 | 170 | return true; |
|
171 | 171 | } |
@@ -224,7 +224,7 bool QPieSeries::insert(int index, QPieSlice* slice) | |||
|
224 | 224 | connect(slice, SIGNAL(clicked()), d, SLOT(sliceClicked())); |
|
225 | 225 | connect(slice, SIGNAL(hovered(bool)), d, SLOT(sliceHovered(bool))); |
|
226 | 226 | |
|
227 |
emit |
|
|
227 | emit added(QList<QPieSlice*>() << slice); | |
|
228 | 228 | |
|
229 | 229 | return true; |
|
230 | 230 | } |
@@ -243,7 +243,7 bool QPieSeries::remove(QPieSlice* slice) | |||
|
243 | 243 | |
|
244 | 244 | d->updateDerivativeData(); |
|
245 | 245 | |
|
246 |
emit |
|
|
246 | emit removed(QList<QPieSlice*>() << slice); | |
|
247 | 247 | |
|
248 | 248 | delete slice; |
|
249 | 249 | slice = 0; |
@@ -268,7 +268,7 void QPieSeries::clear() | |||
|
268 | 268 | |
|
269 | 269 | d->updateDerivativeData(); |
|
270 | 270 | |
|
271 |
emit |
|
|
271 | emit removed(slices); | |
|
272 | 272 | } |
|
273 | 273 | |
|
274 | 274 | /*! |
General Comments 0
You need to be logged in to leave comments.
Login now