class
CanvasThe class where all the magic happens.
Contents
- Reference
This contains all behaviour related to painting itself.
All of mousePositionChanged, mouseReleased, undo, redo, changeColor, changeWidth are signals that other than modifying the local canvas accordingly, they also send the event over the network to the other user.
Public functions
- auto paint(QPainter* painter) -> void -> auto override
Public slots
- void mousePositionChanged(QPoint const& pos)
- void mouseReleased()
- void undo()
- void redo()
- void onReceivedMessage(QString const& msg)
- void changeColor(QColor const& color)
- void changeWidth(const int width)
Function documentation
auto sk:: Canvas:: paint(QPainter* painter) -> void override
Draws the canvas.
void sk:: Canvas:: mousePositionChanged(QPoint const& pos) public slot
This triggers a paint event on the canvas.
void sk:: Canvas:: mouseReleased() public slot
This triggers 'creating a new layer' event.
void sk:: Canvas:: undo() public slot
This goes back to the previously stored layer.
void sk:: Canvas:: onReceivedMessage(QString const& msg) public slot
Called when a message through the network is received. Also handles the actual events that were received.
void sk:: Canvas:: changeColor(QColor const& color) public slot
Changes the color of the pen/brush to draw with.
void sk:: Canvas:: changeWidth(const int width) public slot
Changes the size of the brush/pen.