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