Commit acb36acf authored by Marco Bubke's avatar Marco Bubke
Browse files

QmlDesigner.FormEditor: Change to component for double click

parent 3a3d9c14
......@@ -35,6 +35,8 @@
#include "formeditorview.h"
#include "formeditorview.h"
#include <coreplugin/editormanager/editormanager.h>
#include <QtDebug>
#include <QGraphicsSceneDragDropEvent>
#include <nodemetainfo.h>
......@@ -192,5 +194,15 @@ void AbstractFormEditorTool::dragMoveEvent(QGraphicsSceneDragDropEvent * /* even
Q_ASSERT(false);
}
void AbstractFormEditorTool::mouseDoubleClickEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent *event)
{
FormEditorItem *formEditorItem = topFormEditorItem(itemList);
if (formEditorItem) {
ModelNode doubleClickNode = formEditorItem->qmlItemNode().modelNode();
if (doubleClickNode.metaInfo().isComponent()) {
Core::EditorManager::instance()->openEditor(doubleClickNode.metaInfo().componentFileName());
event->accept();
}
}
}
}
......@@ -59,7 +59,7 @@ public:
virtual void mouseReleaseEvent(const QList<QGraphicsItem*> &itemList,
QGraphicsSceneMouseEvent *event) = 0;
virtual void mouseDoubleClickEvent(const QList<QGraphicsItem*> &itemList,
QGraphicsSceneMouseEvent *event) = 0;
QGraphicsSceneMouseEvent *event);
virtual void hoverMoveEvent(const QList<QGraphicsItem*> &itemList,
QGraphicsSceneMouseEvent *event) = 0;
......
......@@ -40,6 +40,8 @@
#include "resizehandleitem.h"
#include "nodemetainfo.h"
#include <QApplication>
#include <QGraphicsSceneMouseEvent>
#include <QAction>
......@@ -218,10 +220,9 @@ void MoveTool::mouseReleaseEvent(const QList<QGraphicsItem*> &/*itemList*/,
}
}
void MoveTool::mouseDoubleClickEvent(const QList<QGraphicsItem*> & /*itemList*/,
QGraphicsSceneMouseEvent * /*event*/)
void MoveTool::mouseDoubleClickEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent *event)
{
AbstractFormEditorTool::mouseDoubleClickEvent(itemList, event);
}
void MoveTool::itemsAboutToRemoved(const QList<FormEditorItem*> &removedItemList)
......
......@@ -36,6 +36,7 @@
#include "formeditorview.h"
#include "resizehandleitem.h"
#include "nodemetainfo.h"
#include <QApplication>
......@@ -197,10 +198,9 @@ void SelectionTool::mouseReleaseEvent(const QList<QGraphicsItem*> &/*itemList*/,
}
void SelectionTool::mouseDoubleClickEvent(const QList<QGraphicsItem*> &/*itemList*/,
QGraphicsSceneMouseEvent * /*event*/)
void SelectionTool::mouseDoubleClickEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent * event)
{
AbstractFormEditorTool::mouseDoubleClickEvent(itemList, event);
}
void SelectionTool::keyPressEvent(QKeyEvent *event)
......
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