diff --git a/common/lc_library.cpp b/common/lc_library.cpp index ea27bc0e..2742ba1b 100644 --- a/common/lc_library.cpp +++ b/common/lc_library.cpp @@ -116,11 +116,11 @@ lcPiecesLibrary::~lcPiecesLibrary() void lcPiecesLibrary::Unload() { - for (const auto PieceIt : mPieces) + for (const auto& PieceIt : mPieces) delete PieceIt.second; mPieces.clear(); - for (const auto PrimitiveIt : mPrimitives) + for (const auto& PrimitiveIt : mPrimitives) delete PrimitiveIt.second; mPrimitives.clear(); @@ -499,7 +499,7 @@ void lcPiecesLibrary::ReadArchiveDescriptions(const QString& OfficialFileName, c { lcMemFile PieceFile; - for (const auto PieceIt : mPieces) + for (const auto& PieceIt : mPieces) { PieceInfo* Info = PieceIt.second; @@ -817,7 +817,7 @@ void lcPiecesLibrary::ReadDirectoryDescriptions(const QFileInfoList (&FileLists) std::vector SortedPieces; SortedPieces.reserve(mPieces.size()); - for (const auto PieceIt : mPieces) + for (const auto& PieceIt : mPieces) SortedPieces.push_back(PieceIt.second); auto PieceInfoCompare = [](PieceInfo* Info1, PieceInfo* Info2) @@ -1072,7 +1072,7 @@ bool lcPiecesLibrary::LoadCacheIndex(const QString& FileName) if (IndexFile.ReadBuffer((char*)&NumFiles, sizeof(NumFiles)) == 0 || NumFiles != mPieces.size()) return false; - for (const auto PieceIt : mPieces) + for (const auto& PieceIt : mPieces) { PieceInfo* Info = PieceIt.second; quint8 Length; @@ -1098,7 +1098,7 @@ bool lcPiecesLibrary::SaveArchiveCacheIndex(const QString& FileName) if (IndexFile.WriteBuffer((char*)&NumFiles, sizeof(NumFiles)) == 0) return false; - for (const auto PieceIt : mPieces) + for (const auto& PieceIt : mPieces) { PieceInfo* Info = PieceIt.second; quint8 Length = (quint8)strlen(Info->m_strDescription); @@ -1648,7 +1648,7 @@ void lcPiecesLibrary::UpdateBuffers(lcContext* Context) int VertexDataSize = 0; int IndexDataSize = 0; - for (const auto PieceIt : mPieces) + for (const auto& PieceIt : mPieces) { PieceInfo* Info = PieceIt.second; lcMesh* Mesh = Info->IsPlaceholder() ? gPlaceholderMesh : Info->GetMesh(); @@ -1675,7 +1675,7 @@ void lcPiecesLibrary::UpdateBuffers(lcContext* Context) VertexDataSize = 0; IndexDataSize = 0; - for (const auto PieceIt : mPieces) + for (const auto& PieceIt : mPieces) { PieceInfo* Info = PieceIt.second; lcMesh* Mesh = Info->IsPlaceholder() ? gPlaceholderMesh : Info->GetMesh(); @@ -1708,7 +1708,7 @@ void lcPiecesLibrary::UnloadUnusedParts() { QMutexLocker LoadLock(&mLoadMutex); - for (const auto PieceIt : mPieces) + for (const auto& PieceIt : mPieces) { PieceInfo* Info = PieceIt.second; if (Info->GetRefCount() == 0 && Info->mState != LC_PIECEINFO_UNLOADED) @@ -3262,7 +3262,7 @@ void lcPiecesLibrary::GetCategoryEntries(const char* CategoryKeywords, bool Grou SinglePieces.RemoveAll(); GroupedPieces.RemoveAll(); - for (const auto PieceIt : mPieces) + for (const auto& PieceIt : mPieces) { PieceInfo* Info = PieceIt.second; @@ -3330,7 +3330,7 @@ void lcPiecesLibrary::GetPatternedPieces(PieceInfo* Parent, lcArray& Pieces.RemoveAll(); - for (const auto PieceIt : mPieces) + for (const auto& PieceIt : mPieces) if (strncmp(Name, PieceIt.first.c_str(), strlen(Name)) == 0) Pieces.Add(PieceIt.second); @@ -3345,7 +3345,7 @@ void lcPiecesLibrary::GetPatternedPieces(PieceInfo* Parent, lcArray& if (Name[Len-1] < '0' || Name[Len-1] > '9') Name[Len-1] = 'P'; - for (const auto PieceIt : mPieces) + for (const auto& PieceIt : mPieces) if (strncmp(Name, PieceIt.first.c_str(), strlen(Name)) == 0) Pieces.Add(PieceIt.second); } @@ -3356,7 +3356,7 @@ void lcPiecesLibrary::GetParts(lcArray& Parts) Parts.SetSize(0); Parts.AllocGrow(mPieces.size()); - for (const auto PartIt : mPieces) + for (const auto& PartIt : mPieces) Parts.Add(PartIt.second); } @@ -3378,7 +3378,7 @@ bool lcPiecesLibrary::LoadBuiltinPieces() lcMemFile PieceFile; - for (const auto PieceIt : mPieces) + for (const auto& PieceIt : mPieces) { PieceInfo* Info = PieceIt.second; diff --git a/common/lc_mainwindow.cpp b/common/lc_mainwindow.cpp index a790236b..d89d2186 100644 --- a/common/lc_mainwindow.cpp +++ b/common/lc_mainwindow.cpp @@ -753,7 +753,8 @@ void lcMainWindow::dragEnterEvent(QDragEnterEvent* Event) void lcMainWindow::dropEvent(QDropEvent* Event) { const QMimeData* MimeData = Event->mimeData(); - for (const QUrl& Url : MimeData->urls()) + const QList Urls = MimeData->urls(); + for (const QUrl& Url : Urls) if (OpenProject(Url.toLocalFile())) break; } diff --git a/common/lc_timelinewidget.cpp b/common/lc_timelinewidget.cpp index 2dd3cb10..abcd9cd8 100644 --- a/common/lc_timelinewidget.cpp +++ b/common/lc_timelinewidget.cpp @@ -349,8 +349,9 @@ void lcTimelineWidget::ItemSelectionChanged() { lcArray Selection; lcStep LastStep = 1; + QList SelectedItems = selectedItems(); - for (QTreeWidgetItem* PieceItem : selectedItems()) + for (QTreeWidgetItem* PieceItem : SelectedItems) { lcPiece* Piece = (lcPiece*)PieceItem->data(0, Qt::UserRole).value(); if (Piece) diff --git a/qt/lc_qpreferencesdialog.cpp b/qt/lc_qpreferencesdialog.cpp index 97f73ba4..67676c09 100644 --- a/qt/lc_qpreferencesdialog.cpp +++ b/qt/lc_qpreferencesdialog.cpp @@ -273,7 +273,7 @@ void lcQPreferencesDialog::updateParts() } else { - for (const auto PartIt : Library->mPieces) + for (const auto& PartIt : Library->mPieces) { PieceInfo* Info = PartIt.second; diff --git a/qt/lc_qpropertiestree.cpp b/qt/lc_qpropertiestree.cpp index 0d52e6c9..feb736a4 100644 --- a/qt/lc_qpropertiestree.cpp +++ b/qt/lc_qpropertiestree.cpp @@ -480,7 +480,7 @@ QWidget *lcQPropertiesTree::createEditor(QWidget *parent, QTreeWidgetItem *item) std::vector SortedPieces; SortedPieces.reserve(Library->mPieces.size()); - for (const auto PartIt : Library->mPieces) + for (const auto& PartIt : Library->mPieces) SortedPieces.push_back(PartIt.second); auto PieceCompare = [](PieceInfo* Info1, PieceInfo* Info2)