A QGraphicsScene subclass that provides simple drawing capabilities. More...
#include <SimpleDrawingScene.h>
Public Types | |
enum class | DrawingMode { DrawingMode , EditMode } |
Defines the interaction modes for the scene. More... | |
enum class | SupportItemItem { Line , Rect , Ellipse , FreeHand } |
The types of drawable shapes supported by the scene. More... | |
Public Slots | |
void | undo () |
Undoes the last drawing operation. | |
void | redo () |
Redoes the last undone operation. | |
Public Member Functions | |
SimpleDrawingScene (QObject *parent=nullptr) | |
Constructs a SimpleDrawingScene. | |
void | setColor (const QColor &color) |
Sets the current drawing color. | |
QColor | getColor () const |
Gets the current drawing color. | |
void | setPenWidth (const short penWidth) |
Sets the pen width for drawing. | |
short | getPenWidth () const |
Gets the current pen width. | |
void | setItemType (const SupportItemItem i) |
Sets the current drawing item type. | |
void | setMode (const DrawingMode m) |
Sets the interaction mode. | |
QImage | exportImage () |
Exports the current scene as an image. | |
A QGraphicsScene subclass that provides simple drawing capabilities.
This class implements a drawing canvas with multiple shape types, undo/redo functionality, and different interaction modes.
|
strong |
|
strong |
|
explicit |
Constructs a SimpleDrawingScene.
parent | The parent QObject (optional) |
QImage SimpleDrawingScene::exportImage | ( | ) |
Exports the current scene as an image.
|
inline |
Gets the current drawing color.
|
inline |
Gets the current pen width.
|
inline |
Sets the current drawing color.
color | The color to use for new drawings |
|
inline |
Sets the current drawing item type.
i | The shape type to create (from SupportItemItem enum) |
void SimpleDrawingScene::setMode | ( | const DrawingMode | m | ) |
Sets the interaction mode.
m | The mode to set (from DrawingMode enum) |
|
inline |
Sets the pen width for drawing.
penWidth | The width in pixels for new drawings |