umbrello 2.39.0
Umbrello UML Modeller is a Unified Modelling Language (UML) diagram program based on KDE Technology
WidgetBase Class Reference

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

#include <widgetbase.h>

Inheritance diagram for WidgetBase:
Collaboration 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 ()
 
UMLObjectumlObject () 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 UMLWidgetwidgetWithID (Uml::ID::Type id)
 
WidgetType baseType () const
 
void setBaseType (const WidgetType &baseType)
 
QLatin1String baseTypeStr () const
 
QString baseTypeStrWithoutPrefix () const
 
virtual void setSelected (bool select)
 
UMLSceneumlScene () const
 
UMLDocumlDoc () const
 
QString documentation () const
 
bool hasDocumentation () const
 
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 () const
 
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 () const
 
void setAutoResize (bool state)
 
bool changesShape () const
 
void setChangesShape (bool state)
 
virtual bool showPropertiesDialog ()
 
virtual bool loadFromXMI (QDomElement &qElement)
 
virtual void saveToXMI (QXmlStreamWriter &writer)
 
virtual void removeAssoc (AssociationWidget *pAssoc)
 
virtual void addAssoc (AssociationWidget *pAssoc)
 
WidgetBaseoperator= (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 UMLWidgetonWidget (const QPointF &p)
 
virtual void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=nullptr)
 
bool isActivityWidget () const
 
bool isActorWidget () const
 
bool isArtifactWidget () const
 
bool isAssociationWidget () const
 
bool isBoxWidget () const
 
bool isCategoryWidget () const
 
bool isClassWidget () const
 
bool isCombinedFragmentWidget () const
 
bool isComponentWidget () const
 
bool isDatatypeWidget () const
 
bool isEntityWidget () const
 
bool isEnumWidget () const
 
bool isFloatingDashLineWidget () const
 
bool isForkJoinWidget () const
 
bool isInterfaceWidget () const
 
bool isMessageWidget () const
 
bool isNodeWidget () const
 
bool isNoteWidget () const
 
bool isObjectNodeWidget () const
 
bool isObjectWidget () const
 
bool isPackageWidget () const
 
bool isPinWidget () const
 
bool isPortWidget () const
 
bool isPreconditionWidget () const
 
bool isRegionWidget () const
 
bool isSignalWidget () const
 
bool isStateWidget () const
 
bool isTextWidget () const
 
bool isUseCaseWidget () const
 
ActivityWidgetasActivityWidget ()
 
ActorWidgetasActorWidget ()
 
ArtifactWidgetasArtifactWidget ()
 
AssociationWidgetasAssociationWidget ()
 
BoxWidgetasBoxWidget ()
 
CategoryWidgetasCategoryWidget ()
 
ClassifierWidgetasClassifierWidget ()
 
CombinedFragmentWidgetasCombinedFragmentWidget ()
 
ComponentWidgetasComponentWidget ()
 
DatatypeWidgetasDatatypeWidget ()
 
EntityWidgetasEntityWidget ()
 
EnumWidgetasEnumWidget ()
 
FloatingDashLineWidgetasFloatingDashLineWidget ()
 
ForkJoinWidgetasForkJoinWidget ()
 
InterfaceWidgetasInterfaceWidget ()
 
MessageWidgetasMessageWidget ()
 
NodeWidgetasNodeWidget ()
 
NoteWidgetasNoteWidget ()
 
ObjectNodeWidgetasObjectNodeWidget ()
 
ObjectWidgetasObjectWidget ()
 
PackageWidgetasPackageWidget ()
 
PinWidgetasPinWidget ()
 
PinPortBaseasPinPortBase ()
 
PortWidgetasPortWidget ()
 
PreconditionWidgetasPreconditionWidget ()
 
RegionWidgetasRegionWidget ()
 
SignalWidgetasSignalWidget ()
 
StateWidgetasStateWidget ()
 
FloatingTextWidgetasFloatingTextWidget ()
 
UseCaseWidgetasUseCaseWidget ()
 
