WorkArea.hpp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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 loadSL (const std::string & filename);
  33. void saveStrengthLine (const std::string & filename);
  34. void setReadOnly(bool readOnly);
  35. };
  36. #endif