VariableChooser: Update variable description on keyboard navigation

Change-Id: I716e4bd6325f0d00b1fa73ea4a76f185660c89a0
Reviewed-by: hjk <hjk@theqtcompany.com>
This commit is contained in:
Orgad Shaneh
2015-06-16 10:45:17 +03:00
committed by hjk
parent b0e1dbb9b9
commit ba82f9a518

View File

@@ -77,6 +77,8 @@ public:
void contextMenuEvent(QContextMenuEvent *ev); void contextMenuEvent(QContextMenuEvent *ev);
void currentChanged(const QModelIndex &current, const QModelIndex &previous);
private: private:
VariableChooserPrivate *m_target; VariableChooserPrivate *m_target;
}; };
@@ -225,6 +227,12 @@ void VariableTreeView::contextMenuEvent(QContextMenuEvent *ev)
m_target->insertText(expandedText); m_target->insertText(expandedText);
} }
void VariableTreeView::currentChanged(const QModelIndex &current, const QModelIndex &previous)
{
Q_UNUSED(previous);
m_target->updateDescription(current);
}
VariableChooserPrivate::VariableChooserPrivate(VariableChooser *parent) VariableChooserPrivate::VariableChooserPrivate(VariableChooser *parent)
: q(parent), : q(parent),
m_lineEdit(0), m_lineEdit(0),
@@ -248,8 +256,6 @@ VariableChooserPrivate::VariableChooserPrivate(VariableChooser *parent)
verticalLayout->addWidget(m_variableTree); verticalLayout->addWidget(m_variableTree);
verticalLayout->addWidget(m_variableDescription); verticalLayout->addWidget(m_variableDescription);
connect(m_variableTree, &QTreeView::clicked,
this, &VariableChooserPrivate::updateDescription);
connect(m_variableTree, &QTreeView::activated, connect(m_variableTree, &QTreeView::activated,
this, &VariableChooserPrivate::handleItemActivated); this, &VariableChooserPrivate::handleItemActivated);
connect(qobject_cast<QApplication *>(qApp), &QApplication::focusChanged, connect(qobject_cast<QApplication *>(qApp), &QApplication::focusChanged,