UMLWidgetasUMLWidget ()
 
const ActivityWidgetasActivityWidget () const
 
const ActorWidgetasActorWidget () const
 
const ArtifactWidgetasArtifactWidget () const
 
const AssociationWidgetasAssociationWidget () const
 
const BoxWidgetasBoxWidget () const
 
const CategoryWidgetasCategoryWidget () const
 
const ClassifierWidgetasClassifierWidget () const
 
const CombinedFragmentWidgetasCombinedFragmentWidget () const
 
const ComponentWidgetasComponentWidget () const
 
const DatatypeWidgetasDatatypeWidget () const
 
const EntityWidgetasEntityWidget () const
 
const EnumWidgetasEnumWidget () const
 
const FloatingDashLineWidgetasFloatingDashLineWidget () const
 
const ForkJoinWidgetasForkJoinWidget () const
 
const InterfaceWidgetasInterfaceWidget () const
 
const MessageWidgetasMessageWidget () const
 
const NodeWidgetasNodeWidget () const
 
const NoteWidgetasNoteWidget () const
 
const ObjectNodeWidgetasObjectNodeWidget () const
 
const ObjectWidgetasObjectWidget () const
 
const PackageWidgetasPackageWidget () const
 
const PinWidgetasPinWidget () const
 
const PinPortBaseasPinPortBase () const
 
const PortWidgetasPortWidget () const
 
const PreconditionWidgetasPreconditionWidget () const
 
const RegionWidgetasRegionWidget () const
 
const SignalWidgetasSignalWidget () const
 
const StateWidgetasStateWidget () const
 
const FloatingTextWidgetasFloatingTextWidget () const
 
const UseCaseWidgetasUseCaseWidget () const
 
const UMLWidgetasUMLWidget () const
 
virtual bool activate (IDChangeLog *changeLog=nullptr)
 
- Public Member Functions inherited from QGraphicsObjectWrapper

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

UMLScenem_scene
 
QPointer< UMLObjectm_umlObject
 
QString m_Doc
 Only used if m_umlObject is not set.
 
QString m_Text
 
QRectF m_rect
 Widget size. In this rectangle, the x and y coordinates are always 0.
 
Uml::ID::Type m_nId
 
Uml::ID::Type m_nLocalID
 
QColor m_textColor
 Color of the text of the widget. Is saved to XMI.
 
QColor m_lineColor
 Color of the lines of the widget. Is saved to XMI.
 
QColor m_fillColor
 color of the background of the widget
 
QBrush m_brush
 
QFont m_font
 
uint m_lineWidth
 Width of the lines of the widget. Is saved to XMI.
 
bool m_useFillColor
 flag indicates if the UMLWidget uses the Diagram FillColour
 
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.
 
- Protected Attributes inherited from QGraphicsObjectWrapper
bool m_calledFromItemChange {false}
 

Private Attributes

WidgetType m_baseType
 Type of widget.
 

Detailed Description

Member Enumeration Documentation

◆ 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
sceneThe view to be displayed on.
typeThe WidgetType to construct. This must be set to the appropriate value by the constructors of inheriting classes.
idThe XMI ID to use. The value Uml::ID::None will trigger generation of a new ID.
Here is the call graph for this function:

◆ ~WidgetBase()

WidgetBase::~WidgetBase ( )
virtual

Destructor.

Member Function Documentation

◆ activate()

bool WidgetBase::activate ( IDChangeLog * changeLog = nullptr)
virtual

Activate the object after deserializing it from XMI

Parameters
changeLogoptional pointer to IDChangeLog object
Returns
true for success

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

Here is the call graph for this function:

◆ 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() [1/2]

ActivityWidget * WidgetBase::asActivityWidget ( )

◆ asActivityWidget() [2/2]

const ActivityWidget * WidgetBase::asActivityWidget ( ) const

◆ asActorWidget() [1/2]

ActorWidget * WidgetBase::asActorWidget ( )

◆ asActorWidget() [2/2]

