# eric6.Graphics.UMLGraphicsView

Module implementing a subclass of E5GraphicsView for our diagrams.

### Global Attributes

None

### Classes

UMLGraphicsView | Class implementing a specialized E5GraphicsView for our diagrams.

### Functions

None

## UMLGraphicsView

Class implementing a specialized E5GraphicsView for our diagrams.

### Signals

relayout()
  emitted to indicate a relayout of the diagram is requested

### Derived from

E5GraphicsView

### Class Attributes

None

### Class Methods

None

### Methods

UMLGraphicsView | Constructor
__alignShapes | Private slot to align the selected shapes.
__checkSizeActions | Private slot to set the enabled state of the size actions.
__decHeight | Private method to handle the decrease height context menu entry.
__decWidth | Private method to handle the decrease width context menu entry.
__deleteShape | Private method to delete the selected shapes from the display.
__incHeight | Private method to handle the increase height context menu entry.
__incWidth | Private method to handle the increase width context menu entry.
__initActions | Private method to initialize the view actions.
__itemsBoundingRect | Private method to calculate the bounding rectangle of the given items.
__printPreviewPrint | Private slot to generate a print preview.
__relayout | Private slot to handle the re-layout context menu entry.
__rescan | Private slot to handle the re-scan context menu entry.
__sceneChanged | Private slot called when the scene changes.
__setSize | Private method to handle the set size context menu entry.
autoAdjustSceneSize | Public method to adjust the scene size to the diagram size.
event | Public method handling events.
filteredItems | Public method to filter a list of items.
findItem | Public method to find an UML item based on the ID.
findItemByName | Public method to find an UML item based on its name.
gestureEvent | Protected method handling gesture events.
getItemId | Public method to get the ID to be assigned to an item.
getPersistenceData | Public method to get a list of data to be persisted.
initToolBar | Public method to populate a toolbar with our actions.
keyPressEvent | Protected method handling key press events.
parsePersistenceData | Public method to parse persisted data.
printDiagram | Public slot called to print the diagram.
printPreviewDiagram | Public slot called to show a print preview of the diagram.
saveImage | Public method to handle the save context menu entry.
selectItem | Public method to select an item.
selectItems | Public method to select the given items.
setDiagramName | Public slot to set the diagram name.
wheelEvent | Protected method to handle wheel events.

### Static Methods

None

#### UMLGraphicsView (Constructor)

UMLGraphicsView(scene, parent=None)

Constructor

scene
  reference to the scene object (QGraphicsScene)
parent
  parent widget of the view (QWidget)

#### UMLGraphicsView.__alignShapes

__alignShapes(alignment)

Private slot to align the selected shapes.

alignment
  alignment type (Qt.AlignmentFlag)

#### UMLGraphicsView.__checkSizeActions

__checkSizeActions()

Private slot to set the enabled state of the size actions.

#### UMLGraphicsView.__decHeight

__decHeight()

Private method to handle the decrease height context menu entry.

#### UMLGraphicsView.__decWidth

__decWidth()

Private method to handle the decrease width context menu entry.

#### UMLGraphicsView.__deleteShape

__deleteShape()

Private method to delete the selected shapes from the display.

#### UMLGraphicsView.__incHeight

__incHeight()

Private method to handle the increase height context menu entry.

#### UMLGraphicsView.__incWidth

__incWidth()

Private method to handle the increase width context menu entry.

#### UMLGraphicsView.__initActions

__initActions()

Private method to initialize the view actions.

#### UMLGraphicsView.__itemsBoundingRect

__itemsBoundingRect(items)

Private method to calculate the bounding rectangle of the given items.

items
  list of items to operate on (list of UMLItem)

Returns:
  bounding rectangle (QRectF)

#### UMLGraphicsView.__printPreviewPrint

__printPreviewPrint(printer)

Private slot to generate a print preview.

printer
  reference to the printer object (QPrinter)

#### UMLGraphicsView.__relayout

__relayout()

Private slot to handle the re-layout context menu entry.

#### UMLGraphicsView.__rescan

__rescan()

Private slot to handle the re-scan context menu entry.

#### UMLGraphicsView.__sceneChanged

__sceneChanged(areas)

Private slot called when the scene changes.

areas
  list of rectangles that contain changes (list of QRectF)

#### UMLGraphicsView.__setSize

__setSize()

Private method to handle the set size context menu entry.

#### UMLGraphicsView.autoAdjustSceneSize

autoAdjustSceneSize(limit=False)

Public method to adjust the scene size to the diagram size.

limit
  flag indicating to limit the scene to the initial size (boolean)

#### UMLGraphicsView.event

event(evt)

Public method handling events.

evt
  reference to the event (QEvent)

Returns:
  flag indicating, if the event was handled (boolean)

#### UMLGraphicsView.filteredItems

filteredItems(items, itemType=UMLItem)

Public method to filter a list of items.

items
  list of items as returned by the scene object (QGraphicsItem)
itemType
  type to be filtered (class)

Returns:
  list of interesting collision items (QGraphicsItem)

#### UMLGraphicsView.findItem

findItem(itemId)

Public method to find an UML item based on the ID.

itemId
  of the item to search for (integer)

Returns:
  item found (UMLItem) or None

#### UMLGraphicsView.findItemByName

findItemByName(name)

Public method to find an UML item based on its name.

name
  name to look for (string)

Returns:
  item found (UMLItem) or None

#### UMLGraphicsView.gestureEvent

gestureEvent(evt)

Protected method handling gesture events.

evt
  reference to the gesture event (QGestureEvent

#### UMLGraphicsView.getItemId

getItemId()

Public method to get the ID to be assigned to an item.

Returns:
  item ID (integer)

#### UMLGraphicsView.getPersistenceData

getPersistenceData()

Public method to get a list of data to be persisted.

Returns:
  list of data to be persisted (list of strings)

#### UMLGraphicsView.initToolBar

initToolBar()

Public method to populate a toolbar with our actions.

Returns:
  the populated toolBar (QToolBar)

#### UMLGraphicsView.keyPressEvent

keyPressEvent(evt)

Protected method handling key press events.

evt
  reference to the key event (QKeyEvent)

#### UMLGraphicsView.parsePersistenceData

parsePersistenceData(version, data)

Public method to parse persisted data.

version
  version of the data (string)
data
  persisted data to be parsed (list of string)

Returns:
  tuple of flag indicating success (boolean) and faulty line number (integer)

#### UMLGraphicsView.printDiagram

printDiagram()

Public slot called to print the diagram.

#### UMLGraphicsView.printPreviewDiagram

printPreviewDiagram()

Public slot called to show a print preview of the diagram.

#### UMLGraphicsView.saveImage

saveImage()

Public method to handle the save context menu entry.

#### UMLGraphicsView.selectItem

selectItem(item)

Public method to select an item.

item
  item to be selected (QGraphicsItemItem)

#### UMLGraphicsView.selectItems

selectItems(items)

Public method to select the given items.

items
  list of items to be selected (list of QGraphicsItemItem)

#### UMLGraphicsView.setDiagramName

setDiagramName(name)

Public slot to set the diagram name.

name
  diagram name (string)

#### UMLGraphicsView.wheelEvent

wheelEvent(evt)

Protected method to handle wheel events.

evt
  reference to the wheel event (QWheelEvent)

Up