# eric6.E5Gui.E5MapWidget

Module implementing a base class for showing a document map.

### Global Attributes

None

### Classes

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

### Functions

None

## E5MapWidget

Class implementing a base class for showing a document map.

### Derived from

QWidget

### Class Attributes

None

### Class Methods

None

### Methods

E5MapWidget | 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

#### E5MapWidget (Constructor)

E5MapWidget(parent=None)

Constructor

parent
  reference to the parent widget (QWidget)

#### E5MapWidget.__generateSliderRange

__generateSliderRange(scrollbar)

Private method to generate the slider rectangle.

scrollbar
  reference to the vertical scrollbar (QScrollBar)

Returns:
  slider rectangle (QRect)

#### E5MapWidget.__setSliderColor

__setSliderColor()

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

#### E5MapWidget.__updateMasterViewportWidth

__updateMasterViewportWidth()

Private method to update the master's viewport width.

#### E5MapWidget._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)

#### E5MapWidget.backgroundColor

backgroundColor()

Public method to get the background color.

Returns:
  background color (QColor)

#### E5MapWidget.calculateGeometry

calculateGeometry()

Public method to recalculate the map widget's geometry.

#### E5MapWidget.generateIndicatorRect

generateIndicatorRect(position)

Public method to generate an indicator rectangle.

position
  indicator position (integer)

Returns:
  indicator rectangle (QRect)

#### E5MapWidget.isEnabled

isEnabled()

Public method to check the enabled state.

Returns:
  flag indicating the enabled state (boolean)

#### E5MapWidget.isOnRightSide

isOnRightSide()

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

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

Return Type:
  bool

#### E5MapWidget.lineDimensions

lineDimensions()

Public method to get the line (indicator) dimensions.

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

#### E5MapWidget.mouseMoveEvent

mouseMoveEvent(event)

Protected method to handle a mouse moves.

event
  reference to the mouse event (QMouseEvent)

#### E5MapWidget.mousePressEvent

mousePressEvent(event)

Protected method to handle a mouse button press.

event
  reference to the mouse event (QMouseEvent)

#### E5MapWidget.paintEvent

paintEvent(event)

Protected method to handle a paint event.

event
  paint event (QPaintEvent)

#### E5MapWidget.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)

Returns:
  scrollbar value (integer)

#### E5MapWidget.scaleFactor

scaleFactor(slider=False)

Public method to determine the scrollbar's scale factor.

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

Returns:
  scale factor (float)

#### E5MapWidget.setBackgroundColor

setBackgroundColor(color)

Public method to set the widget background color.

color
  color for the background (QColor)

#### E5MapWidget.setEnabled

setEnabled(enable)

Public method to set the enabled state.

enable
  flag indicating the enabled state (boolean)

#### E5MapWidget.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)

#### E5MapWidget.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

#### E5MapWidget.setMaster

setMaster(master)

Public method to set the map master widget.

master
  map master widget (QAbstractScrollArea)

#### E5MapWidget.setWidth

setWidth(width)

Public method to set the widget width.

width
  widget width (integer)

#### E5MapWidget.sizeHint

sizeHint()

Public method to give an indication about the preferred size.

Returns:
  preferred size (QSize)

#### E5MapWidget.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)

Returns:
  position (integer)

#### E5MapWidget.wheelEvent

wheelEvent(event)

Protected slot handling mouse wheel events.

event
  reference to the wheel event (QWheelEvent)

#### E5MapWidget.width

width()

Public method to get the widget's width.

Returns:
  widget width (integer)

Up