const ActorWidget * WidgetBase::asActorWidget ( ) const

◆ asArtifactWidget() [1/2]

ArtifactWidget * WidgetBase::asArtifactWidget ( )

◆ asArtifactWidget() [2/2]

const ArtifactWidget * WidgetBase::asArtifactWidget ( ) const

◆ asAssociationWidget() [1/2]

AssociationWidget * WidgetBase::asAssociationWidget ( )

◆ asAssociationWidget() [2/2]

const AssociationWidget * WidgetBase::asAssociationWidget ( ) const

◆ asBoxWidget() [1/2]

BoxWidget * WidgetBase::asBoxWidget ( )

◆ asBoxWidget() [2/2]

const BoxWidget * WidgetBase::asBoxWidget ( ) const

◆ asCategoryWidget() [1/2]

CategoryWidget * WidgetBase::asCategoryWidget ( )

◆ asCategoryWidget() [2/2]

const CategoryWidget * WidgetBase::asCategoryWidget ( ) const

◆ asClassifierWidget() [1/2]

ClassifierWidget * WidgetBase::asClassifierWidget ( )

◆ asClassifierWidget() [2/2]

const ClassifierWidget * WidgetBase::asClassifierWidget ( ) const

◆ asCombinedFragmentWidget() [1/2]

CombinedFragmentWidget * WidgetBase::asCombinedFragmentWidget ( )

◆ asCombinedFragmentWidget() [2/2]

const CombinedFragmentWidget * WidgetBase::asCombinedFragmentWidget ( ) const

◆ asComponentWidget() [1/2]

ComponentWidget * WidgetBase::asComponentWidget ( )

◆ asComponentWidget() [2/2]

const ComponentWidget * WidgetBase::asComponentWidget ( ) const

◆ asDatatypeWidget() [1/2]

DatatypeWidget * WidgetBase::asDatatypeWidget ( )

◆ asDatatypeWidget() [2/2]

const DatatypeWidget * WidgetBase::asDatatypeWidget ( ) const

◆ asEntityWidget() [1/2]

EntityWidget * WidgetBase::asEntityWidget ( )

◆ asEntityWidget() [2/2]

const EntityWidget * WidgetBase::asEntityWidget ( ) const

◆ asEnumWidget() [1/2]

EnumWidget * WidgetBase::asEnumWidget ( )

◆ asEnumWidget() [2/2]

const EnumWidget * WidgetBase::asEnumWidget ( ) const

◆ asFloatingDashLineWidget() [1/2]

FloatingDashLineWidget * WidgetBase::asFloatingDashLineWidget ( )

◆ asFloatingDashLineWidget() [2/2]

const FloatingDashLineWidget * WidgetBase::asFloatingDashLineWidget ( ) const

◆ asFloatingTextWidget() [1/2]

FloatingTextWidget * WidgetBase::asFloatingTextWidget ( )

◆ asFloatingTextWidget() [2/2]

const FloatingTextWidget * WidgetBase::asFloatingTextWidget ( ) const

◆ asForkJoinWidget() [1/2]

ForkJoinWidget * WidgetBase::asForkJoinWidget ( )

◆ asForkJoinWidget() [2/2]

const ForkJoinWidget * WidgetBase::asForkJoinWidget ( ) const

◆ asInterfaceWidget() [1/2]

InterfaceWidget * WidgetBase::asInterfaceWidget ( )

◆ asInterfaceWidget() [2/2]

const InterfaceWidget * WidgetBase::asInterfaceWidget ( ) const

◆ asMessageWidget() [1/2]

MessageWidget * WidgetBase::asMessageWidget ( )

◆ asMessageWidget() [2/2]

const MessageWidget * WidgetBase::asMessageWidget ( ) const

◆ asNodeWidget() [1/2]

NodeWidget * WidgetBase::asNodeWidget ( )

◆ asNodeWidget() [2/2]

const NodeWidget * WidgetBase::asNodeWidget ( ) const

