forme.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. #ifndef Forme_H
  2. #define Forme_H
  3. #include "chemin.h"
  4. #include <QList>
  5. //#include <QtWidgets/QtWidgets>
  6. class Forme: public QGraphicsItem
  7. {
  8. public:
  9. //Forme(QGraphicsItem *parent=NULL);
  10. void lineto(float x, float y);
  11. void lineTo(QPointF target_node);
  12. Forme(QPointF origin, QGraphicsItem *parent=NULL);
  13. // Forme(const Forme&);
  14. Forme& operator=(Forme const& sourcedecopie);
  15. void setcolor(QString fcolor);
  16. void setstrokecolor(QString scolor);
  17. void setstrokewidth(QString width);
  18. //~Forme();
  19. QList<drawPath> getshape() ;
  20. void setrealdraw(bool);
  21. signals:
  22. void formeclicked(void) const;
  23. void ping(void) const;
  24. private:
  25. QStringList pathstringlist;
  26. bool tempbroke;
  27. //void breakpath(QPointF dest);
  28. //int drpathsnmbr;
  29. QStringList pathstringcomputedlist;
  30. QStringList getcomputedstring(void) const;
  31. QStringList getstring(void) const;
  32. void setstring(QStringList toset);
  33. QColor strokecolor;
  34. QColor fillcolor;
  35. // Forme();
  36. // Forme(QGraphicsItem *parent);
  37. //? Forme(const QGraphicsObject&);
  38. //public methods:
  39. QRectF boundingRect() const;
  40. void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
  41. QWidget *widget);
  42. void pingname(void) const;
  43. QPainterPath getpath() const;
  44. int getnode_number() const;
  45. int getpath_number() const;
  46. // void add_shape(QStringList *toadd);
  47. //////////////////////////////////////////////////////////////////////////////
  48. //////////////////////////////////////////////////////////////////////////////
  49. QPointF lastpoint;
  50. bool isrealdraw;
  51. QPen pen;
  52. QBrush brush;
  53. //QString name;
  54. enum startendpath_mode{none,topleft,bottomleft,topright,bottomright};
  55. startendpath_mode endpath_mode;
  56. startendpath_mode startpath_mode;
  57. //drawPath *pth_start;
  58. //drawPath *pth_end;
  59. bool visiblestart;
  60. bool visibleend;
  61. QPainterPath path;
  62. QPointF currentPosition(void);
  63. int pathsnmbr;
  64. int nodenumber;
  65. QList<drawPath> shape;
  66. protected:
  67. void mousePressEvent(QGraphicsSceneMouseEvent *event);
  68. //void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
  69. void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
  70. void dragEnterEvent(QGraphicsSceneDragDropEvent *event);
  71. void dragLeaveEvent(QGraphicsSceneDragDropEvent *event);
  72. void dropEvent(QGraphicsSceneDragDropEvent *event);
  73. /* void dragEnterEvent(QDragEnterEvent *event);
  74. void dragLeaveEvent(QDragLeaveEvent *event);
  75. void dragMoveEvent(QDragMoveEvent *event);
  76. void dropEvent(QDropEvent *event);
  77. void mousePressEvent(QMouseEvent *event);
  78. */
  79. };
  80. #endif // Forme_H