eric4.E4Canvas.E4Canvas

Module implementing a canvas class.

Classes

E4Canvas Class implementing a canvas.

Functions

None


E4Canvas

Class implementing a canvas.

Derived from

QWidget

Methods

E4Canvas Constructor
addItem Public method to add an item to the canvas.
clear Public method to clear the canvas.
collisions Public method returning all items that collide with a point or rectangle.
getCanvasHeight Public method to get the canvas height.
getCanvasSize Public method to get the canvas size.
getCanvasWidth Public method to get the canvas width.
getItems Public method to get all items of the canvas.
getSelectedItems Public method to retrieve all selected items.
paintEvent Protected overridden method to paint the canvas.
removeItem Public method to remove an item from the canvas.
resizeEvent Protected overridden method to handle resize events.
setCanvasSize Public method to set the canvas size.
setZoom Public method to set the zoom level.
sizeHint Public method to give a size hint.
zoom Public method to get the zoom level.

E4Canvas (Constructor)

E4Canvas(parent, width_, height_, backColor = QColor(255, 255, 255))

Constructor

parent
parent widget (QWidget)
width_
initial width of the canvas (float)
height_
initial height of the canvas (float)
backColor
background color of the canvas (QColor)

E4Canvas.addItem

addItem(canvasItem)

Public method to add an item to the canvas.

canvasItem
item to be added to the canvas (E4CanvasItem)

E4Canvas.clear

clear()

Public method to clear the canvas.

Note: This does not delete the items.

E4Canvas.collisions

collisions(pointOrRect)

Public method returning all items that collide with a point or rectangle.

pointOrRect
point or rectangle to chack against (QPoint, QPointF, QRect or QRectF)
Returns:
list of references to items colliding with the given point or rectangle

E4Canvas.getCanvasHeight

getCanvasHeight()

Public method to get the canvas height.

Returns:
height width (float)

E4Canvas.getCanvasSize

getCanvasSize()

Public method to get the canvas size.

Returns:
canvas size (QSizeF)

E4Canvas.getCanvasWidth

getCanvasWidth()

Public method to get the canvas width.

Returns:
canvas width (float)

E4Canvas.getItems

getItems()

Public method to get all items of the canvas.

Returns:
reference to the list of items (list of E4CanvasItem)

E4Canvas.getSelectedItems

getSelectedItems()

Public method to retrieve all selected items.

Returns:
reference to the list of items (list of E4CanvasItem)

E4Canvas.paintEvent

paintEvent(evt)

Protected overridden method to paint the canvas.

evt
(QPaintEvent)

E4Canvas.removeItem

removeItem(canvasItem)

Public method to remove an item from the canvas.

canvasItem
item to be removed from the canvas (E4CanvasItem)

E4Canvas.resizeEvent

resizeEvent(evt)

Protected overridden method to handle resize events.

evt
the resize event object (QResizeEvent)

E4Canvas.setCanvasSize

setCanvasSize(width, height)

Public method to set the canvas size.

width
new width of the canvas (float)
height
new height of the canvas (float)

E4Canvas.setZoom

setZoom(zoom)

Public method to set the zoom level.

zoom
zoom level (float)

E4Canvas.sizeHint

sizeHint()

Public method to give a size hint.

Returns:
size hint (QSize)

E4Canvas.zoom

zoom()

Public method to get the zoom level.

Returns:
zoom level (float)

Up