Skip to content
Snippets Groups Projects
Commit b5d08242 authored by Tobias Hunger's avatar Tobias Hunger
Browse files

Add signal to hint where to focus next

Reviewed-by: dt
parent c6c90a15
No related branches found
No related tags found
No related merge requests found
...@@ -366,6 +366,8 @@ EnvironmentWidget::EnvironmentWidget(QWidget *parent, QWidget *additionalDetails ...@@ -366,6 +366,8 @@ EnvironmentWidget::EnvironmentWidget(QWidget *parent, QWidget *additionalDetails
connect(m_model, SIGNAL(renamedVariable(QString)), connect(m_model, SIGNAL(renamedVariable(QString)),
this, SLOT(renamedVariable(QString))); this, SLOT(renamedVariable(QString)));
connect(m_model, SIGNAL(focusIndex(QModelIndex)),
this, SLOT(focusIndex(QModelIndex)));
QVBoxLayout *vbox = new QVBoxLayout(this); QVBoxLayout *vbox = new QVBoxLayout(this);
vbox->setContentsMargins(0, 0, 0, 0); vbox->setContentsMargins(0, 0, 0, 0);
...@@ -449,6 +451,12 @@ void EnvironmentWidget::renamedVariable(const QString &name) ...@@ -449,6 +451,12 @@ void EnvironmentWidget::renamedVariable(const QString &name)
m_environmentTreeView->setFocus(); m_environmentTreeView->setFocus();
} }
void EnvironmentWidget::focusIndex(const QModelIndex &index)
{
m_environmentTreeView->setCurrentIndex(index);
m_environmentTreeView->setFocus();
}
void EnvironmentWidget::setBaseEnvironment(const ProjectExplorer::Environment &env) void EnvironmentWidget::setBaseEnvironment(const ProjectExplorer::Environment &env)
{ {
m_model->setBaseEnvironment(env); m_model->setBaseEnvironment(env);
......
...@@ -84,6 +84,9 @@ signals: ...@@ -84,6 +84,9 @@ signals:
/// and to ensure that the model is in a consistent /// and to ensure that the model is in a consistent
/// state at each signal emission /// state at each signal emission
void renamedVariable(const QString &newName); void renamedVariable(const QString &newName);
/// Hint to the view where it should make sense to focus on next
void focusIndex(const QModelIndex &index);
private: private:
void updateResultEnvironment(); void updateResultEnvironment();
int findInChanges(const QString &name) const; int findInChanges(const QString &name) const;
...@@ -125,6 +128,7 @@ private slots: ...@@ -125,6 +128,7 @@ private slots:
void invalidateCurrentIndex(); void invalidateCurrentIndex();
void updateSummaryText(); void updateSummaryText();
void renamedVariable(const QString &name); void renamedVariable(const QString &name);
void focusIndex(const QModelIndex &index);
private: private:
EnvironmentModel *m_model; EnvironmentModel *m_model;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment