WorkArea.hpp 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. bool readOnly;
  17. QImage *img;
  18. QList < QPoint * >liste_points;
  19. int indexPointClicked;
  20. protected:
  21. void paintEvent (QPaintEvent * event) override;
  22. void mousePressEvent (QMouseEvent * event);
  23. void mouseMoveEvent (QMouseEvent * event);
  24. void mouseReleaseEvent (QMouseEvent * event);
  25. public:
  26. WorkArea (int screenSizeX, int screenSizeY, QWidget * parent = nullptr);
  27. WorkArea (int screenSizeX, int screenSizeY, const std::string & filename, QWidget * parent = nullptr);
  28. WorkArea (int screenSizeX, int screenSizeY, const std::string & imageFilename, const std::string & SLFilename, bool readOnly, QWidget * parent = nullptr);
  29. ~WorkArea ();
  30. void paint (QPainter & painter);
  31. void loadImage (const std::string & filename);
  32. void saveStrengthLine (const std::string & filename);
  33. };
  34. #endif