ExtensionManager: Fix warnings about detaching containers

Change-Id: I9ed40d7c464c1690c1091016691591f34e70fb6c
Reviewed-by: Artem Sokolovskii <artem.sokolovskii@qt.io>
This commit is contained in:
Alessandro Portale
2024-10-07 13:18:34 +02:00
parent 623854d452
commit 1d06ed5d90

View File

@@ -49,7 +49,7 @@ public:
void ExtensionsModelPrivate::addUnlistedLocalPlugins() void ExtensionsModelPrivate::addUnlistedLocalPlugins()
{ {
QStringList responseExtensions; QStringList responseExtensions;
for (const QJsonValueConstRef &responseItem : responseItems) for (const QJsonValueConstRef &responseItem : qAsConst(responseItems))
responseExtensions << responseItem.toObject().value("id").toString(); responseExtensions << responseItem.toObject().value("id").toString();
localPlugins.clear(); localPlugins.clear();
@@ -114,7 +114,7 @@ QVariant ExtensionsModelPrivate::dataFromRemotePlugin(const QJsonObject &json, i
const QJsonArray sources = json.value("sources").toArray(); const QJsonArray sources = json.value("sources").toArray();
const QString thisPlatform = customOsTypeToString(HostOsInfo::hostOs()); const QString thisPlatform = customOsTypeToString(HostOsInfo::hostOs());
const QString thisArch = QSysInfo::currentCpuArchitecture(); const QString thisArch = QSysInfo::currentCpuArchitecture();
for (const QJsonValue source : sources) { for (const QJsonValue &source : sources) {
const QJsonObject sourceObject = source.toObject(); const QJsonObject sourceObject = source.toObject();
const QJsonObject platform = sourceObject.value("platform").toObject(); const QJsonObject platform = sourceObject.value("platform").toObject();
if (platform.isEmpty() // Might be a Lua plugin if (platform.isEmpty() // Might be a Lua plugin
@@ -296,8 +296,8 @@ QModelIndex ExtensionsModel::indexOfId(const QString &extensionId) const
if (localIndex >= 0) if (localIndex >= 0)
return index(d->responseItems.count() + localIndex); return index(d->responseItems.count() + localIndex);
for (int remoteIndex = 0; const QJsonValueConstRef vlaue : d->responseItems) { for (int remoteIndex = 0; const QJsonValueConstRef &value : std::as_const(d->responseItems)) {
if (vlaue.toObject().value(EXTENSION_KEY_ID) == extensionId) if (value.toObject().value(EXTENSION_KEY_ID) == extensionId)
return index(remoteIndex); return index(remoteIndex);
++remoteIndex; ++remoteIndex;
} }