#pragma once #include #include #include "gui/network/SocketGraphic.h" #include "gui/network/NodeEdgeGraphic.h" #include class NodeGraphic : public QGraphicsItem { public: NodeGraphic(QGraphicsItem *parent = nullptr); QRectF boundingRect() const override; SocketGraphic* getInput(int indx) const; SocketGraphic* getOutput(int indx) const; // void addEdge(NodeEdgeGraphic* edge); void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override; // void setInputEdge(NodeEdgeGraphic* edge, int indx); // void setOutputEdge(NodeEdgeGraphic* edge, int indx); private: void initSockets(); std::vector inputs_; std::vector outputs_; // std::vector edges_; std::string title_=""; int maxTitleLen_=10; QRectF bodyRect_; int socketSize_ = 1; int inputSocketCnt_=0; int outputSocketCnt_=0; protected: QVariant itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value) override; };