# eric3.Graphics.UMLCanvasView

Module implementing a subclass of QCanvasView for our diagrams.

### Classes

UMLCanvasView | Class implementing a specialized canvasview for our diagrams.

### Functions

None

## UMLCanvasView

Class implementing a specialized canvasview for our diagrams.

### Derived from

QCanvasView

### Methods

UMLCanvasView | Constructor
contentsMouseMoveEvent | Overriden method to handle mouse moves.
contentsMousePressEvent | Overriden method to handle mouse button presses.
contentsMouseReleaseEvent | Overriden method to handle mouse button releases.
contextMenuEvent | Overriden method to handle a context menu event.
doZoom | Private method to perform the zooming.
getDiagram | Method to retrieve the diagram from the canvas fitting it in the minimum rectangle.
getDiagramRect | Method to calculate the minimum rectangle fitting the diagram.
handleDecHeight | Private method to handle the decrease height context menu entry.
handleDecWidth | Private method to handle the decrease width context menu entry.
handleDeleteShape | Private method to delete the selected shapes from the display.
handleIncHeight | Private method to handle the increase height context menu entry.
handleIncWidth | Private method to handle the increase width context menu entry.
handlePrintDiagram | Private slot called to print the diagram.
handleReLayout | Private method to handle the re-layout context menu entry.
handleResize | Private method to resize the drawing canvas.
handleSaveImage | Private method to handle the save context menu entry.
handleSetSize | Private method to handle the set size context menu entry.
handleShowPopupMenu | Slot to handle the popup menu about to show signal.
handleZoom | Private method to handle the zoom context menu action.
handleZoomIn | Private method to handle the zoom in context menu entry.
handleZoomOut | Private method to handle the zoom out context menu entry.
handleZoomReset | Private method to handle the reset zoom context menu entry.

### UMLCanvasView (Constructor)

UMLCanvasView(canvas, parent=None, name=None, flags=0)

Constructor

canvas
  canvas that is managed by the view (QCanvas)
parent
  parent widget of the view (QWidget)
name
  name of the view widget (QString or string)
flags
  the window flags to be passed to the view widget

### UMLCanvasView.contentsMouseMoveEvent

contentsMouseMoveEvent(evt)

Overriden method to handle mouse moves. This method moves the widget according to the mouse movements.

evt
  mouse event (QMouseEvent)

### UMLCanvasView.contentsMousePressEvent

contentsMousePressEvent(evt)

Overriden method to handle mouse button presses. This method determines the widget over which the button press occurred.

evt
  mouse event (QMouseEvent)

### UMLCanvasView.contentsMouseReleaseEvent

contentsMouseReleaseEvent(evt)

Overriden method to handle mouse button releases. This method simply resets the tracked widget.

evt
  mouse event (QMouseEvent)

### UMLCanvasView.contextMenuEvent

contextMenuEvent(evt)

Overriden method to handle a context menu event.

evt
  context menu event (QContextMenuEvent)

### UMLCanvasView.doZoom

doZoom()

Private method to perform the zooming.

### UMLCanvasView.getDiagram

getDiagram(rect, diagram)

Method to retrieve the diagram from the canvas fitting it in the minimum rectangle.

rect
  minimum rectangle fitting the diagram (QRect)
diagram
  pixmap to receive the diagram (QPixmap)

### UMLCanvasView.getDiagramRect

getDiagramRect(border=0)

Method to calculate the minimum rectangle fitting the diagram.

border
  border width to include in the calculation (integer)

Returns:
  the minimum rectangle (QRect)

### UMLCanvasView.handleDecHeight

handleDecHeight()

Private method to handle the decrease height context menu entry.

### UMLCanvasView.handleDecWidth

handleDecWidth()

Private method to handle the decrease width context menu entry.

### UMLCanvasView.handleDeleteShape

handleDeleteShape()

Private method to delete the selected shapes from the display.

### UMLCanvasView.handleIncHeight

handleIncHeight()

Private method to handle the increase height context menu entry.

### UMLCanvasView.handleIncWidth

handleIncWidth()

Private method to handle the increase width context menu entry.

### UMLCanvasView.handlePrintDiagram

handlePrintDiagram()

Private slot called to print the diagram.

### UMLCanvasView.handleReLayout

handleReLayout()

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

### UMLCanvasView.handleResize

handleResize(isWidth, amount)

Private method to resize the drawing canvas.

isWidth
  flag indicating width is to be resized (boolean)
amount
  size increment (integer)

### UMLCanvasView.handleSaveImage

handleSaveImage()

Private method to handle the save context menu entry.

### UMLCanvasView.handleSetSize

handleSetSize()

Private method to handle the set size context menu entry.

### UMLCanvasView.handleShowPopupMenu

handleShowPopupMenu()

Slot to handle the popup menu about to show signal. It is used to disable/enable certain menu items according to various conditions.

### UMLCanvasView.handleZoom

handleZoom()

Private method to handle the zoom context menu action.

### UMLCanvasView.handleZoomIn

handleZoomIn()

Private method to handle the zoom in context menu entry.

### UMLCanvasView.handleZoomOut

handleZoomOut()

Private method to handle the zoom out context menu entry.

### UMLCanvasView.handleZoomReset

handleZoomReset()

Private method to handle the reset zoom context menu entry.

Up