Advertisement
Valderman

NodeEdge.hpp

Apr 26th, 2022
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.51 KB | None | 0 0
  1. #pragma once
  2. //---------------------------------------------------------------------------------//
  3.  
  4.  
  5. //---------------------------------------------------------------------------------//
  6. #include <QGraphicsPathItem>
  7. //---------------------------------------------------------------------------------//
  8.  
  9.  
  10. //---------------------------------------------------------------------------------//
  11. #include "Socket.hpp"
  12. //---------------------------------------------------------------------------------//
  13.  
  14.  
  15. //---------------------------------------------------------------------------------//
  16. class NodeEdge : public QGraphicsPathItem
  17. {
  18.     public:
  19.         // constructor:
  20.         explicit NodeEdge(
  21.                     std::shared_ptr<Socket> start_  = nullptr,
  22.                     std::shared_ptr<Socket> finish_ = nullptr
  23.                  );
  24.  
  25.         // deleted:
  26.         NodeEdge(const NodeEdge&)              = delete;
  27.         NodeEdge(NodeEdge&&)                   = delete;
  28.         NodeEdge& operator= (const NodeEdge&)  = delete;
  29.         NodeEdge& operator= (NodeEdge&& other) = delete;
  30.  
  31.         // destructor:
  32.         ~NodeEdge() = default;
  33.  
  34.         // methods:
  35.         void updatePath();
  36.  
  37.     protected:
  38.         virtual void paint(
  39.                         QPainter* painter,
  40.                         const QStyleOptionGraphicsItem*,
  41.                         QWidget*) override;
  42.  
  43.     private:
  44.         std::shared_ptr<Socket> start;
  45.         std::shared_ptr<Socket> finish;
  46.  
  47.         QPainterPath path;
  48. };
  49.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement