The Canvas class represents a custom widget for drawing on a canvas.
More...
#include <canvas.h>
|
| | Canvas (QWidget *parent=nullptr) |
| | Constructs a new Canvas object.
|
| |
| void | clearImage () |
| | Clears the image on the canvas.
|
| |
| void | restartCanvas () |
| | Restarts the canvas by clearing the image and resetting the drawing state.
|
| |
| Eigen::MatrixXd | getMatrix () |
| | Gets the matrix representation of the image on the canvas.
|
| |
| bool | isDrawing () |
| | Checks if the user is currently drawing on the canvas.
|
| |
|
| void | mousePressEvent (QMouseEvent *event) override |
| | Handles the mouse press event.
|
| |
| void | mouseMoveEvent (QMouseEvent *event) override |
| | Handles the mouse move event.
|
| |
| void | mouseReleaseEvent (QMouseEvent *event) override |
| | Handles the mouse release event.
|
| |
The Canvas class represents a custom widget for drawing on a canvas.
This class extends QLabel and provides functionality for drawing on a canvas using the mouse.
◆ Canvas()
| Canvas::Canvas |
( |
QWidget * |
parent = nullptr | ) |
|
|
explicit |
Constructs a new Canvas object.
- Parameters
-
◆ clearImage()
| void Canvas::clearImage |
( |
| ) |
|
Clears the image on the canvas.
◆ getMatrix()
| Eigen::MatrixXd Canvas::getMatrix |
( |
| ) |
|
Gets the matrix representation of the image on the canvas.
- Returns
- The matrix representation of the image.
◆ isDrawing()
| bool Canvas::isDrawing |
( |
| ) |
|
|
inline |
Checks if the user is currently drawing on the canvas.
- Returns
- True if the user is drawing, false otherwise.
◆ mouseMoveEvent()
| void Canvas::mouseMoveEvent |
( |
QMouseEvent * |
event | ) |
|
|
overrideprotected |
Handles the mouse move event.
- Parameters
-
◆ mousePressEvent()
| void Canvas::mousePressEvent |
( |
QMouseEvent * |
event | ) |
|
|
overrideprotected |
Handles the mouse press event.
- Parameters
-
◆ mouseReleaseEvent()
| void Canvas::mouseReleaseEvent |
( |
QMouseEvent * |
event | ) |
|
|
overrideprotected |
Handles the mouse release event.
- Parameters
-
◆ restartCanvas()
| void Canvas::restartCanvas |
( |
| ) |
|
Restarts the canvas by clearing the image and resetting the drawing state.
The documentation for this class was generated from the following files: