Add signal to hint where to focus next

Reviewed-by: dt
This commit is contained in:
Tobias Hunger
2010-04-21 11:02:26 +02:00
parent c6c90a151e
commit b5d0824269
2 changed files with 12 additions and 0 deletions

View File

@@ -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);

View File

@@ -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;