![]() |
NDEVR
API Documentation
|
A widget that provides a canvas for viewing and editing images with drawing tools. More...
Public Types | |
| enum class | EditMode { e_freehand , e_draw_line , e_draw_rect , e_draw_circle , e_erase , e_draw_text , e_crop , e_size } |
| The active drawing or editing tool for the image editor. More... | |
| enum class | ResizeMode { e_center , e_top_left , e_stretch } |
| Describes how an image is positioned when resized. More... | |
Public Member Functions | |
| QTImageEditorView (QWidget *parent=nullptr) | |
| Constructs a QTImageEditorView widget. | |
| void | checkTextEdit () |
| Checks if the text edit widget needs to be committed or dismissed. | |
| void | clearImage () |
| Clears the image to a blank state. | |
| void | clearSelection () |
| Clears the current selection or crop region. | |
| void | editedSignal () |
| Emitted when the image has been edited. | |
| EditMode | editMode () const |
| Returns the current edit mode. | |
| void | finishText () |
| Finishes and commits the current text editing operation. | |
| QImage | image () const |
| Returns the current image being edited. | |
| bool | isEditing () const |
| Returns whether a drawing or text editing operation is currently in progress. | |
| bool | isModified () const |
| Returns whether the image has been modified since the last save. | |
| void | mousePressLocation (QPointF end_point) |
| Handles a mouse press at the given image-space location. | |
| void | mouseReleaseLocation (QPointF end_point) |
| Handles a mouse release at the given image-space location. | |
| QColor | penColor () const |
| Returns the current pen color. | |
| int | penWidth () const |
| Returns the current pen width. | |
| void | resizeImage (const QSize &new_size, ResizeMode resize_mode, bool lock_aspect_ratio) |
| Resizes the image to the given size using the specified mode. | |
| fltp08 | scale () const |
| Returns the current display scale factor. | |
| void | setEditMode (EditMode edit_mode) |
| Sets the active editing mode (drawing tool). | |
| void | setFillColor (const QColor &color) |
| Sets the fill color used for shape drawing operations. | |
| void | setFont (const QFont &font) |
| Sets the font used for text drawing mode. | |
| void | setImage (QImage image) |
| Sets the image to be displayed and edited. | |
| void | setPenColor (const QColor &color) |
| Sets the pen color used for drawing operations. | |
| void | setPenWidth (fltp08 width) |
| Sets the pen width used for drawing operations. | |
| void | setScale (fltp08 scale) |
| Sets the display scale factor for the image. | |
| QSize | sizeHint () const override |
| Returns the recommended size for this widget. | |
| QImage | undoImage () const |
| Returns the image state before the last edit, for undo purposes. | |
| void | updateCursorLocation (QPointF end_point) |
| Updates the cursor position during a drag operation. | |
Protected Member Functions | |
| void | drawText () |
| Renders text onto the image from the active text edit widget. | |
| void | mouseMoveEvent (QMouseEvent *event) override |
| Handles mouse move events for drawing. | |
| void | mousePressEvent (QMouseEvent *event) override |
| Handles mouse press events for drawing. | |
| void | mouseReleaseEvent (QMouseEvent *event) override |
| Handles mouse release events for drawing. | |
| void | paintEvent (QPaintEvent *event) override |
| Paints the editor view including the image and any active drawing overlays. | |
| void | resizeEvent (QResizeEvent *event) override |
| Handles resize events to update the background image. | |
A widget that provides a canvas for viewing and editing images with drawing tools.
Definition at line 24 of file QTImageEditor.h.
|
strong |
The active drawing or editing tool for the image editor.
Definition at line 40 of file QTImageEditor.h.
|
strong |
Describes how an image is positioned when resized.
| Enumerator | |
|---|---|
| e_center | Centers the image within the new size. |
| e_top_left | Anchors the image to the top-left corner. |
| e_stretch | Stretches the image to fill the new size. |
Definition at line 31 of file QTImageEditor.h.
| QTImageEditorView::QTImageEditorView | ( | QWidget * | parent = nullptr | ) |
Constructs a QTImageEditorView widget.
| [in] | parent | The parent widget. |
|
inline |
Returns the current edit mode.
Definition at line 167 of file QTImageEditor.h.
|
inline |
Returns the current image being edited.
Definition at line 97 of file QTImageEditor.h.
Referenced by resizeEvent(), and setImage().
| bool QTImageEditorView::isEditing | ( | ) | const |
Returns whether a drawing or text editing operation is currently in progress.
|
inline |
Returns whether the image has been modified since the last save.
Definition at line 77 of file QTImageEditor.h.
|
overrideprotected |
Handles mouse move events for drawing.
| [in] | event | The mouse event. |
|
overrideprotected |
Handles mouse press events for drawing.
| [in] | event | The mouse event. |
| void QTImageEditorView::mousePressLocation | ( | QPointF | end_point | ) |
Handles a mouse press at the given image-space location.
| [in] | end_point | The press location in image coordinates. |
|
overrideprotected |
Handles mouse release events for drawing.
| [in] | event | The mouse event. |
| void QTImageEditorView::mouseReleaseLocation | ( | QPointF | end_point | ) |
Handles a mouse release at the given image-space location.
| [in] | end_point | The release location in image coordinates. |
|
overrideprotected |
Paints the editor view including the image and any active drawing overlays.
| [in] | event | The paint event. |
|
inline |
|
inline |
Returns the current pen width.
Definition at line 87 of file QTImageEditor.h.
|
overrideprotected |
Handles resize events to update the background image.
| [in] | event | The resize event. |
References image(), and resizeImage().
| void QTImageEditorView::resizeImage | ( | const QSize & | new_size, |
| ResizeMode | resize_mode, | ||
| bool | lock_aspect_ratio ) |
Resizes the image to the given size using the specified mode.
| [in] | new_size | The new image dimensions. |
| [in] | resize_mode | How to position the image within the new size. |
| [in] | lock_aspect_ratio | Whether to preserve the image aspect ratio. |
Referenced by resizeEvent().
|
inline |
Returns the current display scale factor.
Definition at line 119 of file QTImageEditor.h.
Referenced by setScale().
| void QTImageEditorView::setEditMode | ( | EditMode | edit_mode | ) |
Sets the active editing mode (drawing tool).
| [in] | edit_mode | The edit mode to activate. |
|
inline |
Sets the fill color used for shape drawing operations.
| [in] | color | The fill color. |
Definition at line 72 of file QTImageEditor.h.
| void QTImageEditorView::setFont | ( | const QFont & | font | ) |
Sets the font used for text drawing mode.
| [in] | font | The font to use. |
| void QTImageEditorView::setImage | ( | QImage | image | ) |
| void QTImageEditorView::setPenColor | ( | const QColor & | color | ) |
Sets the pen color used for drawing operations.
| [in] | color | The color to use for the pen. |
| void QTImageEditorView::setPenWidth | ( | fltp08 | width | ) |
Sets the pen width used for drawing operations.
| [in] | width | The width of the pen in pixels. |
| void QTImageEditorView::setScale | ( | fltp08 | scale | ) |
|
override |
Returns the recommended size for this widget.
|
inline |
Returns the image state before the last edit, for undo purposes.
Definition at line 129 of file QTImageEditor.h.
| void QTImageEditorView::updateCursorLocation | ( | QPointF | end_point | ) |
Updates the cursor position during a drag operation.
| [in] | end_point | The current cursor location in image coordinates. |