WorkArea.hpp 1.2 KB

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