From 172528ac1f8da17d34e5d97ef45c5b2efaec90c7 Mon Sep 17 00:00:00 2001 From: Leonardo Zide Date: Wed, 21 Feb 2018 16:12:18 -0800 Subject: [PATCH] Removed calls to foreach. --- common/lc_mainwindow.cpp | 2 +- common/lc_model.cpp | 3 ++- common/lc_partselectionwidget.cpp | 2 +- common/lc_shortcuts.cpp | 2 +- common/lc_timelinewidget.cpp | 4 ++-- common/pieceinf.cpp | 2 +- 6 files changed, 8 insertions(+), 7 deletions(-) diff --git a/common/lc_mainwindow.cpp b/common/lc_mainwindow.cpp index 6ab8a678..a790236b 100644 --- a/common/lc_mainwindow.cpp +++ b/common/lc_mainwindow.cpp @@ -753,7 +753,7 @@ void lcMainWindow::dragEnterEvent(QDragEnterEvent* Event) void lcMainWindow::dropEvent(QDropEvent* Event) { const QMimeData* MimeData = Event->mimeData(); - foreach (const QUrl &Url, MimeData->urls()) + for (const QUrl& Url : MimeData->urls()) if (OpenProject(Url.toLocalFile())) break; } diff --git a/common/lc_model.cpp b/common/lc_model.cpp index 4ac06d36..94040ad2 100644 --- a/common/lc_model.cpp +++ b/common/lc_model.cpp @@ -1,6 +1,7 @@ #include "lc_global.h" #include "lc_model.h" #include +#include #include "piece.h" #include "camera.h" #include "light.h" @@ -63,7 +64,7 @@ void lcModelProperties::SaveLDraw(QTextStream& Stream) const if (!mComments.isEmpty()) { QStringList Comments = mComments.split('\n'); - foreach (const QString& Comment, Comments) + for (const QString& Comment : Comments) Stream << QLatin1String("0 !LEOCAD MODEL COMMENT ") << Comment << LineEnding; } diff --git a/common/lc_partselectionwidget.cpp b/common/lc_partselectionwidget.cpp index 7765720b..02304323 100644 --- a/common/lc_partselectionwidget.cpp +++ b/common/lc_partselectionwidget.cpp @@ -67,7 +67,7 @@ void lcPartSelectionListModel::ClearRequests() { lcPiecesLibrary* Library = lcGetPiecesLibrary(); - foreach(int RequestIdx, mRequestedPreviews) + for (int RequestIdx : mRequestedPreviews) { PieceInfo* Info = mParts[RequestIdx].first; Library->ReleasePieceInfo(Info); diff --git a/common/lc_shortcuts.cpp b/common/lc_shortcuts.cpp index bfd9119b..b4f3c38e 100644 --- a/common/lc_shortcuts.cpp +++ b/common/lc_shortcuts.cpp @@ -183,7 +183,7 @@ bool lcMouseShortcuts::Load(const QStringList& Shortcuts) { memset(mShortcuts, 0, sizeof(mShortcuts)); - foreach (const QString& Shortcut, Shortcuts) + for (const QString& Shortcut : Shortcuts) { int Equals = Shortcut.indexOf('='); diff --git a/common/lc_timelinewidget.cpp b/common/lc_timelinewidget.cpp index 3eae15b2..2dd3cb10 100644 --- a/common/lc_timelinewidget.cpp +++ b/common/lc_timelinewidget.cpp @@ -313,7 +313,7 @@ void lcTimelineWidget::MoveSelection() QList SelectedItems = selectedItems(); - foreach(QTreeWidgetItem* PieceItem, SelectedItems) + for (QTreeWidgetItem* PieceItem : SelectedItems) { QTreeWidgetItem* Parent = PieceItem->parent(); @@ -350,7 +350,7 @@ void lcTimelineWidget::ItemSelectionChanged() lcArray Selection; lcStep LastStep = 1; - foreach (QTreeWidgetItem* PieceItem, selectedItems()) + for (QTreeWidgetItem* PieceItem : selectedItems()) { lcPiece* Piece = (lcPiece*)PieceItem->data(0, Qt::UserRole).value(); if (Piece) diff --git a/common/pieceinf.cpp b/common/pieceinf.cpp index 24bd99ef..74813b82 100644 --- a/common/pieceinf.cpp +++ b/common/pieceinf.cpp @@ -71,7 +71,7 @@ void PieceInfo::SetModel(lcModel* Model, bool UpdateMesh, Project* CurrentProjec { lcMemFile PieceFile; - foreach(const QString& Line, MeshLines) + for (const QString& Line : MeshLines) { QByteArray Buffer = Line.toLatin1(); PieceFile.WriteBuffer(Buffer.constData(), Buffer.size());