Added simple layouting functions (implementations for simple grid and circle layout). Also the graph displays class members and connections (edges) to or from them "correctly" now. fortune cookie message = Your exotic ideas will lead you to many exciting new adventures.
29 lines
778 B
C++
29 lines
778 B
C++
#include "qt/view/graphElements/QtGraphNodeMouseMovable.h"
|
|
|
|
#include "qgraphicssceneevent.h"
|
|
|
|
#include "qt/view/graphElements/QtGraphEdge.h"
|
|
|
|
QtGraphNodeMouseMovable::QtGraphNodeMouseMovable(const Vec2i& position, const std::string& name, const Id tokenId)
|
|
: QtGraphNode(position, name, tokenId)
|
|
{
|
|
}
|
|
|
|
QtGraphNodeMouseMovable::~QtGraphNodeMouseMovable()
|
|
{
|
|
}
|
|
|
|
void QtGraphNodeMouseMovable::mousePressEvent(QGraphicsSceneMouseEvent* event)
|
|
{
|
|
m_mouseOffset.x = event->pos().x();
|
|
m_mouseOffset.y = event->pos().y();
|
|
}
|
|
|
|
void QtGraphNodeMouseMovable::mouseMoveEvent(QGraphicsSceneMouseEvent* event)
|
|
{
|
|
this->setPos(event->scenePos().x() - m_mouseOffset.x, event->scenePos().y() - m_mouseOffset.y);
|
|
|
|
Vec2i p(event->scenePos().x(), event->scenePos().y());
|
|
|
|
notifyEdgesAfterMove();
|
|
} |