ui: Added show definition context menu action for graph nodes (issue #83)
* use 'show definition' context menu action or 'Ctrl/Cmd + Left Click' to show definition of node in code
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
#include "qt/utility/utilityQt.h"
|
||||
#include "qt/view/graphElements/nodeComponents/QtGraphNodeComponent.h"
|
||||
#include "qt/view/graphElements/QtGraphEdge.h"
|
||||
#include "utility/messaging/type/code/MessageCodeShowDefinition.h"
|
||||
#include "utility/messaging/type/MessageGraphNodeHide.h"
|
||||
#include "utility/messaging/type/MessageGraphNodeMove.h"
|
||||
#include "utility/ResourcePaths.h"
|
||||
@@ -400,6 +401,20 @@ void QtGraphNode::onHide()
|
||||
}
|
||||
}
|
||||
|
||||
void QtGraphNode::onShowDefinition()
|
||||
{
|
||||
Id tokenId = getTokenId();
|
||||
|
||||
if (tokenId)
|
||||
{
|
||||
MessageCodeShowDefinition(tokenId).dispatch();
|
||||
}
|
||||
else if (getParent())
|
||||
{
|
||||
getParent()->onShowDefinition();
|
||||
}
|
||||
}
|
||||
|
||||
void QtGraphNode::mousePressEvent(QGraphicsSceneMouseEvent* event)
|
||||
{
|
||||
event->ignore();
|
||||
|
||||
@@ -98,6 +98,7 @@ public:
|
||||
|
||||
virtual void onClick();
|
||||
virtual void onHide();
|
||||
virtual void onShowDefinition();
|
||||
virtual void moved(const Vec2i& oldPosition);
|
||||
|
||||
virtual void updateStyle() = 0;
|
||||
|
||||
@@ -39,6 +39,10 @@ void QtGraphNodeComponentClickable::nodeMouseReleaseEvent(QGraphicsSceneMouseEve
|
||||
{
|
||||
m_graphNode->onHide();
|
||||
}
|
||||
else if (event->modifiers() & Qt::ControlModifier)
|
||||
{
|
||||
m_graphNode->onShowDefinition();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_graphNode->onClick();
|
||||
|
||||
Reference in New Issue
Block a user