umbrello: umbrello/umlwidgets/objectwidget.h Source File

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

objectwidget.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 OBJECTWIDGET_H
7#define OBJECTWIDGET_H
8
9#include "messagewidgetlist.h"
10#include "umlwidget.h"
11
12class MessageWidget;
13class SeqLineWidget;
14class UMLScene;
15
27 class ObjectWidget : public UMLWidget
28{
29 Q_OBJECT
30public:
31 ObjectWidget(UMLScene *scene, UMLObject *o);
32 virtual ~ObjectWidget();
33
34 virtual void setX(qreal x);
35 virtual void setY(qreal y);
36
37 qreal centerX();
38
39 void setMultipleInstance(bool multiple);
40 bool multipleInstance() const;
41
42 void setSelected(bool state);
43
44 virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = nullptr);
45
46 bool activate(IDChangeLog *ChangeLog = nullptr);
47
48 void cleanup();
49
50 virtual bool showPropertiesDialog();
51
52 void setDrawAsActor(bool drawAsActor);
53 bool drawAsActor() const;
54
55 void setShowDestruction(bool bShow);
56 bool showDestruction() const;
57
58 int topMargin();
59
60 void setEndLine(int yPosition);
61 int getEndLineY();
62
63 void messageAdded(MessageWidget* message);
64 void messageRemoved(MessageWidget* message);
65
66 bool canTabUp();
67
68 bool messageOverlap(qreal y, MessageWidget* messageWidget);
69
70 virtual void setLineColorCmd(const QColor &color);
71
72 SeqLineWidget *sequentialLine() const;
73
74 virtual void resizeWidget(qreal newW, qreal newH);
75
76 virtual void saveToXMI(QXmlStreamWriter& writer);
77 virtual bool loadFromXMI(QDomElement& qElement);
78
79public Q_SLOTS:
80 void slotMenuSelection(QAction* action);
81 virtual void slotFillColorChanged(Uml::ID::Type viewID);
82 void slotMessageMoved();
83
84protected:
85 virtual void mousePressEvent(QGraphicsSceneMouseEvent *me);
86 virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *me);
87
88 QSizeF minimumSize() const;
89
90 virtual void moveEvent(QGraphicsSceneMouseEvent *event);
91 virtual void moveWidgetBy(qreal diffX, qreal diffY);
92 virtual void constrainMovementForAllWidgets(qreal &diffX, qreal &diffY);
93
94 virtual QCursor resizeCursor() const;
95
96 void paintActor(QPainter *p);
97 void paintObject(QPainter *p);
98
99private:
100 void tabUp();
101 void tabDown();
102
103 void moveDestructionBy(qreal diffY);
104
105 SeqLineWidget* m_pLine;
106 bool m_multipleInstance;
107 bool m_drawAsActor;
108 bool m_showDestruction;
109 bool m_isOnDestructionBox;
110 MessageWidgetList m_messages;
111
112 friend class SeqLineWidget;
113};
114
115#endif
IDChangeLog
Definition idchangelog.h:22
MessageWidget
Displays a message.
Definition messagewidget.h:36
ObjectWidget::activate
bool activate(IDChangeLog *ChangeLog=nullptr)
Definition objectwidget.cpp:244
ObjectWidget::slotMenuSelection
void slotMenuSelection(QAction *action)
Definition objectwidget.cpp:168
ObjectWidget::canTabUp
bool canTabUp()
Definition objectwidget.cpp:500
ObjectWidget::moveWidgetBy
virtual void moveWidgetBy(qreal diffX, qreal diffY)
Definition objectwidget.cpp:123
ObjectWidget::messageAdded
void messageAdded(MessageWidget *message)
Definition objectwidget.cpp:559
ObjectWidget::ObjectWidget
ObjectWidget(UMLScene *scene, UMLObject *o)
Definition objectwidget.cpp:52
ObjectWidget::setY
virtual void setY(qreal y)
Definition objectwidget.cpp:272
ObjectWidget::m_isOnDestructionBox
bool m_isOnDestructionBox
true when a click occurred on the destruction box
Definition objectwidget.h:109
ObjectWidget::tabUp
void tabUp()
Definition objectwidget.cpp:465
ObjectWidget::showPropertiesDialog
virtual bool showPropertiesDialog()
Definition objectwidget.cpp:380
ObjectWidget::m_drawAsActor
bool m_drawAsActor
object should be drawn as an Actor or an Object
Definition objectwidget.h:107
ObjectWidget::mouseMoveEvent
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *me)
Definition objectwidget.cpp:318
ObjectWidget::mousePressEvent
virtual void mousePressEvent(QGraphicsSceneMouseEvent *me)
Definition objectwidget.cpp:303
ObjectWidget::topMargin
int topMargin()
Definition objectwidget.cpp:490
ObjectWidget::moveDestructionBy
void moveDestructionBy(qreal diffY)
Definition objectwidget.cpp:343
ObjectWidget::setX
virtual void setX(qreal x)
Definition objectwidget.cpp:260
ObjectWidget::paintActor
void paintActor(QPainter *p)
Definition objectwidget.cpp:432
ObjectWidget::multipleInstance
bool multipleInstance() const
Definition objectwidget.cpp:95
ObjectWidget::setLineColorCmd
virtual void setLineColorCmd(const QColor &color)
Definition objectwidget.cpp:626
ObjectWidget::m_multipleInstance
bool m_multipleInstance
draw an object as a multiple object
Definition objectwidget.h:106
ObjectWidget::setEndLine
void setEndLine(int yPosition)
Definition objectwidget.cpp:532
ObjectWidget::drawAsActor
bool drawAsActor() const
Definition objectwidget.cpp:236
ObjectWidget::paint
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=nullptr)
Definition objectwidget.cpp:150
ObjectWidget::messageOverlap
bool messageOverlap(qreal y, MessageWidget *messageWidget)
Definition objectwidget.cpp:607
ObjectWidget::~ObjectWidget
virtual ~ObjectWidget()
Definition objectwidget.cpp:70
ObjectWidget::setSelected
void setSelected(bool state)
Definition objectwidget.cpp:100
ObjectWidget::messageRemoved
void messageRemoved(MessageWidget *message)
Definition objectwidget.cpp:573
ObjectWidget::SeqLineWidget
friend class SeqLineWidget
Definition objectwidget.h:112
ObjectWidget::loadFromXMI
virtual bool loadFromXMI(QDomElement &qElement)
Definition objectwidget.cpp:686
ObjectWidget::resizeWidget
virtual void resizeWidget(qreal newW, qreal newH)
Definition objectwidget.cpp:664
ObjectWidget::minimumSize
QSizeF minimumSize() const
Definition objectwidget.cpp:196
ObjectWidget::cleanup
void cleanup()
Definition objectwidget.cpp:367
ObjectWidget::showDestruction
bool showDestruction() const
Definition objectwidget.cpp:522
ObjectWidget::getEndLineY
int getEndLineY()
Definition objectwidget.cpp:544
ObjectWidget::paintObject
void paintObject(QPainter *p)
Definition objectwidget.cpp:398
ObjectWidget::setDrawAsActor
void setDrawAsActor(bool drawAsActor)
Definition objectwidget.cpp:225
ObjectWidget::sequentialLine
SeqLineWidget * sequentialLine() const
Definition objectwidget.cpp:639
ObjectWidget::setShowDestruction
void setShowDestruction(bool bShow)
Definition objectwidget.cpp:510
ObjectWidget::slotMessageMoved
void slotMessageMoved()
Definition objectwidget.cpp:586
ObjectWidget::moveEvent
virtual void moveEvent(QGraphicsSceneMouseEvent *event)
Definition objectwidget.cpp:291
ObjectWidget::tabDown
void tabDown()
Definition objectwidget.cpp:477
ObjectWidget::m_showDestruction
bool m_showDestruction
show object destruction on sequence diagram line
Definition objectwidget.h:108
ObjectWidget::constrainMovementForAllWidgets
virtual void constrainMovementForAllWidgets(qreal &diffX, qreal &diffY)
Definition objectwidget.cpp:139
ObjectWidget::m_pLine
SeqLineWidget * m_pLine
Definition objectwidget.h:105
ObjectWidget::slotFillColorChanged
virtual void slotFillColorChanged(Uml::ID::Type viewID)
Definition objectwidget.cpp:355
ObjectWidget::saveToXMI
virtual void saveToXMI(QXmlStreamWriter &writer)
Definition objectwidget.cpp:673
ObjectWidget::centerX
qreal centerX()
Definition objectwidget.cpp:283
ObjectWidget::resizeCursor
virtual QCursor resizeCursor() const
Definition objectwidget.cpp:651
ObjectWidget::setMultipleInstance
void setMultipleInstance(bool multiple)
Definition objectwidget.cpp:80
ObjectWidget::m_messages
MessageWidgetList m_messages
message widgets with an end on this widget
Definition objectwidget.h:110
SeqLineWidget
Widget class for graphical representation of sequence lines.
Definition seqlinewidget.h:29
UMLObject
The base class for UML objects.
Definition umlobject.h:70
UMLScene
Definition umlscene.h:65
UMLWidget::UMLWidget
UMLWidget(UMLScene *scene, WidgetType type=wt_UMLWidget, UMLObject *o=nullptr)
Definition umlwidget.cpp:86
x
int x
Definition cxx11-lambda-functions-and-expressions.h:4
messagewidgetlist.h
MessageWidgetList
QList< QPointer< MessageWidget > > MessageWidgetList
Definition messagewidgetlist.h:15
Uml::ID::Type
std::string Type
Definition basictypes.h:371
umlwidget.h