umbrello: StateWidget Class Reference

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

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

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

A graphical version of a UML State. More...

`#include <statewidget.h>`

Inheritance diagram for StateWidget:

## Public Types
enum | StateType { Initial = 0 , Normal , End , Fork , Join , Junction , DeepHistory , ShallowHistory , Choice , Combined }
| Enumeration that codes the different types of state. More...
Public Types inherited from UMLWidget
enum | FontType { FT_NORMAL = 0 , FT_BOLD = 1 , FT_ITALIC = 2 , FT_UNDERLINE = 3 , FT_BOLD_ITALIC = 4 , FT_BOLD_UNDERLINE = 5 , FT_ITALIC_UNDERLINE = 6 , FT_BOLD_ITALIC_UNDERLINE = 7 , FT_INVALID = 8 }
enum | AddWidgetOption { NoOption = 0 , SetupSize = 1 , SwitchDirection = 2 , ShowProperties = 4 , Default = SetupSize | ShowProperties }
Public Types inherited from WidgetBase
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 *action)
Public Slots inherited from UMLWidget
virtual void | updateWidget ()
virtual void | slotMenuSelection (QAction *action)
virtual void | slotWidgetMoved (Uml::ID::Type id)
virtual void | slotFillColorChanged (Uml::ID::Type viewID)
virtual void | slotLineColorChanged (Uml::ID::Type viewID)
virtual void | slotTextColorChanged (Uml::ID::Type viewID)
virtual void | slotLineWidthChanged (Uml::ID::Type viewID)
void | slotSnapToGrid ()
Public Slots inherited from WidgetBase
virtual void | slotMenuSelection (QAction *trigger)

## Public Member Functions
| StateWidget (UMLScene *scene, StateType stateType=Normal, Uml::ID::Type id=Uml::ID::None)
virtual | ~StateWidget ()
virtual void | paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0)
StateType | stateType () const
QString | stateTypeStr () const
void | setStateType (StateType stateType)
bool | addActivity (const QString &activity)
bool | removeActivity (const QString &activity)
bool | renameActivity (const QString &activity, const QString &newName)
QStringList | activities () const
void | setActivities (const QStringList &list)
bool | drawVertical () const
void | setDrawVertical (bool to=true)
virtual bool | showPropertiesDialog ()
virtual bool | loadFromXMI (QDomElement &qElement)
virtual void | saveToXMI (QXmlStreamWriter &writer)
Public Member Functions inherited from UMLWidget
| UMLWidget (UMLScene *scene, WidgetType type=wt_UMLWidget, UMLObject *o=0)
| UMLWidget (UMLScene *scene, WidgetType type=wt_UMLWidget, Uml::ID::Type id=Uml::ID::None)
virtual | ~UMLWidget ()
UMLWidget & | operator= (const UMLWidget &other)
bool | operator== (const UMLWidget &other) const
virtual QSizeF | minimumSize () const
void | setMinimumSize (const QSizeF &size)
virtual QSizeF | maximumSize ()
void | setMaximumSize (const QSizeF &size)
virtual void | setUseFillColor (bool fc)
void | setUseFillColorCmd (bool fc)
virtual void | setTextColor (const QColor &color)
void | setTextColorCmd (const QColor &color)
virtual void | setLineColor (const QColor &color)
virtual void | setLineColorCmd (const QColor &color)
virtual void | setLineWidth (uint width)
void | setLineWidthCmd (uint width)
virtual void | setFillColor (const QColor &color)
void | setFillColorCmd (const QColor &color)
void | setSelectedFlag (bool _select)
virtual void | setSelected (bool _select)
void | setScene (UMLScene *scene)
virtual bool | activate (IDChangeLog *changeLog=0)
void | setPenFromSettings (QPainter &p)
void | setPenFromSettings (QPainter *p)
virtual void | setFont (const QFont &font)
void | setFontCmd (const QFont &font)
bool | getStartMove () const
virtual qreal | getX () const
virtual qreal | getY () const
virtual QPointF | getPos () const
virtual void | setX (qreal x)
virtual void | setY (qreal y)
qreal | height () const
qreal | width () const
void | setSize (qreal width, qreal height)
void | setSize (const QSizeF &size)
virtual void | resizeWidget (qreal newW, qreal newH)
virtual void | notifyParentResize ()
bool | getIgnoreSnapToGrid () const
void | setIgnoreSnapToGrid (bool to)
virtual bool | isLocatedIn (const UMLWidget *other) const
void | moveByLocal (qreal dx, qreal dy)
virtual void | removeAssoc (AssociationWidget *pAssoc)
virtual void | addAssoc (AssociationWidget *pAssoc)
AssociationWidgetList & | associationWidgetList () const
bool | isInstance () const
void | setIsInstance (bool isInstance)
void | setInstanceName (const QString &instanceName)
QString | instanceName () const
Uml::ShowStereoType::Enum | showStereotype () const
virtual void | setShowStereotype (Uml::ShowStereoType::Enum flag)
QString | tags () const
virtual bool | showPropertiesDialog ()
virtual void | adjustAssocs (qreal dx, qreal dy)
virtual void | adjustUnselectedAssocs (qreal dx, qreal dy)
bool | isActivated () const
void | setActivated (bool active=true)
virtual void | cleanup ()
void | updateGeometry (bool withAssocs=true)
void | clipSize ()
void | forceUpdateFontMetrics (QPainter *painter)
void | forceUpdateFontMetrics (QFont &font, QPainter *painter)
virtual bool | loadFromXMI (QDomElement &qElement)
virtual void | saveToXMI (QXmlStreamWriter &writer)
QPointF | startMovePosition () const
void | setStartMovePosition (const QPointF &position)
QSizeF | startResizeSize () const
virtual QSizeF | calculateSize (bool withExtensions=true) const
void | resize ()
bool | fixedAspectRatio () const
void | setFixedAspectRatio (bool state)
bool | resizable () const
void | setResizable (bool state)
virtual void | setDefaultFontMetrics (QFont &font, UMLWidget::FontType fontType)
virtual void | setDefaultFontMetrics (QFont &font, UMLWidget::FontType fontType, QPainter &painter)
QFontMetrics & | getFontMetrics (UMLWidget::FontType fontType) const
void | setFontMetrics (UMLWidget::FontType fontType, QFontMetrics fm)
void | setupFontType (QFont &font, UMLWidget::FontType fontType)
virtual void | paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0)
Public Member Functions inherited from WidgetBase
| 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 () 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)
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 () 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
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 ()
const ActivityWidget * | asActivityWidget () const
const ActorWidget * | asActorWidget () const
const ArtifactWidget * | asArtifactWidget () const
const AssociationWidget * | asAssociationWidget () const
const BoxWidget * | asBoxWidget () const
const CategoryWidget * | asCategoryWidget () const
const ClassifierWidget * | asClassifierWidget () const
const CombinedFragmentWidget * | asCombinedFragmentWidget () const
const ComponentWidget * | asComponentWidget () const
const DatatypeWidget * | asDatatypeWidget () const
const EntityWidget * | asEntityWidget () const
const EnumWidget * | asEnumWidget () const
const FloatingDashLineWidget * | asFloatingDashLineWidget () const
const ForkJoinWidget * | asForkJoinWidget () const
const InterfaceWidget * | asInterfaceWidget () const
const MessageWidget * | asMessageWidget () const
const NodeWidget * | asNodeWidget () const
const NoteWidget * | asNoteWidget () const
const ObjectNodeWidget * | asObjectNodeWidget () const
const ObjectWidget * | asObjectWidget () const
const PackageWidget * | asPackageWidget () const
const PinWidget * | asPinWidget () const
const PinPortBase * | asPinPortBase () const
const PortWidget * | asPortWidget () const
const PreconditionWidget * | asPreconditionWidget () const
const RegionWidget * | asRegionWidget () const
const SignalWidget * | asSignalWidget () const
const StateWidget * | asStateWidget () const
const FloatingTextWidget * | asFloatingTextWidget () const
const UseCaseWidget * | asUseCaseWidget () const
const UMLWidget * | asUMLWidget () const
virtual bool | activate (IDChangeLog *changeLog=0)
virtual void | setSelected (bool state)
Public Member Functions inherited from DiagramProxyWidget
| DiagramProxyWidget (UMLWidget *widget, qreal borderWidth=5)
virtual | ~DiagramProxyWidget ()
Uml::ID::Type | diagramLink () const
UMLScene * | linkedDiagram () const
bool | setDiagramLink (const Uml::ID::Type &id)
const QRectF & | clientRect () const
const QRectF & | sceneRect () const
void | setClientRect (const QRectF &rect)
bool | isProxyWidget () const
UMLWidget * | getProxiedWidget (const QPointF &p) const
QPointF | mapFromClient (const QPointF &p) const
QRectF | mapFromClient (const QRectF &r) const
QPointF | mapToClient (const QPointF &pos) const
void | paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0)
bool | showLinkedDiagram () const
void | setShowLinkedDiagram (bool showLinkedDiagram)
QRectF | iconRect () const
void | setIconRect (const QRectF &iconRect)

