diff --git a/src/encoder/encoderfdkaac.cpp b/src/encoder/encoderfdkaac.cpp index bce82a19d81..754075fe097 100644 --- a/src/encoder/encoderfdkaac.cpp +++ b/src/encoder/encoderfdkaac.cpp @@ -187,13 +187,12 @@ QString EncoderFdkAac::buttWindowsFdkAac() { // Typical name for a butt installation folder // is "butt-x.x.x" so list subfolders beginning with "butt" - QStringList nameFilters("butt*"); - QStringList subfolders = - folder.entryList(nameFilters, QDir::Dirs, QDir::Name); + const QStringList subfolders = + folder.entryList(QStringList{"butt*"}, QDir::Dirs, QDir::Name); // If a butt installation is found, try // to find libfdk-aac in it - for (const auto& subName : qAsConst(subfolders)) { + for (const auto& subName : subfolders) { if (!folder.cd(subName)) { continue; } diff --git a/src/util/font.h b/src/util/font.h index f306991724e..42bb21f4701 100644 --- a/src/util/font.h +++ b/src/util/font.h @@ -53,21 +53,23 @@ class FontUtils { #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) QFontDatabase database; #endif - QStringList families = QFontDatabase::applicationFontFamilies(result); - foreach (const QString& family, families) { + QStringList pointSizesStr; + const QStringList families = QFontDatabase::applicationFontFamilies(result); + for (const QString& family : families) { #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) - QStringList styles = QFontDatabase::styles(family); + const QStringList styles = QFontDatabase::styles(family); #else - QStringList styles = database.styles(family); + const QStringList styles = database.styles(family); #endif - foreach (const QString& style, styles) { + for (const QString& style : styles) { #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) - QList pointSizes = QFontDatabase::pointSizes(family, style); + const QList pointSizes = QFontDatabase::pointSizes(family, style); #else - QList pointSizes = database.pointSizes(family, style); + const QList pointSizes = database.pointSizes(family, style); #endif - QStringList pointSizesStr; - foreach (int point, pointSizes) { + pointSizesStr.clear(); + pointSizesStr.reserve(pointSizes.count()); + for (int point : pointSizes) { pointSizesStr.append(QString::number(point)); } qDebug() << "FONT LOADED family:" << family diff --git a/src/widget/weffectchainpresetbutton.cpp b/src/widget/weffectchainpresetbutton.cpp index e33e46809ff..4026ffc181f 100644 --- a/src/widget/weffectchainpresetbutton.cpp +++ b/src/widget/weffectchainpresetbutton.cpp @@ -54,6 +54,7 @@ void WEffectChainPresetButton::populateMenu() { // Chain preset items const EffectsBackendManagerPointer bem = m_pEffectsManager->getBackendManager(); bool presetIsReadOnly = true; + QStringList effectNames; for (const auto& pChainPreset : m_pChainPresetManager->getPresetsSorted()) { QString title = pChainPreset->name(); if (title == m_pChain->presetName()) { @@ -63,7 +64,6 @@ void WEffectChainPresetButton::populateMenu() { } QString tooltip = QStringLiteral("") + pChainPreset->name() + QStringLiteral(""); - QStringList effectNames; for (const auto& pEffectPreset : pChainPreset->effectPresets()) { if (!pEffectPreset->isEmpty()) { effectNames.append(bem->getDisplayNameForEffectPreset(pEffectPreset)); @@ -73,6 +73,7 @@ void WEffectChainPresetButton::populateMenu() { tooltip.append("
"); tooltip.append(effectNames.join("
")); } + effectNames.clear(); parented_ptr pAction = make_parented(title, this); connect(pAction, &QAction::triggered, diff --git a/src/widget/weffectchainpresetselector.cpp b/src/widget/weffectchainpresetselector.cpp index 49b033c9e20..bfed3191968 100644 --- a/src/widget/weffectchainpresetselector.cpp +++ b/src/widget/weffectchainpresetselector.cpp @@ -75,6 +75,7 @@ void WEffectChainPresetSelector::populate() { } const EffectsBackendManagerPointer bem = m_pEffectsManager->getBackendManager(); + QStringList effectNames; for (int i = 0; i < presetList.size(); i++) { auto pChainPreset = presetList.at(i); QString elidedDisplayName = metrics.elidedText(pChainPreset->name(), @@ -83,7 +84,6 @@ void WEffectChainPresetSelector::populate() { addItem(elidedDisplayName, QVariant(pChainPreset->name())); QString tooltip = QStringLiteral("") + pChainPreset->name() + QStringLiteral(""); - QStringList effectNames; for (const auto& pEffectPreset : pChainPreset->effectPresets()) { if (!pEffectPreset->isEmpty()) { effectNames.append(bem->getDisplayNameForEffectPreset(pEffectPreset)); @@ -93,6 +93,7 @@ void WEffectChainPresetSelector::populate() { tooltip.append("
"); tooltip.append(effectNames.join("
")); } + effectNames.clear(); setItemData(i, tooltip, Qt::ToolTipRole); }