Commit 82d9cf41 authored by Eike Ziller's avatar Eike Ziller

Cpp type hierarchy: Use single click activation instead of click handling

Change-Id: I968d28a37b16e9966502ee618c00f23fecd0daa6
Reviewed-by: default avatarNikolai Kosjar <nikolai.kosjar@digia.com>
parent 31a20fca
......@@ -133,6 +133,7 @@ CppTypeHierarchyWidget::CppTypeHierarchyWidget() :
m_inspectedClass->setMargin(5);
m_model = new QStandardItemModel(this);
m_treeView = new NavigationTreeView(this);
m_treeView->setActivationMode(Utils::SingleClickActivation);
m_delegate = new AnnotatedItemDelegate(this);
m_delegate->setDelimiter(QLatin1String(" "));
m_delegate->setAnnotationRole(AnnotationRole);
......@@ -140,7 +141,7 @@ CppTypeHierarchyWidget::CppTypeHierarchyWidget() :
m_treeView->setEditTriggers(QAbstractItemView::NoEditTriggers);
m_treeView->setItemDelegate(m_delegate);
m_treeView->setRootIsDecorated(false);
connect(m_treeView, SIGNAL(clicked(QModelIndex)), this, SLOT(onItemClicked(QModelIndex)));
connect(m_treeView, &QTreeView::activated, this, &CppTypeHierarchyWidget::onItemActivated);
m_noTypeHierarchyAvailableLabel = new QLabel(tr("No type hierarchy available"), this);
m_noTypeHierarchyAvailableLabel->setAlignment(Qt::AlignCenter);
......@@ -231,7 +232,7 @@ void CppTypeHierarchyWidget::clearTypeHierarchy()
m_model->clear();
}
void CppTypeHierarchyWidget::onItemClicked(const QModelIndex &index)
void CppTypeHierarchyWidget::onItemActivated(const QModelIndex &index)
{
auto link = index.data(LinkRole).value<TextEditor::TextEditorWidget::Link>();
if (link.hasValidTarget())
......
......@@ -71,9 +71,6 @@ public:
public slots:
void perform();
private slots:
void onItemClicked(const QModelIndex &index);
private:
typedef QList<CppClass> CppClass::*HierarchyMember;
void buildHierarchy(const CppClass &cppClass, QStandardItem *parent,
......@@ -81,6 +78,7 @@ private:
void showNoTypeHierarchyLabel();
void showTypeHierarchy();
void clearTypeHierarchy();
void onItemActivated(const QModelIndex &index);
CppEditorWidget *m_cppEditor;
Utils::NavigationTreeView *m_treeView;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment