eric5.E5Graphics.E5GraphicsView

Module implementing a canvas view class.

Global Attributes

None

Classes

E5GraphicsView Class implementing a graphics view.

Functions

None


E5GraphicsView

Class implementing a graphics view.

Derived from

QGraphicsView

Class Attributes

None

Class Methods

None

Methods

E5GraphicsView Constructor
__getDiagram Private method to retrieve the diagram from the scene fitting it in the minimum rectangle.
_getDiagramRect Protected method to calculate the minimum rectangle fitting the diagram.
_getDiagramSize Protected method to calculate the minimum size fitting the diagram.
autoAdjustSceneSize Public method to adjust the scene size to the diagram size.
filteredItems Public method to filter a list of items.
printDiagram Public method to print the diagram.
resizeScene Public method to resize the scene.
saveImage Public method to save the scene to a file.
setSceneSize Public method to set the scene size.
setZoom Public method to set the zoom factor.
zoom Public method to get the current zoom factor.
zoomIn Public method to zoom in.
zoomOut Public method to zoom out.
zoomReset Public method to handle the reset zoom context menu entry.

Static Methods

None

E5GraphicsView (Constructor)

E5GraphicsView(scene, parent=None)

Constructor

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

E5GraphicsView.__getDiagram

__getDiagram(rect, format="PNG", filename=None)

Private method to retrieve the diagram from the scene fitting it in the minimum rectangle.

rect
minimum rectangle fitting the diagram (QRectF)
format
format for the image file (string)
filename
name of the file for non pixmaps (string)
Returns:
diagram pixmap to receive the diagram (QPixmap)

E5GraphicsView._getDiagramRect

_getDiagramRect(border=0)

Protected method to calculate the minimum rectangle fitting the diagram.

border
border width to include in the calculation (integer)
Returns:
the minimum rectangle (QRectF)

E5GraphicsView._getDiagramSize

_getDiagramSize(border=0)

Protected method to calculate the minimum size fitting the diagram.

border
border width to include in the calculation (integer)
Returns:
the minimum size (QSizeF)

E5GraphicsView.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)

E5GraphicsView.filteredItems

filteredItems(items)

Public method to filter a list of items.

items
list of items as returned by the scene object (QGraphicsItem)
Returns:
list of interesting collision items (QGraphicsItem)

E5GraphicsView.printDiagram

printDiagram(printer, diagramName="")

Public method to print the diagram.

printer
reference to a ready configured printer object (QPrinter)
diagramName
name of the diagram (string)

E5GraphicsView.resizeScene

resizeScene(amount, isWidth=True)

Public method to resize the scene.

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

E5GraphicsView.saveImage

saveImage(filename, format="PNG")

Public method to save the scene to a file.

filename
name of the file to write the image to (string)
format
format for the image file (string)
Returns:
flag indicating success (boolean)

E5GraphicsView.setSceneSize

setSceneSize(width, height)

Public method to set the scene size.

width
width for the scene (real)
height
height for the scene (real)

E5GraphicsView.setZoom

setZoom(zoomFactor)

Public method to set the zoom factor.

zoomFactor
new zoom factor (float)

E5GraphicsView.zoom

zoom()

Public method to get the current zoom factor.

Returns:
current zoom factor (float)

E5GraphicsView.zoomIn

zoomIn()

Public method to zoom in.

E5GraphicsView.zoomOut

zoomOut()

Public method to zoom out.

E5GraphicsView.zoomReset

zoomReset()

Public method to handle the reset zoom context menu entry.

Up