Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

Opie::MM::OImageZoomer Class Reference

small class to zoom over a Page More...

#include </home/clem/local/src/opie/libopie2/opiemm/oimagezoomer.h>

List of all members.

Public Slots

void setImageSize (const QSize &)
 set the page/image size Tell us the QSize of the Data you show to the user. We need this to do the calculations
void setViewPortSize (const QSize &)
 Set the size of the viewport Tell us the QSize of the viewport. The viewport is the part of the widget which is exposed on the screen.
void setVisiblePoint (const QPoint &)
 the point in the topleft corner which is currently visible Set the visible point. This most of the times relate to QScrollView::contentsX() and QScrollView::contentsY()
void setVisiblePoint (int x, int y)
void setImage (const QImage &)
void setImage (const QPixmap &)

Signals

void zoomAreaRel (int x, int y)
void zoomArea (int x, int y)

Public Member Functions

 OImageZoomer (QWidget *parent=0, const char *name=0, WFlags fl=0)
 The most simple c'tor The main c'tor. You still need to set a QPixmap/QIMage, setImageSize,setViewPortSize,setVisiblePoint.
 OImageZoomer (const QPixmap &, QWidget *parent=0, const char *name=0, WFlags fl=0)
 This c'tor takes a QPixmap additional.
 OImageZoomer (const QImage &, QWidget *parent=0, const char *name=0, WFlags fl=0)
 This c'tor takes a QImage instead You just provide a QImage which is saved. It behaves the same as the others.
 OImageZoomer (const QSize &, const QSize &, QWidget *par, const char *, WFlags fl)
 overloaded c'tor
 ~OImageZoomer ()
void resizeEvent (QResizeEvent *)

Protected Member Functions

void drawContents (QPainter *p)
virtual void mousePressEvent (QMouseEvent *ev)
virtual void mouseMoveEvent (QMouseEvent *ev)
virtual void mouseReleaseEvent (QMouseEvent *ev)

Private Member Functions

void init ()

Private Attributes

QImage m_img
QSize m_imgSize
QSize m_visSize
QPoint m_visPt
int m_mouseX
int m_mouseY
bool m_mevent


Detailed Description

small class to zoom over a Page

This class represents your page but smaller. It can draw a Rect on top of an Image/Pixmap you supply and you can allow the user easily zooming/moving over your widget. All you need to do is to supply a image/pixmap, the visible size and the original image/pixmap size and the current visible top/left position.

This Image works perfectly with QScrollView as you can connect QScrollView::contentsMoving to setVisiblePoint slot and the zoomAreRel to the QScrollView::scrollBy slot. Now you would only need to watch the resize event anf give us the new information about QScrollView::viewport

You need to position and set the size of this widget! using setFixedSize() is quite a good idea for this widget

See also:
QScrollView

QScrollView::viewport()

Since:
1.2

Definition at line 40 of file oimagezoomer.h.


Constructor & Destructor Documentation

Opie::MM::OImageZoomer::OImageZoomer QWidget *  parent = 0,
const char *  name = 0,
WFlags  fl = 0
 

The most simple c'tor The main c'tor. You still need to set a QPixmap/QIMage, setImageSize,setViewPortSize,setVisiblePoint.

Parameters:
parent The parent widget
name A name for this widget
fl The widget flags

Definition at line 25 of file oimagezoomer.cpp.

References init().

Opie::MM::OImageZoomer::OImageZoomer const QPixmap &  pix,
QWidget *  par = 0,
const char *  name = 0,
WFlags  fl = 0
 

This c'tor takes a QPixmap additional.

You initially set the QPixmap but you still need to provide the additional data to make this widget useful

Parameters:
pix A Pixmap it'll be converted to a QImage later!
par The parent widget
name The name of this widget
fl The widget flags

Definition at line 42 of file oimagezoomer.cpp.

References init(), and setImage().

Opie::MM::OImageZoomer::OImageZoomer const QImage &  img,
QWidget *  par = 0,
const char *  name = 0,
WFlags  fl = 0
 

This c'tor takes a QImage instead You just provide a QImage which is saved. It behaves the same as the others.

Parameters:
img A Image which will be used for the zoomer content
par The parent of the widget
name The name of the widget
fl The widgets flags

Definition at line 58 of file oimagezoomer.cpp.

References init(), and setImage().

Opie::MM::OImageZoomer::OImageZoomer const QSize &  pSize,
const QSize &  vSize,
QWidget *  par,
const char *  name,
WFlags  fl
 

overloaded c'tor

This differs only in the arguments it takes

Parameters:
pSize The size of the Page you show
vSize The size of the viewport. The size of the visible part of the widget
par The parent of the widget
name The name
fl The window flags

Definition at line 77 of file oimagezoomer.cpp.

References init().

Opie::MM::OImageZoomer::~OImageZoomer  ) 
 

d'tor

Definition at line 86 of file oimagezoomer.cpp.


Member Function Documentation

void Opie::MM::OImageZoomer::drawContents QPainter *  p  )  [protected]
 

make sure to call these if you reimplement

For internal use only.

Definition at line 162 of file oimagezoomer.cpp.

References len, m_imgSize, m_visPt, m_visSize, Qt::red, Opie::MM::x, and Opie::MM::y.

void Opie::MM::OImageZoomer::init  )  [private]
 

For internal use only.

Definition at line 90 of file oimagezoomer.cpp.

References m_mevent.

Referenced by OImageZoomer().

void Opie::MM::OImageZoomer::mouseMoveEvent QMouseEvent *  ev  )  [protected, virtual]
 

