Quark  0.1
ImageViewerPanel Class Reference

A widget for displaying an image, with support for zooming, rotation, selection, and cropping. More...

#include <ImageViewerPanel.h++>

Inheritance diagram for ImageViewerPanel:

Public Slots

void setImage (QPixmap pixmap)
 Sets the image to be displayed by the widget. More...
 
void zoomIn ()
 Zooms the image in. More...
 
void zoomOut ()
 Zooms the image out. More...
 
void zoomToFit (const QRect &rect)
 Zooms the image so that it fits optimally within the given rectangle. More...
 
void zoomReset ()
 Resets the scale factor to 1.0. More...
 
void rotateLeft ()
 Rotates the image 90 degrees counterclockwise. More...
 
void rotateRight ()
 Rotates the image 90 degrees clockwise. More...
 
void crop (const QRect &rect)
 Crops the image to the specified region. More...
 
void clearSelection ()
 Clears the selection, if any. More...
 

Signals

void imageSizeChanged (QSize size)
 Emitted when the size of the image changes. More...
 
void zoomScaleChanged (float scale)
 Emitted when the zoom scale factor changes. More...
 

Public Member Functions

 ImageViewerPanel (QWidget *parent=NULL)
 Constructs a new ImageViewerPanel. More...
 
virtual ~ImageViewerPanel ()
 Destructor. More...
 
void setAllowSelection (bool allowSelection)
 Enables or disables selection. More...
 
QPixmap image () const
 Returns the image that is currently displayed by the widget. More...
 
int imageWidth () const
 Returns the width, in pixels, of the image that is currently displayed by the widget. More...
 
int imageHeight () const
 Returns the height, in pixels, of the image that is currently displayed by the widget. More...
 
QRect selection () const
 Returns the current selection, or an empty rectangle if there is none. More...
 
float scaleFactor () const
 Returns the current scale factor. More...
 

Protected Member Functions

virtual void mousePressEvent (QMouseEvent *event)
 
virtual void mouseMoveEvent (QMouseEvent *event)
 

Detailed Description

A widget for displaying an image, with support for zooming, rotation, selection, and cropping.

Author
Mark Lindner

Constructor & Destructor Documentation

◆ ImageViewerPanel()

ImageViewerPanel ( QWidget *  parent = NULL)

Constructs a new ImageViewerPanel.

◆ ~ImageViewerPanel()

virtual ~ImageViewerPanel ( )
virtual

Destructor.

Member Function Documentation

◆ clearSelection

void clearSelection ( )
slot

Clears the selection, if any.

◆ crop

void crop ( const QRect &  rect)
slot

Crops the image to the specified region.

◆ image()

QPixmap image ( ) const
inline

Returns the image that is currently displayed by the widget.

◆ imageHeight()

int imageHeight ( ) const
inline

Returns the height, in pixels, of the image that is currently displayed by the widget.

◆ imageSizeChanged

void imageSizeChanged ( QSize  size)
signal

Emitted when the size of the image changes.

◆ imageWidth()

int imageWidth ( ) const
inline

Returns the width, in pixels, of the image that is currently displayed by the widget.

◆ mouseMoveEvent()

virtual void mouseMoveEvent ( QMouseEvent *  event)
protectedvirtual

◆ mousePressEvent()

virtual void mousePressEvent ( QMouseEvent *  event)
protectedvirtual

◆ rotateLeft

void rotateLeft ( )
slot

Rotates the image 90 degrees counterclockwise.

◆ rotateRight

void rotateRight ( )
slot

Rotates the image 90 degrees clockwise.

◆ scaleFactor()

float scaleFactor ( ) const
inline

Returns the current scale factor.

◆ selection()

QRect selection ( ) const

Returns the current selection, or an empty rectangle if there is none.

◆ setAllowSelection()

void setAllowSelection ( bool  allowSelection)

Enables or disables selection.

When enabled, dragging the mouse across the image will crate a rubber-band selection box. Selection is disabled by default.

◆ setImage

void setImage ( QPixmap  pixmap)
slot

Sets the image to be displayed by the widget.

◆ zoomIn

void zoomIn ( )
slot

Zooms the image in.

The scale factor is multiplied by 1.25, unless the result would be greater than 4.0.

◆ zoomOut

void zoomOut ( )
slot

Zooms the image out.

The scale factor is divided by 1.25, unless the result would be greater than 0.25.

◆ zoomReset

void zoomReset ( )
slot

Resets the scale factor to 1.0.

◆ zoomScaleChanged

void zoomScaleChanged ( float  scale)
signal

Emitted when the zoom scale factor changes.

◆ zoomToFit

void zoomToFit ( const QRect &  rect)
slot

Zooms the image so that it fits optimally within the given rectangle.


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