umbrello: umbrello/umlwidgets/objectwidget.h Source File

umbrello 2.32.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 * This program is free software; you can redistribute it and/or modify *
3 * it under the terms of the GNU General Public License as published by *
4 * the Free Software Foundation; either version 2 of the License, or *
5 * (at your option) any later version. *
6 * *
7 * copyright (C) 2002-2020 *
8 * Umbrello UML Modeller Authors <umbrello-devel@kde.org> *
9 ***************************************************************************/
10
11 #ifndef OBJECTWIDGET_H
12 #define OBJECTWIDGET_H
13
14 #include "messagewidgetlist.h"
15 #include "umlwidget.h"
16
17 class MessageWidget;
18 class SeqLineWidget;
19 class UMLScene;
20
32 class ObjectWidget : public UMLWidget
33 {
34 Q_OBJECT
35 public:
36 ObjectWidget(UMLScene *scene, UMLObject *o);
37 virtual ~ObjectWidget();
38
39 virtual void setX(qreal x);
40 virtual void setY(qreal y);
41
42 qreal centerX();
43
44 void setMultipleInstance(bool multiple);
45 bool multipleInstance() const;
46
47 void setSelected(bool state);
48
49 virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
50
51 bool activate(IDChangeLog* ChangeLog = 0);
52
53 void cleanup();
54
55 virtual bool showPropertiesDialog();
56
57 void setDrawAsActor(bool drawAsActor);
58 bool drawAsActor() const;
59
60 void setShowDestruction(bool bShow);
61 bool showDestruction() const;
62
63 int topMargin();
64
65 void setEndLine(int yPosition);
66 int getEndLineY();
67
68 void messageAdded(MessageWidget* message);
69 void messageRemoved(MessageWidget* message);
70
71 bool canTabUp();
72
73 bool messageOverlap(qreal y, MessageWidget* messageWidget);
74
75 virtual void setLineColorCmd(const QColor &color);
76
77 SeqLineWidget *sequentialLine() const;
78
79 virtual void resizeWidget(qreal newW, qreal newH);
80
81 virtual void saveToXMI1(QXmlStreamWriter& writer);
82 virtual bool loadFromXMI1(QDomElement& qElement);
83
84 public slots:
85 void slotMenuSelection(QAction* action);
86 virtual void slotFillColorChanged(Uml::ID::Type viewID);
87 void slotMessageMoved();
88
89 protected:
90 virtual void mousePressEvent(QGraphicsSceneMouseEvent *me);
91 virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *me);
92
93 QSizeF minimumSize() const;
94
95 virtual void moveEvent(QGraphicsSceneMouseEvent *event);
96 virtual void moveWidgetBy(qreal diffX, qreal diffY);
97 virtual void constrainMovementForAllWidgets(qreal &diffX, qreal &diffY);
98
99 virtual QCursor resizeCursor() const;
100
101 void paintActor(QPainter *p);
102 void paintObject(QPainter *p);
103
104 private:
105 void tabUp();
106 void tabDown();
107
108 void moveDestructionBy(qreal diffY);
109
110 SeqLineWidget* m_pLine;
111 bool m_multipleInstance;
112 bool m_drawAsActor;
113 bool m_showDestruction;
114 bool m_isOnDestructionBox;
115 MessageWidgetList m_messages;
116
117 friend class SeqLineWidget;
118 };
119
120 #endif
IDChangeLog
Definition: idchangelog.h:27
MessageWidget
Displays a message.
Definition: messagewidget.h:41
ObjectWidget
Displays an instance of a Concept.
Definition: objectwidget.h:33
ObjectWidget::slotMenuSelection
void slotMenuSelection(QAction *action)
Definition: objectwidget.cpp:173
ObjectWidget::canTabUp
bool canTabUp()
Definition: objectwidget.cpp:505
ObjectWidget::moveWidgetBy
virtual void moveWidgetBy(qreal diffX, qreal diffY)
Definition: objectwidget.cpp:128
ObjectWidget::messageAdded
void messageAdded(MessageWidget *message)
Definition: objectwidget.cpp:564
ObjectWidget::ObjectWidget
ObjectWidget(UMLScene *scene, UMLObject *o)
Definition: objectwidget.cpp:57
ObjectWidget::setY
virtual void setY(qreal y)
Definition: objectwidget.cpp:277
ObjectWidget::m_isOnDestructionBox
bool m_isOnDestructionBox
true when a click occurred on the destruction box
Definition: objectwidget.h:114
ObjectWidget::tabUp
void tabUp()
Definition: objectwidget.cpp:470
ObjectWidget::showPropertiesDialog
virtual bool showPropertiesDialog()
Definition: objectwidget.cpp:385
ObjectWidget::m_drawAsActor
bool m_drawAsActor
object should be drawn as an Actor or an Object
Definition: objectwidget.h:112
ObjectWidget::mouseMoveEvent
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *me)
Definition: objectwidget.cpp:323
ObjectWidget::mousePressEvent
virtual void mousePressEvent(QGraphicsSceneMouseEvent *me)
Definition: objectwidget.cpp:308
ObjectWidget::topMargin
int topMargin()
Definition: objectwidget.cpp:495
ObjectWidget::moveDestructionBy
void moveDestructionBy(qreal diffY)
Definition: objectwidget.cpp:348
ObjectWidget::setX
virtual void setX(qreal x)
Definition: objectwidget.cpp:265
ObjectWidget::paintActor
void paintActor(QPainter *p)
Definition: objectwidget.cpp:437
ObjectWidget::multipleInstance
bool multipleInstance() const
Definition: objectwidget.cpp:100
ObjectWidget::setLineColorCmd
virtual void setLineColorCmd(const QColor &color)
Definition: objectwidget.cpp:631
ObjectWidget::m_multipleInstance
bool m_multipleInstance
draw an object as a multiple object
Definition: objectwidget.h:111
ObjectWidget::setEndLine
void setEndLine(int yPosition)
Definition: objectwidget.cpp:537
ObjectWidget::drawAsActor
bool drawAsActor() const
Definition: objectwidget.cpp:241
ObjectWidget::messageOverlap
bool messageOverlap(qreal y, MessageWidget *messageWidget)
Definition: objectwidget.cpp:612
ObjectWidget::~ObjectWidget
virtual ~ObjectWidget()
Definition: objectwidget.cpp:75
ObjectWidget::setSelected
void setSelected(bool state)
Definition: objectwidget.cpp:105
ObjectWidget::messageRemoved
void messageRemoved(MessageWidget *message)
Definition: objectwidget.cpp:578
ObjectWidget::resizeWidget
virtual void resizeWidget(qreal newW, qreal newH)
Definition: objectwidget.cpp:669
ObjectWidget::minimumSize
QSizeF minimumSize() const
Definition: objectwidget.cpp:201
ObjectWidget::cleanup
void cleanup()
Definition: objectwidget.cpp:372
ObjectWidget::showDestruction
bool showDestruction() const
Definition: objectwidget.cpp:527
ObjectWidget::saveToXMI1
virtual void saveToXMI1(QXmlStreamWriter &writer)
Definition: objectwidget.cpp:678
ObjectWidget::getEndLineY
int getEndLineY()
Definition: objectwidget.cpp:549
ObjectWidget::activate
bool activate(IDChangeLog *ChangeLog=0)
Definition: objectwidget.cpp:249
ObjectWidget::paintObject
void paintObject(QPainter *p)
Definition: objectwidget.cpp:403
ObjectWidget::setDrawAsActor
void setDrawAsActor(bool drawAsActor)
Definition: objectwidget.cpp:230
ObjectWidget::loadFromXMI1
virtual bool loadFromXMI1(QDomElement &qElement)
Definition: objectwidget.cpp:691
ObjectWidget::sequentialLine
SeqLineWidget * sequentialLine() const
Definition: objectwidget.cpp:644
ObjectWidget::setShowDestruction
void setShowDestruction(bool bShow)
Definition: objectwidget.cpp:515
ObjectWidget::slotMessageMoved
void slotMessageMoved()
Definition: objectwidget.cpp:591
ObjectWidget::moveEvent
virtual void moveEvent(QGraphicsSceneMouseEvent *event)
Definition: objectwidget.cpp:296
ObjectWidget::tabDown
void tabDown()
Definition: objectwidget.cpp:482
ObjectWidget::m_showDestruction
bool m_showDestruction
show object destruction on sequence diagram line
Definition: objectwidget.h:113
ObjectWidget::constrainMovementForAllWidgets
virtual void constrainMovementForAllWidgets(qreal &diffX, qreal &diffY)
Definition: objectwidget.cpp:144
ObjectWidget::m_pLine
SeqLineWidget * m_pLine
Definition: objectwidget.h:110
ObjectWidget::slotFillColorChanged
virtual void slotFillColorChanged(Uml::ID::Type viewID)
Definition: objectwidget.cpp:360
ObjectWidget::centerX
qreal centerX()
Definition: objectwidget.cpp:288
ObjectWidget::resizeCursor
virtual QCursor resizeCursor() const
Definition: objectwidget.cpp:656
ObjectWidget::setMultipleInstance
void setMultipleInstance(bool multiple)
Definition: objectwidget.cpp:85
ObjectWidget::m_messages
MessageWidgetList m_messages
message widgets with an end on this widget
Definition: objectwidget.h:115
ObjectWidget::paint
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0)
Definition: objectwidget.cpp:155
SeqLineWidget
Widget class for graphical representation of sequence lines.
Definition: seqlinewidget.h:34
UMLObject
The base class for UML objects.
Definition: umlobject.h:75
UMLScene
Definition: umlscene.h:70
UMLWidget
The base class for graphical UML objects.
Definition: umlwidget.h:41
x
int x
Definition: cxx11-lambda-functions-and-expressions.h:4
messagewidgetlist.h
MessageWidgetList
QList< QPointer< MessageWidget > > MessageWidgetList
Definition: messagewidgetlist.h:18
Uml::ID::Type
std::string Type
Definition: basictypes.h:385
umlwidget.h