umbrello 2.39.2 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

messagewidget.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 MESSAGEWIDGET_H
7#define MESSAGEWIDGET_H
8
9#include "umlwidget.h"
10#include "linkwidget.h"
11
12// forward declarations
13 class FloatingTextWidget;
14 class ObjectWidget;
15 class QResizeEvent;
16 class UMLOperation;
17
35 class MessageWidget : public UMLWidget, public LinkWidget
36{
37 Q_OBJECT
38 public:
39 MessageWidget(UMLScene * scene, ObjectWidget* a, ObjectWidget* b,
40 int y, Uml::SequenceMessage::Enum sequenceMessageType,
41 Uml::ID::Type id = Uml::ID::None);
42 MessageWidget(UMLScene * scene, Uml::SequenceMessage::Enum sequenceMessageType,
43 Uml::ID::Type id = Uml::ID::None);
44 MessageWidget(UMLScene * scene, ObjectWidget* a, int xclick, int yclick,
45 Uml::SequenceMessage::Enum sequenceMessageType,
46 Uml::ID::Type id = Uml::ID::None);
47 virtual ~MessageWidget();
48
49 virtual void setY(qreal y);
50
51 //---------- LinkWidget Interface methods implementation from here on.
52
53 virtual void lwSetFont (QFont font);
54 virtual UMLClassifier *operationOwner();
55
56 virtual UMLOperation *operation();
57 virtual void setOperation(UMLOperation *op);
58
59 virtual QString customOpText();
60 virtual void setCustomOpText(const QString &opText);
61
62 virtual void setMessageText(FloatingTextWidget *ft);
63 virtual void setText(FloatingTextWidget *ft, const QString &newText);
64
65 virtual QString lwOperationText();
66 virtual UMLClassifier *lwClassifier();
67 virtual void setOperationText(const QString &op);
68
69 virtual void constrainTextPos(qreal &textX, qreal &textY, qreal textWidth, qreal textHeight,
70 Uml::TextRole::Enum tr);
71
72 //---------- End LinkWidget Interface methods implementation.
73
75 Uml::SequenceMessage::Enum sequenceMessageType() const {
76 return m_sequenceMessageType;
77 }
78
79 bool hasObjectWidget(ObjectWidget * w);
80
81 ObjectWidget* objectWidget(Uml::RoleType::Enum role);
82 void setObjectWidget(ObjectWidget * ow, Uml::RoleType::Enum role);
83
84 bool isSelf() const;
85
91 FloatingTextWidget * floatingTextWidget() {
92 return m_pFText;
93 }
94
100 void setFloatingTextWidget(FloatingTextWidget * f) {
101 m_pFText = f;
102 }
103
104 void calculateWidget();
105
106 virtual bool activate(IDChangeLog * Log = 0);
107 void resolveObjectWidget(IDChangeLog* log);
108
109 void calculateDimensions();
110 void calculateDimensionsSynchronous();
111 void calculateDimensionsAsynchronous();
112 void calculateDimensionsCreation();
113 void calculateDimensionsDestroy();
114 void calculateDimensionsLost();
115 void calculateDimensionsFound();
116
117 virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
118
119 void setTextPosition();
120
121 void cleanup();
122
123 void setSelected(bool _select);
124
125 int getMinY();
126 int getMaxY();
127
128 virtual QSizeF minimumSize() const;
129
130 UMLWidget* onWidget(const QPointF& p);
131
132 virtual void resizeWidget(qreal newW, qreal newH);
133
134 virtual void saveToXMI(QXmlStreamWriter& writer);
135 virtual bool loadFromXMI(QDomElement & qElement);
136
137 void setxclicked(int xclick);
138 void setyclicked(int yclick);
139
143 int getxclicked() const {
144 return m_xclicked;
145 }
146
147 virtual bool showPropertiesDialog();
148
149 protected:
150 virtual void moveWidgetBy(qreal diffX, qreal diffY);
151 virtual void constrainMovementForAllWidgets(qreal &diffX, qreal &diffY);
152
153 virtual bool isInResizeArea(QGraphicsSceneMouseEvent *me);
154
155 void setLinkAndTextPos();
156
157 int constrainX(int textX, int textWidth, Uml::TextRole::Enum tr);
158
159 static void paintArrow(QPainter *p, int x, int y, int w,
160 Qt::ArrowType direction, bool useDottedLine = false);
161 static void paintSolidArrowhead(QPainter *p, int x, int y, Qt::ArrowType direction);
162
163 void updateResizability();
164
165 void paintSynchronous(QPainter *painter, const QStyleOptionGraphicsItem *option);
166 void paintAsynchronous(QPainter *painter, const QStyleOptionGraphicsItem *option);
167 void paintCreation(QPainter *painter, const QStyleOptionGraphicsItem *option);
168 void paintDestroy(QPainter *painter, const QStyleOptionGraphicsItem *option);
169 void paintLost(QPainter *painter, const QStyleOptionGraphicsItem *option);
170 void paintFound(QPainter *painter, const QStyleOptionGraphicsItem *option);
171
172 // Data loaded/saved
173 QString m_CustomOp;
177 Uml::SequenceMessage::Enum m_sequenceMessageType;
178
179 private:
180 void resizeEvent(QResizeEvent *re);
181
182 qreal constrainPositionY(qreal diffY);
183
184 void init();
185
186 QPointer<ObjectWidget> m_pOw[2];
187 FloatingTextWidget * m_pFText;
188
189 int m_xclicked;
190 int m_yclicked;
191
197 Uml::ID::Type m_widgetAId, m_widgetBId, m_textId;
198
199 public slots:
200 void slotWidgetMoved(Uml::ID::Type id);
201 void slotMenuSelection(QAction* action);
202
203signals:
208 void sigMessageMoved();
209};
210
211#endif
FloatingTextWidget
Displays a line of text or an operation.
Definition floatingtextwidget.h:32
IDChangeLog
Definition idchangelog.h:22
LinkWidget
Interface to FloatingTextWidget for AssociationWidget and MessageWidget.
Definition linkwidget.h:32
MessageWidget
Displays a message.
Definition messagewidget.h:36
MessageWidget::lwClassifier
virtual UMLClassifier * lwClassifier()
Definition messagewidget.cpp:1047
MessageWidget::m_sequenceMessageType
Uml::SequenceMessage::Enum m_sequenceMessageType
Definition messagewidget.h:177
MessageWidget::calculateDimensionsCreation
void calculateDimensionsCreation()
Definition messagewidget.cpp:1156
MessageWidget::slotWidgetMoved
void slotWidgetMoved(Uml::ID::Type id)
Definition messagewidget.cpp:768
MessageWidget::loadFromXMI
virtual bool loadFromXMI(QDomElement &qElement)
Definition messagewidget.cpp:1440
MessageWidget::isInResizeArea
virtual bool isInResizeArea(QGraphicsSceneMouseEvent *me)
Definition messagewidget.cpp:195
MessageWidget::setSelected
void setSelected(bool _select)
Definition messagewidget.cpp:1268
MessageWidget::calculateWidget
void calculateWidget()
Definition messagewidget.cpp:761
MessageWidget::MessageWidget
MessageWidget(UMLScene *scene, ObjectWidget *a, ObjectWidget *b, int y, Uml::SequenceMessage::Enum sequenceMessageType, Uml::ID::Type id=Uml::ID::None)
Definition messagewidget.cpp:52
MessageWidget::resolveObjectWidget
void resolveObjectWidget(IDChangeLog *log)
Definition messagewidget.cpp:919
MessageWidget::getMinY
int getMinY()
Definition messagewidget.cpp:1286
MessageWidget::constrainPositionY
qreal constrainPositionY(qreal diffY)
Definition messagewidget.cpp:274
MessageWidget::calculateDimensionsLost
void calculateDimensionsLost()
Definition messagewidget.cpp:1195
MessageWidget::m_pFText
FloatingTextWidget * m_pFText
Definition messagewidget.h:187
MessageWidget::m_xclicked
int m_xclicked
Definition messagewidget.h:189
MessageWidget::paintFound
void paintFound(QPainter *painter, const QStyleOptionGraphicsItem *option)
Definition messagewidget.cpp:605
MessageWidget::isSelf
bool isSelf() const
Definition messagewidget.cpp:812
MessageWidget::calculateDimensionsAsynchronous
void calculateDimensionsAsynchronous()
Definition messagewidget.cpp:1120
MessageWidget::cleanup
void cleanup()
Definition messagewidget.cpp:1245
MessageWidget::paintAsynchronous
void paintAsynchronous(QPainter *painter, const QStyleOptionGraphicsItem *option)
Definition messagewidget.cpp:477
MessageWidget::hasObjectWidget
bool hasObjectWidget(ObjectWidget *w)
Definition messagewidget.cpp:797
MessageWidget::setFloatingTextWidget
void setFloatingTextWidget(FloatingTextWidget *f)
Definition messagewidget.h:100
MessageWidget::constrainX
int constrainX(int textX, int textWidth, Uml::TextRole::Enum tr)
Definition messagewidget.cpp:696
MessageWidget::paintSynchronous
void paintSynchronous(QPainter *painter, const QStyleOptionGraphicsItem *option)
Definition messagewidget.cpp:409
MessageWidget::customOpText
virtual QString customOpText()
Definition messagewidget.cpp:1014
MessageWidget::getMaxY
int getMaxY()
Definition messagewidget.cpp:1308
MessageWidget::sequenceMessageType
Uml::SequenceMessage::Enum sequenceMessageType() const
Definition messagewidget.h:75
MessageWidget::lwOperationText
virtual QString lwOperationText()
Definition messagewidget.cpp:1033
MessageWidget::paint
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0)
Definition messagewidget.cpp:331
MessageWidget::setObjectWidget
void setObjectWidget(ObjectWidget *ow, Uml::RoleType::Enum role)
Definition messagewidget.cpp:1351
MessageWidget::setxclicked
void setxclicked(int xclick)
Definition messagewidget.cpp:1370
MessageWidget::paintLost
void paintLost(QPainter *painter, const QStyleOptionGraphicsItem *option)
Definition messagewidget.cpp:567
MessageWidget::getxclicked
int getxclicked() const
Definition messagewidget.h:143
MessageWidget::calculateDimensionsDestroy
void calculateDimensionsDestroy()
Definition messagewidget.cpp:1187
MessageWidget::m_widgetAId
Uml::ID::Type m_widgetAId
Definition messagewidget.h:197
MessageWidget::m_textId
Uml::ID::Type m_textId
Definition messagewidget.h:197
MessageWidget::objectWidget
ObjectWidget * objectWidget(Uml::RoleType::Enum role)
Definition messagewidget.cpp:1362
MessageWidget::setOperationText
virtual void setOperationText(const QString &op)
Definition messagewidget.cpp:958
MessageWidget::activate
virtual bool activate(IDChangeLog *Log=0)
Definition messagewidget.cpp:836
MessageWidget::setyclicked
void setyclicked(int yclick)
Definition messagewidget.cpp:1378
MessageWidget::resizeEvent
void resizeEvent(QResizeEvent *re)
Definition messagewidget.cpp:754
MessageWidget::m_CustomOp
QString m_CustomOp
Definition messagewidget.h:173
MessageWidget::calculateDimensionsFound
void calculateDimensionsFound()
Definition messagewidget.cpp:1220
MessageWidget::moveWidgetBy
virtual void moveWidgetBy(qreal diffX, qreal diffY)
Definition messagewidget.cpp:305
MessageWidget::updateResizability
void updateResizability()
Definition messagewidget.cpp:176
MessageWidget::m_widgetBId
Uml::ID::Type m_widgetBId
Definition messagewidget.h:197
MessageWidget::m_yclicked
int m_yclicked
Definition messagewidget.h:190
MessageWidget::setOperation
virtual void setOperation(UMLOperation *op)
Definition messagewidget.cpp:999
MessageWidget::calculateDimensions
void calculateDimensions()
Definition messagewidget.cpp:1060
MessageWidget::constrainTextPos
virtual void constrainTextPos(qreal &textX, qreal &textY, qreal textWidth, qreal textHeight, Uml::TextRole::Enum tr)
Definition messagewidget.cpp:728
MessageWidget::setCustomOpText
virtual void setCustomOpText(const QString &opText)
Definition messagewidget.cpp:1023
MessageWidget::m_pOw
QPointer< ObjectWidget > m_pOw[2]
Definition messagewidget.h:186
MessageWidget::sigMessageMoved
void sigMessageMoved()
MessageWidget::minimumSize
virtual QSizeF minimumSize() const
Definition messagewidget.cpp:1324
MessageWidget::paintCreation
void paintCreation(QPainter *painter, const QStyleOptionGraphicsItem *option)
Definition messagewidget.cpp:527
MessageWidget::floatingTextWidget
FloatingTextWidget * floatingTextWidget()
Definition messagewidget.h:91
MessageWidget::saveToXMI
virtual void saveToXMI(QXmlStreamWriter &writer)
Definition messagewidget.cpp:1408
MessageWidget::setMessageText
virtual void setMessageText(FloatingTextWidget *ft)
Definition messagewidget.cpp:930
MessageWidget::setTextPosition
void setTextPosition()
Definition messagewidget.cpp:676
MessageWidget::onWidget
UMLWidget * onWidget(const QPointF &p)
Definition messagewidget.cpp:651
MessageWidget::calculateDimensionsSynchronous
void calculateDimensionsSynchronous()
Definition messagewidget.cpp:1086
MessageWidget::setLinkAndTextPos
void setLinkAndTextPos()
Definition messagewidget.cpp:746
MessageWidget::constrainMovementForAllWidgets
virtual void constrainMovementForAllWidgets(qreal &diffX, qreal &diffY)
Definition messagewidget.cpp:321
MessageWidget::operationOwner
virtual UMLClassifier * operationOwner()
Definition messagewidget.cpp:977
MessageWidget::init
void init()
Definition messagewidget.cpp:128
MessageWidget::paintDestroy
void paintDestroy(QPainter *painter, const QStyleOptionGraphicsItem *option)
Definition messagewidget.cpp:558
MessageWidget::lwSetFont
virtual void lwSetFont(QFont font)
Definition messagewidget.cpp:967
MessageWidget::paintSolidArrowhead
static void paintSolidArrowhead(QPainter *p, int x, int y, Qt::ArrowType direction)
Definition messagewidget.cpp:362
MessageWidget::setY
virtual void setY(qreal y)
Definition messagewidget.cpp:153
MessageWidget::~MessageWidget
virtual ~MessageWidget()
Definition messagewidget.cpp:141
MessageWidget::slotMenuSelection
void slotMenuSelection(QAction *action)
Definition messagewidget.cpp:818
MessageWidget::showPropertiesDialog
virtual bool showPropertiesDialog()
Definition messagewidget.cpp:1386
MessageWidget::setText
virtual void setText(FloatingTextWidget *ft, const QString &newText)
Definition messagewidget.cpp:946
MessageWidget::resizeWidget
virtual void resizeWidget(qreal newW, qreal newH)
Definition messagewidget.cpp:241
MessageWidget::paintArrow
static void paintArrow(QPainter *p, int x, int y, int w, Qt::ArrowType direction, bool useDottedLine=false)
Definition messagewidget.cpp:380
MessageWidget::operation
virtual UMLOperation * operation()
Definition messagewidget.cpp:990
ObjectWidget
Displays an instance of a Concept.
Definition objectwidget.h:28
UMLClassifier
Information for a non-graphical Concept/Class.
Definition classifier.h:35
UMLOperation
Definition operation.h:20
UMLScene
Definition umlscene.h:65
UMLWidget
The base class for graphical UML objects.
Definition umlwidget.h:36
WidgetBase::font
virtual QFont font() const
Definition widgetbase.cpp:549
x
int x
Definition cxx11-lambda-functions-and-expressions.h:4
b
bool b
Definition cxx11-null-pointer-constant.h:6
linkwidget.h
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
Uml::RoleType::Enum
Enum
Definition basictypes.h:236
Uml::SequenceMessage::Enum
Enum
Definition basictypes.h:217
Uml::TextRole::Enum
Enum
Definition basictypes.h:176
a
QString a
Definition petalnode.cpp:13
umlwidget.h