/*********************************************************************/ /* */ /* Copyright 2022-2023 RĂ©mi Synave - remi.synave@univ-littoral.fr */ /* */ /* This file is part of DSL. */ /* This software uses Qt to build the Graphical User Interface */ /* https://www.qt.io/ */ /* */ /* DSL is free software: you can redistribute it and/or modify */ /* it under the terms of the GNU General Public License as published */ /* by the Free Software Foundation, either version 3 of the License, */ /* or (at your option) any later version. */ /* */ /* DSL is distributed in the hope that it will be useful, */ /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ /* GNU General Public License for more details. */ /* */ /* You should have received a copy of the GNU General Public License */ /* along with DSL. If not, see . */ /* */ /*********************************************************************/ #ifndef WORKAREA_HPP #define WORKAREA_HPP #include #include #include #include #include #include #include #include "StrengthLine.hpp" class WorkArea: public QWidget { Q_OBJECT private: const int taillePoint = 10; const int epaisseurLigne = 3; unsigned int screenSizeX, screenSizeY; QList < QPoint * >liste_points; int indexPointClicked; protected: void paintEvent (QPaintEvent * event) override; void mousePressEvent (QMouseEvent * event); void mouseMoveEvent (QMouseEvent * event); void mouseReleaseEvent (QMouseEvent * event); public: WorkArea (int screenSizeX, int screenSizeY, QWidget * parent = nullptr); WorkArea (int screenSizeX, int screenSizeY, const std::string & filename, QWidget * parent = nullptr); ~WorkArea (); void loadImage (const std::string & filename); void paint (QPainter & painter); void addSL(const StrengthLine *sl); double getDistance() const; signals: void click(); }; #endif