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

fromDict | Class method to create a generic UML item from persisted data.

### Methods

UMLItem | Constructor
addAssociation | Public method to add an association to this widget.
adjustAssociations | Public method to adjust the associations to widget movements.
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.
toDict | Public method to collect data to be persisted.

### Static Methods

None

#### UMLItem.fromDict (class method)

fromDict(data, colors=None)

Class method to create a generic UML item from persisted data.

data (dict)
  dictionary containing the persisted data as generated by toDict()
colors (tuple of (QColor, QColor))
  tuple containing the foreground and background colors

Return:
  created UML item

Return Type:
  UMLItem

#### UMLItem (Constructor)

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

Constructor

model (UMLModel)
  UML model containing the item data
x (int)
  x-coordinate
y (int)
  y-coordinate
rounded (bool)
  flag indicating a rounded corner
colors (tuple of (QColor, QColor))
  tuple containing the foreground and background colors
parent (QGraphicsItem)
  reference to the parent object

#### UMLItem.addAssociation

addAssociation(assoc)

Public method to add an association to this widget.

assoc (AssociationWidget)
  association to be added

#### UMLItem.adjustAssociations

adjustAssociations()

Public method to adjust the associations to widget movements.

#### UMLItem.getId

getId()

Public method to get the item ID.

Return:
  ID of the item

Return Type:
  int

#### UMLItem.getItemType

getItemType()

Public method to get the item's type.

Return:
  item type

Return Type:
  str

#### UMLItem.getName

getName()

Public method to retrieve the item name.

Return:
  item name

Return Type:
  str

#### UMLItem.itemChange

itemChange(change, value)

Public method called when an items state changes.

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

Return:
  adjusted values

Return Type:
  Any

#### UMLItem.moveBy

moveBy(dx, dy)

Public overriden method to move the widget relative.

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

#### UMLItem.paint

paint(painter, option, widget=None)

Public method to paint the item in local coordinates.

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

#### UMLItem.parseItemDataString

parseItemDataString(version, data)

Public method to parse the given persistence data.

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

Return:
  flag indicating success

Return Type:
  bool

#### UMLItem.removeAssociation

removeAssociation(assoc)

Public method to remove an association to this widget.

assoc (AssociationWidget)
  association to be removed

#### UMLItem.removeAssociations

removeAssociations()

Public method to remove all associations of this widget.

#### UMLItem.setId

setId(itemId)

Public method to assign an ID to the item.

itemId (int)
  assigned ID

#### UMLItem.setPos

setPos(x, y)

Public overriden method to set the items position.

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

#### UMLItem.setSize

setSize(width, height)

Public method to set the rectangles size.

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

#### UMLItem.toDict

toDict()

Public method to collect data to be persisted.

Return:
  dictionary containing data to be persisted

Return Type:
  dict

Up

## UMLModel

Class implementing the UMLModel base class.

### Derived from

None

### 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 (str)
  package name

#### UMLModel.getName

getName()

Public method to retrieve the model name.

Return:
  model name

Return Type:
  str

Up