diff --git a/src/plugins/projectexplorer/environment.cpp b/src/plugins/projectexplorer/environment.cpp index be132fdad104b4f64316ef98127d4c07d4198d8a..326200a710260bd4736b58a1f028c95b0a71448b 100644 --- a/src/plugins/projectexplorer/environment.cpp +++ b/src/plugins/projectexplorer/environment.cpp @@ -291,6 +291,11 @@ void Environment::modify(const QList<EnvironmentItem> & list) *this = resultEnvironment; } +bool Environment::hasKey(const QString &key) +{ + return m_values.contains(key); +} + bool Environment::operator!=(const Environment &other) const { return !(*this == other); diff --git a/src/plugins/projectexplorer/environment.h b/src/plugins/projectexplorer/environment.h index a25781d60e50ac7f0758541cb70e680d0af14156..289320a00304772c65288a34c4fce11225517fd3 100644 --- a/src/plugins/projectexplorer/environment.h +++ b/src/plugins/projectexplorer/environment.h @@ -71,6 +71,7 @@ public: void set(const QString &key, const QString &value); void unset(const QString &key); void modify(const QList<EnvironmentItem> & list); + bool hasKey(const QString &key); void appendOrSet(const QString &key, const QString &value, const QString &sep = QString()); void prependOrSet(const QString &key, const QString &value, const QString &sep = QString()); diff --git a/src/plugins/projectexplorer/environmenteditmodel.cpp b/src/plugins/projectexplorer/environmenteditmodel.cpp index 3998397f1c46bbb03f2e0947dd7382c116b0a9a1..33190ec9f4759d74e0808fdd3aad83583c15f7c5 100644 --- a/src/plugins/projectexplorer/environmenteditmodel.cpp +++ b/src/plugins/projectexplorer/environmenteditmodel.cpp @@ -271,7 +271,7 @@ QModelIndex EnvironmentModel::addVariable() QModelIndex EnvironmentModel::addVariable(const EnvironmentItem &item) { - bool existsInBaseEnvironment = (m_baseEnvironment.find(item.name) != m_baseEnvironment.constEnd()); + bool existsInBaseEnvironment = m_baseEnvironment.hasKey(item.name); int rowInResult; if (existsInBaseEnvironment) rowInResult = findInResult(item.name); @@ -301,7 +301,7 @@ void EnvironmentModel::removeVariable(const QString &name) { int rowInResult = findInResult(name); int rowInChanges = findInChanges(name); - bool existsInBaseEnvironment = m_baseEnvironment.find(name) != m_baseEnvironment.constEnd(); + bool existsInBaseEnvironment = m_baseEnvironment.hasKey(name); if (existsInBaseEnvironment) { m_items.removeAt(rowInChanges); updateResultEnvironment(); @@ -347,7 +347,7 @@ bool EnvironmentModel::isUnset(const QString &name) bool EnvironmentModel::isInBaseEnvironment(const QString &name) { - return m_baseEnvironment.find(name) != m_baseEnvironment.constEnd(); + return m_baseEnvironment.hasKey(name); } QList<EnvironmentItem> EnvironmentModel::userChanges() const