From b5d0824269d17b657dc81121150bbb6f364dd1c4 Mon Sep 17 00:00:00 2001 From: Tobias Hunger <tobias.hunger@nokia.com> Date: Wed, 21 Apr 2010 11:02:26 +0200 Subject: [PATCH] Add signal to hint where to focus next Reviewed-by: dt --- src/plugins/projectexplorer/environmenteditmodel.cpp | 8 ++++++++ src/plugins/projectexplorer/environmenteditmodel.h | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/src/plugins/projectexplorer/environmenteditmodel.cpp b/src/plugins/projectexplorer/environmenteditmodel.cpp index 8a17cc23ee1..4a8b44977ea 100644 --- a/src/plugins/projectexplorer/environmenteditmodel.cpp +++ b/src/plugins/projectexplorer/environmenteditmodel.cpp @@ -366,6 +366,8 @@ EnvironmentWidget::EnvironmentWidget(QWidget *parent, QWidget *additionalDetails connect(m_model, SIGNAL(renamedVariable(QString)), this, SLOT(renamedVariable(QString))); + connect(m_model, SIGNAL(focusIndex(QModelIndex)), + this, SLOT(focusIndex(QModelIndex))); QVBoxLayout *vbox = new QVBoxLayout(this); vbox->setContentsMargins(0, 0, 0, 0); @@ -449,6 +451,12 @@ void EnvironmentWidget::renamedVariable(const QString &name) m_environmentTreeView->setFocus(); } +void EnvironmentWidget::focusIndex(const QModelIndex &index) +{ + m_environmentTreeView->setCurrentIndex(index); + m_environmentTreeView->setFocus(); +} + void EnvironmentWidget::setBaseEnvironment(const ProjectExplorer::Environment &env) { m_model->setBaseEnvironment(env); diff --git a/src/plugins/projectexplorer/environmenteditmodel.h b/src/plugins/projectexplorer/environmenteditmodel.h index 60eea7bc518..485f02360d6 100644 --- a/src/plugins/projectexplorer/environmenteditmodel.h +++ b/src/plugins/projectexplorer/environmenteditmodel.h @@ -84,6 +84,9 @@ 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 + void focusIndex(const QModelIndex &index); + private: void updateResultEnvironment(); int findInChanges(const QString &name) const; @@ -125,6 +128,7 @@ private slots: void invalidateCurrentIndex(); void updateSummaryText(); void renamedVariable(const QString &name); + void focusIndex(const QModelIndex &index); private: EnvironmentModel *m_model; -- GitLab