ui: GraphView can set active tokenId on node clicked
By now the graph displays the active node, without neighbours or anything, and clicking a node sets the active token id to the clicked nodes id. fortune cookie message = Be prepared to accept an exciting opportunity in the future.
This commit is contained in:
@@ -5,7 +5,8 @@
|
||||
|
||||
#include "qt/view/graphElements/QtGraphEdge.h"
|
||||
|
||||
QtGraphNode::QtGraphNode(const Vec2i& position, const std::string& name)
|
||||
QtGraphNode::QtGraphNode(const Vec2i& position, const std::string& name, const Id tokenId)
|
||||
: GraphNode(tokenId)
|
||||
{
|
||||
this->setRect(0, 0, 100, 100);
|
||||
this->setPos(position.x, position.y);
|
||||
@@ -21,6 +22,11 @@ QtGraphNode::~QtGraphNode()
|
||||
{
|
||||
}
|
||||
|
||||
std::string QtGraphNode::getName()
|
||||
{
|
||||
return m_text->toPlainText().toStdString();
|
||||
}
|
||||
|
||||
Vec2i QtGraphNode::getPosition()
|
||||
{
|
||||
return Vec2i(this->scenePos().x(), this->scenePos().y());
|
||||
@@ -53,6 +59,9 @@ void QtGraphNode::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
m_mouseOffset.x = event->pos().x();
|
||||
m_mouseOffset.y = event->pos().y();
|
||||
|
||||
MessageActivateToken message(m_tokenId);
|
||||
message.dispatch();
|
||||
}
|
||||
|
||||
void QtGraphNode::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
||||
|
||||
Reference in New Issue
Block a user