QMLPlugins: Remove foreach / Q_FOREACH usage

Task-number: QTCREATORBUG-27464
Change-Id: Ie3e3ec9fdaea856943e5325cabd21e52bf290e70
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
Artem Sokolovskii
2022-05-31 16:42:57 +02:00
parent 57e705b616
commit 92b3a51358
12 changed files with 38 additions and 23 deletions

View File

@@ -200,7 +200,8 @@ QVariant FlameGraphModel::lookup(const FlameGraphData &stats, int role) const
if (!m_typeIdsWithNotes.contains(stats.typeIndex))
return ret;
Timeline::TimelineNotesModel *notes = m_modelManager->notesModel();
foreach (const QVariant &item, notes->byTypeId(stats.typeIndex)) {
const QList<QVariant> items = notes->byTypeId(stats.typeIndex);
for (const QVariant &item : items) {
if (ret.isEmpty())
ret = notes->text(item.toInt());
else

View File

@@ -432,7 +432,7 @@ QString PixmapCacheModel::fileName(int index) const
void PixmapCacheModel::computeMaxCacheSize()
{
foreach (const PixmapCacheModel::Item &event, m_data) {
for (const PixmapCacheModel::Item &event : qAsConst(m_data)) {
if (event.pixmapEventType == PixmapCacheModel::PixmapCacheCountChanged) {
if (event.cacheSize > m_maxCacheSize)
m_maxCacheSize = event.cacheSize;

View File

@@ -41,7 +41,8 @@ int QmlProfilerNotesModel::addQmlNote(int typeId, int collapsedRow, qint64 start
int foundTypeId = -1;
int timelineModel = -1;
int timelineIndex = -1;
foreach (const Timeline::TimelineModel *model, timelineModels()) {
const QList<const Timeline::TimelineModel *> models = timelineModels();
for (const Timeline::TimelineModel *model : models) {
if (model->handlesTypeId(typeId)) {
for (int i = model->firstIndex(start); i <= model->lastIndex(start + duration); ++i) {
if (i < 0)

View File

@@ -137,8 +137,8 @@ void QmlProfilerStatisticsView::contextMenuEvent(QContextMenuEvent *ev)
QPoint position = ev->globalPos();
QList <QAction *> commonActions = QmlProfilerTool::profilerContextMenuActions();
foreach (QAction *act, commonActions)
const QList <QAction *> commonActions = QmlProfilerTool::profilerContextMenuActions();
for (QAction *act : commonActions)
menu.addAction(act);
if (mouseOnTable(position)) {

View File

@@ -503,7 +503,8 @@ void QmlProfilerTool::setButtonsEnabled(bool enable)
void QmlProfilerTool::createInitialTextMarks()
{
QmlProfilerTextMarkModel *model = d->m_profilerModelManager->textMarkModel();
foreach (IDocument *document, DocumentModel::openedDocuments())
const QList<IDocument *> documents = DocumentModel::openedDocuments();
for (IDocument *document : documents)
model->createMarks(d->m_viewContainer, document->filePath().toString());
}
@@ -736,7 +737,8 @@ void QmlProfilerTool::setAvailableFeatures(quint64 features)
void QmlProfilerTool::setRecordedFeatures(quint64 features)
{
foreach (QAction *action, d->m_displayFeaturesMenu->actions())
const QList<QAction *> actions = d->m_displayFeaturesMenu->actions();
for (QAction *action : actions)
action->setEnabled(features & (1ULL << action->data().toUInt()));
}