Commit 0326454e authored by Marco Bubke's avatar Marco Bubke

QmlDesigner.Navigator: Change to component for double click

parent 7a2fc356
......@@ -35,6 +35,8 @@
#include "navigatortreemodel.h"
#include "navigatorwidget.h"
#include <coreplugin/editormanager/editormanager.h>
#include <nodeproperty.h>
#include <nodelistproperty.h>
#include <QHeaderView>
......@@ -51,6 +53,7 @@ NavigatorView::NavigatorView(QObject* parent) :
m_widget->setTreeModel(m_treeModel.data());
connect(treeWidget()->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(changeSelection(QItemSelection,QItemSelection)));
connect(treeWidget(), SIGNAL(doubleClicked(QModelIndex)), this, SLOT(changeToComponent(QModelIndex)));
treeWidget()->setIndentation(treeWidget()->indentation() * 0.5);
NameItemDelegate *idDelegate = new NameItemDelegate(this,m_treeModel.data());
......@@ -248,6 +251,15 @@ void NavigatorView::nodeOrderChanged(const NodeListProperty &listProperty, const
m_treeModel->updateItemRowOrder(listProperty, node, oldIndex);
}
void NavigatorView::changeToComponent(const QModelIndex &index)
{
if (index.isValid() && m_treeModel->data(index, Qt::UserRole).isValid()) {
ModelNode doubleClickNode = m_treeModel->nodeForIndex(index);
if (doubleClickNode.metaInfo().isComponent())
Core::EditorManager::instance()->openEditor(doubleClickNode.metaInfo().componentFileName());
}
}
void NavigatorView::changeSelection(const QItemSelection & /*newSelection*/, const QItemSelection &/*deselected*/)
{
if (m_blockSelectionChangedSignal)
......
......@@ -102,6 +102,7 @@ private slots:
// void handleChangedItem(QStandardItem * item);
void changeSelection(const QItemSelection &selected, const QItemSelection &deselected);
void updateItemSelection();
void changeToComponent(const QModelIndex &index);
protected: //functions
QTreeView *treeWidget();
......
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