Advertisement
Valderman

NodeEdge.cpp

Apr 26th, 2022
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.21 KB | None | 0 0
  1. #include "NodeEdge.hpp"
  2. //---------------------------------------------------------------------------------//
  3.  
  4.  
  5. //---------------------------------------------------------------------------------//
  6. NodeEdge::NodeEdge(
  7.             std::shared_ptr<Socket> start_,
  8.             std::shared_ptr<Socket> finish_
  9.           )
  10.     : QGraphicsPathItem(new QGraphicsPathItem)
  11.     , start(start_)
  12.     , finish(finish_)
  13. {
  14. }
  15. //---------------------------------------------------------------------------------//
  16.  
  17.  
  18. //---------------------------------------------------------------------------------//
  19. void NodeEdge::paint(QPainter* painter, const QStyleOptionGraphicsItem*, QWidget*)
  20. {
  21.     updatePath();
  22.  
  23.     painter->setPen(QPen(QColor("#001000")));
  24.     painter->setBrush(Qt::NoBrush);
  25.     painter->drawPath(path());
  26. }
  27. //---------------------------------------------------------------------------------//
  28.  
  29.  
  30. //---------------------------------------------------------------------------------//
  31. void NodeEdge::updatePath()
  32. {
  33.  
  34.     /*QPainterPath*/ path = QPainterPath(QPointF(0, 0));
  35.     path.lineTo(200, 100);
  36.     setPath(path);
  37. }
  38. //---------------------------------------------------------------------------------//
  39.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement