umbrello: WidgetBase Class Reference

umbrello 2.32.1 Umbrello UML Modeller is a Unified Modelling Language (UML) diagram program based on KDE Technology

Public Types | Public Slots | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
WidgetBase Class Reference

Common base class for UMLWidget and AssociationWidget. More...

`#include <widgetbase.h>`

Inheritance diagram for WidgetBase:

## Public Types
enum | WidgetType { wt_Min = 299 , wt_UMLWidget , wt_Actor , wt_UseCase , wt_Class , wt_Interface , wt_Datatype , wt_Enum , wt_Entity , wt_Package , wt_Object , wt_Note , wt_Box , wt_Message , wt_Text , wt_State , wt_Activity , wt_Component , wt_Artifact , wt_Node , wt_Association , wt_ForkJoin , wt_Precondition , wt_CombinedFragment , wt_FloatingDashLine , wt_Signal , wt_Pin , wt_ObjectNode , wt_Region , wt_Category , wt_Port , wt_Instance , wt_Max }

## Public Slots
virtual void | slotMenuSelection (QAction *trigger)

## Public Member Functions
| WidgetBase (UMLScene *scene, WidgetType type=wt_UMLWidget, Uml::ID::Type id=Uml::ID::None)
virtual | ~WidgetBase ()
UMLObject * | umlObject () const
virtual void | setUMLObject (UMLObject *obj)
Uml::ID::Type | id () const
void | setID (Uml::ID::Type id)
void | setLocalID (Uml::ID::Type id)
Uml::ID::Type | localID () const
virtual UMLWidget * | widgetWithID (Uml::ID::Type id)
WidgetType | baseType () const
void | setBaseType (const WidgetType &baseType)
QLatin1String | baseTypeStr () const
QString | baseTypeStrWithoutPrefix () const
virtual void | setSelected (bool select)
UMLScene * | umlScene () const
UMLDoc * | umlDoc () const
QString | documentation () const
bool | hasDocumentation ()
virtual void | setDocumentation (const QString &doc)
QString | name () const
virtual void | setName (const QString &strName)
QColor | lineColor () const
virtual void | setLineColor (const QColor &color)
uint | lineWidth () const
virtual void | setLineWidth (uint width)
QColor | textColor () const
virtual void | setTextColor (const QColor &color)
QColor | fillColor () const
virtual void | setFillColor (const QColor &color)
bool | usesDiagramLineColor () const
void | setUsesDiagramLineColor (bool state)
bool | usesDiagramLineWidth () const
void | setUsesDiagramLineWidth (bool state)
bool | useFillColor ()
virtual void | setUseFillColor (bool state)
bool | usesDiagramTextColor () const
void | setUsesDiagramTextColor (bool state)
bool | usesDiagramFillColor () const
void | setUsesDiagramFillColor (bool state)
bool | usesDiagramUseFillColor () const
void | setUsesDiagramUseFillColor (bool state)
virtual QFont | font () const
virtual void | setFont (const QFont &font)
bool | autoResize ()
void | setAutoResize (bool state)
bool | changesShape ()
void | setChangesShape (bool state)
virtual bool | showPropertiesDialog ()
virtual bool | loadFromXMI1 (QDomElement &qElement)
virtual void | saveToXMI1 (QXmlStreamWriter &writer)
virtual void | removeAssoc (AssociationWidget *pAssoc)
virtual void | addAssoc (AssociationWidget *pAssoc)
WidgetBase & | operator= (const WidgetBase &other)
QRectF | rect () const
void | setRect (const QRectF &rect)
void | setRect (qreal x, qreal y, qreal width, qreal height)
virtual QRectF | boundingRect () const
virtual UMLWidget * | onWidget (const QPointF &p)
virtual void | paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0)
bool | isActivityWidget ()
bool | isActorWidget ()
bool | isArtifactWidget ()
bool | isAssociationWidget ()
bool | isBoxWidget ()
bool | isCategoryWidget ()
bool | isClassWidget ()
bool | isCombinedFragmentWidget ()
bool | isComponentWidget ()
bool | isDatatypeWidget ()
bool | isEntityWidget ()
bool | isEnumWidget ()
bool | isFloatingDashLineWidget ()
bool | isForkJoinWidget ()
bool | isInterfaceWidget ()
bool | isMessageWidget ()
bool | isNodeWidget ()
bool | isNoteWidget ()
bool | isObjectNodeWidget ()
bool | isObjectWidget ()
bool | isPackageWidget ()
bool | isPinWidget ()
bool | isPortWidget ()
bool | isPreconditionWidget ()
bool | isRegionWidget ()
bool | isSignalWidget ()
bool | isStateWidget ()
bool | isTextWidget ()
bool | isUseCaseWidget ()
ActivityWidget * | asActivityWidget ()
ActorWidget * | asActorWidget ()
ArtifactWidget * | asArtifactWidget ()
AssociationWidget * | asAssociationWidget ()
BoxWidget * | asBoxWidget ()
CategoryWidget * | asCategoryWidget ()
ClassifierWidget * | asClassifierWidget ()
CombinedFragmentWidget * | asCombinedFragmentWidget ()
ComponentWidget * | asComponentWidget ()
DatatypeWidget * | asDatatypeWidget ()
EntityWidget * | asEntityWidget ()
EnumWidget * | asEnumWidget ()
FloatingDashLineWidget * | asFloatingDashLineWidget ()
ForkJoinWidget * | asForkJoinWidget ()
InterfaceWidget * | asInterfaceWidget ()
MessageWidget * | asMessageWidget ()
NodeWidget * | asNodeWidget ()
NoteWidget * | asNoteWidget ()
ObjectNodeWidget * | asObjectNodeWidget ()
ObjectWidget * | asObjectWidget ()
PackageWidget * | asPackageWidget ()
PinWidget * | asPinWidget ()
PinPortBase * | asPinPortBase ()
PortWidget * | asPortWidget ()
PreconditionWidget * | asPreconditionWidget ()
RegionWidget * | asRegionWidget ()
SignalWidget * | asSignalWidget ()
StateWidget * | asStateWidget ()
FloatingTextWidget * | asFloatingTextWidget ()
UseCaseWidget * | asUseCaseWidget ()
UMLWidget * | asUMLWidget ()
virtual bool | activate (IDChangeLog *changeLog=0)

## Static Public Member Functions
static QString | toString (WidgetType wt)
static QString | toI18nString (WidgetType wt)
static Icon_Utils::IconType | toIcon (WidgetType wt)
static bool | widgetHasUMLObject (WidgetBase::WidgetType type)

## Protected Member Functions
virtual void | contextMenuEvent (QGraphicsSceneContextMenuEvent *event)
Protected Member Functions inherited from QGraphicsObjectWrapper
QVariant | itemChange (GraphicsItemChange change, const QVariant &value)

## Protected Attributes
UMLScene * | m_scene
QPointer< UMLObject > | m_umlObject
QString | m_Doc
| Only used if m_umlObject is not set. More...
QString | m_Text
QRectF | m_rect
| widget size More...
Uml::ID::Type | m_nId
Uml::ID::Type | m_nLocalID
QColor | m_textColor
| Color of the text of the widget. Is saved to XMI. More...
QColor | m_lineColor
| Color of the lines of the widget. Is saved to XMI. More...
QColor | m_fillColor
| color of the background of the widget More...
QBrush | m_brush
QFont | m_font
uint | m_lineWidth
| Width of the lines of the widget. Is saved to XMI. More...
bool | m_useFillColor
| flag indicates if the UMLWidget uses the Diagram FillColour More...
bool | m_usesDiagramFillColor
bool | m_usesDiagramLineColor
bool | m_usesDiagramLineWidth
bool | m_usesDiagramTextColor
bool | m_usesDiagramUseFillColor
bool | m_autoResize
bool | m_changesShape
| The widget changes its shape when the number of connections or their positions are changed. More...
Protected Attributes inherited from QGraphicsObjectWrapper
bool | m_calledFromItemChange {false}

## Private Attributes
WidgetType | m_baseType
| Type of widget. More...

## Detailed Description

Common base class for UMLWidget and AssociationWidget.

Author
  Oliver Kellogg okell.nosp@m.ogg@.nosp@m.users.nosp@m..sou.nosp@m.rcefo.nosp@m.rge..nosp@m.net Bugs and comments to umbre.nosp@m.llo-.nosp@m.devel.nosp@m.@kde.nosp@m..org or https://bugs.kde.org

## Member Enumeration Documentation

## ◆ WidgetType

enum WidgetBase::WidgetType

Enumerator
wt_Min |
wt_UMLWidget |
wt_Actor |
wt_UseCase |
wt_Class |
wt_Interface |
wt_Datatype |
wt_Enum |
wt_Entity |
wt_Package |
wt_Object |
wt_Note |
wt_Box |
wt_Message |
wt_Text |
wt_State |
wt_Activity |
wt_Component |
wt_Artifact |
wt_Node |
wt_Association |
wt_ForkJoin |
wt_Precondition |
wt_CombinedFragment |
wt_FloatingDashLine |
wt_Signal |
wt_Pin |
wt_ObjectNode |
wt_Region |
wt_Category |
wt_Port |
wt_Instance |
wt_Max |

