34#include <NDEVR/QTTools.h>
109 m_smooth_transform = smooth_resize;
121 void setIcon(
const QIcon& image, QIcon::Mode mode = QIcon::Mode::Normal);
151 m_auto_resize = auto_resize;
182 m_icon_scale = scale;
203 QIcon
icon() {
return m_icon; };
209 void setupIconListener();
211 QRect alignRect(QSize size, QSize preferred_size)
const;
214 bool m_auto_resize =
true;
215 bool m_smooth_transform =
true;
216 bool m_force_aspect_ratio_width =
false;
217 bool m_force_aspect_ratio_height =
false;
218 bool m_ignore_device_pixel_ratio =
false;
220 QMenu* m_menu =
nullptr;
223 QPixmap m_blend_image;
227 QIcon::Mode m_icon_mode;
228 QStyle::PixelMetric m_size_hint_pixel_metric;
229 Qt::Alignment m_alignment;
ViewMode
Enumerates how the image is scaled to fit the widget frame.
@ e_zoom_out
Scale the entire image to fit within the frame.
@ e_zoom_in
Crop the image to fill the frame.
@ e_keep
No size adjustment; display at native resolution.
@ e_stretch
Stretch the image to exactly match the frame dimensions.
void setImage(const QImage &image)
Sets the displayed image from a QImage.
void setBlendFactor(fltp04 blend_factor)
Sets the blend factor between the primary and blend images.
void setSmoothResize(bool smooth_resize)
Sets whether smooth (bilinear) scaling is used when resizing.
QSize minimumSizeHint() const override
Returns the minimum size hint, which is zero to allow full shrinking.
void setIgnoreDPR(bool ignore)
Sets whether to ignore the device pixel ratio when rendering.
void paintEvent(QPaintEvent *event) override
Paints the image within the widget bounds using the current view mode.
void setSizeHintPixelMetric(QStyle::PixelMetric metric)
Sets the size hint based on a QStyle pixel metric.
void clearImage()
Clears the currently displayed image.
void setAutoResize(bool auto_resize)
Sets whether the widget automatically resizes to fit its content.
ImageView(const StringView &image, QWidget *parent=nullptr)
Constructs an ImageView with an initial image.
void setIcon(const QIcon &image, QIcon::Mode mode=QIcon::Mode::Normal)
Sets the displayed icon from a QIcon.
void setAllowImageContextMenu(bool allow_context_menu)
Sets whether a context menu is shown when right-clicking the image.
void setImageScale(fltp08 scale)
Sets a custom scale factor for the displayed icon.
void setAlignment(Qt::Alignment alignment)
Sets the alignment of the image within the widget.
void setForceAspectRatioH(bool force)
Sets whether to force the image height to maintain the aspect ratio.
QIcon icon()
Returns the currently displayed QIcon.
void setIconMode(QIcon::Mode mode)
Sets the icon rendering mode.
void resizeEvent(QResizeEvent *resize_event) override
Handles resize events, updating the cached scaled image.
void setBlendImage(const QPixmap &blend_image)
Sets a secondary image to blend with the primary image.
void setImage(const QPixmap &pixmap)
Sets the displayed image from a QPixmap.
QSize sizeHint() const override
Returns the recommended size for this widget.
void setIconID(const StringView &image, bool force_refresh=false)
Sets the displayed icon by its resource ID.
void setViewMode(ViewMode mode)
Sets the view mode controlling how the image fits the widget.
ImageView(QWidget *parent=nullptr)
Constructs an empty ImageView.
void setImageID(const StringView &image, bool force_refresh=false)
Sets the displayed image by its resource ID.
void setForceAspectRatioW(bool force)
Sets whether to force the image width to maintain the aspect ratio.
void showContextMenuSlot(const QPoint &pos)
Shows a context menu at the given position for image operations.
A ResourceListener which will always be executed on the main UI thread and can be tied to a Qt Object...
The core String View class for the NDEVR API.
The core String class for the NDEVR API.
The primary namespace for the NDEVR SDK.
float fltp04
Defines an alias representing a 4 byte floating-point number Bit layout is as follows: -Sign: 1 bit a...
double fltp08
Defines an alias representing an 8 byte floating-point number.