◆ asNoteWidget() [1/2]

NoteWidget * WidgetBase::asNoteWidget ( )

◆ asNoteWidget() [2/2]

const NoteWidget * WidgetBase::asNoteWidget ( ) const

◆ asObjectNodeWidget() [1/2]

ObjectNodeWidget * WidgetBase::asObjectNodeWidget ( )

◆ asObjectNodeWidget() [2/2]

const ObjectNodeWidget * WidgetBase::asObjectNodeWidget ( ) const

◆ asObjectWidget() [1/2]

ObjectWidget * WidgetBase::asObjectWidget ( )

◆ asObjectWidget() [2/2]

const ObjectWidget * WidgetBase::asObjectWidget ( ) const

◆ asPackageWidget() [1/2]

PackageWidget * WidgetBase::asPackageWidget ( )

◆ asPackageWidget() [2/2]

const PackageWidget * WidgetBase::asPackageWidget ( ) const

◆ asPinPortBase() [1/2]

PinPortBase * WidgetBase::asPinPortBase ( )

◆ asPinPortBase() [2/2]

const PinPortBase * WidgetBase::asPinPortBase ( ) const

◆ asPinWidget() [1/2]

PinWidget * WidgetBase::asPinWidget ( )

◆ asPinWidget() [2/2]

const PinWidget * WidgetBase::asPinWidget ( ) const

◆ asPortWidget() [1/2]

PortWidget * WidgetBase::asPortWidget ( )

◆ asPortWidget() [2/2]

const PortWidget * WidgetBase::asPortWidget ( ) const

◆ asPreconditionWidget() [1/2]

PreconditionWidget * WidgetBase::asPreconditionWidget ( )

◆ asPreconditionWidget() [2/2]

const PreconditionWidget * WidgetBase::asPreconditionWidget ( ) const

◆ asRegionWidget() [1/2]

RegionWidget * WidgetBase::asRegionWidget ( )

◆ asRegionWidget() [2/2]

const RegionWidget * WidgetBase::asRegionWidget ( ) const

◆ asSignalWidget() [1/2]

SignalWidget * WidgetBase::asSignalWidget ( )

◆ asSignalWidget() [2/2]

const SignalWidget * WidgetBase::asSignalWidget ( ) const

◆ asStateWidget() [1/2]

StateWidget * WidgetBase::asStateWidget ( )

◆ asStateWidget() [2/2]

const StateWidget * WidgetBase::asStateWidget ( ) const

◆ asUMLWidget() [1/2]

UMLWidget * WidgetBase::asUMLWidget ( )

◆ asUMLWidget() [2/2]

const UMLWidget * WidgetBase::asUMLWidget ( ) const

◆ asUseCaseWidget() [1/2]

UseCaseWidget * WidgetBase::asUseCaseWidget ( )

◆ asUseCaseWidget() [2/2]

const UseCaseWidget * WidgetBase::asUseCaseWidget ( ) const

◆ autoResize()

bool WidgetBase::autoResize ( ) const

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.
Here is the call graph for this function:

◆ boundingRect()

QRectF WidgetBase::boundingRect ( ) const
virtual
Returns
The bounding rectangle for this widget.
See also
setRect

Reimplemented in AssociationWidget, CombinedFragmentWidget, and PinPortBase.

Here is the call graph for this function:

◆ changesShape()

bool WidgetBase::changesShape ( ) const

Return changes state property

Returns
the changes shape state

◆ contextMenuEvent()

void WidgetBase::contextMenuEvent ( QGraphicsSceneContextMenuEvent * event)
protectedvirtual

Reimplemented to show appropriate context menu.

Reimplemented in AssociationWidget, StateWidget, and UMLWidget.

Here is the call graph for this function:

◆ 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 ( ) const

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.

Here is the call graph for this function:

◆ isActivityWidget()

bool WidgetBase::isActivityWidget ( ) const
inline
Here is the call graph for this function:

◆ isActorWidget()