## Constructor & Destructor Documentation

## ◆ WidgetBase()

WidgetBase::WidgetBase | ( | UMLScene * | scene,
|  | WidgetType | type = `wt_UMLWidget`,
|  | Uml::ID::Type | id = `Uml::ID::None`
| ) |  |
| explicit

Creates a WidgetBase object.

Parameters

  scene | The view to be displayed on.
  type | The WidgetType to construct. This must be set to the appropriate value by the constructors of inheriting classes.

## ◆ ~WidgetBase()

WidgetBase::~WidgetBase | ( |  | ) |
| virtual

Destructor.

## Member Function Documentation

## ◆ activate()

bool WidgetBase::activate | ( | IDChangeLog * | changeLog = `0` | ) |
| virtual

Activate the object after deserializing it from XMI

Parameters

  ChangeLog |

Returns
  true for success

Reimplemented in PreconditionWidget, MessageWidget, UMLWidget, PinPortBase, ObjectWidget, FloatingTextWidget, CombinedFragmentWidget, and AssociationWidget.

## ◆ addAssoc()

void WidgetBase::addAssoc | ( | AssociationWidget * | pAssoc | ) |
| virtual

Adds an already created association to the list of associations that include this UMLWidget

Reimplemented in UMLWidget.

## ◆ asActivityWidget()

ActivityWidget * WidgetBase::asActivityWidget | ( |  | ) |

## ◆ asActorWidget()

ActorWidget * WidgetBase::asActorWidget | ( |  | ) |

## ◆ asArtifactWidget()

ArtifactWidget * WidgetBase::asArtifactWidget | ( |  | ) |

## ◆ asAssociationWidget()

AssociationWidget * WidgetBase::asAssociationWidget | ( |  | ) |

## ◆ asBoxWidget()

BoxWidget * WidgetBase::asBoxWidget | ( |  | ) |

## ◆ asCategoryWidget()

CategoryWidget * WidgetBase::asCategoryWidget | ( |  | ) |

## ◆ asClassifierWidget()

ClassifierWidget * WidgetBase::asClassifierWidget | ( |  | ) |

## ◆ asCombinedFragmentWidget()

CombinedFragmentWidget * WidgetBase::asCombinedFragmentWidget | ( |  | ) |

## ◆ asComponentWidget()

ComponentWidget * WidgetBase::asComponentWidget | ( |  | ) |

## ◆ asDatatypeWidget()

DatatypeWidget * WidgetBase::asDatatypeWidget | ( |  | ) |

## ◆ asEntityWidget()

EntityWidget * WidgetBase::asEntityWidget | ( |  | ) |

## ◆ asEnumWidget()

EnumWidget * WidgetBase::asEnumWidget | ( |  | ) |

## ◆ asFloatingDashLineWidget()

FloatingDashLineWidget * WidgetBase::asFloatingDashLineWidget | ( |  | ) |

## ◆ asFloatingTextWidget()

FloatingTextWidget * WidgetBase::asFloatingTextWidget | ( |  | ) |

## ◆ asForkJoinWidget()

ForkJoinWidget * WidgetBase::asForkJoinWidget | ( |  | ) |

## ◆ asInterfaceWidget()

InterfaceWidget * WidgetBase::asInterfaceWidget | ( |  | ) |

## ◆ asMessageWidget()

MessageWidget * WidgetBase::asMessageWidget | ( |  | ) |

## ◆ asNodeWidget()

NodeWidget * WidgetBase::asNodeWidget | ( |  | ) |

## ◆ asNoteWidget()

NoteWidget * WidgetBase::asNoteWidget | ( |  | ) |

## ◆ asObjectNodeWidget()

ObjectNodeWidget * WidgetBase::asObjectNodeWidget | ( |  | ) |

## ◆ asObjectWidget()

ObjectWidget * WidgetBase::asObjectWidget | ( |  | ) |

## ◆ asPackageWidget()

PackageWidget * WidgetBase::asPackageWidget | ( |  | ) |

## ◆ asPinPortBase()

PinPortBase * WidgetBase::asPinPortBase | ( |  | ) |

## ◆ asPinWidget()

PinWidget * WidgetBase::asPinWidget | ( |  | ) |

## ◆ asPortWidget()

PortWidget * WidgetBase::asPortWidget | ( |  | ) |

## ◆ asPreconditionWidget()

PreconditionWidget * WidgetBase::asPreconditionWidget | ( |  | ) |

## ◆ asRegionWidget()

RegionWidget * WidgetBase::asRegionWidget | ( |  | ) |

## ◆ asSignalWidget()

SignalWidget * WidgetBase::asSignalWidget | ( |  | ) |

## ◆ asStateWidget()

StateWidget * WidgetBase::asStateWidget | ( |  | ) |

## ◆ asUMLWidget()

UMLWidget * WidgetBase::asUMLWidget | ( |  | ) |

## ◆ asUseCaseWidget()

UseCaseWidget * WidgetBase::asUseCaseWidget | ( |  | ) |

## ◆ autoResize()

bool WidgetBase::autoResize | ( |  | ) |

Return state of auto resize property

Returns
  the auto resize state

## ◆ baseType()

WidgetBase::WidgetType WidgetBase::baseType | ( |  | ) | const

Read property of m_baseType.

## ◆ baseTypeStr()

QLatin1String WidgetBase::baseTypeStr | ( |  | ) | const

Returns
  The type used for rtti as string.

## ◆ baseTypeStrWithoutPrefix()

QString WidgetBase::baseTypeStrWithoutPrefix | ( |  | ) | const

Returns
  The type as string without 'wt_' prefix.

## ◆ boundingRect()

QRectF WidgetBase::boundingRect | ( |  | ) | const
| virtual

Returns
  The bounding rectangle for this widget.

See also
  setRect

Reimplemented in PinPortBase, CombinedFragmentWidget, and AssociationWidget.

## ◆ changesShape()

bool WidgetBase::changesShape | ( |  | ) |

Return changes state property

Returns
  the changes shape state

## ◆ contextMenuEvent()

void WidgetBase::contextMenuEvent | ( | QGraphicsSceneContextMenuEvent * | event | ) |
| protectedvirtual

Reimplemented to show appropriate context menu.

Reimplemented in UMLWidget, StateWidget, and AssociationWidget.

## ◆ documentation()

QString WidgetBase::documentation | ( |  | ) | const

Used by some child classes to get documentation.

Returns
  The documentation from the UMLObject (if m_umlObject is set.)

## ◆ fillColor()

QColor WidgetBase::fillColor | ( |  | ) | const

Returns fill color

Returns
  currently used fill color

## ◆ font()

QFont WidgetBase::font | ( |  | ) | const
| virtual

Returns the font used for displaying any text.

Returns
  the font

Reimplemented in AssociationWidget.

## ◆ hasDocumentation()

bool WidgetBase::hasDocumentation | ( |  | ) |

Returns state of documentation for the widget.

Returns
  false if documentation is empty

## ◆ id()

Uml::ID::Type WidgetBase::id | ( |  | ) | const

Read property of m_nId.

## ◆ isActivityWidget()

bool WidgetBase::isActivityWidget | ( |  | ) |
| inline

## ◆ isActorWidget()

bool WidgetBase::isActorWidget | ( |  | ) |
| inline

## ◆ isArtifactWidget()

bool WidgetBase::isArtifactWidget | ( |  | ) |
| inline

## ◆ isAssociationWidget()

bool WidgetBase::isAssociationWidget | ( |  | ) |
| inline

## ◆ isBoxWidget()

bool WidgetBase::isBoxWidget | ( |  | ) |
| inline

## ◆ isCategoryWidget()

bool WidgetBase::isCategoryWidget | ( |  | ) |
| inline

## ◆ isClassWidget()

bool WidgetBase::isClassWidget | ( |  | ) |
| inline

## ◆ isCombinedFragmentWidget()

bool WidgetBase::isCombinedFragmentWidget | ( |  | ) |
| inline

## ◆ isComponentWidget()

bool WidgetBase::isComponentWidget | ( |  | ) |
| inline

## ◆ isDatatypeWidget()

bool WidgetBase::isDatatypeWidget | ( |  | ) |
| inline

## ◆ isEntityWidget()

bool WidgetBase::isEntityWidget | ( |  | ) |
| inline

## ◆ isEnumWidget()

bool WidgetBase::isEnumWidget | ( |  | ) |
| inline

## ◆ isFloatingDashLineWidget()

bool WidgetBase::isFloatingDashLineWidget | ( |  | ) |
| inline

## ◆ isForkJoinWidget()

bool WidgetBase::isForkJoinWidget | ( |  | ) |
| inline

## ◆ isInterfaceWidget()

bool WidgetBase::isInterfaceWidget | ( |  | ) |
| inline

## ◆ isMessageWidget()

bool WidgetBase::isMessageWidget | ( |  | ) |
| inline

## ◆ isNodeWidget()

bool WidgetBase::isNodeWidget | ( |  | ) |
| inline

## ◆ isNoteWidget()

bool WidgetBase::isNoteWidget | ( |  | ) |
| inline

## ◆ isObjectNodeWidget()

bool WidgetBase::isObjectNodeWidget | ( |  | ) |
| inline

## ◆ isObjectWidget()

bool WidgetBase::isObjectWidget | ( |  | ) |
| inline

## ◆ isPackageWidget()

bool WidgetBase::isPackageWidget | ( |  | ) |
| inline

## ◆ isPinWidget()

bool WidgetBase::isPinWidget | ( |  | ) |
| inline

## ◆ isPortWidget()

bool WidgetBase::isPortWidget | ( |  | ) |
| inline

## ◆ isPreconditionWidget()

bool WidgetBase::isPreconditionWidget | ( |  | ) |
| inline

## ◆ isRegionWidget()

bool WidgetBase::isRegionWidget | ( |  | ) |
| inline

## ◆ isSignalWidget()

bool WidgetBase::isSignalWidget | ( |  | ) |
| inline

## ◆ isStateWidget()

bool WidgetBase::isStateWidget | ( |  | ) |
| inline

## ◆ isTextWidget()

bool WidgetBase::isTextWidget | ( |  | ) |
| inline

## ◆ isUseCaseWidget()

bool WidgetBase::isUseCaseWidget | ( |  | ) |
| inline

## ◆ lineColor()

QColor WidgetBase::lineColor | ( |  | ) | const

Returns line color

Returns
  currently used line color

## ◆ lineWidth()

uint WidgetBase::lineWidth | ( |  | ) | const

Returns line width

Returns
  currently used line with

## ◆ loadFromXMI1()

bool WidgetBase::loadFromXMI1 | ( | QDomElement & | qElement | ) |
| virtual

A virtual method to load the properties of this widget from a QDomElement into this widget.

Subclasses should reimplement this to load additional properties required, calling this base method to load the basic properties of the widget.

Parameters

  qElement | A QDomElement which contains xml info for this widget.

Todo:
  Add support to load older version.

Reimplemented in UMLWidget, StateWidget, SignalWidget, RegionWidget, PreconditionWidget, PinPortBase, ObjectWidget, ObjectNodeWidget, NoteWidget, MessageWidget, ForkJoinWidget, FloatingTextWidget, FloatingDashLineWidget, EnumWidget, EntityWidget, DatatypeWidget, CombinedFragmentWidget, ClassifierWidget, AssociationWidget, and ActivityWidget.

## ◆ localID()

Uml::ID::Type WidgetBase::localID | ( |  | ) | const

Returns the local ID for this object. This ID is used so that many objects of the same UMLObject instance can be on the same diagram.

Returns
  The local ID.

## ◆ name()

QString WidgetBase::name | ( |  | ) | const

Gets the name from the corresponding UMLObject if this widget has an underlying UMLObject; if it does not, then it returns the local m_Text (notably the case for FloatingTextWidget.)

Returns
  the currently set name

## ◆ onWidget()

UMLWidget * WidgetBase::onWidget | ( | const QPointF & | p | ) |
| virtual

Test if point is inside the bounding rectangle of the widget. Inheriting classes may reimplement this to test possible child widgets.

Parameters

  p | Point to be checked.

Returns
  'this' if the given point is in the boundaries of the widget; else NULL.

Reimplemented in PinPortBase, MessageWidget, FloatingTextWidget, ClassifierWidget, and AssociationWidget.

## ◆ operator=()

WidgetBase & WidgetBase::operator= | ( | const WidgetBase & | other | ) |

Assignment operator

## ◆ paint()

void WidgetBase::paint | ( | QPainter * | painter,
|  | const QStyleOptionGraphicsItem * | option,
|  | QWidget * | widget = `0`
| ) |  |
| virtual

Draws the UMLWidget on the given paint device

Parameters

  painter | The painter for the drawing device
  option | Painting related options
  widget | Background widget on which to paint (optional)

