# eric7.EricWidgets.EricMapWidget

Module implementing a base class for showing a document map.

### Global Attributes

None

### Classes

EricMapWidget | Class implementing a base class for showing a document map.

### Functions

None

## EricMapWidget

Class implementing a base class for showing a document map.

### Derived from

QWidget

### Class Attributes

None

### Class Methods

None

### Methods

EricMapWidget | Constructor
__generateSliderRange | Private method to generate the slider rectangle.
__setSliderColor | Private method to set the slider color depending upon the background color.
__updateMasterViewportWidth | Private method to update the master's viewport width.
_paintIt | Protected method for painting the widget's indicators.
backgroundColor | Public method to get the background color.
calculateGeometry | Public method to recalculate the map widget's geometry.
generateIndicatorRect | Public method to generate an indicator rectangle.
isEnabled | Public method to check the enabled state.
isOnRightSide | Public method to test, if the map is shown on the right side of the master widget.
lineDimensions | Public method to get the line (indicator) dimensions.
mouseMoveEvent | Protected method to handle a mouse moves.
mousePressEvent | Protected method to handle a mouse button press.
paintEvent | Protected method to handle a paint event.
position2Value | Public method to convert a position into a scrollbar value.
scaleFactor | Public method to determine the scrollbar's scale factor.
setBackgroundColor | Public method to set the widget background color.
setEnabled | Public method to set the enabled state.
setLineDimensions | Public method to set the line (indicator) dimensions.
setMapPosition | Public method to set, whether the map should be shown to the right or left of the master widget.
setMaster | Public method to set the map master widget.
setWidth | Public method to set the widget width.
sizeHint | Public method to give an indication about the preferred size.
value2Position | Public method to convert a scrollbar value into a position.
wheelEvent | Protected slot handling mouse wheel events.
width | Public method to get the widget's width.

### Static Methods

None

#### EricMapWidget (Constructor)

EricMapWidget(parent=None)

Constructor

parent
  reference to the parent widget (QWidget)

#### EricMapWidget.__generateSliderRange

__generateSliderRange(scrollbar)

Private method to generate the slider rectangle.

scrollbar
  reference to the vertical scrollbar (QScrollBar)

Return:
  slider rectangle (QRect)

#### EricMapWidget.__setSliderColor

__setSliderColor()

Private method to set the slider color depending upon the background color.

#### EricMapWidget.__updateMasterViewportWidth

__updateMasterViewportWidth()

Private method to update the master's viewport width.

#### EricMapWidget._paintIt

_paintIt(painter)

Protected method for painting the widget's indicators.

Note: This method should be implemented by subclasses.

painter
  reference to the painter object (QPainter)

#### EricMapWidget.backgroundColor

backgroundColor()

Public method to get the background color.

Return:
  background color (QColor)

#### EricMapWidget.calculateGeometry

calculateGeometry()

Public method to recalculate the map widget's geometry.

#### EricMapWidget.generateIndicatorRect

generateIndicatorRect(position)

Public method to generate an indicator rectangle.

position
  indicator position (integer)

Return:
  indicator rectangle (QRect)

#### EricMapWidget.isEnabled

isEnabled()

Public method to check the enabled state.

Return:
  flag indicating the enabled state (boolean)

#### EricMapWidget.isOnRightSide

isOnRightSide()

Public method to test, if the map is shown on the right side of the master widget.

Return:
  flag indicating that the map is to the right of the master widget

Return Type:
  bool

#### EricMapWidget.lineDimensions

lineDimensions()

Public method to get the line (indicator) dimensions.

Return:
  tuple with border width (integer) and line height (integer)

#### EricMapWidget.mouseMoveEvent

mouseMoveEvent(event)

Protected method to handle a mouse moves.

event
  reference to the mouse event (QMouseEvent)

#### EricMapWidget.mousePressEvent

mousePressEvent(event)

Protected method to handle a mouse button press.

event
  reference to the mouse event (QMouseEvent)

#### EricMapWidget.paintEvent

paintEvent(event)

Protected method to handle a paint event.

event
  paint event (QPaintEvent)

#### EricMapWidget.position2Value

position2Value(position, slider=False)

Public method to convert a position into a scrollbar value.

position
  scrollbar position to convert (integer)
slider
  flag indicating to calculate the result for the slider (boolean)

Return:
  scrollbar value (integer)

#### EricMapWidget.scaleFactor

scaleFactor(slider=False)

Public method to determine the scrollbar's scale factor.

slider
  flag indicating to calculate the result for the slider (boolean)

Return:
  scale factor (float)

#### EricMapWidget.setBackgroundColor

setBackgroundColor(color)

Public method to set the widget background color.

color
  color for the background (QColor)

#### EricMapWidget.setEnabled

setEnabled(enable)

Public method to set the enabled state.

enable
  flag indicating the enabled state (boolean)

#### EricMapWidget.setLineDimensions

setLineDimensions(border, height)

Public method to set the line (indicator) dimensions.

border
  border width on each side in x-direction (integer)
height
  height of the line in pixels (integer)

#### EricMapWidget.setMapPosition

setMapPosition(onRight)

Public method to set, whether the map should be shown to the right or left of the master widget.

onRight (bool)
  flag indicating to show the map on the right side of the master widget

#### EricMapWidget.setMaster

setMaster(master)

Public method to set the map master widget.

master
  map master widget (QAbstractScrollArea)

#### EricMapWidget.setWidth

setWidth(width)

Public method to set the widget width.

width
  widget width (integer)

#### EricMapWidget.sizeHint

sizeHint()

Public method to give an indication about the preferred size.

Return:
  preferred size (QSize)

#### EricMapWidget.value2Position

value2Position(value, slider=False)

Public method to convert a scrollbar value into a position.

value
  value to convert (integer)
slider
  flag indicating to calculate the result for the slider (boolean)

Return:
  position (integer)

#### EricMapWidget.wheelEvent

wheelEvent(event)

Protected slot handling mouse wheel events.

event
  reference to the wheel event (QWheelEvent)

#### EricMapWidget.width

width()

Public method to get the widget's width.

Return:
  widget width (integer)

Up