umbrello: umbrello/umlwidgets/statewidget.h Source File

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

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

- File List
- File Members

statewidget.h
Go to the documentation of this file.
1/*
2 SPDX-License-Identifier: GPL-2.0-or-later
3 SPDX-FileCopyrightText: 2002-2021 Umbrello UML Modeller Authors <umbrello-devel@kde.org>
4*/
5
6#ifndef STATEWIDGET_H
7#define STATEWIDGET_H
8
9#include "umlwidget.h"
10
11#include <QPainter>
12#include <QStringList>
13
14#define STATE_MARGIN 5
15#define STATE_WIDTH 30
16#define STATE_HEIGHT 10
17
33 class StateWidget : public UMLWidget
34{
35 Q_OBJECT
36 Q_ENUMS(StateType)
37public:
39 enum StateType
40 {
41 Initial = 0, // Pseudostate
42 Normal,
43 End,
44 Fork, // Pseudostate
45 Join, // Pseudostate
46 Junction, // Pseudostate
47 DeepHistory, // Pseudostate
48 ShallowHistory, // Pseudostate
49 Choice, // Pseudostate
50 //Terminate // Pseudostate
51 //EntryPoint // Pseudostate
52 //ExitPoint // Pseudostate
53 Combined // Pseudostate
54 };
55
56 explicit StateWidget(UMLScene * scene, StateType stateType = Normal, Uml::ID::Type id = Uml::ID::None);
57 virtual ~StateWidget();
58
59 virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
60
61 StateType stateType() const;
62 QString stateTypeStr() const;
63 void setStateType(StateType stateType);
64
65 bool addActivity(const QString &activity);
66 bool removeActivity(const QString &activity);
67 bool renameActivity(const QString &activity, const QString &newName);
68
69 QStringList activities() const;
70 void setActivities(const QStringList &list);
71
72 bool drawVertical() const;
73 void setDrawVertical(bool to = true);
74
75 virtual bool showPropertiesDialog();
76
77 virtual bool loadFromXMI(QDomElement & qElement);
78 virtual void saveToXMI(QXmlStreamWriter& writer);
79
80protected:
81 QSizeF minimumSize() const;
82 QSizeF maximumSize();
83 void setAspectRatioMode();
84 virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event);
85 virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
86 virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
87 virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
88 virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
89
90public Q_SLOTS:
91 virtual void slotMenuSelection(QAction* action);
92
93private:
94 StateType m_stateType;
95 bool m_drawVertical;
96 QStringList m_Activities;
97 QSizeF m_size;
98};
99
100#endif
StateWidget
A graphical version of a UML State.
Definition statewidget.h:34
StateWidget::minimumSize
QSizeF minimumSize() const
Definition statewidget.cpp:224
StateWidget::renameActivity
bool renameActivity(const QString &activity, const QString &newName)
Definition statewidget.cpp:441
StateWidget::mouseDoubleClickEvent
virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
Definition statewidget.cpp:346
StateWidget::saveToXMI
virtual void saveToXMI(QXmlStreamWriter &writer)
Definition statewidget.cpp:507
StateWidget::~StateWidget
virtual ~StateWidget()
Definition statewidget.cpp:53
StateWidget::stateType
StateType stateType() const
Definition statewidget.cpp:390
StateWidget::removeActivity
bool removeActivity(const QString &activity)
Definition statewidget.cpp:430
StateWidget::stateTypeStr
QString stateTypeStr() const
Definition statewidget.cpp:398
StateWidget::activities
QStringList activities() const
Definition statewidget.cpp:462
StateWidget::contextMenuEvent
virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
Definition statewidget.cpp:336
StateWidget::mousePressEvent
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event)
Definition statewidget.cpp:356
StateWidget::setActivities
void setActivities(const QStringList &list)
Definition statewidget.cpp:453
StateWidget::maximumSize
QSizeF maximumSize()
Definition statewidget.cpp:288
StateWidget::mouseReleaseEvent
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
Definition statewidget.cpp:376
StateWidget::mouseMoveEvent
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event)
Definition statewidget.cpp:366
StateWidget::loadFromXMI
virtual bool loadFromXMI(QDomElement &qElement)
Definition statewidget.cpp:532
StateWidget::drawVertical
bool drawVertical() const
Definition statewidget.cpp:470
StateWidget::m_size
QSizeF m_size
widget size used by combined state
Definition statewidget.h:97
StateWidget::StateType
StateType
Enumeration that codes the different types of state.
Definition statewidget.h:40
StateWidget::Junction
@ Junction
Definition statewidget.h:46
StateWidget::Fork
@ Fork
Definition statewidget.h:44
StateWidget::ShallowHistory
@ ShallowHistory
Definition statewidget.h:48
StateWidget::Join
@ Join
Definition statewidget.h:45
StateWidget::DeepHistory
@ DeepHistory
Definition statewidget.h:47
StateWidget::Combined
@ Combined
Definition statewidget.h:53
StateWidget::Choice
@ Choice
Definition statewidget.h:49
StateWidget::Initial
@ Initial
Definition statewidget.h:41
StateWidget::End
@ End
Definition statewidget.h:43
StateWidget::Normal
@ Normal
Definition statewidget.h:42
StateWidget::slotMenuSelection
virtual void slotMenuSelection(QAction *action)
Definition statewidget.cpp:565
StateWidget::setStateType
void setStateType(StateType stateType)
Definition statewidget.cpp:406
StateWidget::m_drawVertical
bool m_drawVertical
whether to draw the fork/join horizontally or vertically
Definition statewidget.h:95
StateWidget::showPropertiesDialog
virtual bool showPropertiesDialog()
Definition statewidget.cpp:489
StateWidget::addActivity
bool addActivity(const QString &activity)
Definition statewidget.cpp:420
StateWidget::setAspectRatioMode
void setAspectRatioMode()
Definition statewidget.cpp:317
StateWidget::paint
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0)
Definition statewidget.cpp:60
StateWidget::m_stateType
StateType m_stateType
Type of state.
Definition statewidget.h:94
StateWidget::StateWidget
StateWidget(UMLScene *scene, StateType stateType=Normal, Uml::ID::Type id=Uml::ID::None)
Definition statewidget.cpp:39
StateWidget::setDrawVertical
void setDrawVertical(bool to=true)
Definition statewidget.cpp:478
StateWidget::m_Activities
QStringList m_Activities
List of activities for the state.
Definition statewidget.h:96
UMLScene
Definition umlscene.h:65
UMLWidget
The base class for graphical UML objects.
Definition umlwidget.h:36
Uml::ID::None
const Type None
special value for uninitialized ID
Definition basictypes.h:373
Uml::ID::Type
std::string Type
Definition basictypes.h:371
umlwidget.h