Eidolon
|
Public Member Functions | |
def | __init__ (self, parent=None) |
def | modifyDrawWidget (self, drawWidget) |
def | updateView (self) |
def | fillImage (self, img) |
def | mousePress (self, e) |
def | mouseRelease (self, e) |
def | mouseDrag (self, e, dx, dy) |
def | mouseWheelMove (self, e) |
def | mouseDoubleClick (self, e) |
def | keyPress (self, e) |
def | keyRelease (self, e) |
def | parentClosed (self, e) |
def | getDrawDims (self) |
def | getBoxFitScale (self, w, h) |
Public Attributes | |
imgFormat | |
img | |
prevX | |
prevY | |
Defines the base class for 2D views, handling the redraw cycle and mouse and key input callback methods. The method modifyDrawWidget() modifies its argument widget by replacing the paintEvent, wheelEvent, and mouse*Event, and key*Event methods. The new paintEvent() method first calls updateView(), creates a QImage to cover the screen, calls fillImage() with that QImage object as the argument, and then draws the QImage to screen. The update cycle expects updateView() to setup scene and UI values then fillImage() draws whatever's necessary to the QImage object. This class therefore represents the boundary between the UI and 2D rendering subsystems. The methods of this class except modifyDrawWidget(), getDrawDims(), and getBoxFitScale() must be overridden to implement behaviour.
def __init__ | ( | self, | |
parent = None |
|||
) |
def fillImage | ( | self, | |
img | |||
) |
Called by the widget acting as the drawing target, the QImage `img' is filled with data here, then drawn.
def getBoxFitScale | ( | self, | |
w, | |||
h | |||
) |
Returns the scale factor needed to fit a rectangle of dimensions `w' x `h' in the drawing area.
def getDrawDims | ( | self | ) |
Get the draw area (width,height) pair.
def keyPress | ( | self, | |
e | |||
) |
By default passes the event `e' to QtWidgets.QWidget.keyPressEvent.
def keyRelease | ( | self, | |
e | |||
) |
By default passes the event `e' to QtWidgets.QWidget.keyReleaseEvent.
def modifyDrawWidget | ( | self, | |
drawWidget | |||
) |
Modify the given object (assumed to be the widget the 2D view is drawn in) to send its events to the parent and repaint itself using an internal image object.
def mouseDoubleClick | ( | self, | |
e | |||
) |
def mouseDrag | ( | self, | |
e, | |||
dx, | |||
dy | |||
) |
Called when the mouse is moved with a button pressed, `e' is the MouseEvent from mouseMoveEvent() calls, and (dx,dy) is the distance the mouse was moved since the last event.
def mousePress | ( | self, | |
e | |||
) |
def mouseRelease | ( | self, | |
e | |||
) |
def mouseWheelMove | ( | self, | |
e | |||
) |
def parentClosed | ( | self, | |
e | |||
) |
Called if this widget is inside a parent container and that container is closed. It is up to the parent to call this, Qt doesn't do it automatically.
def updateView | ( | self | ) |
Called before `fillImage()', used to update the scene and UI before draw.
img |
imgFormat |
prevX |
prevY |