KitAspects: Avoid using keys()

Instead, iterate directly over the container.

Change-Id: Ie42136f29e5ddab8cd8da76e09616547187a2635
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Jarek Kobus
2024-01-04 15:00:45 +01:00
parent 00815e006d
commit 1fe1055277

View File

@@ -249,12 +249,11 @@ private:
IDeviceConstPtr device = BuildDeviceKitAspect::device(kit()); IDeviceConstPtr device = BuildDeviceKitAspect::device(kit());
const GuardLocker locker(m_ignoreChanges); const GuardLocker locker(m_ignoreChanges);
// TODO: Get rid of keys, iterate directly on hash. for (auto it = m_languageComboboxMap.cbegin(); it != m_languageComboboxMap.cend(); ++it) {
const QList<Id> keys = m_languageComboboxMap.keys(); const Id l = it.key();
for (const Id l : keys) {
const Toolchains ltcList = ToolchainManager::toolchains(equal(&Toolchain::language, l)); const Toolchains ltcList = ToolchainManager::toolchains(equal(&Toolchain::language, l));
QComboBox *cb = m_languageComboboxMap.value(l); QComboBox *cb = *it;
cb->clear(); cb->clear();
cb->addItem(Tr::tr("<No compiler>"), QByteArray()); cb->addItem(Tr::tr("<No compiler>"), QByteArray());
@@ -283,10 +282,8 @@ private:
void makeReadOnly() override void makeReadOnly() override
{ {
m_isReadOnly = true; m_isReadOnly = true;
const QList<Id> keys = m_languageComboboxMap.keys(); for (QComboBox *cb : std::as_const(m_languageComboboxMap))
for (const Id l : keys) { cb->setEnabled(false);
m_languageComboboxMap.value(l)->setEnabled(false);
}
} }
void currentToolChainChanged(Id language, int idx) void currentToolChainChanged(Id language, int idx)