chemin.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #ifndef DRAWPATH_H
  2. #define DRAWPATH_H
  3. #include <QPointF>
  4. #include <QPainterPath>
  5. #include <QStringList>
  6. #include <QPen>
  7. #include <QGraphicsItem>
  8. #include <QMouseEvent>
  9. //#include <QtWidgets>
  10. #include <iostream>
  11. class drawPath: public QGraphicsItem
  12. {
  13. public:
  14. void setrealdraw(bool param);
  15. //constructors and destructors
  16. drawPath();
  17. ~drawPath();
  18. drawPath(QPointF origine);
  19. drawPath(QPointF origine,QPointF desti);
  20. //copy constructor
  21. drawPath (drawPath const& sourcedecopie);
  22. drawPath& operator=(drawPath const&
  23. sourcedecopie);
  24. /* drawPath& operator=( drawPath const){
  25. // QPainterPath path(arg.path);
  26. }
  27. */
  28. //public methods:
  29. QRectF boundingRect() const;
  30. //drawPath(QStringList *toadd);
  31. void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
  32. QWidget *widget);
  33. void lineTo(QPointF desti);
  34. void moveTo(QPointF desti);
  35. //getters:
  36. QPainterPath getpath() const;
  37. bool isvalid(void) const;
  38. int getnode_number() const;
  39. private:
  40. bool isrealdraw;
  41. // bool is_start;
  42. // bool is_end;
  43. QPointF origin;
  44. QPointF dest;
  45. // bool visible;
  46. // void lineTo(float x, float y);
  47. //QPointF currentPosition();
  48. QPainterPath path;
  49. int nodes_number;
  50. protected:
  51. void mousePressEvent(QMouseEvent *event);
  52. };
  53. /*
  54. bool operator==( drawPath a, bool b){
  55. return a.isvalid()&&b;
  56. };*/
  57. #endif // DRAWPATH_H