make sure to call these if you reimplement

For internal use only.

Definition at line 216 of file oimagezoomer.cpp.

References height, m_imgSize, m_mevent, m_mouseX, m_mouseY, width, and zoomAreaRel().

void Opie::MM::OImageZoomer::mousePressEvent QMouseEvent *  ev  )  [protected, virtual]
 

make sure to call these if you reimplememt

For internal use only.

Definition at line 201 of file oimagezoomer.cpp.

References m_mevent, m_mouseX, and m_mouseY.

void Opie::MM::OImageZoomer::mouseReleaseEvent QMouseEvent *  ev  )  [protected, virtual]
 

make sure to call these if you reimplement

For internal use only.

Definition at line 206 of file oimagezoomer.cpp.

References height, m_imgSize, m_mevent, width, and zoomArea().

void Opie::MM::OImageZoomer::resizeEvent QResizeEvent *   ) 
 

make sure to call these if you reimplement

For internal use only.

Definition at line 154 of file oimagezoomer.cpp.

References height, m_img, pix, size, and width.

Referenced by setImage().

void Opie::MM::OImageZoomer::setImage const QPixmap &  pix  )  [slot]
 

overloaded function it calls the QImage version

Definition at line 150 of file oimagezoomer.cpp.

References setImage().

void Opie::MM::OImageZoomer::setImage const QImage &  img  )  [slot]
 

Set the Image. The image will be resized on resizeEvent and it'll set the QPixmap background

Parameters:
img The image will be stored internally and used as the background

Definition at line 141 of file oimagezoomer.cpp.

References m_img, and resizeEvent().

Referenced by Opie::MM::OImageScrollView::generateImage(), OImageZoomer(), and setImage().

void Opie::MM::OImageZoomer::setImageSize const QSize &  size  )  [slot]
 

set the page/image size Tell us the QSize of the Data you show to the user. We need this to do the calculations

Parameters:
size The size of the stuff you want to zoom on

Definition at line 103 of file oimagezoomer.cpp.

References m_imgSize.

void Opie::MM::OImageZoomer::setViewPortSize const QSize &  size  )  [slot]
 

Set the size of the viewport Tell us the QSize of the viewport. The viewport is the part of the widget which is exposed on the screen.

Parameters:
size Te size of the viewport
See also:
QScrollView::viewport()

Definition at line 117 of file oimagezoomer.cpp.

References m_visSize.

void Opie::MM::OImageZoomer::setVisiblePoint int  x,
int  y
[inline, slot]
 

This slot is present for convience. You can connect the QScrollView::contentsMoved to this slot and it calls the QPoint version for you This realtes to QScrollView::contentsX() and QScrollView::contentsY()

Parameters:
x The top left x coordinate
y The top left y coorisnate

Definition at line 135 of file oimagezoomer.h.

References setVisiblePoint().

void Opie::MM::OImageZoomer::setVisiblePoint const QPoint &  pt  )  [slot]
 

the point in the topleft corner which is currently visible Set the visible point. This most of the times relate to QScrollView::contentsX() and QScrollView::contentsY()

See also:
setVisiblePoint(int,int)

Definition at line 129 of file oimagezoomer.cpp.

References m_visPt.

Referenced by setVisiblePoint().

void Opie::MM::OImageZoomer::zoomArea int  x,
int  y
[signal]
 

Here you get absolute coordinates. This slot will be emitted from within the mouseReleaseEvent of this widget. if no mouse move where done. So you may not delete this widget

Parameters:
x The absolute X Coordinate to scroll to.
y The absolute Y Coordinate to scroll to.

Referenced by mouseReleaseEvent().

void Opie::MM::OImageZoomer::zoomAreaRel int  x,
int  y
[signal]
 

Relative movement in the coordinates of the viewport This signal can easily be connected to QScrollView::scrollBy. This signal is emitted from within the mouseMoveEvent of this widget

Parameters:
x The way to move relative on the X-Axis
y The way to move relative on the Y-Axis
See also:
setVisiblePoint

QScrollView::scrollBy

Referenced by mouseMoveEvent().


Member Data Documentation

QImage Opie::MM::OImageZoomer::m_img [private]
 

Definition at line 119 of file oimagezoomer.h.

Referenced by resizeEvent(), and setImage().

QSize Opie::MM::OImageZoomer::m_imgSize [private]
 

Definition at line 120 of file oimagezoomer.h.

Referenced by drawContents(), mouseMoveEvent(), mouseReleaseEvent(), and setImageSize().

bool Opie::MM::OImageZoomer::m_mevent [private]
 

Definition at line 123 of file oimagezoomer.h.

Referenced by init(), mouseMoveEvent(), mousePressEvent(), and mouseReleaseEvent().

int Opie::MM::OImageZoomer::m_mouseX [private]
 

Definition at line 122 of file oimagezoomer.h.

Referenced by mouseMoveEvent(), and mousePressEvent().

int Opie::MM::OImageZoomer::m_mouseY [private]
 

Definition at line 122 of file oimagezoomer.h.

Referenced by mouseMoveEvent(), and mousePressEvent().

QPoint Opie::MM::OImageZoomer::m_visPt [private]
 

Definition at line 121 of file oimagezoomer.h.

Referenced by drawContents(), and setVisiblePoint().

QSize Opie::MM::OImageZoomer::m_visSize [private]
 

Definition at line 120 of file oimagezoomer.h.

Referenced by drawContents(), and setViewPortSize().


The documentation for this class was generated from the following files:
Generated on Sat Nov 5 18:01:31 2005 for OPIE by  doxygen 1.4.2