QElectroTech 0.200.1-dev
Loading...
Searching...
No Matches
ClickableImageLabel Class Reference

The ClickableImageLabel class Displays an image scaled to fit a reasonable dialog size, but always samples the picked color from the original, full-resolution image at the corresponding coordinate – never from the (possibly smoothly interpolated, and therefore color-blended) scaled-down pixmap being displayed, which would make the picked color subtly wrong for exactly the pixels near an edge where it matters most. More...

#include <imagetransparentcolordialog.h>

Inherits QLabel.

Collaboration diagram for ClickableImageLabel:
Collaboration graph

Signals

void colorPicked (const QColor &color)

Public Member Functions

 ClickableImageLabel (const QImage &sourceImage, QWidget *parent=nullptr)
 ClickableImageLabel::ClickableImageLabel.
QImage displayImage () const

Protected Member Functions

void mousePressEvent (QMouseEvent *event) override
 ClickableImageLabel::mousePressEvent Maps the click back to the original, full-resolution image before sampling – see the class-level comment for why.

Private Attributes

QImage m_source
QImage m_displayImage
qreal m_displayScale = 1.0

Detailed Description

The ClickableImageLabel class Displays an image scaled to fit a reasonable dialog size, but always samples the picked color from the original, full-resolution image at the corresponding coordinate – never from the (possibly smoothly interpolated, and therefore color-blended) scaled-down pixmap being displayed, which would make the picked color subtly wrong for exactly the pixels near an edge where it matters most.

Constructor & Destructor Documentation

◆ ClickableImageLabel()

ClickableImageLabel::ClickableImageLabel ( const QImage & sourceImage,
QWidget * parent = nullptr )
explicit

ClickableImageLabel::ClickableImageLabel.

Parameters
sourceImagethe full-resolution image to display and sample from
parent

Member Function Documentation

◆ colorPicked

void ClickableImageLabel::colorPicked ( const QColor & color)
signal
Here is the caller graph for this function:

◆ displayImage()

QImage ClickableImageLabel::displayImage ( ) const
inline

The same downsampled image already computed for display – reused as the live-preview source so a tolerance drag runs its per-tick colour-key pass against a small image instead of the full-resolution one, which on a large source (a scanned schematic background, several Mpx) made every intermediate slider tick visibly lag. resultPixmap() still computes the final, committed result from the true full-resolution source – only the live preview is downsampled.

◆ mousePressEvent()

void ClickableImageLabel::mousePressEvent ( QMouseEvent * event)
overrideprotected

ClickableImageLabel::mousePressEvent Maps the click back to the original, full-resolution image before sampling – see the class-level comment for why.

Parameters
event
Here is the call graph for this function:

Member Data Documentation

◆ m_displayImage

QImage ClickableImageLabel::m_displayImage
private

◆ m_displayScale

qreal ClickableImageLabel::m_displayScale = 1.0
private

◆ m_source

QImage ClickableImageLabel::m_source
private

The documentation for this class was generated from the following files: