Home ⌂Doc Index ◂Up ▴

eric6.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.

Signals

zoomValueChanged(int)
emitted to signal a change of the zoom value

Derived from

QGraphicsView

Class Attributes

ZoomLevelDefault
ZoomLevels

Class Methods

None

Methods

E5GraphicsView Constructor
__getDiagram Private method to retrieve the diagram from the scene fitting it in the minimum rectangle.
__levelForZoom Private method determining the zoom level index given a zoom factor.
_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.
getBackgroundColor Public method to get the configured background color.
getDrawingColors Public method to get the configured drawing colors.
getForegroundColor Public method to get the configured foreground color.
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 value in percent.
zoom Public method to get the current zoom factor in percent.
zoomIn Public method to zoom in.
zoomOut Public method to zoom out.
zoomReset Public method to handle the reset the zoom value.

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, imageFormat="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)
imageFormat
format for the image file (string)
filename
name of the file for non pixmaps (string)
Returns:
diagram pixmap to receive the diagram (QPixmap)

E5GraphicsView.__levelForZoom

__levelForZoom(zoom)

Private method determining the zoom level index given a zoom factor.

zoom
zoom factor (integer)
Returns:
index of zoom factor (integer)

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.getBackgroundColor

getBackgroundColor()

Public method to get the configured background color.

Returns:
background color
Return Type:
QColor

E5GraphicsView.getDrawingColors

getDrawingColors()

Public method to get the configured drawing colors.

Returns:
tuple containing the foreground and background colors
Return Type:
tuple of (QColor, QColor)

E5GraphicsView.getForegroundColor

getForegroundColor()

Public method to get the configured foreground color.

Returns:
foreground color
Return Type:
QColor

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.

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

E5GraphicsView.saveImage

saveImage(filename, imageFormat="PNG")

Public method to save the scene to a file.

filename
name of the file to write the image to (string)
imageFormat
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(value)

Public method to set the zoom value in percent.

value
zoom value in percent (integer)

E5GraphicsView.zoom

zoom()

Public method to get the current zoom factor in percent.

Returns:
current zoom factor in percent (integer)

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 the zoom value.

Up



Home ⌂Doc Index ◂Up ▴