umbrello 2.39.0
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 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
28class 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
41
42 void setStartPoint(int startX, int startY);
43
49 int getLineLength() const {
50 return m_nLengthY;
51 }
52
59 return m_pObject;
60 }
61
62 void setEndOfLine(int yPosition);
63 void setLineColorCmd(const QColor &color);
64
65protected:
67
68 void moveDestructionBox();
69
72
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 }
95
97
98 static int const m_nMouseDownEpsilonX;
99 void contextMenuEvent(QGraphicsSceneContextMenuEvent* event);
100};
101
102#endif
Displays an instance of a Concept.
Definition objectwidget.h:28
Widget class for graphical representation of sequence lines.
Definition seqlinewidget.h:29
bool onDestructionBox(const QPointF &p)
Definition seqlinewidget.cpp:77
void cleanupDestructionBox()
Definition seqlinewidget.cpp:120
int m_nLengthY
the length of the line
Definition seqlinewidget.h:96
ObjectWidget * m_pObject
ObjectWidget associated with this sequence line.
Definition seqlinewidget.h:70
void contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
Definition seqlinewidget.cpp:205
virtual ~SeqLineWidget()
Definition seqlinewidget.cpp:44
ObjectWidget * getObjectWidget()
Definition seqlinewidget.h:58
void moveDestructionBox()
Definition seqlinewidget.cpp:163
struct SeqLineWidget::DestructionBox m_DestructionBox
the destruction box
void cleanup()
Definition seqlinewidget.cpp:98
void setLineColorCmd(const QColor &color)
Definition seqlinewidget.cpp:197
SeqLineWidget(UMLScene *scene, ObjectWidget *pObject)
Definition seqlinewidget.cpp:28
int getLineLength() const
Definition seqlinewidget.h:49
UMLScene * m_scene
scene displayed on
Definition seqlinewidget.h:71
void setupDestructionBox()
Definition seqlinewidget.cpp:133
bool onWidget(const QPointF &p)
Definition seqlinewidget.cpp:56
void setStartPoint(int startX, int startY)
Definition seqlinewidget.cpp:109
void setEndOfLine(int yPosition)
Definition seqlinewidget.cpp:182
static int const m_nMouseDownEpsilonX
margin used for mouse clicks
Definition seqlinewidget.h:98
Definition umlscene.h:65
Definition seqlinewidget.h:73
QGraphicsLineItem * line1
Definition seqlinewidget.h:74
void setLine1Points(QRect rect)
Definition seqlinewidget.h:86
QGraphicsLineItem * line2
Definition seqlinewidget.h:75
void setLine2Points(QRect rect)
Definition seqlinewidget.h:90
void setLineColorCmd(const QColor &color)
Definition seqlinewidget.h:76