forked from qt-creator/qt-creator
tracing: Remove foreach
Change-Id: I74f17198a9f98f958924214ad2058e295b313373 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
@@ -60,7 +60,7 @@ void TimelineModelAggregator::setModels(const QVariantList &models)
|
|||||||
{
|
{
|
||||||
Q_D(TimelineModelAggregator);
|
Q_D(TimelineModelAggregator);
|
||||||
|
|
||||||
QList<TimelineModel *> timelineModels = Utils::transform(models, [](const QVariant &model) {
|
const QList<TimelineModel *> timelineModels = Utils::transform(models, [](const QVariant &model) {
|
||||||
return qvariant_cast<TimelineModel *>(model);
|
return qvariant_cast<TimelineModel *>(model);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -68,14 +68,14 @@ void TimelineModelAggregator::setModels(const QVariantList &models)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
int prevHeight = height();
|
int prevHeight = height();
|
||||||
foreach (TimelineModel *m, d->modelList) {
|
for (TimelineModel *m : std::as_const(d->modelList)) {
|
||||||
disconnect(m, &TimelineModel::heightChanged, this, &TimelineModelAggregator::heightChanged);
|
disconnect(m, &TimelineModel::heightChanged, this, &TimelineModelAggregator::heightChanged);
|
||||||
if (d->notesModel)
|
if (d->notesModel)
|
||||||
d->notesModel->removeTimelineModel(m);
|
d->notesModel->removeTimelineModel(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
d->modelList = timelineModels;
|
d->modelList = timelineModels;
|
||||||
foreach (TimelineModel *m, timelineModels) {
|
for (TimelineModel *m : timelineModels) {
|
||||||
connect(m, &TimelineModel::heightChanged, this, &TimelineModelAggregator::heightChanged);
|
connect(m, &TimelineModel::heightChanged, this, &TimelineModelAggregator::heightChanged);
|
||||||
if (d->notesModel)
|
if (d->notesModel)
|
||||||
d->notesModel->addTimelineModel(m);
|
d->notesModel->addTimelineModel(m);
|
||||||
@@ -95,7 +95,7 @@ QVariantList TimelineModelAggregator::models() const
|
|||||||
{
|
{
|
||||||
Q_D(const TimelineModelAggregator);
|
Q_D(const TimelineModelAggregator);
|
||||||
QVariantList ret;
|
QVariantList ret;
|
||||||
foreach (TimelineModel *model, d->modelList)
|
for (TimelineModel *model : d->modelList)
|
||||||
ret << QVariant::fromValue(model);
|
ret << QVariant::fromValue(model);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user