# eric7.PdfViewer.PdfView

Module implementing a specialized PDF view class.

### Global Attributes

None

### Classes

PdfMarker | Class defining the data structure for markers.
PdfMarkerGeometry | Class defining the data structure for marker geometries.
PdfMarkerType | Class defining the various marker types.
PdfView | Class implementing a specialized PDF view.

### Functions

None

## PdfMarker

Class defining the data structure for markers.

### Derived from

None

### Class Attributes

markerType
rectangle

### Class Methods

None

### Methods

None

### Static Methods

None

Up

## PdfMarkerGeometry

Class defining the data structure for marker geometries.

### Derived from

None

### Class Attributes

markerType
rectangle

### Class Methods

None

### Methods

None

### Static Methods

None

Up

## PdfMarkerType

Class defining the various marker types.

### Derived from

enum.Enum

### Class Attributes

SEARCHRESULT
SELECTION

### Class Methods

None

### Methods

None

### Static Methods

None

Up

## PdfView

Class implementing a specialized PDF view.

### Signals

selectionAvailable(bool)
  emitted to indicate the availability of a selection

### Derived from

QPdfView

### Class Attributes

MarkerColors

### Class Methods

None

### Methods

PdfView | Constructor
__calculateDocumentLayout | Private slot to calculate the document layout data.
__calculateDocumentViewport | Private method to calculate the document viewport.
__calculateMarkerGeometries | Private method to calculate the marker geometries.
__currentPageChanged | Private slot to handle a change of the current page.
__updateView | Private method to update the view.
__zoomFactorForMode | Private method to calculate the zoom factor iaw.
__zoomInOut | Private method to zoom into or out of the view.
addMarker | Public slot to add a marker.
addSearchMarker | Public slot to add a search marker given a PDF link.
clearAllMarkers | Public slot to clear all markers.
clearMarkers | Public slot to clear the markers of a specific type.
clearSearchMarkers | Public slot to clear the search markers.
clearSelection | Public slot to clear the current selection.
event | Public method handling events.
gestureEvent | Protected method handling gesture events.
getSelection | Public method to get a PDF selection object.
hasSelection | Public method to check the presence of a selection.
keyPressEvent | Protected method handling key press events.
mouseMoveEvent | Protected method to handle mouse move events.
mousePressEvent | Protected method to handle mouse press events.
mouseReleaseEvent | Protected method to handle mouse release events.
paintEvent | Protected method to paint the view.
resizeEvent | Protected method to handle a widget resize.
scrollContentsBy | Public method called when the scrollbars are moved.
setDocument | Public method to set the PDF document.
wheelEvent | Protected method to handle wheel events.
zoomIn | Public slot to zoom into the view.
zoomOut | Public slot to zoom out of the view.
zoomReset | Public slot to reset the zoom factor of the view.

### Static Methods

None

#### PdfView (Constructor)

PdfView(parent)

Constructor

parent (QWidget)
  reference to the parent widget

#### PdfView.__calculateDocumentLayout

__calculateDocumentLayout()

Private slot to calculate the document layout data.

This is a PyQt implementation of the code found in the QPdfView class because it is calculated in a private part and not accessible.

#### PdfView.__calculateDocumentViewport

__calculateDocumentViewport()

Private method to calculate the document viewport.

This is a PyQt implementation of the code found in the QPdfView class because it is calculated in a private part and not accessible.

#### PdfView.__calculateMarkerGeometries

__calculateMarkerGeometries(page, offset)

Private method to calculate the marker geometries.

page (int)
  page number
offset (QPoint or QPointF)
  page offset

#### PdfView.__currentPageChanged

__currentPageChanged()

Private slot to handle a change of the current page.

#### PdfView.__updateView

__updateView()

Private method to update the view.

#### PdfView.__zoomFactorForMode

__zoomFactorForMode(zoomMode)

Private method to calculate the zoom factor iaw. the current zoom mode.

zoomMode (QPdfView.ZoomMode)
  zoom mode to get the zoom factor for

Return:
  zoom factor

Return Type:
  float

#### PdfView.__zoomInOut

__zoomInOut(zoomIn)

Private method to zoom into or out of the view.

zoomIn (bool)
  flag indicating to zoom into the view

#### PdfView.addMarker

addMarker(page, rect, markerType)

Public slot to add a marker.

page (int)
  page number for the marker
rect (QRect or QRectF)
  marker rectangle
markerType (PdfMarkerType)
  type of the marker

#### PdfView.addSearchMarker

addSearchMarker(link)

Public slot to add a search marker given a PDF link.

link (QPdfLink)
  reference to the PDF link object

#### PdfView.clearAllMarkers

clearAllMarkers()

Public slot to clear all markers.

#### PdfView.clearMarkers

clearMarkers(markerType)

Public slot to clear the markers of a specific type.

markerType (PdfMarkerType)
  type of the marker

#### PdfView.clearSearchMarkers

clearSearchMarkers()

Public slot to clear the search markers.

#### PdfView.clearSelection

clearSelection()

Public slot to clear the current selection.

#### PdfView.event

event(evt)

Public method handling events.

evt (QEvent)
  reference to the event

Return:
  flag indicating, if the event was handled

Return Type:
  bool

#### PdfView.gestureEvent

gestureEvent(evt)

Protected method handling gesture events.

evt (QGestureEvent)
  reference to the gesture event

#### PdfView.getSelection

getSelection()

Public method to get a PDF selection object.

Return:
  reference to the PDF selection object

Return Type:
  QPdfSelection

#### PdfView.hasSelection

hasSelection()

Public method to check the presence of a selection.

Return:
  flag indicating the presence of a selection

Return Type:
  bool

#### PdfView.keyPressEvent

keyPressEvent(evt)

Protected method handling key press events.

evt (QKeyEvent)
  reference to the key event

#### PdfView.mouseMoveEvent

mouseMoveEvent(evt)

Protected method to handle mouse move events.

evt (QMouseEvent)
  reference to the mouse event

#### PdfView.mousePressEvent

mousePressEvent(evt)

Protected method to handle mouse press events.

evt (QMouseEvent)
  reference to the mouse event

#### PdfView.mouseReleaseEvent

mouseReleaseEvent(evt)

Protected method to handle mouse release events.

evt (QMouseEvent)
  reference to the mouse event

#### PdfView.paintEvent

paintEvent(evt)

Protected method to paint the view.

This event handler calls the original paint event handler of the super class and paints the markers on top of the result.

evt (QPaintEvent)
  reference to the paint event

#### PdfView.resizeEvent

resizeEvent(evt)

Protected method to handle a widget resize.

evt (QResizeEvent)
  reference to the resize event

#### PdfView.scrollContentsBy

scrollContentsBy(dx, dy)

Public method called when the scrollbars are moved.

dx (int)
  change of the horizontal scroll bar
dy (int)
  change of the vertical scroll bar

#### PdfView.setDocument

setDocument(document)

Public method to set the PDF document.

document (QPdfDocument)
  reference to the PDF document object

#### PdfView.wheelEvent

wheelEvent(evt)

Protected method to handle wheel events.

evt (QWheelEvent)
  reference to the wheel event

#### PdfView.zoomIn

zoomIn()

Public slot to zoom into the view.

#### PdfView.zoomOut

zoomOut()

Public slot to zoom out of the view.

#### PdfView.zoomReset

zoomReset()

Public slot to reset the zoom factor of the view.

Up