eric4.E4Graphics.E4GraphicsView
Module implementing a canvas view class.
Global Attributes
Classes
Functions
E4GraphicsView
Class implementing a graphics view.
Derived from
QGraphicsView
Class Attributes
Methods
E4GraphicsView |
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. |
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. |
E4GraphicsView (Constructor)
E4GraphicsView(scene, parent = None)
Constructor
- scene
-
reference to the scene object (QGraphicsScene)
- parent
-
parent widget (QWidget)
E4GraphicsView.__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 or QString)
- filename
-
name of the file for non pixmaps (string or QString)
- Returns:
-
diagram pixmap to receive the diagram (QPixmap)
E4GraphicsView._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)
E4GraphicsView._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)
E4GraphicsView.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)
E4GraphicsView.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 or QString)
E4GraphicsView.resizeScene
resizeScene(amount, isWidth = True)
Public method to resize the scene.
- isWidth
-
flag indicating width is to be resized (boolean)
- amount
-
size increment (integer)
E4GraphicsView.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 or QString)
- format
-
format for the image file (string or QString)
- Returns:
-
flag indicating success (boolean)
E4GraphicsView.setSceneSize
setSceneSize(width, height)
Public method to set the scene size.
- width
-
width for the scene (integer)
- height
-
height for the scene (integer)
E4GraphicsView.setZoom
setZoom(zoomFactor)
Public method to set the zoom factor.
- zoomFactor
-
new zoom factor (float)
E4GraphicsView.zoom
zoom()
Public method to get the current zoom factor.
- Returns:
-
current zoom factor (float)
E4GraphicsView.zoomIn
zoomIn()
Public method to zoom in.
E4GraphicsView.zoomOut
zoomOut()
Public method to zoom out.
E4GraphicsView.zoomReset
zoomReset()
Public method to handle the reset zoom context menu entry.