![]() |
NDEVR
API Documentation
|
A widget that shows a raster image or icon. More...
Public Types | |
| enum | ViewMode { e_keep , e_zoom_in , e_zoom_out , e_stretch } |
| Enumerates how the image is scaled to fit the widget frame. More... | |
Public Member Functions | |
| ImageView (const StringView &image, QWidget *parent=nullptr) | |
| Constructs an ImageView with an initial image. | |
| ImageView (QWidget *parent=nullptr) | |
| Constructs an empty ImageView. | |
| void | clearImage () |
| Clears the currently displayed image. | |
| QIcon | icon () |
| Returns the currently displayed QIcon. | |
| QSize | minimumSizeHint () const override |
| Returns the minimum size hint, which is zero to allow full shrinking. | |
| void | paintEvent (QPaintEvent *event) override |
| Paints the image within the widget bounds using the current view mode. | |
| void | resizeEvent (QResizeEvent *resize_event) override |
| Handles resize events, updating the cached scaled image. | |
| void | setAlignment (Qt::Alignment alignment) |
| Sets the alignment of the image within the widget. | |
| void | setAllowImageContextMenu (bool allow_context_menu) |
| Sets whether a context menu is shown when right-clicking the image. | |
| void | setAutoResize (bool auto_resize) |
| Sets whether the widget automatically resizes to fit its content. | |
| void | setBlendFactor (fltp04 blend_factor) |
| Sets the blend factor between the primary and blend images. | |
| void | setBlendImage (const QPixmap &blend_image) |
| Sets a secondary image to blend with the primary image. | |
| void | setForceAspectRatioH (bool force) |
| Sets whether to force the image height to maintain the aspect ratio. | |
| void | setForceAspectRatioW (bool force) |
| Sets whether to force the image width to maintain the aspect ratio. | |
| void | setIcon (const QIcon &image, QIcon::Mode mode=QIcon::Mode::Normal) |
| Sets the displayed icon from a QIcon. | |
| void | setIconID (const StringView &image, bool force_refresh=false) |
| Sets the displayed icon by its resource ID. | |
| void | setIconMode (QIcon::Mode mode) |
| Sets the icon rendering mode. | |
| void | setIgnoreDPR (bool ignore) |
| Sets whether to ignore the device pixel ratio when rendering. | |
| void | setImage (const QImage &image) |
| Sets the displayed image from a QImage. | |
| void | setImage (const QPixmap &pixmap) |
| Sets the displayed image from a QPixmap. | |
| void | setImageID (const StringView &image, bool force_refresh=false) |
| Sets the displayed image by its resource ID. | |
| void | setImageScale (fltp08 scale) |
| Sets a custom scale factor for the displayed icon. | |
| void | setSizeHintPixelMetric (QStyle::PixelMetric metric) |
| Sets the size hint based on a QStyle pixel metric. | |
| void | setSmoothResize (bool smooth_resize) |
| Sets whether smooth (bilinear) scaling is used when resizing. | |
| void | setViewMode (ViewMode mode) |
| Sets the view mode controlling how the image fits the widget. | |
| QSize | sizeHint () const override |
| Returns the recommended size for this widget. | |
Protected Member Functions | |
| void | showContextMenuSlot (const QPoint &pos) |
| Shows a context menu at the given position for image operations. | |
| enum ImageView::ViewMode |
Enumerates how the image is scaled to fit the widget frame.
Definition at line 50 of file ImageView.h.
| ImageView::ImageView | ( | const StringView & | image, |
| QWidget * | parent = nullptr ) |
Constructs an ImageView with an initial image.
| [in] | image | The image ID or path to display. |
| [in] | parent | The parent widget. |
Referenced by ImageView().
| ImageView::ImageView | ( | QWidget * | parent = nullptr | ) |
|
inline |
Returns the currently displayed QIcon.
Definition at line 203 of file ImageView.h.
|
inlineoverride |
Returns the minimum size hint, which is zero to allow full shrinking.
Definition at line 141 of file ImageView.h.
|
override |
Paints the image within the widget bounds using the current view mode.
| [in] | event | The paint event. |
|
override |
Handles resize events, updating the cached scaled image.
| [in] | resize_event | The resize event. |
| void ImageView::setAlignment | ( | Qt::Alignment | alignment | ) |
Sets the alignment of the image within the widget.
| [in] | alignment | The Qt alignment flags. |
| void ImageView::setAllowImageContextMenu | ( | bool | allow_context_menu | ) |
Sets whether a context menu is shown when right-clicking the image.
| [in] | allow_context_menu | Whether to enable the context menu. |
|
inline |
Sets whether the widget automatically resizes to fit its content.
| [in] | auto_resize | Whether to enable auto-resize. |
Definition at line 149 of file ImageView.h.
| void ImageView::setBlendFactor | ( | fltp04 | blend_factor | ) |
Sets the blend factor between the primary and blend images.
| [in] | blend_factor | 0.0 = no blend, 1.0 = only blend image. |
| void ImageView::setBlendImage | ( | const QPixmap & | blend_image | ) |
Sets a secondary image to blend with the primary image.
| [in] | blend_image | The pixmap to blend. |
| void ImageView::setForceAspectRatioH | ( | bool | force | ) |
Sets whether to force the image height to maintain the aspect ratio.
| [in] | force | Whether to force height aspect ratio. |
| void ImageView::setForceAspectRatioW | ( | bool | force | ) |
Sets whether to force the image width to maintain the aspect ratio.
| [in] | force | Whether to force width aspect ratio. |
| void ImageView::setIcon | ( | const QIcon & | image, |
| QIcon::Mode | mode = QIcon::Mode::Normal ) |
Sets the displayed icon from a QIcon.
| [in] | image | The QIcon to display. |
| [in] | mode | The icon mode (Normal, Disabled, Active, Selected). |
| void ImageView::setIconID | ( | const StringView & | image, |
| bool | force_refresh = false ) |
Sets the displayed icon by its resource ID.
| [in] | image | The icon resource identifier. |
| [in] | force_refresh | Whether to force reloading even if already set. |
| void ImageView::setIconMode | ( | QIcon::Mode | mode | ) |
Sets the icon rendering mode.
| [in] | mode | The icon mode to use. |
| void ImageView::setIgnoreDPR | ( | bool | ignore | ) |
Sets whether to ignore the device pixel ratio when rendering.
| [in] | ignore | Whether to ignore DPR. |
| void ImageView::setImage | ( | const QImage & | image | ) |
Sets the displayed image from a QImage.
| [in] | image | The QImage to display. |
| void ImageView::setImage | ( | const QPixmap & | pixmap | ) |
Sets the displayed image from a QPixmap.
| [in] | pixmap | The pixmap to display. |
| void ImageView::setImageID | ( | const StringView & | image, |
| bool | force_refresh = false ) |
Sets the displayed image by its resource ID.
| [in] | image | The image resource identifier. |
| [in] | force_refresh | Whether to force reloading even if already set. |
|
inline |
Sets a custom scale factor for the displayed icon.
| [in] | scale | The scale multiplier. |
Definition at line 180 of file ImageView.h.
| void ImageView::setSizeHintPixelMetric | ( | QStyle::PixelMetric | metric | ) |
Sets the size hint based on a QStyle pixel metric.
| [in] | metric | The pixel metric to use for the size hint. |
|
inline |
Sets whether smooth (bilinear) scaling is used when resizing.
| [in] | smooth_resize | Whether to use smooth transformation. |
Definition at line 107 of file ImageView.h.
|
inline |
Sets the view mode controlling how the image fits the widget.
| [in] | mode | The ViewMode to use. |
Definition at line 157 of file ImageView.h.
|
override |
Returns the recommended size for this widget.