Reimplemented in FloatingDashLineWidget, UseCaseWidget, UMLWidget, StateWidget, SignalWidget, RegionWidget, PreconditionWidget, PinPortBase, PackageWidget, ObjectWidget, ObjectNodeWidget, NoteWidget, NodeWidget, MessageWidget, ForkJoinWidget, FloatingTextWidget, EnumWidget, EntityWidget, DatatypeWidget, ComponentWidget, CombinedFragmentWidget, ClassifierWidget, CategoryWidget, BoxWidget, ArtifactWidget, ActorWidget, and ActivityWidget.

## ◆ rect()

QRectF WidgetBase::rect | ( |  | ) | const

return drawing rectangle of widget in local coordinates

## ◆ removeAssoc()

void WidgetBase::removeAssoc | ( | AssociationWidget * | pAssoc | ) |
| virtual

Removes an already created association from the list of associations that include this UMLWidget

Reimplemented in UMLWidget.

## ◆ saveToXMI1()

void WidgetBase::saveToXMI1 | ( | QXmlStreamWriter & | writer | ) |
| virtual

A virtual method to save the properties of this widget into a QXmlStreamWriter i.e. XML.

Subclasses should first create a new dedicated element as the child of qElement parameter passed. Then this base method should be called to save basic widget properties.

Parameters

  writer | The QXmlStreamWriter to write to.

Reimplemented in UseCaseWidget, UMLWidget, StateWidget, SignalWidget, RegionWidget, PreconditionWidget, PinPortBase, PackageWidget, ObjectWidget, ObjectNodeWidget, NoteWidget, NodeWidget, MessageWidget, ForkJoinWidget, FloatingTextWidget, FloatingDashLineWidget, EnumWidget, EntityWidget, DatatypeWidget, ComponentWidget, CombinedFragmentWidget, ClassifierWidget, CategoryWidget, BoxWidget, AssociationWidget, ArtifactWidget, ActorWidget, and ActivityWidget.

## ◆ setAutoResize()

void WidgetBase::setAutoResize | ( | bool | state | ) |

set auto resize state

Parameters

  state |

## ◆ setBaseType()

void WidgetBase::setBaseType | ( | const WidgetType & | baseType | ) |

Set property m_baseType. Used for types changing their types during runtime.

## ◆ setChangesShape()

void WidgetBase::setChangesShape | ( | bool | state | ) |

set changes shape property

Parameters

  state |

## ◆ setDocumentation()

void WidgetBase::setDocumentation | ( | const QString & | doc | ) |
| virtual

Used by some child classes to set documentation.

Parameters

  doc | The documentation to be set in the UMLObject (if m_umlObject is set.)

Reimplemented in ClassifierWidget.

## ◆ setFillColor()

void WidgetBase::setFillColor | ( | const QColor & | color | ) |
| virtual

Sets the fill color

Parameters

  color | The new fill color

Reimplemented in UMLWidget.

## ◆ setFont()

void WidgetBase::setFont | ( | const QFont & | font | ) |
| virtual

Set the font used to display text inside this widget.

Reimplemented in UMLWidget.

## ◆ setID()

void WidgetBase::setID | ( | Uml::ID::Type | id | ) |

Write property of m_nId.

## ◆ setLineColor()

void WidgetBase::setLineColor | ( | const QColor & | color | ) |
| virtual

Sets the line color

Parameters

  color | The new line color

Reimplemented in UMLWidget, and AssociationWidget.

## ◆ setLineWidth()

void WidgetBase::setLineWidth | ( | uint | width | ) |
| virtual

Sets the line width

Parameters

  width | The new line width

Reimplemented in UMLWidget, and AssociationWidget.

## ◆ setLocalID()

void WidgetBase::setLocalID | ( | Uml::ID::Type | id | ) |

Sets the local id of the object.

Parameters

  id | The local id of the object.

## ◆ setName()

void WidgetBase::setName | ( | const QString & | strName | ) |
| virtual

Sets the name in the corresponding UMLObject. Sets the local m_Text if m_umlObject is NULL.

Parameters

  strName | The name to be set.

Reimplemented in AssociationWidget, SignalWidget, and PinPortBase.

## ◆ setRect() [1/2]

void WidgetBase::setRect | ( | const QRectF & | rect | ) |

set widget rectangle in item coordinates

## ◆ setRect() [2/2]

void WidgetBase::setRect | ( | qreal | x,
|  | qreal | y,
|  | qreal | width,
|  | qreal | height
| ) |  |

set widget rectangle in item coordinates

## ◆ setSelected()

void WidgetBase::setSelected | ( | bool | select | ) |
| virtual

Reimplemented from QGraphicsObjectWrapper.

