QmlProfiler: Require model manager when constructing timeline models

This relieves us of the headaches created by figuring out what should
happen if the model manager is changed later. Extension models can be
safely created through a factory.

Change-Id: I8cf8fd6d639e4e6c9da66351ea44cfc35fd614a5
Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
This commit is contained in:
Ulf Hermann
2014-10-28 17:37:11 +01:00
committed by Ulf Hermann
parent 307d45ecaa
commit 91cb52d40b
15 changed files with 136 additions and 72 deletions

View File

@@ -80,20 +80,15 @@ void TimelineModelAggregator::setModelManager(QmlProfilerModelManager *modelMana
connect(modelManager,SIGNAL(dataAvailable()),this,SIGNAL(dataAvailable()));
// external models pushed on top
foreach (AbstractTimelineModel *timelineModel, QmlProfilerPlugin::instance->getModels()) {
timelineModel->setModelManager(modelManager);
foreach (AbstractTimelineModel *timelineModel,
QmlProfilerPlugin::instance->getModels(modelManager)) {
addModel(timelineModel);
}
QmlProfilerAnimationsModel *paintEventsModelProxy = new QmlProfilerAnimationsModel(this);
paintEventsModelProxy->setModelManager(modelManager);
addModel(paintEventsModelProxy);
addModel(new QmlProfilerAnimationsModel(modelManager, this));
for (int i = 0; i < QmlDebug::MaximumRangeType; ++i) {
QmlProfilerRangeModel *rangeModel = new QmlProfilerRangeModel((QmlDebug::RangeType)i, this);
rangeModel->setModelManager(modelManager);
addModel(rangeModel);
}
for (int i = 0; i < QmlDebug::MaximumRangeType; ++i)
addModel(new QmlProfilerRangeModel(modelManager, (QmlDebug::RangeType)i, this));
// Connect this last so that it's executed after the models have updated their data.
connect(modelManager->qmlModel(),SIGNAL(changed()),this,SIGNAL(stateChanged()));