#ifndef VISUALIZATIONWIEW_H #define VISUALIZATIONWIEW_H #include class QTimer; class Sheet; /// Widget that paints the state of the heat surface class VisualizationWiew : public QWidget { Q_OBJECT Q_DISABLE_COPY(VisualizationWiew) protected: /// Updates the interfaz each refresh time QTimer* refreshTimer = nullptr; /// The simulation data source Sheet* sheet = nullptr; public: /// Constructor explicit VisualizationWiew(QWidget* parent = nullptr); /// Get access to the sheet inline Sheet* getSheet() { return this->sheet; } signals: /// Emitted each time the visualization is updated void refreshed(); public slots: /// Set the refresh rate as a text for easy signal-slot connection void setRefreshRateText(const QString& millisecondsText); /// Set the refresh rate void setRefreshRate(int milliseconds); /// Set the data source void setSheet(Sheet* sheet); /// Start refreshing the interface /// @param epsilon The simulation will stop when all temperature changes /// will be less than this value void start(double epsilon); /// Stop refreshing the interface void stop(); protected: /// Called each time the window is refreshed virtual void paintEvent(QPaintEvent *event) override; }; #endif // VISUALIZATIONWIEW_H