bool WidgetBase::isActorWidget ( ) const
inline
Here is the call graph for this function:

◆ isArtifactWidget()

bool WidgetBase::isArtifactWidget ( ) const
inline
Here is the call graph for this function:

◆ isAssociationWidget()

bool WidgetBase::isAssociationWidget ( ) const
inline
Here is the call graph for this function:

◆ isBoxWidget()

bool WidgetBase::isBoxWidget ( ) const
inline
Here is the call graph for this function:

◆ isCategoryWidget()

bool WidgetBase::isCategoryWidget ( ) const
inline
Here is the call graph for this function:

◆ isClassWidget()

bool WidgetBase::isClassWidget ( ) const
inline
Here is the call graph for this function:

◆ isCombinedFragmentWidget()

bool WidgetBase::isCombinedFragmentWidget ( ) const
inline
Here is the call graph for this function:

◆ isComponentWidget()

bool WidgetBase::isComponentWidget ( ) const
inline
Here is the call graph for this function:

◆ isDatatypeWidget()

bool WidgetBase::isDatatypeWidget ( ) const
inline
Here is the call graph for this function:

◆ isEntityWidget()

bool WidgetBase::isEntityWidget ( ) const
inline
Here is the call graph for this function:

◆ isEnumWidget()

bool WidgetBase::isEnumWidget ( ) const
inline
Here is the call graph for this function:

◆ isFloatingDashLineWidget()

bool WidgetBase::isFloatingDashLineWidget ( ) const
inline
Here is the call graph for this function:

◆ isForkJoinWidget()

bool WidgetBase::isForkJoinWidget ( ) const
inline
Here is the call graph for this function:

◆ isInterfaceWidget()

bool WidgetBase::isInterfaceWidget ( ) const
inline
Here is the call graph for this function:

◆ isMessageWidget()

bool WidgetBase::isMessageWidget ( ) const
inline
Here is the call graph for this function:

◆ isNodeWidget()

bool WidgetBase::isNodeWidget ( ) const
inline
Here is the call graph for this function:

◆ isNoteWidget()

bool WidgetBase::isNoteWidget ( ) const
inline
Here is the call graph for this function:

◆ isObjectNodeWidget()

bool WidgetBase::isObjectNodeWidget ( ) const
inline
Here is the call graph for this function:

◆ isObjectWidget()

bool WidgetBase::isObjectWidget ( ) const
inline
Here is the call graph for this function:

◆ isPackageWidget()

bool WidgetBase::isPackageWidget ( ) const
inline
Here is the call graph for this function:

◆ isPinWidget()

bool WidgetBase::isPinWidget ( ) const
inline
Here is the call graph for this function:

◆ isPortWidget()

bool WidgetBase::isPortWidget ( ) const
inline
Here is the call graph for this function:

◆ isPreconditionWidget()

bool WidgetBase::isPreconditionWidget ( ) const
inline
Here is the call graph for this function:

◆ isRegionWidget()

bool WidgetBase::isRegionWidget ( ) const
inline
Here is the call graph for this function:

◆ isSignalWidget()

bool WidgetBase::isSignalWidget ( ) const
inline
Here is the call graph for this function:

◆ isStateWidget()

bool WidgetBase::isStateWidget ( ) const
inline
Here is the call graph for this function:

◆ isTextWidget()

bool WidgetBase::isTextWidget ( ) const
inline
Here is the call graph for this function:

◆ isUseCaseWidget()

bool WidgetBase::isUseCaseWidget ( ) const
inline
Here is the call graph for this function:

◆ 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

◆ loadFromXMI()

