##// END OF EJS Templates
Model mappers now connected to series and model destroy signals
Marek Rosa -
r1656:449d9eb6f2f2
parent child
Show More
@@ -58,6 +58,7 void QBarModelMapper::setModel(QAbstractItemModel *model)
58 58 connect(d->m_model, SIGNAL(rowsRemoved(QModelIndex,int,int)), d, SLOT(modelRowsRemoved(QModelIndex,int,int)));
59 59 connect(d->m_model, SIGNAL(columnsInserted(QModelIndex,int,int)), d, SLOT(modelColumnsAdded(QModelIndex,int,int)));
60 60 connect(d->m_model, SIGNAL(columnsRemoved(QModelIndex,int,int)), d, SLOT(modelColumnsRemoved(QModelIndex,int,int)));
61 connect(d->m_model, SIGNAL(destroyed()), d, SLOT(handleModelDestroyed()));
61 62 }
62 63
63 64 QAbstractBarSeries* QBarModelMapper::series() const
@@ -81,6 +82,7 void QBarModelMapper::setSeries(QAbstractBarSeries *series)
81 82 // connect the signals from the series
82 83 connect(d->m_series, SIGNAL(barsetsAdded(QList<QBarSet*>)), d, SLOT(barSetsAdded(QList<QBarSet*>)));
83 84 connect(d->m_series, SIGNAL(barsetsRemoved(QList<QBarSet*>)), d, SLOT(barSetsRemoved(QList<QBarSet*>)));
85 connect(d->m_series, SIGNAL(destroyed()), d, SLOT(handleSeriesDestroyed()));
84 86 }
85 87
86 88 /*!
@@ -247,6 +249,11 QModelIndex QBarModelMapperPrivate::barModelIndex(int barSection, int posInBar)
247 249 return m_model->index(barSection, posInBar + m_first);
248 250 }
249 251
252 void QBarModelMapperPrivate::handleSeriesDestroyed()
253 {
254 m_series = 0;
255 }
256
250 257 void QBarModelMapperPrivate::modelUpdated(QModelIndex topLeft, QModelIndex bottomRight)
251 258 {
252 259 Q_UNUSED(topLeft)
@@ -360,6 +367,11 void QBarModelMapperPrivate::modelColumnsRemoved(QModelIndex parent, int start,
360 367 blockSeriesSignals(false);
361 368 }
362 369
370 void QBarModelMapperPrivate::handleModelDestroyed()
371 {
372 m_model = 0;
373 }
374
363 375 void QBarModelMapperPrivate::insertData(int start, int end)
364 376 {
365 377 Q_UNUSED(end)
@@ -54,6 +54,7 public Q_SLOTS:
54 54 void modelRowsRemoved(QModelIndex parent, int start, int end);
55 55 void modelColumnsAdded(QModelIndex parent, int start, int end);
56 56 void modelColumnsRemoved(QModelIndex parent, int start, int end);
57 void handleModelDestroyed();
57 58
58 59 // for the series
59 60 void barSetsAdded(QList<QBarSet*> sets);
@@ -62,6 +63,7 public Q_SLOTS:
62 63 void valuesRemoved(int index, int count);
63 64 void barLabelChanged();
64 65 void barValueChanged(int index);
66 void handleSeriesDestroyed();
65 67
66 68 void initializeBarFromModel();
67 69
@@ -56,6 +56,7 void QPieModelMapper::setModel(QAbstractItemModel *model)
56 56 connect(d->m_model, SIGNAL(rowsRemoved(QModelIndex,int,int)), d, SLOT(modelRowsRemoved(QModelIndex,int,int)));
57 57 connect(d->m_model, SIGNAL(columnsInserted(QModelIndex,int,int)), d, SLOT(modelColumnsAdded(QModelIndex,int,int)));
58 58 connect(d->m_model, SIGNAL(columnsRemoved(QModelIndex,int,int)), d, SLOT(modelColumnsRemoved(QModelIndex,int,int)));
59 connect(d->m_model, SIGNAL(destroyed()), d, SLOT(handleModelDestroyed()));
59 60 }
60 61
61 62 QPieSeries* QPieModelMapper::series() const
@@ -79,6 +80,7 void QPieModelMapper::setSeries(QPieSeries *series)
79 80 // connect the signals from the series
80 81 connect(d->m_series, SIGNAL(added(QList<QPieSlice*>)), d, SLOT(slicesAdded(QList<QPieSlice*>)));
81 82 connect(d->m_series, SIGNAL(removed(QList<QPieSlice*>)), d, SLOT(slicesRemoved(QList<QPieSlice*>)));
83 connect(d->m_series, SIGNAL(destroyed()), d, SLOT(handleSeriesDestroyed()));
82 84 }
83 85
84 86 /*!
@@ -360,6 +362,11 void QPieModelMapperPrivate::sliceValueChanged()
360 362 blockModelSignals(false);
361 363 }
362 364
365 void QPieModelMapperPrivate::handleSeriesDestroyed()
366 {
367 m_series = 0;
368 }
369
363 370 void QPieModelMapperPrivate::modelUpdated(QModelIndex topLeft, QModelIndex bottomRight)
364 371 {
365 372 if (m_model == 0 || m_series == 0)
@@ -443,6 +450,11 void QPieModelMapperPrivate::modelColumnsRemoved(QModelIndex parent, int start,
443 450 blockSeriesSignals(false);
444 451 }
445 452
453 void QPieModelMapperPrivate::handleModelDestroyed()
454 {
455 m_model = 0;
456 }
457
446 458 void QPieModelMapperPrivate::insertData(int start, int end)
447 459 {
448 460 if (m_model == 0 || m_series == 0)
@@ -56,12 +56,14 public Q_SLOTS:
56 56 void modelRowsRemoved(QModelIndex parent, int start, int end);
57 57 void modelColumnsAdded(QModelIndex parent, int start, int end);
58 58 void modelColumnsRemoved(QModelIndex parent, int start, int end);
59 void handleModelDestroyed();
59 60
60 61 // for the series
61 62 void slicesAdded(QList<QPieSlice*> slices);
62 63 void slicesRemoved(QList<QPieSlice*> slices);
63 64 void sliceLabelChanged();
64 65 void sliceValueChanged();
66 void handleSeriesDestroyed();
65 67
66 68 void initializePieFromModel();
67 69
@@ -64,6 +64,7 void QXYModelMapper::setModel(QAbstractItemModel *model)
64 64 connect(d->m_model, SIGNAL(rowsRemoved(QModelIndex,int,int)), d, SLOT(modelRowsRemoved(QModelIndex,int,int)));
65 65 connect(d->m_model, SIGNAL(columnsInserted(QModelIndex,int,int)), d, SLOT(modelColumnsAdded(QModelIndex,int,int)));
66 66 connect(d->m_model, SIGNAL(columnsRemoved(QModelIndex,int,int)), d, SLOT(modelColumnsRemoved(QModelIndex,int,int)));
67 connect(d->m_model, SIGNAL(destroyed()), d, SLOT(handleModelDestroyed()));
67 68 }
68 69
69 70 /*!
@@ -94,6 +95,7 void QXYModelMapper::setSeries(QXYSeries *series)
94 95 connect(d->m_series, SIGNAL(pointAdded(int)), d, SLOT(handlePointAdded(int)));
95 96 connect(d->m_series, SIGNAL(pointRemoved(int)), d, SLOT(handlePointRemoved(int)));
96 97 connect(d->m_series, SIGNAL(pointReplaced(int)), d, SLOT(handlePointReplaced(int)));
98 connect(d->m_series, SIGNAL(destroyed()), d, SLOT(handleSeriesDestroyed()));
97 99 }
98 100
99 101 /*!
@@ -291,6 +293,11 void QXYModelMapperPrivate::handlePointReplaced(int pointPos)
291 293 blockModelSignals(false);
292 294 }
293 295
296 void QXYModelMapperPrivate::handleSeriesDestroyed()
297 {
298 m_series = 0;
299 }
300
294 301 void QXYModelMapperPrivate::modelUpdated(QModelIndex topLeft, QModelIndex bottomRight)
295 302 {
296 303 if (m_model == 0 || m_series == 0)
@@ -391,6 +398,11 void QXYModelMapperPrivate::modelColumnsRemoved(QModelIndex parent, int start, i
391 398 blockSeriesSignals(false);
392 399 }
393 400
401 void QXYModelMapperPrivate::handleModelDestroyed()
402 {
403 m_model = 0;
404 }
405
394 406 void QXYModelMapperPrivate::insertData(int start, int end)
395 407 {
396 408 if (m_model == 0 || m_series == 0)
@@ -56,11 +56,13 public Q_SLOTS:
56 56 void modelRowsRemoved(QModelIndex parent, int start, int end);
57 57 void modelColumnsAdded(QModelIndex parent, int start, int end);
58 58 void modelColumnsRemoved(QModelIndex parent, int start, int end);
59 void handleModelDestroyed();
59 60
60 61 // for the series
61 62 void handlePointAdded(int pointPos);
62 63 void handlePointRemoved(int pointPos);
63 64 void handlePointReplaced(int pointPos);
65 void handleSeriesDestroyed();
64 66
65 67 void initializeXYFromModel();
66 68
General Comments 0
You need to be logged in to leave comments. Login now