From b9efb80900e946130304161958fad07f263e8105 Mon Sep 17 00:00:00 2001 From: Tobias Hunger <tobias.hunger@nokia.com> Date: Mon, 19 Apr 2010 19:00:08 +0200 Subject: [PATCH] Add some comments to environmentmodel::data() Reviewed-by: dt --- src/plugins/projectexplorer/environmenteditmodel.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/projectexplorer/environmenteditmodel.cpp b/src/plugins/projectexplorer/environmenteditmodel.cpp index f1e55b2af98..52a693a5c08 100644 --- a/src/plugins/projectexplorer/environmenteditmodel.cpp +++ b/src/plugins/projectexplorer/environmenteditmodel.cpp @@ -103,13 +103,14 @@ QVariant EnvironmentModel::data(const QModelIndex &index, int role) const if (!index.isValid()) return QVariant(); - if ((role == Qt::DisplayRole || role == Qt::EditRole)) { + if (role == Qt::DisplayRole || role == Qt::EditRole) { if (index.column() == 0) { return m_resultEnvironment.key(m_resultEnvironment.constBegin() + index.row()); } else if (index.column() == 1) { + // Do not return "<UNSET>" when editing a previously unset variable: if (role == Qt::EditRole) { int pos = findInChanges(indexToVariable(index)); - if (pos != -1) + if (pos >= 0) return m_items.at(pos).value; } return m_resultEnvironment.value(m_resultEnvironment.constBegin() + index.row()); @@ -127,7 +128,6 @@ QVariant EnvironmentModel::data(const QModelIndex &index, int role) const return QVariant(); } - Qt::ItemFlags EnvironmentModel::flags(const QModelIndex &index) const { Q_UNUSED(index) -- GitLab