Eidolon
Public Member Functions | Public Attributes | List of all members
Base2DWidget Class Reference
Inheritance diagram for Base2DWidget:
Inheritance graph
Collaboration diagram for Base2DWidget:
Collaboration graph

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
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  parent = None 
)

Member Function Documentation

◆ fillImage()

def fillImage (   self,
  img 
)
Called by the widget acting as the drawing target, the QImage `img' is filled with data here, then drawn.
Here is the caller graph for this function:

◆ getBoxFitScale()

def getBoxFitScale (   self,
  w,
  h 
)
Returns the scale factor needed to fit a rectangle of dimensions `w' x `h' in the drawing area.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getDrawDims()

def getDrawDims (   self)
Get the draw area (width,height) pair.
Here is the caller graph for this function:

◆ keyPress()

def keyPress (   self,
  e 
)
By default passes the event `e' to QtWidgets.QWidget.keyPressEvent.
Here is the caller graph for this function:

◆ keyRelease()

def keyRelease (   self,
  e 
)
By default passes the event `e' to QtWidgets.QWidget.keyReleaseEvent.
Here is the caller graph for this function:

◆ modifyDrawWidget()

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.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mouseDoubleClick()

def mouseDoubleClick (   self,
  e 
)
Here is the caller graph for this function:

◆ mouseDrag()

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.
Here is the caller graph for this function:

◆ mousePress()

def mousePress (   self,
  e 
)
Here is the caller graph for this function:

◆ mouseRelease()

def mouseRelease (   self,
  e 
)
Here is the caller graph for this function:

◆ mouseWheelMove()

def mouseWheelMove (   self,
  e 
)
Here is the caller graph for this function:

◆ parentClosed()

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.

◆ updateView()

def updateView (   self)
Called before `fillImage()', used to update the scene and UI before draw.
Here is the caller graph for this function:

Member Data Documentation

◆ img

img

◆ imgFormat

imgFormat

◆ prevX

prevX

◆ prevY

prevY

The documentation for this class was generated from the following file: