forked from qt-creator/qt-creator
Todo plugin: Replace foreach with ranged for loop
Change-Id: Iff18b1dbc556fe48df6ba086774662e8b9231491 Reviewed-by: hjk <hjk@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -36,7 +36,8 @@ void CppTodoItemsScanner::scannerParamsChanged()
|
||||
CppEditor::CppModelManager *modelManager = CppEditor::CppModelManager::instance();
|
||||
|
||||
QSet<QString> filesToBeUpdated;
|
||||
foreach (const CppEditor::ProjectInfo::ConstPtr &info, modelManager->projectInfos())
|
||||
const CppEditor::ProjectInfoList infoList = modelManager->projectInfos();
|
||||
for (const CppEditor::ProjectInfo::ConstPtr &info : infoList)
|
||||
filesToBeUpdated.unite(info->sourceFiles());
|
||||
|
||||
modelManager->updateSourceFiles(filesToBeUpdated);
|
||||
|
||||
@@ -136,7 +136,7 @@ QList<TodoItem> LineParser::todoItemsFromKeywordEntries(const QList<KeywordEntry
|
||||
{
|
||||
QList<TodoItem> todoItems;
|
||||
|
||||
foreach (const KeywordEntry &entry, entries) {
|
||||
for (const KeywordEntry &entry : entries) {
|
||||
TodoItem item;
|
||||
item.text = m_keywords.at(entry.keywordIndex).name + entry.text;
|
||||
item.color = m_keywords.at(entry.keywordIndex).color;
|
||||
|
||||
@@ -26,7 +26,8 @@ QmlJsTodoItemsScanner::QmlJsTodoItemsScanner(const KeywordList &keywordList, QOb
|
||||
bool QmlJsTodoItemsScanner::shouldProcessFile(const Utils::FilePath &fileName)
|
||||
{
|
||||
QmlJS::ModelManagerInterface *modelManager = QmlJS::ModelManagerInterface::instance();
|
||||
foreach (const QmlJS::ModelManagerInterface::ProjectInfo &info, modelManager->projectInfos()) {
|
||||
const QList<QmlJS::ModelManagerInterface::ProjectInfo> infoList = modelManager->projectInfos();
|
||||
for (const QmlJS::ModelManagerInterface::ProjectInfo &info : infoList) {
|
||||
if (info.sourceFiles.contains(fileName))
|
||||
return true;
|
||||
}
|
||||
@@ -58,7 +59,8 @@ void QmlJsTodoItemsScanner::processDocument(QmlJS::Document::Ptr doc)
|
||||
{
|
||||
QList<TodoItem> itemList;
|
||||
|
||||
foreach (const QmlJS::SourceLocation &sourceLocation, doc->engine()->comments()) {
|
||||
const QList<QmlJS::SourceLocation> sourceLocations = doc->engine()->comments();
|
||||
for (const QmlJS::SourceLocation &sourceLocation : sourceLocations) {
|
||||
QString source = doc->source().mid(sourceLocation.begin(), sourceLocation.length).trimmed();
|
||||
|
||||
// Process every line
|
||||
|
||||
@@ -47,7 +47,7 @@ TodoItemsModel *TodoItemsProvider::todoItemsModel()
|
||||
void TodoItemsProvider::settingsChanged(const Settings &newSettings)
|
||||
{
|
||||
if (newSettings.keywords != m_settings.keywords) {
|
||||
foreach (TodoItemsScanner *scanner, m_scanners)
|
||||
for (TodoItemsScanner *scanner : qAsConst(m_scanners))
|
||||
scanner->setParams(newSettings.keywords);
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ void TodoItemsProvider::createScanners()
|
||||
if (QmlJS::ModelManagerInterface::instance())
|
||||
m_scanners << new QmlJsTodoItemsScanner(m_settings.keywords, this);
|
||||
|
||||
foreach (TodoItemsScanner *scanner, m_scanners) {
|
||||
for (TodoItemsScanner *scanner : qAsConst(m_scanners)) {
|
||||
connect(scanner, &TodoItemsScanner::itemsFetched, this,
|
||||
&TodoItemsProvider::itemsFetched, Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user