Reimplemented in ObjectWidget, UMLWidget, MessageWidget, and AssociationWidget.

## ◆ setTextColor()

void WidgetBase::setTextColor | ( | const QColor & | color | ) |
| virtual

Sets the text color

Parameters

  color | the new text color

Reimplemented in UMLWidget, and AssociationWidget.

## ◆ setUMLObject()

void WidgetBase::setUMLObject | ( | UMLObject * | obj | ) |
| virtual

Sets the UMLObject to represent.

Parameters

  obj | The object to represent.

Reimplemented in ClassifierWidget, and AssociationWidget.

## ◆ setUseFillColor()

void WidgetBase::setUseFillColor | ( | bool | state | ) |
| virtual

Set state if fill color is used

Parameters

  state | The state to set

Reimplemented in UMLWidget.

## ◆ setUsesDiagramFillColor()

void WidgetBase::setUsesDiagramFillColor | ( | bool | state | ) |

Set state if diagram fill color is used

Parameters

  state | The state to set

## ◆ setUsesDiagramLineColor()

void WidgetBase::setUsesDiagramLineColor | ( | bool | state | ) |

Set state of diagram line color is used

Parameters

  state | The state to set

## ◆ setUsesDiagramLineWidth()

void WidgetBase::setUsesDiagramLineWidth | ( | bool | state | ) |

Set state of diagram line width is used

Parameters

  state | The state to set

## ◆ setUsesDiagramTextColor()

void WidgetBase::setUsesDiagramTextColor | ( | bool | state | ) |

Set state if diagram text color is used

Parameters

  state | The state to set

## ◆ setUsesDiagramUseFillColor()

void WidgetBase::setUsesDiagramUseFillColor | ( | bool | state | ) |

Set state of diagram use fill color is used

Parameters

  state | The state to set

## ◆ showPropertiesDialog()

bool WidgetBase::showPropertiesDialog | ( |  | ) |
| virtual

A virtual method for the widget to display a property dialog box. Subclasses should reimplement this appropriately. In case the user cancels the dialog or there are some requirements not fulfilled the method returns false; true otherwise.

Returns
  true - properties has been applyed
  false - properties has not been applied

Reimplemented in UMLWidget, StateWidget, SignalWidget, ObjectWidget, ObjectNodeWidget, NoteWidget, MessageWidget, ForkJoinWidget, FloatingTextWidget, ClassifierWidget, BoxWidget, AssociationWidget, and ActivityWidget.

## ◆ slotMenuSelection

void WidgetBase::slotMenuSelection | ( | QAction * | trigger | ) |
| virtualslot

This is usually called synchronously after menu.exec() and trigger's parent is always the ListPopupMenu which can be used to get the type of action of trigger.

Note
  Subclasses can reimplement to handle specific actions and leave the rest to WidgetBase::slotMenuSelection.

Reimplemented in FloatingDashLineWidget.

## ◆ textColor()

QColor WidgetBase::textColor | ( |  | ) | const

Returns text color

Returns
  currently used text color

## ◆ toI18nString()

QString WidgetBase::toI18nString | ( | WidgetType | wt | ) |
| static

Returns the given enum value as localized string.

Parameters

  wt | WidgetType of which a string representation is wanted

Returns
  the WidgetType as localized string

## ◆ toIcon()

Icon_Utils::IconType WidgetBase::toIcon | ( | WidgetBase::WidgetType | wt | ) |
| static

Returns the given enum value as icon type.

Parameters

  wt | WidgetType of which an icon type representation is wanted

Returns
  the WidgetType as icon type

## ◆ toString()

QString WidgetBase::toString | ( | WidgetType | wt | ) |
| static

Helper function for debug output. Returns the given enum value as string.

Parameters

  wt | WidgetType of which a string representation is wanted

Returns
  the WidgetType as string

## ◆ umlDoc()

UMLDoc * WidgetBase::umlDoc | ( |  | ) | const

This is shortcut method for UMLApp::app()->document().

Returns
  Pointer to the UMLDoc object.

## ◆ umlObject()

UMLObject * WidgetBase::umlObject | ( |  | ) | const

Returns the UMLObject set to represent.

Returns
  the UMLObject to represent.

## ◆ umlScene()

UMLScene * WidgetBase::umlScene | ( |  | ) | const

Deliver a pointer to the connected UMLView (needed esp. by event handling of AssociationLine).

## ◆ useFillColor()

bool WidgetBase::useFillColor | ( |  | ) |

Return state of fill color usage

Returns
  True if fill color is used

