# eric4.Graphics.ClassItem

Module implementing an UML like class item.

### Classes

ClassItem | Class implementing an UML like class item.
ClassModel | Class implementing the class model.

### Functions

None

## ClassItem

Class implementing an UML like class item.

### Derived from

UMLItem

### Methods

ClassItem | Constructor
__calculateSize | Private method to calculate the size of the class item.
__createTexts | Private method to create the text items of the class item.
isExternal | Method returning the external state.
paint | Public method to paint the item in local coordinates.
setModel | Method to set the class model.

#### ClassItem (Constructor)

ClassItem(model = None, external = False, x = 0, y = 0, rounded = False, noAttrs = False, parent = None, scene = None)

Constructor

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)
parent=
  reference to the parent object (QGraphicsItem)
scene=
  reference to the scene object (QGraphicsScene)

#### ClassItem.__calculateSize

__calculateSize()

Private method to calculate the size of the class item.

#### ClassItem.__createTexts

__createTexts()

Private method to create the text items of the class item.

#### ClassItem.isExternal

isExternal()

Method returning the external state.

Returns:
  external state (boolean)

#### ClassItem.paint

paint(painter, option, widget = None)

Public method to paint the item in local coordinates.

painter
  reference to the painter object (QPainter)
option
  style options (QStyleOptionGraphicsItem)
widget
  optional reference to the widget painted on (QWidget)

#### ClassItem.setModel

setModel(model)

Method to set the class model.

model
  class model containing the class data (ClassModel)

Up

## ClassModel

Class implementing the class model.

### Derived from

object

### 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