# eric6.Graphics.UMLItem

Module implementing the UMLItem base class.

### Global Attributes

None

### Classes

UMLItem | Class implementing the UMLItem base class.
UMLModel | Class implementing the UMLModel base class.

### Functions

None

## UMLItem

Class implementing the UMLItem base class.

### Derived from

QGraphicsRectItem

### Class Attributes

ItemType

### Class Methods

None

### Methods

UMLItem | Constructor
addAssociation | Public method to add an association to this widget.
adjustAssociations | Public method to adjust the associations to widget movements.
buildItemDataString | Public method to build a string to persist the specific item data.
getId | Public method to get the item ID.
getItemType | Public method to get the item's type.
getName | Public method to retrieve the item name.
itemChange | Public method called when an items state changes.
moveBy | Public overriden method to move the widget relative.
paint | Public method to paint the item in local coordinates.
parseItemDataString | Public method to parse the given persistence data.
removeAssociation | Public method to remove an association to this widget.
removeAssociations | Public method to remove all associations of this widget.
setId | Public method to assign an ID to the item.
setPos | Public overriden method to set the items position.
setSize | Public method to set the rectangles size.

### Static Methods

None

#### UMLItem (Constructor)

UMLItem(model=None, x=0, y=0, rounded=False, parent=None)

Constructor

model
  UML model containing the item data (UMLModel)
x
  x-coordinate (integer)
y
  y-coordinate (integer)
rounded
  flag indicating a rounded corner (boolean)
parent=
  reference to the parent object (QGraphicsItem)

#### UMLItem.addAssociation

addAssociation(assoc)

Public method to add an association to this widget.

assoc
  association to be added (AssociationWidget)

#### UMLItem.adjustAssociations

adjustAssociations()

Public method to adjust the associations to widget movements.

#### UMLItem.buildItemDataString

buildItemDataString()

Public method to build a string to persist the specific item data.

This string must start with ", " and should be built like "attribute=value" with pairs separated by ", ". value must not contain ", " or newlines.

Returns:
  persistence data (string)

#### UMLItem.getId

getId()

Public method to get the item ID.

Returns:
  ID of the item (integer)

#### UMLItem.getItemType

getItemType()

Public method to get the item's type.

Returns:
  item type (string)

#### UMLItem.getName

getName()

Public method to retrieve the item name.

Returns:
  item name (string)

#### UMLItem.itemChange

itemChange(change, value)

Public method called when an items state changes.

change
  the item's change (QGraphicsItem.GraphicsItemChange)
value
  the value of the change

Returns:
  adjusted values

#### UMLItem.moveBy

moveBy(dx, dy)

Public overriden method to move the widget relative.

dx
  relative movement in x-direction (float)
dy
  relative movement in y-direction (float)

#### UMLItem.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)

#### UMLItem.parseItemDataString

parseItemDataString(version, data)

Public method to parse the given persistence data.

version
  version of the data (string)
data
  persisted data to be parsed (string)

Returns:
  flag indicating success (boolean)

#### UMLItem.removeAssociation

removeAssociation(assoc)

Public method to remove an association to this widget.

assoc
  association to be removed (AssociationWidget)

#### UMLItem.removeAssociations

removeAssociations()

Public method to remove all associations of this widget.

#### UMLItem.setId

setId(id)

Public method to assign an ID to the item.

id
  assigned ID (integer)

#### UMLItem.setPos

setPos(x, y)

Public overriden method to set the items position.

x
  absolute x-position (float)
y
  absolute y-position (float)

#### UMLItem.setSize

setSize(width, height)

Public method to set the rectangles size.

width
  width of the rectangle (float)
height
  height of the rectangle (float)

Up

## UMLModel

Class implementing the UMLModel base class.

### Derived from

object

### Class Attributes

None

### Class Methods

None

### Methods

UMLModel | Constructor
getName | Public method to retrieve the model name.

### Static Methods

None

#### UMLModel (Constructor)

UMLModel(name)

Constructor

name
  package name (string)

#### UMLModel.getName

getName()

Public method to retrieve the model name.

Returns:
  model name (string)

Up