diff --git a/src/plugins/projectexplorer/buildenvironmentwidget.cpp b/src/plugins/projectexplorer/buildenvironmentwidget.cpp index e7f741f93514cbc318dea4ba895f839ccf322647..c0a65cfd25a1049cae2cde54fe0104dcdfb2d837 100644 --- a/src/plugins/projectexplorer/buildenvironmentwidget.cpp +++ b/src/plugins/projectexplorer/buildenvironmentwidget.cpp @@ -85,7 +85,6 @@ void BuildEnvironmentWidget::init(BuildConfiguration *bc) m_buildEnvironmentWidget->setBaseEnvironment(m_buildConfiguration->baseEnvironment()); m_buildEnvironmentWidget->setBaseEnvironmentText(m_buildConfiguration->baseEnvironmentText()); m_buildEnvironmentWidget->setUserChanges(m_buildConfiguration->userEnvironmentChanges()); - m_buildEnvironmentWidget->updateButtons(); } void BuildEnvironmentWidget::environmentModelUserChangesChanged() diff --git a/src/plugins/projectexplorer/environmenteditmodel.cpp b/src/plugins/projectexplorer/environmenteditmodel.cpp index f50df4de923ad4535221cd6b6fd7a9ccb8c0c45c..3481e324302e8ee51778091c84968046183cba89 100644 --- a/src/plugins/projectexplorer/environmenteditmodel.cpp +++ b/src/plugins/projectexplorer/environmenteditmodel.cpp @@ -152,14 +152,6 @@ int EnvironmentModel::findInChanges(const QString &name) const return -1; } -int EnvironmentModel::findInChangesInsertPosition(const QString &name) const -{ - for (int i=0; i<m_items.size(); ++i) - if (m_items.at(i).name > name) - return i; - return m_items.size(); -} - QModelIndex EnvironmentModel::variableToIndex(const QString &name) const { int row = findInResult(name); @@ -380,8 +372,6 @@ EnvironmentWidget::EnvironmentWidget(QWidget *parent, QWidget *additionalDetails connect(m_model, SIGNAL(modelReset()), this, SLOT(invalidateCurrentIndex())); - connect(m_model, SIGNAL(renamedVariable(QString)), - this, SLOT(renamedVariable(QString))); connect(m_model, SIGNAL(focusIndex(QModelIndex)), this, SLOT(focusIndex(QModelIndex))); @@ -460,13 +450,6 @@ EnvironmentWidget::~EnvironmentWidget() m_model = 0; } -void EnvironmentWidget::renamedVariable(const QString &name) -{ - QModelIndex index = m_model->variableToIndex(name); - m_environmentTreeView->setCurrentIndex(index); - m_environmentTreeView->setFocus(); -} - void EnvironmentWidget::focusIndex(const QModelIndex &index) { m_environmentTreeView->setCurrentIndex(index); @@ -532,14 +515,12 @@ void EnvironmentWidget::addEnvironmentButtonClicked() QModelIndex index = m_model->addVariable(); m_environmentTreeView->setCurrentIndex(index); m_environmentTreeView->edit(index); - updateButtons(); } void EnvironmentWidget::removeEnvironmentButtonClicked() { const QString &name = m_model->indexToVariable(m_environmentTreeView->currentIndex()); m_model->resetVariable(name); - updateButtons(); } // unset in Merged Environment Mode means, unset if it comes from the base environment @@ -551,7 +532,6 @@ void EnvironmentWidget::unsetEnvironmentButtonClicked() m_model->resetVariable(name); else m_model->unsetVariable(name); - updateButtons(); } void EnvironmentWidget::environmentCurrentIndexChanged(const QModelIndex ¤t) diff --git a/src/plugins/projectexplorer/environmenteditmodel.h b/src/plugins/projectexplorer/environmenteditmodel.h index 485f02360d6f61812558d047193d22d63e33be0d..6aafe9460264d499ad776813f6bbab6a9aaddb5c 100644 --- a/src/plugins/projectexplorer/environmenteditmodel.h +++ b/src/plugins/projectexplorer/environmenteditmodel.h @@ -76,21 +76,14 @@ public: signals: void userChangesChanged(); - /// Strictly speaking this is a hack to work around - /// the problem that we don't emit the right signals - /// on editing a variable - /// Don't try to fix that with out consulting me - /// In short it's impossible to emit the right signals - /// and to ensure that the model is in a consistent - /// state at each signal emission - void renamedVariable(const QString &newName); /// Hint to the view where it should make sense to focus on next + // This is a hack since there is no way for a model to suggest + // the next interesting place to focus on to the view. void focusIndex(const QModelIndex &index); private: void updateResultEnvironment(); int findInChanges(const QString &name) const; - int findInChangesInsertPosition(const QString &name) const; int findInResultInsertPosition(const QString &name) const; int findInResult(const QString &name) const; @@ -112,8 +105,6 @@ public: QList<EnvironmentItem> userChanges() const; void setUserChanges(QList<EnvironmentItem> list); -public slots: - void updateButtons(); signals: void userChangesChanged(); @@ -127,8 +118,8 @@ private slots: void environmentCurrentIndexChanged(const QModelIndex ¤t); void invalidateCurrentIndex(); void updateSummaryText(); - void renamedVariable(const QString &name); void focusIndex(const QModelIndex &index); + void updateButtons(); private: EnvironmentModel *m_model;