## Protected Member Functions
QSizeF | minimumSize () const
QSizeF | maximumSize ()
void | setAspectRatioMode ()
virtual void | contextMenuEvent (QGraphicsSceneContextMenuEvent *event)
virtual void | mouseDoubleClickEvent (QGraphicsSceneMouseEvent *event)
virtual void | mousePressEvent (QGraphicsSceneMouseEvent *event)
virtual void | mouseMoveEvent (QGraphicsSceneMouseEvent *event)
virtual void | mouseReleaseEvent (QGraphicsSceneMouseEvent *event)
Protected Member Functions inherited from UMLWidget
virtual void | contextMenuEvent (QGraphicsSceneContextMenuEvent *event)
virtual void | mouseDoubleClickEvent (QGraphicsSceneMouseEvent *event)
virtual void | mousePressEvent (QGraphicsSceneMouseEvent *event)
virtual void | mouseMoveEvent (QGraphicsSceneMouseEvent *event)
virtual void | mouseReleaseEvent (QGraphicsSceneMouseEvent *event)
virtual void | moveEvent (QGraphicsSceneMouseEvent *event)
virtual void | moveWidgetBy (qreal diffX, qreal diffY)
virtual void | constrainMovementForAllWidgets (qreal &diffX, qreal &diffY)
virtual void | constrain (qreal &width, qreal &height)
virtual bool | isInResizeArea (QGraphicsSceneMouseEvent *me)
virtual QCursor | resizeCursor () const
void | selectSingle (QGraphicsSceneMouseEvent *me)
void | selectMultiple (QGraphicsSceneMouseEvent *me)
void | deselect (QGraphicsSceneMouseEvent *me)
void | setSelectionBounds ()
void | resize (QGraphicsSceneMouseEvent *me)
bool | wasSizeChanged ()
bool | wasPositionChanged ()
virtual void | toForeground ()
void | addConnectedWidget (UMLWidget *widget, Uml::AssociationType::Enum type=Uml::AssociationType::Association, AddWidgetOptions options=Default)
void | addConnectedUMLObject (UMLObject::ObjectType otype, Uml::AssociationType::Enum type)
void | addWidget (UMLWidget *widget, bool showProperties=true)
virtual void | contextMenuEvent (QGraphicsSceneContextMenuEvent *event)
Protected Member Functions inherited from QGraphicsObjectWrapper
QVariant | itemChange (GraphicsItemChange change, const QVariant &value)
Protected Member Functions inherited from DiagramProxyWidget
DiagramProxyWidget & | operator= (const DiagramProxyWidget &other)
bool | activate (IDChangeLog *changeLog=0)
bool | loadFromXMI (QDomElement &qElement)
void | saveToXMI (QXmlStreamWriter &writer)
void | setupEvent (QGraphicsSceneMouseEvent &e, const QGraphicsSceneMouseEvent *event, const QPointF &pos) const
void | setupEvent (QGraphicsSceneContextMenuEvent &e, const QGraphicsSceneContextMenuEvent *event, const QPointF &pos) const
virtual void | contextMenuEvent (QGraphicsSceneContextMenuEvent *event)
virtual void | mouseDoubleClickEvent (QGraphicsSceneMouseEvent *event)
virtual void | mousePressEvent (QGraphicsSceneMouseEvent *event)
virtual void | mouseMoveEvent (QGraphicsSceneMouseEvent *event)
virtual void | mouseReleaseEvent (QGraphicsSceneMouseEvent *event)
void | slotMenuSelection (QAction *action)

