WorkArea.hpp 872 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #ifndef WORKAREA_HPP
  2. #define WORKAREA_HPP
  3. #include <string>
  4. #include <QWidget>
  5. #include <QPainter>
  6. #include <QMouseEvent>
  7. #include <QPoint>
  8. #include <QImage>
  9. class WorkArea: public QWidget
  10. {
  11. Q_OBJECT
  12. private:
  13. const int taillePoint = 10;
  14. const int epaisseurLigne = 3;
  15. unsigned int screenSizeX, screenSizeY;
  16. QImage *img;
  17. QList < QPoint * >liste_points;
  18. int indexPointClicked;
  19. protected:
  20. void paintEvent (QPaintEvent * event) override;
  21. void mousePressEvent (QMouseEvent * event);
  22. void mouseMoveEvent (QMouseEvent * event);
  23. void mouseReleaseEvent (QMouseEvent * event);
  24. public:
  25. WorkArea (int screenSizeX, int screenSizeY, QWidget * parent = nullptr);
  26. ~WorkArea ();
  27. void paint (QPainter & painter);
  28. void loadImage (const std::string & filename);
  29. void saveStrengthLine (const std::string & filename);
  30. };
  31. #endif