umbrello: umbrello/umlwidgets/seqlinewidget.h Source File

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

seqlinewidget.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 SEQLINEWIDGET_H
7#define SEQLINEWIDGET_H
8
9#include <QGraphicsLineItem>
10
11#include <QPen>
12
13class ObjectWidget;
14class UMLScene;
15
28 class SeqLineWidget : public QGraphicsLineItem
29{
30public:
31 SeqLineWidget(UMLScene *scene, ObjectWidget * pObject);
32 virtual ~SeqLineWidget();
33
34 bool onWidget(const QPointF& p);
35
36 bool onDestructionBox(const QPointF& p);
37
38 void cleanup();
39
40 void setupDestructionBox();
41
42 void setStartPoint(int startX, int startY);
43
49 int getLineLength() const {
50 return m_nLengthY;
51 }
52
58 ObjectWidget * getObjectWidget() {
59 return m_pObject;
60 }
61
62 void setEndOfLine(int yPosition);
63 void setLineColorCmd(const QColor &color);
64
65protected:
66 void cleanupDestructionBox();
67
68 void moveDestructionBox();
69
70 ObjectWidget* m_pObject;
71 UMLScene* m_scene;
72
73 struct DestructionBox {
74 QGraphicsLineItem * line1{nullptr};
75 QGraphicsLineItem * line2{nullptr};
76 void setLineColorCmd(const QColor &color)
77 {
78 if (!line1)
79 return;
80 QPen pen = line1->pen();
81 pen.setColor(color);
82 line1->setPen(pen);
83 line2->setPen(pen);
84 }
85
86 void setLine1Points(QRect rect) {
87 line1->setLine(rect.x(), rect.y(),
88 rect.x() + rect.width(), rect.y() + rect.height());
89 }
90 void setLine2Points(QRect rect) {
91 line2->setLine(rect.x(), rect.y() + rect.height(),
92 rect.x() + rect.width(), rect.y());
93 }
94 } m_DestructionBox;
95
96 int m_nLengthY;
97
98 static int const m_nMouseDownEpsilonX;
99 void contextMenuEvent(QGraphicsSceneContextMenuEvent* event);
100};
101
102#endif
ObjectWidget
Displays an instance of a Concept.
Definition objectwidget.h:28
SeqLineWidget
Widget class for graphical representation of sequence lines.
Definition seqlinewidget.h:29
SeqLineWidget::onDestructionBox
bool onDestructionBox(const QPointF &p)
Definition seqlinewidget.cpp:77
SeqLineWidget::cleanupDestructionBox
void cleanupDestructionBox()
Definition seqlinewidget.cpp:120
SeqLineWidget::m_nLengthY
int m_nLengthY
the length of the line
Definition seqlinewidget.h:96
SeqLineWidget::m_pObject
ObjectWidget * m_pObject
ObjectWidget associated with this sequence line.
Definition seqlinewidget.h:70
SeqLineWidget::contextMenuEvent
void contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
Definition seqlinewidget.cpp:205
SeqLineWidget::~SeqLineWidget
virtual ~SeqLineWidget()
Definition seqlinewidget.cpp:44
SeqLineWidget::getObjectWidget
ObjectWidget * getObjectWidget()
Definition seqlinewidget.h:58
SeqLineWidget::moveDestructionBox
void moveDestructionBox()
Definition seqlinewidget.cpp:163
SeqLineWidget::m_DestructionBox
struct SeqLineWidget::DestructionBox m_DestructionBox
the destruction box
SeqLineWidget::cleanup
void cleanup()
Definition seqlinewidget.cpp:98
SeqLineWidget::setLineColorCmd
void setLineColorCmd(const QColor &color)
Definition seqlinewidget.cpp:197
SeqLineWidget::SeqLineWidget
SeqLineWidget(UMLScene *scene, ObjectWidget *pObject)
Definition seqlinewidget.cpp:28
SeqLineWidget::getLineLength
int getLineLength() const
Definition seqlinewidget.h:49
SeqLineWidget::m_scene
UMLScene * m_scene
scene displayed on
Definition seqlinewidget.h:71
SeqLineWidget::setupDestructionBox
void setupDestructionBox()
Definition seqlinewidget.cpp:133
SeqLineWidget::onWidget
bool onWidget(const QPointF &p)
Definition seqlinewidget.cpp:56
SeqLineWidget::setStartPoint
void setStartPoint(int startX, int startY)
Definition seqlinewidget.cpp:109
SeqLineWidget::setEndOfLine
void setEndOfLine(int yPosition)
Definition seqlinewidget.cpp:182
SeqLineWidget::m_nMouseDownEpsilonX
static int const m_nMouseDownEpsilonX
margin used for mouse clicks
Definition seqlinewidget.h:98
UMLScene
Definition umlscene.h:65
SeqLineWidget::DestructionBox
Definition seqlinewidget.h:73
SeqLineWidget::DestructionBox::line1
QGraphicsLineItem * line1
Definition seqlinewidget.h:74
SeqLineWidget::DestructionBox::setLine1Points
void setLine1Points(QRect rect)
Definition seqlinewidget.h:86
SeqLineWidget::DestructionBox::line2
QGraphicsLineItem * line2
Definition seqlinewidget.h:75
SeqLineWidget::DestructionBox::setLine2Points
void setLine2Points(QRect rect)
Definition seqlinewidget.h:90
SeqLineWidget::DestructionBox::setLineColorCmd
void setLineColorCmd(const QColor &color)
Definition seqlinewidget.h:76