mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-03 06:02:29 -06:00
Use const accessor
This avoids an unnecessary check to the container internal atomic variable and prevents potential detachment. PR #22280.
This commit is contained in:
@@ -97,7 +97,7 @@ void TorrentContentModelFolder::updatePriority()
|
||||
// If all children have the same priority
|
||||
// then the folder should have the same
|
||||
// priority
|
||||
const BitTorrent::DownloadPriority prio = m_childItems.first()->priority();
|
||||
const BitTorrent::DownloadPriority prio = m_childItems.constFirst()->priority();
|
||||
for (int i = 1; i < m_childItems.size(); ++i)
|
||||
{
|
||||
if (m_childItems.at(i)->priority() != prio)
|
||||
|
||||
@@ -199,8 +199,8 @@ QIcon UIThemeManager::getFlagIcon(const QString &countryIsoCode) const
|
||||
return {};
|
||||
|
||||
const QString key = countryIsoCode.toLower();
|
||||
const auto iter = m_flags.find(key);
|
||||
if (iter != m_flags.end())
|
||||
const auto iter = m_flags.constFind(key);
|
||||
if (iter != m_flags.cend())
|
||||
return *iter;
|
||||
|
||||
const QIcon icon {u":/icons/flags/" + key + u".svg"};
|
||||
|
||||
@@ -175,7 +175,7 @@ void DefaultThemeSource::loadColors()
|
||||
const QHash<QString, QColor> lightModeColorOverrides = colorsFromJSON(config.value(KEY_COLORS_LIGHT).toObject());
|
||||
for (auto overridesIt = lightModeColorOverrides.cbegin(); overridesIt != lightModeColorOverrides.cend(); ++overridesIt)
|
||||
{
|
||||
auto it = m_colors.find(overridesIt.key());
|
||||
const auto it = m_colors.find(overridesIt.key());
|
||||
if (it != m_colors.end())
|
||||
it.value().light = overridesIt.value();
|
||||
}
|
||||
@@ -183,7 +183,7 @@ void DefaultThemeSource::loadColors()
|
||||
const QHash<QString, QColor> darkModeColorOverrides = colorsFromJSON(config.value(KEY_COLORS_DARK).toObject());
|
||||
for (auto overridesIt = darkModeColorOverrides.cbegin(); overridesIt != darkModeColorOverrides.cend(); ++overridesIt)
|
||||
{
|
||||
auto it = m_colors.find(overridesIt.key());
|
||||
const auto it = m_colors.find(overridesIt.key());
|
||||
if (it != m_colors.end())
|
||||
it.value().dark = overridesIt.value();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user