## Private Attributes
StateType | m_stateType
| Type of state.
bool | m_drawVertical
| whether to draw the fork/join horizontally or vertically
QStringList | m_Activities
| List of activities for the state.
QSizeF | m_size
| widget size used by combined state

## Additional Inherited Members
Signals inherited from UMLWidget
void | sigWidgetMoved (Uml::ID::Type id)
Static Public Member Functions inherited from WidgetBase
static QString | toString (WidgetType wt)
static QString | toI18nString (WidgetType wt)
static Icon_Utils::IconType | toIcon (WidgetType wt)
static bool | widgetHasUMLObject (WidgetBase::WidgetType type)
Static Public Attributes inherited from UMLWidget
static const QSizeF | DefaultMinimumSize
static const QSizeF | DefaultMaximumSize
static const int | defaultMargin = 5
static const int | selectionMarkerSize = 4
static const int | resizeMarkerLineCount = 3
Protected Attributes inherited from UMLWidget
QString | m_instanceName
| instance name (used if on a deployment diagram)
bool | m_isInstance
| holds whether this widget is a component instance (i.e. on a deployment diagram)
Uml::ShowStereoType::Enum | m_showStereotype
| if and how the stereotype should be displayed
bool | m_startMove
QPointF | m_startMovePostion
QSizeF | m_startResizeSize
int | m_nPosX
UMLDoc * | m_doc
| shortcut for UMLApp::app()->document()
bool | m_resizable
QFontMetrics * | m_pFontMetrics [FT_INVALID]
QSizeF | m_minimumSize
QSizeF | m_maximumSize
bool | m_activated
| true if the activate function has been called for this class instance
bool | m_ignoreSnapToGrid
bool | m_ignoreSnapComponentSizeToGrid
bool | m_fixedAspectRatio
QString | m_oldStatusBarMsg
| The text in the status bar when the cursor was pressed.
QPointF | m_pressOffset
QPointF | m_oldPos
| The X/Y position the widget had when the movement started.
qreal | m_oldW
| The width/height the widget had when the resize started.
qreal | m_oldH
bool | m_shiftPressed
| If shift or control button were pressed in mouse press event.
bool | m_inMoveArea
bool | m_inResizeArea
bool | m_moved
bool | m_resized
Protected Attributes inherited from WidgetBase
UMLScene * | m_scene
QPointer< UMLObject > | m_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}

## Detailed Description

A graphical version of a UML State.

This class is the graphical version of a UML State.

A StateWidget is created by a UMLView. A StateWidget belongs to only one UMLView instance. When the UMLView instance that this class belongs to is destroyed, it will be automatically deleted.

The StateWidget class inherits from the UMLWidget class which adds most of the functionality to this class.

Author
  Paul Hensgen phens.nosp@m.gen@.nosp@m.techi.nosp@m.e.co.nosp@m.m 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

## ◆ StateType

enum StateWidget::StateType

Enumeration that codes the different types of state.

Enumerator
Initial |
Normal |
End |
Fork |
Join |
Junction |
DeepHistory |
ShallowHistory |
Choice |
Combined |

## Constructor & Destructor Documentation

## ◆ StateWidget()

