You've already forked nodeeditor
mirror of
https://github.com/AxioDL/nodeeditor.git
synced 2026-03-30 11:48:31 -07:00
88 lines
1.8 KiB
C++
88 lines
1.8 KiB
C++
#pragma once
|
|
|
|
#include <QtCore/QUuid>
|
|
#include <QtWidgets/QGraphicsObject>
|
|
|
|
#include "Connection.hpp"
|
|
|
|
#include "NodeGeometry.hpp"
|
|
#include "NodeState.hpp"
|
|
|
|
class QGraphicsProxyWidget;
|
|
|
|
namespace QtNodes
|
|
{
|
|
|
|
class NodeGraphicsScene;
|
|
class FlowItemEntry;
|
|
|
|
|
|
class NodeGraphicsObject : public QGraphicsObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
NodeGraphicsObject(NodeGraphicsScene &scene, NodeId node);
|
|
|
|
virtual ~NodeGraphicsObject();
|
|
|
|
NodeId nodeId() { return _nodeId; }
|
|
|
|
NodeId nodeId() const { return _nodeId; }
|
|
|
|
QRectF boundingRect() const override;
|
|
|
|
void setGeometryChanged();
|
|
|
|
/// Visits all attached connections and corrects
|
|
/// their corresponding end points.
|
|
void moveConnections() const;
|
|
|
|
enum { Type = UserType + 1 };
|
|
|
|
int type() const override { return Type; }
|
|
|
|
void lock(bool locked = true);
|
|
|
|
void unlock() { lock(false); }
|
|
|
|
protected:
|
|
void paint(QPainter* painter,
|
|
QStyleOptionGraphicsItem const* option,
|
|
QWidget* widget = 0) override;
|
|
|
|
QVariant itemChange(GraphicsItemChange change, const QVariant &value) override;
|
|
|
|
void mousePressEvent(QGraphicsSceneMouseEvent* event) override;
|
|
|
|
void mouseMoveEvent(QGraphicsSceneMouseEvent* event) override;
|
|
|
|
void mouseReleaseEvent(QGraphicsSceneMouseEvent* event) override;
|
|
|
|
void hoverEnterEvent(QGraphicsSceneHoverEvent* event) override;
|
|
|
|
void hoverLeaveEvent(QGraphicsSceneHoverEvent* event) override;
|
|
|
|
void hoverMoveEvent(QGraphicsSceneHoverEvent *) override;
|
|
|
|
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent* event) override;
|
|
|
|
void contextMenuEvent(QGraphicsSceneContextMenuEvent* event) override;
|
|
|
|
private:
|
|
|
|
//void embedQWidget();
|
|
|
|
private:
|
|
|
|
NodeGraphicsScene & _scene;
|
|
|
|
NodeId _nodeId;
|
|
|
|
bool _locked;
|
|
|
|
// either nullptr or owned by parent QGraphicsItem
|
|
QGraphicsProxyWidget * _proxyWidget;
|
|
};
|
|
}
|