# eric7.Snapshot.SnapshotRegionGrabber

Module implementing a grabber widget for a rectangular snapshot region.

### Global Attributes

None

### Classes

SnapshotRegionGrabber | Class implementing a grabber widget for a rectangular snapshot region.

### Functions

drawRect | Module function to draw a rectangle with the given parameters.

## SnapshotRegionGrabber

Class implementing a grabber widget for a rectangular snapshot region.

### Signals

grabbed(QPixmap)
  emitted after the region was grabbed

### Derived from

QWidget

### Class Attributes

Ellipse
FillMask
Rectangle
StrokeMask

### Class Methods

None

### Methods

SnapshotRegionGrabber | Constructor
__grabRect | Private method to grab the selected rectangle (i.e.
__handleMask | Private method to calculate the handle mask.
__initialize | Private slot to initialize the rest of the widget.
__limitPointToRect | Private method to limit the given point to the given rectangle.
__normalizeSelection | Private method to normalize the given selection.
__updateHandles | Private method to update the handles.
keyPressEvent | Protected method to handle key presses.
mouseDoubleClickEvent | Protected method to handle mouse double clicks.
mouseMoveEvent | Protected method to handle mouse movements.
mousePressEvent | Protected method to handle mouse button presses.
mouseReleaseEvent | Protected method to handle mouse button releases.
paintEvent | Protected method handling paint events.
resizeEvent | Protected method to handle resize events.

### Static Methods

None

#### SnapshotRegionGrabber (Constructor)

SnapshotRegionGrabber(mode=Rectangle)

Constructor

mode (int)
  region grabber mode (SnapshotRegionGrabber.Rectangle or SnapshotRegionGrabber.Ellipse)

Raises ValueError:
  raised to indicate a bad value for the 'mode' parameter

#### SnapshotRegionGrabber.__grabRect

__grabRect()

Private method to grab the selected rectangle (i.e. do the snapshot).

#### SnapshotRegionGrabber.__handleMask

__handleMask(maskType)

Private method to calculate the handle mask.

maskType (int)
  type of the mask to be used (SnapshotRegionGrabber.FillMask or SnapshotRegionGrabber.StrokeMask)

Return:
  calculated mask

Return Type:
  QRegion

#### SnapshotRegionGrabber.__initialize

__initialize()

Private slot to initialize the rest of the widget.

#### SnapshotRegionGrabber.__limitPointToRect

__limitPointToRect(point, rect)

Private method to limit the given point to the given rectangle.

point (QPoint)
  point to be limited
rect (QRect)
  rectangle the point shall be limited to

Return:
  limited point

Return Type:
  QPoint

#### SnapshotRegionGrabber.__normalizeSelection

__normalizeSelection(sel)

Private method to normalize the given selection.

sel (QRect)
  selection to be normalized

Return:
  normalized selection

Return Type:
  QRect

#### SnapshotRegionGrabber.__updateHandles

__updateHandles()

Private method to update the handles.

#### SnapshotRegionGrabber.keyPressEvent

keyPressEvent(evt)

Protected method to handle key presses.

evt (QKeyEvent)
  key press event

#### SnapshotRegionGrabber.mouseDoubleClickEvent

mouseDoubleClickEvent(evt)

Protected method to handle mouse double clicks.

evt (QMouseEvent)
  mouse double click event

#### SnapshotRegionGrabber.mouseMoveEvent

mouseMoveEvent(evt)

Protected method to handle mouse movements.

evt (QMouseEvent)
  mouse move event

#### SnapshotRegionGrabber.mousePressEvent

mousePressEvent(evt)

Protected method to handle mouse button presses.

evt (QMouseEvent)
  mouse press event

#### SnapshotRegionGrabber.mouseReleaseEvent

mouseReleaseEvent(evt)

Protected method to handle mouse button releases.

evt (QMouseEvent)
  mouse release event

#### SnapshotRegionGrabber.paintEvent

paintEvent(evt)

Protected method handling paint events.

evt (QPaintEvent)
  paint event

#### SnapshotRegionGrabber.resizeEvent

resizeEvent(evt)

Protected method to handle resize events.

evt (QResizeEvent)
  resize event

Up

## drawRect

drawRect(painter, rect, outline, fill=None)

Module function to draw a rectangle with the given parameters.

painter (QPainter)
  reference to the painter to be used
rect (QRect)
  rectangle to be drawn
outline (QColor)
  color of the outline
fill (QColor)
  fill color

Up