StateWidget::StateWidget | ( | UMLScene * | scene,
|  | StateType | stateType = `Normal`,
|  | Uml::ID::Type | id = `Uml::ID::None`
| ) |  |
| explicit

Creates a State widget.

Parameters

  scene | The parent of the widget.
  stateType | The type of state.
  id | The ID to assign (-1 will prompt a new ID.)

## ◆ ~StateWidget()

StateWidget::~StateWidget | ( |  | ) |
| virtual

Destructor.

## Member Function Documentation

## ◆ activities()

QStringList StateWidget::activities | ( |  | ) | const

Returns the list of activities.

## ◆ addActivity()

bool StateWidget::addActivity | ( | const QString & | activity | ) |

Adds an activity to this widget.

Returns
  true on success

## ◆ contextMenuEvent()

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

Event handler for context menu events.

Reimplemented from UMLWidget.

## ◆ drawVertical()

bool StateWidget::drawVertical | ( |  | ) | const

Get whether to draw a fork or join vertically.

## ◆ loadFromXMI()

bool StateWidget::loadFromXMI | ( | QDomElement & | qElement | ) |
| virtual

Loads a "statewidget" XMI element.

Reimplemented from UMLWidget.

## ◆ maximumSize()

QSizeF StateWidget::maximumSize | ( |  | ) |
| protectedvirtual

Overrides method from UMLWidget

Reimplemented from UMLWidget.

## ◆ minimumSize()

QSizeF StateWidget::minimumSize | ( |  | ) | const
| protectedvirtual

Overrides method from UMLWidget

Reimplemented from UMLWidget.

## ◆ mouseDoubleClickEvent()

void StateWidget::mouseDoubleClickEvent | ( | QGraphicsSceneMouseEvent * | event | ) |
| protectedvirtual

Event handler for mouse double click events.

Parameters

  event | the QGraphicsSceneMouseEvent event.

Reimplemented from UMLWidget.

## ◆ mouseMoveEvent()

void StateWidget::mouseMoveEvent | ( | QGraphicsSceneMouseEvent * | event | ) |
| protectedvirtual

Handles a mouse move event. It resizes or moves the widget, depending on where the cursor is pressed on the widget. Go on reading for more info about this.

If resizing, the widget is resized using UMLWidget::resizeWidget (where specific widget resize constraint can be applied), and then the associations are adjusted. The resizing can be constrained also to a specific axis using control and shift buttons. If one or another is pressed, it's constrained to X axis. If both are pressed, it's constrained to Y axis.