bool WidgetBase::loadFromXMI ( 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
qElementA QDomElement which contains xml info for this widget.
Todo
Add support to load older version.

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

Here is the call graph for this function:

◆ 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
pPoint to be checked.
Returns
'this' if the given point is in the boundaries of the widget; else NULL.

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

Here is the call graph for this function:

◆ operator=()

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

Assignment operator

Here is the call graph for this function:

◆ paint()

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

Draws the UMLWidget on the given paint device

Parameters
painterThe painter for the drawing device
optionPainting related options
widgetBackground widget on which to paint (optional)

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

◆ 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.

◆ saveToXMI()

void WidgetBase::saveToXMI ( 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
writerThe QXmlStreamWriter to write to.

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

Here is the call graph for this function:

◆ 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.

Here is the call graph for this function:

◆ 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
docThe 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
colorThe 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.

Here is the call graph for this function:

◆ setID()

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

Write property of m_nId.

Here is the call graph for this function:

◆ setLineColor()

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

Sets the line color

Parameters
colorThe new line color

Reimplemented in AssociationWidget, and UMLWidget.

◆ setLineWidth()

void WidgetBase::setLineWidth ( uint width)
virtual

Sets the line width

Parameters
widthThe new line width

Reimplemented in AssociationWidget, and UMLWidget.

◆ setLocalID()

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

Sets the local id of the object.

Parameters
idThe local id of the object.
Here is the call graph for this function:

◆ 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
strNameThe name to be set.

Reimplemented in AssociationWidget, PinPortBase, and SignalWidget.

◆ setRect() [1/2]

void WidgetBase::setRect ( const QRectF & rect)

set widget rectangle in item coordinates

Here is the call graph for this function:

◆ setRect() [2/2]

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

set widget rectangle in item coordinates

Here is the call graph for this function:

◆ setSelected()

void WidgetBase::setSelected ( bool select)
virtual

Reimplemented from QGraphicsObjectWrapper.

Reimplemented in AssociationWidget, MessageWidget, ObjectWidget, and UMLWidget.

Here is the call graph for this function:

◆ setTextColor()

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

Sets the text color

Parameters
colorthe new text color

Reimplemented in AssociationWidget, and UMLWidget.

◆ setUMLObject()

void WidgetBase::setUMLObject ( UMLObject * obj)
virtual

Sets the UMLObject to represent.

Parameters
objThe object to represent.

Reimplemented in AssociationWidget, and ClassifierWidget.

◆ setUseFillColor()

void WidgetBase::setUseFillColor ( bool state)
virtual

Set state if fill color is used

Parameters
stateThe state to set

Reimplemented in UMLWidget.

◆ setUsesDiagramFillColor()

void WidgetBase::setUsesDiagramFillColor ( bool state)

Set state if diagram fill color is used

Parameters
stateThe state to set

◆ setUsesDiagramLineColor()

void WidgetBase::setUsesDiagramLineColor ( bool state)

Set state of diagram line color is used

Parameters
stateThe state to set

◆ setUsesDiagramLineWidth()

void WidgetBase::setUsesDiagramLineWidth ( bool state)

Set state of diagram line width is used

Parameters
stateThe state to set

◆ setUsesDiagramTextColor()

void WidgetBase::setUsesDiagramTextColor ( bool state)

Set state if diagram text color is used

Parameters
stateThe state to set
Here is the call graph for this function:

◆ setUsesDiagramUseFillColor()

void WidgetBase::setUsesDiagramUseFillColor ( bool state)

Set state of diagram use fill color is used

Parameters
stateThe 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 ActivityWidget, AssociationWidget, BoxWidget, ClassifierWidget, FloatingTextWidget, ForkJoinWidget, MessageWidget, NoteWidget, ObjectNodeWidget, ObjectWidget, SignalWidget, StateWidget, and UMLWidget.

◆ 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.

Here is the call graph for this function:

◆ 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
wtWidgetType of which a string representation is wanted
Returns
the WidgetType as localized string
Here is the call graph for this function:

◆ toIcon()

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

Returns the given enum value as icon type.

Parameters
wtWidgetType 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
wtWidgetType 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.
Here is the call graph for this function:

◆ 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 ( ) const

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
idThe 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 ClassifierWidget, and PinPortBase.

Here is the call graph for this function:

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 nullptr.) 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. In this rectangle, the x and y coordinates are always 0.

◆ 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: