forked from qt-creator/qt-creator
ProjectExplorer: Use qAsConst w/ non-const Qt containers in range-loops
Change-Id: I6422b3e40a6925504a231be2d47b3214d86c6e06 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -754,7 +754,7 @@ void AppOutputPane::slotRunControlFinished()
|
|||||||
{
|
{
|
||||||
auto *rc = qobject_cast<RunControl *>(sender());
|
auto *rc = qobject_cast<RunControl *>(sender());
|
||||||
QTimer::singleShot(0, this, [this, rc]() { slotRunControlFinished2(rc); });
|
QTimer::singleShot(0, this, [this, rc]() { slotRunControlFinished2(rc); });
|
||||||
for (const RunControlTab &t : m_runControlTabs) {
|
for (const RunControlTab &t : qAsConst(m_runControlTabs)) {
|
||||||
if (t.runControl == rc) {
|
if (t.runControl == rc) {
|
||||||
t.window->flush();
|
t.window->flush();
|
||||||
break;
|
break;
|
||||||
|
@@ -637,7 +637,7 @@ BuildConfigurationFactory *BuildConfigurationFactory::find(const Kit *k, const F
|
|||||||
{
|
{
|
||||||
QTC_ASSERT(k, return nullptr);
|
QTC_ASSERT(k, return nullptr);
|
||||||
const Utils::Id deviceType = DeviceTypeKitAspect::deviceTypeId(k);
|
const Utils::Id deviceType = DeviceTypeKitAspect::deviceTypeId(k);
|
||||||
for (BuildConfigurationFactory *factory : g_buildConfigurationFactories) {
|
for (BuildConfigurationFactory *factory : qAsConst(g_buildConfigurationFactories)) {
|
||||||
if (Utils::mimeTypeForFile(projectPath.toString())
|
if (Utils::mimeTypeForFile(projectPath.toString())
|
||||||
.matchesName(factory->m_supportedProjectMimeTypeName)
|
.matchesName(factory->m_supportedProjectMimeTypeName)
|
||||||
&& factory->supportsTargetDeviceType(deviceType))
|
&& factory->supportsTargetDeviceType(deviceType))
|
||||||
@@ -649,7 +649,7 @@ BuildConfigurationFactory *BuildConfigurationFactory::find(const Kit *k, const F
|
|||||||
// create
|
// create
|
||||||
BuildConfigurationFactory * BuildConfigurationFactory::find(Target *parent)
|
BuildConfigurationFactory * BuildConfigurationFactory::find(Target *parent)
|
||||||
{
|
{
|
||||||
for (BuildConfigurationFactory *factory : g_buildConfigurationFactories) {
|
for (BuildConfigurationFactory *factory : qAsConst(g_buildConfigurationFactories)) {
|
||||||
if (factory->canHandle(parent))
|
if (factory->canHandle(parent))
|
||||||
return factory;
|
return factory;
|
||||||
}
|
}
|
||||||
@@ -711,7 +711,7 @@ BuildConfiguration *BuildConfigurationFactory::create(Target *parent, const Buil
|
|||||||
BuildConfiguration *BuildConfigurationFactory::restore(Target *parent, const QVariantMap &map)
|
BuildConfiguration *BuildConfigurationFactory::restore(Target *parent, const QVariantMap &map)
|
||||||
{
|
{
|
||||||
const Utils::Id id = idFromMap(map);
|
const Utils::Id id = idFromMap(map);
|
||||||
for (BuildConfigurationFactory *factory : g_buildConfigurationFactories) {
|
for (BuildConfigurationFactory *factory : qAsConst(g_buildConfigurationFactories)) {
|
||||||
QTC_ASSERT(factory->m_creator, return nullptr);
|
QTC_ASSERT(factory->m_creator, return nullptr);
|
||||||
if (!factory->canHandle(parent))
|
if (!factory->canHandle(parent))
|
||||||
continue;
|
continue;
|
||||||
|
@@ -326,7 +326,7 @@ void ExtraCompilerFactory::annouceCreation(const Project *project,
|
|||||||
const Utils::FilePath &source,
|
const Utils::FilePath &source,
|
||||||
const Utils::FilePaths &targets)
|
const Utils::FilePaths &targets)
|
||||||
{
|
{
|
||||||
for (ExtraCompilerFactoryObserver *observer : *observers)
|
for (ExtraCompilerFactoryObserver *observer : qAsConst(*observers))
|
||||||
observer->newExtraCompiler(project, source, targets);
|
observer->newExtraCompiler(project, source, targets);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -877,7 +877,7 @@ FolderNavigationWidgetFactory::FolderNavigationWidgetFactory()
|
|||||||
Core::NavigationView FolderNavigationWidgetFactory::createWidget()
|
Core::NavigationView FolderNavigationWidgetFactory::createWidget()
|
||||||
{
|
{
|
||||||
auto fnw = new FolderNavigationWidget;
|
auto fnw = new FolderNavigationWidget;
|
||||||
for (const RootDirectory &root : m_rootDirectories)
|
for (const RootDirectory &root : qAsConst(m_rootDirectories))
|
||||||
fnw->insertRootDirectory(root);
|
fnw->insertRootDirectory(root);
|
||||||
connect(this,
|
connect(this,
|
||||||
&FolderNavigationWidgetFactory::rootDirectoryAdded,
|
&FolderNavigationWidgetFactory::rootDirectoryAdded,
|
||||||
|
@@ -591,7 +591,7 @@ HeaderPaths GccToolChain::builtInHeaderPaths(const Utils::Environment &env,
|
|||||||
headerCache->insert(qMakePair(env, arguments), paths);
|
headerCache->insert(qMakePair(env, arguments), paths);
|
||||||
|
|
||||||
qCDebug(gccLog) << "Reporting header paths to code model:";
|
qCDebug(gccLog) << "Reporting header paths to code model:";
|
||||||
for (const HeaderPath &hp : paths) {
|
for (const HeaderPath &hp : qAsConst(paths)) {
|
||||||
qCDebug(gccLog) << compilerCommand.toUserOutput()
|
qCDebug(gccLog) << compilerCommand.toUserOutput()
|
||||||
<< (languageId == Constants::CXX_LANGUAGE_ID ? ": C++ [" : ": C [")
|
<< (languageId == Constants::CXX_LANGUAGE_ID ? ": C++ [" : ": C [")
|
||||||
<< arguments.join(", ") << "]" << hp.path;
|
<< arguments.join(", ") << "]" << hp.path;
|
||||||
@@ -1053,7 +1053,7 @@ QList<ToolChain *> GccToolChainFactory::autoDetectToolchains(
|
|||||||
if (ccachePath.exists() && !searchPaths.contains(ccachePath))
|
if (ccachePath.exists() && !searchPaths.contains(ccachePath))
|
||||||
searchPaths << ccachePath;
|
searchPaths << ccachePath;
|
||||||
}
|
}
|
||||||
for (const FilePath &dir : searchPaths) {
|
for (const FilePath &dir : qAsConst(searchPaths)) {
|
||||||
static const QRegularExpression regexp(binaryRegexp);
|
static const QRegularExpression regexp(binaryRegexp);
|
||||||
QDir binDir(dir.toString());
|
QDir binDir(dir.toString());
|
||||||
QStringList nameFilters(compilerName);
|
QStringList nameFilters(compilerName);
|
||||||
@@ -1094,7 +1094,7 @@ QList<ToolChain *> GccToolChainFactory::autoDetectToolchains(
|
|||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
QList<ToolChain *> result;
|
QList<ToolChain *> result;
|
||||||
for (const FilePath &compilerPath : compilerPaths) {
|
for (const FilePath &compilerPath : qAsConst(compilerPaths)) {
|
||||||
bool alreadyExists = false;
|
bool alreadyExists = false;
|
||||||
for (ToolChain * const existingTc : existingCandidates) {
|
for (ToolChain * const existingTc : existingCandidates) {
|
||||||
// We have a match if the existing toolchain ultimately refers to the same file
|
// We have a match if the existing toolchain ultimately refers to the same file
|
||||||
|
@@ -1229,7 +1229,7 @@ MsvcToolChainConfigWidget::MsvcToolChainConfigWidget(ToolChain *tc)
|
|||||||
m_varsBatPathCombo->setObjectName("varsBatCombo");
|
m_varsBatPathCombo->setObjectName("varsBatCombo");
|
||||||
m_varsBatPathCombo->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
|
m_varsBatPathCombo->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
|
||||||
m_varsBatPathCombo->setEditable(true);
|
m_varsBatPathCombo->setEditable(true);
|
||||||
for (const MsvcToolChain *tmpTc : g_availableMsvcToolchains) {
|
for (const MsvcToolChain *tmpTc : qAsConst(g_availableMsvcToolchains)) {
|
||||||
const QString nativeVcVars = QDir::toNativeSeparators(tmpTc->varsBat());
|
const QString nativeVcVars = QDir::toNativeSeparators(tmpTc->varsBat());
|
||||||
if (!tmpTc->varsBat().isEmpty()
|
if (!tmpTc->varsBat().isEmpty()
|
||||||
&& m_varsBatPathCombo->findText(nativeVcVars) == -1) {
|
&& m_varsBatPathCombo->findText(nativeVcVars) == -1) {
|
||||||
@@ -1335,7 +1335,7 @@ void MsvcToolChainConfigWidget::updateAbis()
|
|||||||
// choose one appropriately.
|
// choose one appropriately.
|
||||||
Abis supportedAbis;
|
Abis supportedAbis;
|
||||||
Abi targetAbi;
|
Abi targetAbi;
|
||||||
for (const MsvcToolChain *tc : g_availableMsvcToolchains) {
|
for (const MsvcToolChain *tc : qAsConst(g_availableMsvcToolchains)) {
|
||||||
if (tc->varsBat() == normalizedVcVars && tc->targetAbi().wordWidth() == wordWidth
|
if (tc->varsBat() == normalizedVcVars && tc->targetAbi().wordWidth() == wordWidth
|
||||||
&& tc->targetAbi().architecture() == arch && tc->language() == currentTc->language()) {
|
&& tc->targetAbi().architecture() == arch && tc->language() == currentTc->language()) {
|
||||||
// We need to filter out duplicates as there might be multiple toolchains with
|
// We need to filter out duplicates as there might be multiple toolchains with
|
||||||
@@ -1436,7 +1436,7 @@ void ClangClToolChainConfigWidget::setFromClangClToolChain()
|
|||||||
m_nameDisplayLabel->setText(currentTC->displayName());
|
m_nameDisplayLabel->setText(currentTC->displayName());
|
||||||
m_varsBatDisplayCombo->clear();
|
m_varsBatDisplayCombo->clear();
|
||||||
m_varsBatDisplayCombo->addItem(msvcVarsToDisplay(*currentTC));
|
m_varsBatDisplayCombo->addItem(msvcVarsToDisplay(*currentTC));
|
||||||
for (const MsvcToolChain *tc : g_availableMsvcToolchains) {
|
for (const MsvcToolChain *tc : qAsConst(g_availableMsvcToolchains)) {
|
||||||
const QString varsToDisplay = msvcVarsToDisplay(*tc);
|
const QString varsToDisplay = msvcVarsToDisplay(*tc);
|
||||||
if (m_varsBatDisplayCombo->findText(varsToDisplay) == -1)
|
if (m_varsBatDisplayCombo->findText(varsToDisplay) == -1)
|
||||||
m_varsBatDisplayCombo->addItem(varsToDisplay);
|
m_varsBatDisplayCombo->addItem(varsToDisplay);
|
||||||
@@ -1867,7 +1867,7 @@ QList<ToolChain *> MsvcToolChainFactory::autoDetect(const QList<ToolChain *> &al
|
|||||||
|
|
||||||
detectCppBuildTools2015(&results);
|
detectCppBuildTools2015(&results);
|
||||||
|
|
||||||
for (ToolChain *tc : results)
|
for (ToolChain *tc : qAsConst(results))
|
||||||
tc->setDetection(ToolChain::AutoDetection);
|
tc->setDetection(ToolChain::AutoDetection);
|
||||||
|
|
||||||
return results;
|
return results;
|
||||||
|
@@ -3545,7 +3545,7 @@ void ProjectExplorerPluginPrivate::addExistingProjects()
|
|||||||
return;
|
return;
|
||||||
QStringList failedProjects;
|
QStringList failedProjects;
|
||||||
QStringList addedProjects;
|
QStringList addedProjects;
|
||||||
for (const QString &filePath : subProjectFilePaths) {
|
for (const QString &filePath : qAsConst(subProjectFilePaths)) {
|
||||||
if (projectNode->addSubProject(filePath))
|
if (projectNode->addSubProject(filePath))
|
||||||
addedProjects << filePath;
|
addedProjects << filePath;
|
||||||
else
|
else
|
||||||
|
@@ -396,7 +396,7 @@ static ProjectImporter::ToolChainData createToolChains(const ToolChainDescriptio
|
|||||||
if (data.tcs.isEmpty())
|
if (data.tcs.isEmpty())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for (ToolChain *tc : data.tcs)
|
for (ToolChain *tc : qAsConst(data.tcs))
|
||||||
ToolChainManager::registerToolChain(tc);
|
ToolChainManager::registerToolChain(tc);
|
||||||
|
|
||||||
data.areTemporary = true;
|
data.areTemporary = true;
|
||||||
@@ -413,7 +413,7 @@ ProjectImporter::findOrCreateToolChains(const ToolChainDescription &tcd) const
|
|||||||
result.tcs = ToolChainManager::toolChains([&tcd](const ToolChain *tc) {
|
result.tcs = ToolChainManager::toolChains([&tcd](const ToolChain *tc) {
|
||||||
return tc->language() == tcd.language && tc->compilerCommand() == tcd.compilerPath;
|
return tc->language() == tcd.language && tc->compilerCommand() == tcd.compilerPath;
|
||||||
});
|
});
|
||||||
for (const ToolChain *tc : result.tcs) {
|
for (const ToolChain *tc : qAsConst(result.tcs)) {
|
||||||
const QByteArray tcId = tc->id();
|
const QByteArray tcId = tc->id();
|
||||||
result.areTemporary = result.areTemporary ? true : hasKitWithTemporaryData(ToolChainKitAspect::id(), tcId);
|
result.areTemporary = result.areTemporary ? true : hasKitWithTemporaryData(ToolChainKitAspect::id(), tcId);
|
||||||
}
|
}
|
||||||
|
@@ -556,7 +556,7 @@ RunConfiguration *RunConfigurationCreationInfo::create(Target *target) const
|
|||||||
|
|
||||||
RunConfiguration *RunConfigurationFactory::restore(Target *parent, const QVariantMap &map)
|
RunConfiguration *RunConfigurationFactory::restore(Target *parent, const QVariantMap &map)
|
||||||
{
|
{
|
||||||
for (RunConfigurationFactory *factory : g_runConfigurationFactories) {
|
for (RunConfigurationFactory *factory : qAsConst(g_runConfigurationFactories)) {
|
||||||
if (factory->canHandle(parent)) {
|
if (factory->canHandle(parent)) {
|
||||||
const Utils::Id id = idFromMap(map);
|
const Utils::Id id = idFromMap(map);
|
||||||
if (id.name().startsWith(factory->m_runConfigurationId.name())) {
|
if (id.name().startsWith(factory->m_runConfigurationId.name())) {
|
||||||
@@ -581,7 +581,7 @@ RunConfiguration *RunConfigurationFactory::clone(Target *parent, RunConfiguratio
|
|||||||
const QList<RunConfigurationCreationInfo> RunConfigurationFactory::creatorsForTarget(Target *parent)
|
const QList<RunConfigurationCreationInfo> RunConfigurationFactory::creatorsForTarget(Target *parent)
|
||||||
{
|
{
|
||||||
QList<RunConfigurationCreationInfo> items;
|
QList<RunConfigurationCreationInfo> items;
|
||||||
for (RunConfigurationFactory *factory : g_runConfigurationFactories) {
|
for (RunConfigurationFactory *factory : qAsConst(g_runConfigurationFactories)) {
|
||||||
if (factory->canHandle(parent))
|
if (factory->canHandle(parent))
|
||||||
items.append(factory->availableCreators(parent));
|
items.append(factory->availableCreators(parent));
|
||||||
}
|
}
|
||||||
|
@@ -516,7 +516,7 @@ void RunControlPrivate::initiateReStart()
|
|||||||
checkState(RunControlState::Stopped);
|
checkState(RunControlState::Stopped);
|
||||||
|
|
||||||
// Re-set worked on re-runs.
|
// Re-set worked on re-runs.
|
||||||
for (RunWorker *worker : m_workers) {
|
for (RunWorker *worker : qAsConst(m_workers)) {
|
||||||
if (worker->d->state == RunWorkerState::Done)
|
if (worker->d->state == RunWorkerState::Done)
|
||||||
worker->d->state = RunWorkerState::Initialized;
|
worker->d->state = RunWorkerState::Initialized;
|
||||||
}
|
}
|
||||||
@@ -532,7 +532,7 @@ void RunControlPrivate::continueStart()
|
|||||||
checkState(RunControlState::Starting);
|
checkState(RunControlState::Starting);
|
||||||
bool allDone = true;
|
bool allDone = true;
|
||||||
debugMessage("Looking for next worker");
|
debugMessage("Looking for next worker");
|
||||||
for (RunWorker *worker : m_workers) {
|
for (RunWorker *worker : qAsConst(m_workers)) {
|
||||||
if (worker) {
|
if (worker) {
|
||||||
const QString &workerId = worker->d->id;
|
const QString &workerId = worker->d->id;
|
||||||
debugMessage(" Examining worker " + workerId);
|
debugMessage(" Examining worker " + workerId);
|
||||||
@@ -595,7 +595,7 @@ void RunControlPrivate::continueStopOrFinish()
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
for (RunWorker *worker : m_workers) {
|
for (RunWorker *worker : qAsConst(m_workers)) {
|
||||||
if (worker) {
|
if (worker) {
|
||||||
const QString &workerId = worker->d->id;
|
const QString &workerId = worker->d->id;
|
||||||
debugMessage(" Examining worker " + workerId);
|
debugMessage(" Examining worker " + workerId);
|
||||||
@@ -647,7 +647,7 @@ void RunControlPrivate::forceStop()
|
|||||||
debugMessage("Was finished, too late to force Stop");
|
debugMessage("Was finished, too late to force Stop");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (RunWorker *worker : m_workers) {
|
for (RunWorker *worker : qAsConst(m_workers)) {
|
||||||
if (worker) {
|
if (worker) {
|
||||||
const QString &workerId = worker->d->id;
|
const QString &workerId = worker->d->id;
|
||||||
debugMessage(" Examining worker " + workerId);
|
debugMessage(" Examining worker " + workerId);
|
||||||
@@ -763,7 +763,7 @@ void RunControlPrivate::onWorkerStopped(RunWorker *worker)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (RunWorker *dependent : worker->d->stopDependencies) {
|
for (RunWorker *dependent : qAsConst(worker->d->stopDependencies)) {
|
||||||
switch (dependent->d->state) {
|
switch (dependent->d->state) {
|
||||||
case RunWorkerState::Done:
|
case RunWorkerState::Done:
|
||||||
break;
|
break;
|
||||||
@@ -780,7 +780,7 @@ void RunControlPrivate::onWorkerStopped(RunWorker *worker)
|
|||||||
|
|
||||||
debugMessage("Checking whether all stopped");
|
debugMessage("Checking whether all stopped");
|
||||||
bool allDone = true;
|
bool allDone = true;
|
||||||
for (RunWorker *worker : m_workers) {
|
for (RunWorker *worker : qAsConst(m_workers)) {
|
||||||
if (worker) {
|
if (worker) {
|
||||||
const QString &workerId = worker->d->id;
|
const QString &workerId = worker->d->id;
|
||||||
debugMessage(" Examining worker " + workerId);
|
debugMessage(" Examining worker " + workerId);
|
||||||
|
@@ -506,7 +506,7 @@ void RunSettingsWidget::addSubWidget(QWidget *widget, QLabel *label)
|
|||||||
|
|
||||||
void RunSettingsWidget::removeSubWidgets()
|
void RunSettingsWidget::removeSubWidgets()
|
||||||
{
|
{
|
||||||
for (const RunConfigItem &item : m_subWidgets) {
|
for (const RunConfigItem &item : qAsConst(m_subWidgets)) {
|
||||||
delete item.first;
|
delete item.first;
|
||||||
delete item.second;
|
delete item.second;
|
||||||
}
|
}
|
||||||
|
@@ -913,7 +913,7 @@ void SessionManagerPrivate::restoreStartupProject(const PersistentSettingsReader
|
|||||||
{
|
{
|
||||||
const QString startupProject = reader.restoreValue(QLatin1String("StartupProject")).toString();
|
const QString startupProject = reader.restoreValue(QLatin1String("StartupProject")).toString();
|
||||||
if (!startupProject.isEmpty()) {
|
if (!startupProject.isEmpty()) {
|
||||||
for (Project *pro : m_projects) {
|
for (Project *pro : qAsConst(m_projects)) {
|
||||||
if (pro->projectFilePath().toString() == startupProject) {
|
if (pro->projectFilePath().toString() == startupProject) {
|
||||||
m_instance->setStartupProject(pro);
|
m_instance->setStartupProject(pro);
|
||||||
break;
|
break;
|
||||||
|
@@ -204,7 +204,7 @@ TargetSetupPage::TargetSetupPage(QWidget *parent)
|
|||||||
|
|
||||||
setTitle(tr("Kit Selection"));
|
setTitle(tr("Kit Selection"));
|
||||||
|
|
||||||
for (IPotentialKit *pk : g_potentialKits)
|
for (IPotentialKit *pk : qAsConst(g_potentialKits))
|
||||||
if (pk->isEnabled())
|
if (pk->isEnabled())
|
||||||
m_potentialWidgets.append(pk->createWidget(this));
|
m_potentialWidgets.append(pk->createWidget(this));
|
||||||
|
|
||||||
|
@@ -419,7 +419,7 @@ void TaskWindow::delayedInitialization()
|
|||||||
|
|
||||||
alreadyDone = true;
|
alreadyDone = true;
|
||||||
|
|
||||||
for (ITaskHandler *h : g_taskHandlers) {
|
for (ITaskHandler *h : qAsConst(g_taskHandlers)) {
|
||||||
if (h->isDefaultHandler() && !d->m_defaultHandler)
|
if (h->isDefaultHandler() && !d->m_defaultHandler)
|
||||||
d->m_defaultHandler = h;
|
d->m_defaultHandler = h;
|
||||||
|
|
||||||
@@ -843,7 +843,7 @@ void TaskDelegate::currentChanged(const QModelIndex ¤t, const QModelIndex
|
|||||||
|
|
||||||
QString TaskDelegate::hrefForPos(const QPointF &pos)
|
QString TaskDelegate::hrefForPos(const QPointF &pos)
|
||||||
{
|
{
|
||||||
for (const auto &link : m_hrefs) {
|
for (const auto &link : qAsConst(m_hrefs)) {
|
||||||
if (link.first.contains(pos))
|
if (link.first.contains(pos))
|
||||||
return link.second;
|
return link.second;
|
||||||
}
|
}
|
||||||
|
@@ -192,7 +192,7 @@ bool ToolChain::operator == (const ToolChain &tc) const
|
|||||||
|
|
||||||
ToolChain *ToolChain::clone() const
|
ToolChain *ToolChain::clone() const
|
||||||
{
|
{
|
||||||
for (ToolChainFactory *f : Internal::g_toolChainFactories) {
|
for (ToolChainFactory *f : qAsConst(Internal::g_toolChainFactories)) {
|
||||||
if (f->supportedToolChainType() == d->m_typeId) {
|
if (f->supportedToolChainType() == d->m_typeId) {
|
||||||
ToolChain *tc = f->create();
|
ToolChain *tc = f->create();
|
||||||
QTC_ASSERT(tc, return nullptr);
|
QTC_ASSERT(tc, return nullptr);
|
||||||
|
Reference in New Issue
Block a user