If not resizing, the widget is being moved. If the move is being started, the selection bounds are set (which includes updating the list of selected widgets). The difference between the previous position of the selection and the new one is calculated (taking in account the selection bounds so widgets don't go beyond the scene limits). Then, it's constrained to X or Y axis depending on shift and control buttons. A further constraint is made using constrainMovementForAllWidgets (for example, if the widget that receives the event can only be moved in Y axis, with this method the movement of all the widgets in the selection can be constrained to be moved only in Y axis). Then, all the selected widgets are moved using moveWidgetBy (where specific widget movement constraint can be applied) and, if a certain amount of time passed from the last move event, the associations are also updated (they're not updated always to be easy on the CPU). Finally, the scene is resized, and selection bounds updated.

Parameters

  event | The QGraphicsSceneMouseEvent event.

Reimplemented from UMLWidget.

## ◆ mousePressEvent()

void StateWidget::mousePressEvent | ( | QGraphicsSceneMouseEvent * | event | ) |
| protectedvirtual

Handles a mouse press event. It'll select the widget (or mark it to be deselected) and prepare it to be moved or resized. Go on reading for more info about this.

Widget values and message bar status are saved.

If shift or control buttons are pressed, we're in move area no matter where the button was pressed in the widget. Moreover, if the widget wasn't already selected, it's added to the selection. If already selected, it's marked to be deselected when releasing the button (provided it isn't moved). Also, if the widget is already selected with other widgets but shift nor control buttons are pressed, we're in move area. If finally we don't move the widget, it's selected and the other widgets deselected when releasing the left button.

If shift nor control buttons are pressed, we're facing a single selection. Depending on the position of the cursor, we're in move or in resize area. If the widget wasn't selected (both when there are no widgets selected, or when there're other widgets selected but not the one receiving the press event) it's selected and the others deselected, if any. If already selected, it's marked to be deselected when releasing the button (provided it wasn't moved or resized).

Parameters

  event | The QGraphicsSceneMouseEvent event.

Reimplemented from UMLWidget.

## ◆ mouseReleaseEvent()

void StateWidget::mouseReleaseEvent | ( | QGraphicsSceneMouseEvent * | event | ) |
| protectedvirtual

Handles a mouse release event. It selects or deselects the widget and cancels or confirms the move or resize. Go on reading for more info about this. No matter which tool is selected, Z position of widget is updated.

Middle button release resets the selection. Left button release, if it wasn't moved nor resized, selects the widget and deselect the others if it wasn't selected and there were other widgets selected. If the widget was marked to be deselected, deselects it. If it was moved or resized, the document is set to modified if position or size changed. Also, if moved, all the associations are adjusted because the timer could have prevented the adjustment in the last move event before the release. If mouse was pressed in resize area, cursor is set again to normal cursor Right button release if right button was pressed shows the pop up menu for the widget. If left button was pressed, it cancels the move or resize with a mouse move event at the same position than the cursor was when pressed. Another left button release is also sent.

Parameters

  event | The QGraphicsSceneMouseEvent event.

Reimplemented from UMLWidget.

## ◆ paint()

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

Overrides the standard paint event.

Reimplemented from UMLWidget.

## ◆ removeActivity()

bool StateWidget::removeActivity | ( | const QString & | activity | ) |

Removes the given activity from the state.

## ◆ renameActivity()

bool StateWidget::renameActivity | ( | const QString & | activity,
|  | const QString & | newName
| ) |  |

Renames the given activity.

## ◆ saveToXMI()

void StateWidget::saveToXMI | ( | QXmlStreamWriter & | writer | ) |
| virtual

Creates the "statewidget" XMI element.

Reimplemented from UMLWidget.

## ◆ setActivities()

void StateWidget::setActivities | ( | const QStringList & | list | ) |

Sets the states activities to the ones given.

## ◆ setAspectRatioMode()

void StateWidget::setAspectRatioMode | ( |  | ) |
| protected

Set the aspect ratio mode. Some state types have a fixed aspect ratio

## ◆ setDrawVertical()

void StateWidget::setDrawVertical | ( | bool | to = `true` | ) |

Set whether to draw a fork or join vertically.

## ◆ setStateType()

void StateWidget::setStateType | ( | StateType | stateType | ) |

Sets the type of state.

## ◆ showPropertiesDialog()

bool StateWidget::showPropertiesDialog | ( |  | ) |
| virtual

Show a properties dialog for a StateWidget.

Reimplemented from UMLWidget.

## ◆ slotMenuSelection

void StateWidget::slotMenuSelection | ( | QAction * | action | ) |
| virtualslot

Captures any popup menu signals for menus it created.

## ◆ stateType()

StateWidget::StateType StateWidget::stateType | ( |  | ) | const

Returns the type of state.

Returns
  StateType

## ◆ stateTypeStr()

QString StateWidget::stateTypeStr | ( |  | ) | const

Returns the type string of state.

## Member Data Documentation

## ◆ m_Activities

QStringList StateWidget::m_Activities
| private

List of activities for the state.

## ◆ m_drawVertical

bool StateWidget::m_drawVertical
| private

whether to draw the fork/join horizontally or vertically

## ◆ m_size

QSizeF StateWidget::m_size
| private

widget size used by combined state

## ◆ m_stateType

StateType StateWidget::m_stateType
| private

Type of state.

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

- umbrello/umlwidgets/statewidget.h
- umbrello/umlwidgets/statewidget.cpp