# eric3.Graphics.ClassWidget

Module implementing an UML like class widget.

### Classes

ClassModel | Class implementing the class model.
ClassWidget | Class implementing an UML like class widget.

### Functions

None

## ClassModel

Class implementing the class model.

### Derived from

None

### Methods

ClassModel | Constructor
addAttribute | Method to add an attribute to the class model.
addMethod | Method to add a method to the class model.
getAttributes | Method to retrieve the attributes of the class.
getMethods | Method to retrieve the methods of the class.
getName | Method to retrieve the class name.

### ClassModel (Constructor)

ClassModel(name, methods=[], attributes=[])

Constructor

name
  the class name (string)
methods
  list of method names of the class (list of strings)
attributes
  list of attribute names of the class (list of strings)

### ClassModel.addAttribute

addAttribute(attribute)

Method to add an attribute to the class model.

attribute
  attribute name to be added (string)

### ClassModel.addMethod

addMethod(method)

Method to add a method to the class model.

method
  method name to be added (string)

### ClassModel.getAttributes

getAttributes()

Method to retrieve the attributes of the class.

Returns:
  list of class attributes (list of strings)

### ClassModel.getMethods

getMethods()

Method to retrieve the methods of the class.

Returns:
  list of class methods (list of strings)

### ClassModel.getName

getName()

Method to retrieve the class name.

Returns:
  class name (string)

Up

## ClassWidget

Class implementing an UML like class widget.

### Derived from

UMLWidget

### Methods

ClassWidget | Constructor
calculateSize | Method to calculate the size of the class widget.
drawShape | Overriden method to draw the shape.
isExternal | Method returning the external state.
setModel | Method to set the class model.

### ClassWidget (Constructor)

ClassWidget(canvas, model=None, external=0, x=0, y=0, rounded=0, noAttrs=0)

Constructor

canvas
  canvas containing the class widget (QCanvas)
model
  class model containing the class data (ClassModel)
external
  flag indicating a class defined outside our scope (boolean)
x
  x-coordinate (integer)
y
  y-coordinate (integer)
rounded=
  flag indicating a rounded corner (boolean)
noAttrs=
  flag indicating, that no attributes should be shown (boolean)

### ClassWidget.calculateSize

calculateSize()

Method to calculate the size of the class widget.

### ClassWidget.drawShape

drawShape(painter)

Overriden method to draw the shape.

painter
  painter the shape is drawn to (QPainter)

### ClassWidget.isExternal

isExternal()

Method returning the external state.

Returns:
  external state (boolean)

### ClassWidget.setModel

setModel(model)

Method to set the class model.

model
  class model containing the class data (ClassModel)

Up