WorkArea.hpp 1.4 KB

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