## ◆ usesDiagramFillColor()

bool WidgetBase::usesDiagramFillColor | ( |  | ) | const

Returns state of diagram fill color is used

Returns
  True means diagrams fill color is used

## ◆ usesDiagramLineColor()

bool WidgetBase::usesDiagramLineColor | ( |  | ) | const

Returns state of diagram line color is used

Returns
  True means diagrams line color is used

## ◆ usesDiagramLineWidth()

bool WidgetBase::usesDiagramLineWidth | ( |  | ) | const

Returns state of diagram line width is used

Returns
  True means diagrams line width is used

## ◆ usesDiagramTextColor()

bool WidgetBase::usesDiagramTextColor | ( |  | ) | const

Returns state if diagram text color is used

Returns
  True means diagram text color is used

## ◆ usesDiagramUseFillColor()

bool WidgetBase::usesDiagramUseFillColor | ( |  | ) | const

Returns state of diagram use fill color is used

Returns
  True means diagrams fill color is used

## ◆ widgetHasUMLObject()

bool WidgetBase::widgetHasUMLObject | ( | WidgetBase::WidgetType | type | ) |
| static

Returns whether the widget type has an associated UMLObject

## ◆ widgetWithID()

UMLWidget * WidgetBase::widgetWithID | ( | Uml::ID::Type | id | ) |
| virtual

Returns the widget with the given ID. The default implementation tests the following IDs:

- m_nLocalID
- if m_umlObject is non NULL: m_umlObject->id()
- m_nID Composite widgets override this function to test further owned widgets.

Parameters

  id | The ID to test this widget against.

Returns
  'this' if id is either of m_nLocalID, m_umlObject->id(), or m_nId; else NULL.

Reimplemented in PinPortBase, and ClassifierWidget.

## Member Data Documentation

## ◆ m_autoResize

bool WidgetBase::m_autoResize
| protected

## ◆ m_baseType

WidgetType WidgetBase::m_baseType
| private

Type of widget.

## ◆ m_brush

QBrush WidgetBase::m_brush
| protected

## ◆ m_changesShape

bool WidgetBase::m_changesShape
| protected

The widget changes its shape when the number of connections or their positions are changed.

## ◆ m_Doc

QString WidgetBase::m_Doc
| protected

Only used if m_umlObject is not set.

## ◆ m_fillColor

QColor WidgetBase::m_fillColor
| protected

color of the background of the widget

## ◆ m_font

QFont WidgetBase::m_font
| protected

## ◆ m_lineColor

QColor WidgetBase::m_lineColor
| protected

Color of the lines of the widget. Is saved to XMI.

## ◆ m_lineWidth

uint WidgetBase::m_lineWidth
| protected

Width of the lines of the widget. Is saved to XMI.

## ◆ m_nId

Uml::ID::Type WidgetBase::m_nId
| protected

This ID is only used when the widget does not have a corresponding UMLObject (i.e. the m_umlObject pointer is NULL.) For UMLObjects, the ID from the UMLObject is used.

## ◆ m_nLocalID

Uml::ID::Type WidgetBase::m_nLocalID
| protected

This ID is only used when a widget could be added more than once to a diagram

## ◆ m_rect

QRectF WidgetBase::m_rect
| protected

widget size

## ◆ m_scene

UMLScene* WidgetBase::m_scene
| protected

## ◆ m_Text

QString WidgetBase::m_Text
| protected

## ◆ m_textColor

QColor WidgetBase::m_textColor
| protected

Color of the text of the widget. Is saved to XMI.

## ◆ m_umlObject

QPointer<UMLObject> WidgetBase::m_umlObject
| protected

## ◆ m_useFillColor

bool WidgetBase::m_useFillColor
| protected

flag indicates if the UMLWidget uses the Diagram FillColour

## ◆ m_usesDiagramFillColor

bool WidgetBase::m_usesDiagramFillColor
| protected

true by default, false if the colors have been explicitly set for this widget. These are saved to XMI.

## ◆ m_usesDiagramLineColor

bool WidgetBase::m_usesDiagramLineColor
| protected

## ◆ m_usesDiagramLineWidth

bool WidgetBase::m_usesDiagramLineWidth
| protected

## ◆ m_usesDiagramTextColor

bool WidgetBase::m_usesDiagramTextColor
| protected

## ◆ m_usesDiagramUseFillColor

bool WidgetBase::m_usesDiagramUseFillColor
| protected

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

- umbrello/umlwidgets/widgetbase.h
- umbrello/umlwidgets/widgetbase.cpp