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

seqlinewidget.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 SEQLINEWIDGET_H
12 #define SEQLINEWIDGET_H
13
14 #include <QGraphicsLineItem>
15
16 #include <QPen>
17
18 class ObjectWidget;
19 class UMLScene;
20
26 class SeqLineWidget : public QGraphicsLineItem
27 {
28 public:
29 SeqLineWidget(UMLScene *scene, ObjectWidget * pObject);
30 virtual ~SeqLineWidget();
31
32 bool onWidget(const QPointF& p);
33
34 bool onDestructionBox(const QPointF& p);
35
36 void cleanup();
37
38 void setupDestructionBox();
39
40 void setStartPoint(int startX, int startY);
41
47 int getLineLength() {
48 return m_nLengthY;
49 }
50
56 ObjectWidget * getObjectWidget() {
57 return m_pObject;
58 }
59
60 void setEndOfLine(int yPosition);
61 void setLineColorCmd(const QColor &color);
62
63 protected:
64 void cleanupDestructionBox();
65
66 void moveDestructionBox();
67
68 ObjectWidget* m_pObject;
69 UMLScene* m_scene;
70
71 struct DestructionBox {
72 QGraphicsLineItem * line1{nullptr};
73 QGraphicsLineItem * line2{nullptr};
74 void setLineColorCmd(const QColor &color)
75 {
76 if (!line1)
77 return;
78 QPen pen = line1->pen();
79 pen.setColor(color);
80 line1->setPen(pen);
81 line2->setPen(pen);
82 }
83
84 void setLine1Points(QRect rect) {
85 line1->setLine(rect.x(), rect.y(),
86 rect.x() + rect.width(), rect.y() + rect.height());
87 }
88 void setLine2Points(QRect rect) {
89 line2->setLine(rect.x(), rect.y() + rect.height(),
90 rect.x() + rect.width(), rect.y());
91 }
92 } m_DestructionBox;
93
94 int m_nLengthY;
95
96 static int const m_nMouseDownEpsilonX;
97 void contextMenuEvent(QGraphicsSceneContextMenuEvent* event);
98 };
99
100 #endif
SeqLineWidget::DestructionBox::setLine1Points
void setLine1Points(QRect rect)
Definition: seqlinewidget.h:84
UMLWidget::height
qreal height() const
Definition: umlwidget.h:114
UMLScene::resizeSceneToItems
void resizeSceneToItems()
Definition: umlscene.cpp:3690
SeqLineWidget::moveDestructionBox
void moveDestructionBox()
Definition: seqlinewidget.cpp:168
x
int x
Definition: cxx11-lambda-functions-and-expressions.h:4
SeqLineWidget::m_pObject
ObjectWidget * m_pObject
ObjectWidget associated with this sequence line.
Definition: seqlinewidget.h:68
seqlinewidget.h
umlview.h
SeqLineWidget::setupDestructionBox
void setupDestructionBox()
Definition: seqlinewidget.cpp:138
SeqLineWidget::DestructionBox
Definition: seqlinewidget.h:71
DEBUG_REGISTER_DISABLED
#define DEBUG_REGISTER_DISABLED(src)
Definition: debug_utils.h:132
ObjectWidget::showDestruction
bool showDestruction() const
Definition: objectwidget.cpp:526
SeqLineWidget::DestructionBox::line2
QGraphicsLineItem * line2
Definition: seqlinewidget.h:73
SeqLineWidget::contextMenuEvent
void contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
Definition: seqlinewidget.cpp:211
SeqLineWidget::~SeqLineWidget
virtual ~SeqLineWidget()
Definition: seqlinewidget.cpp:49
SeqLineWidget::cleanup
void cleanup()
Definition: seqlinewidget.cpp:103
SeqLineWidget::m_nMouseDownEpsilonX
static int const m_nMouseDownEpsilonX
margin used for mouse clicks
Definition: seqlinewidget.h:96
SeqLineWidget::getLineLength
int getLineLength()
Definition: seqlinewidget.h:47
SeqLineWidget::m_DestructionBox
struct SeqLineWidget::DestructionBox m_DestructionBox
the destruction box
UMLWidget::contextMenuEvent
virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
Definition: umlwidget.cpp:259
objectwidget.h
SeqLineWidget
Widget class for graphical representation of sequence lines.
Definition: seqlinewidget.h:27
messagewidget.h
SeqLineWidget::DestructionBox::line1
QGraphicsLineItem * line1
Definition: seqlinewidget.h:72
SeqLineWidget::getObjectWidget
ObjectWidget * getObjectWidget()
Definition: seqlinewidget.h:56
SeqLineWidget::m_nLengthY
int m_nLengthY
the length of the line
Definition: seqlinewidget.h:94
WidgetBase::lineColor
QColor lineColor() const
Definition: widgetbase.cpp:356
SeqLineWidget::cleanupDestructionBox
void cleanupDestructionBox()
Definition: seqlinewidget.cpp:125
ObjectWidget
Displays an instance of a Concept.
Definition: objectwidget.h:33
umlscene.h
SeqLineWidget::SeqLineWidget
SeqLineWidget(UMLScene *scene, ObjectWidget *pObject)
Definition: seqlinewidget.cpp:33
SeqLineWidget::DestructionBox::setLineColorCmd
void setLineColorCmd(const QColor &color)
Definition: seqlinewidget.h:74
debug_utils.h
SeqLineWidget::DestructionBox::setLine2Points
void setLine2Points(QRect rect)
Definition: seqlinewidget.h:88
UMLScene
Definition: umlscene.h:69
SeqLineWidget::setStartPoint
void setStartPoint(int startX, int startY)
Definition: seqlinewidget.cpp:114
SeqLineWidget::m_scene
UMLScene * m_scene
scene displayed on
Definition: seqlinewidget.h:69
widgetbasepopupmenu.h
SeqLineWidget::onDestructionBox
bool onDestructionBox(const QPointF &p)
Definition: seqlinewidget.cpp:82
UMLWidget::width
qreal width() const
Definition: umlwidget.h:121
SeqLineWidget::setLineColorCmd
void setLineColorCmd(const QColor &color)
Definition: seqlinewidget.cpp:203
SeqLineWidget::setEndOfLine
void setEndOfLine(int yPosition)
Definition: seqlinewidget.cpp:187
SeqLineWidget::onWidget
bool onWidget(const QPointF &p)
Definition: seqlinewidget.cpp:61