# 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
  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
  type of the mask to be used (SnapshotRegionGrabber.FillMask or SnapshotRegionGrabber.StrokeMask)

Return:
  calculated mask (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
  point to be limited (QPoint)
rect
  rectangle the point shall be limited to (QRect)

Return:
  limited point (QPoint)

#### SnapshotRegionGrabber.__normalizeSelection

__normalizeSelection(sel)

Private method to normalize the given selection.

sel
  selection to be normalized (QRect)

Return:
  normalized selection (QRect)

#### SnapshotRegionGrabber.__updateHandles

__updateHandles()

Private method to update the handles.

#### SnapshotRegionGrabber.keyPressEvent

keyPressEvent(evt)

Protected method to handle key presses.

evt
  key press event (QKeyEvent)

#### SnapshotRegionGrabber.mouseDoubleClickEvent

mouseDoubleClickEvent(evt)

Protected method to handle mouse double clicks.

evt
  mouse double click event (QMouseEvent)

#### SnapshotRegionGrabber.mouseMoveEvent

mouseMoveEvent(evt)

Protected method to handle mouse movements.

evt
  mouse move event (QMouseEvent)

#### SnapshotRegionGrabber.mousePressEvent

mousePressEvent(evt)

Protected method to handle mouse button presses.

evt
  mouse press event (QMouseEvent)

#### SnapshotRegionGrabber.mouseReleaseEvent

mouseReleaseEvent(evt)

Protected method to handle mouse button releases.

evt
  mouse release event (QMouseEvent)

#### SnapshotRegionGrabber.paintEvent

paintEvent(evt)

Protected method handling paint events.

evt
  paint event (QPaintEvent)

#### SnapshotRegionGrabber.resizeEvent

resizeEvent(evt)

Protected method to handle resize events.

evt
  resize event (QResizeEvent)

Up

## drawRect

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

Module function to draw a rectangle with the given parameters.

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

Up