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