graphpoint.cpp 899 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #include "graphpoint.h"
  2. GraphPoint::GraphPoint(const GitOid &commitOid, QObject* parent) : QObject(parent)
  3. ,m_commitOid(commitOid)
  4. ,m_x(0)
  5. ,m_y(0)
  6. {
  7. }
  8. GraphPoint::GraphPoint(const GitOid &commitOid, int x, int y, const QString &color, QObject *parent) : QObject(parent)
  9. ,m_commitOid(commitOid)
  10. ,m_x(x)
  11. ,m_y(y)
  12. ,m_color(color)
  13. {
  14. }
  15. GraphPoint::~GraphPoint()
  16. {
  17. }
  18. void GraphPoint::setX(int x)
  19. {
  20. if (m_x == x) {
  21. return;
  22. }
  23. m_x = x;
  24. emit xChanged(x);
  25. }
  26. void GraphPoint::setY(int y)
  27. {
  28. if (m_y == y) {
  29. return;
  30. }
  31. m_y = y;
  32. emit yChanged(y);
  33. }
  34. void GraphPoint::setColor(const QString& color)
  35. {
  36. if (m_color == color) {
  37. return;
  38. }
  39. m_color = color;
  40. emit colorChanged(color);
  41. }
  42. void GraphPoint::addChildPoint(GraphPoint* point)
  43. {
  44. if(m_childPoints.indexOf(point) < 0) {
  45. m_childPoints.append(point);
  46. }
  47. }