forked from qt-creator/qt-creator
Don't allocate unneeded temporary containers
Fix clazy warnings: allocating an unneeded temporary container [clazy-container-anti-pattern] Change-Id: I4b4c2c634eea650bbdf3c12d982a17f899fc94ec Reviewed-by: Alessandro Portale <alessandro.portale@qt.io> Reviewed-by: David Schulz <david.schulz@qt.io> Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -50,9 +50,8 @@ ColorSettings::ColorSettings(QWidget *parent)
|
||||
m_colorThemes = s->value(Constants::C_SETTINGS_COLORSETTINGS_COLORTHEMES).toMap();
|
||||
|
||||
m_ui.m_comboColorThemes->clear();
|
||||
for (const auto &key : m_colorThemes.keys())
|
||||
m_ui.m_comboColorThemes->addItem(key);
|
||||
|
||||
for (auto it = m_colorThemes.cbegin(); it != m_colorThemes.cend(); ++it)
|
||||
m_ui.m_comboColorThemes->addItem(it.key());
|
||||
m_ui.m_comboColorThemes->setCurrentText(s->value(Constants::C_SETTINGS_COLORSETTINGS_CURRENTCOLORTHEME).toString());
|
||||
}
|
||||
|
||||
@@ -74,9 +73,9 @@ void ColorSettings::selectTheme(int index)
|
||||
m_ui.m_colorThemeView->reset();
|
||||
if (!name.isEmpty() && m_colorThemes.contains(name)) {
|
||||
m_ui.m_colorThemeView->setEnabled(true);
|
||||
QVariantMap colordata = m_colorThemes[name].toMap();
|
||||
for (const auto &index : colordata.keys())
|
||||
m_ui.m_colorThemeView->setColor(index.toInt(), QColor(colordata[index].toString()));
|
||||
const QVariantMap colordata = m_colorThemes[name].toMap();
|
||||
for (auto it = colordata.cbegin(); it != colordata.cend(); ++it)
|
||||
m_ui.m_colorThemeView->setColor(it.key().toInt(), QColor(it.value().toString()));
|
||||
} else {
|
||||
m_ui.m_colorThemeView->setEnabled(false);
|
||||
}
|
||||
@@ -86,7 +85,7 @@ void ColorSettings::createTheme()
|
||||
{
|
||||
QString name = QInputDialog::getText(this, tr("Create New Color Theme"), tr("Theme ID"));
|
||||
if (!name.isEmpty()) {
|
||||
if (m_colorThemes.keys().contains(name)) {
|
||||
if (m_colorThemes.contains(name)) {
|
||||
QMessageBox::warning(this, tr("Cannot Create Theme"), tr("Theme %1 is already available.").arg(name));
|
||||
} else {
|
||||
m_ui.m_colorThemeView->reset();
|
||||
|
||||
@@ -358,7 +358,7 @@ QString ScxmlTag::editorInfo(const QString &key) const
|
||||
|
||||
bool ScxmlTag::hasEditorInfo(const QString &key) const
|
||||
{
|
||||
return m_editorInfo.keys().contains(key);
|
||||
return m_editorInfo.contains(key);
|
||||
}
|
||||
|
||||
void ScxmlTag::setAttributeName(int ind, const QString &name)
|
||||
|
||||
Reference in New Issue
Block a user