umbrello: umbrello/umlwidgets/seqlinewidget.h Source File

umbrello 2.32.1 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
33 class SeqLineWidget : public QGraphicsLineItem
34 {
35 public:
36 SeqLineWidget(UMLScene *scene, ObjectWidget * pObject);
37 virtual ~SeqLineWidget();
38
39 bool onWidget(const QPointF& p);
40
41 bool onDestructionBox(const QPointF& p);
42
43 void cleanup();
44
45 void setupDestructionBox();
46
47 void setStartPoint(int startX, int startY);
48
54 int getLineLength() {
55 return m_nLengthY;
56 }
57
63 ObjectWidget * getObjectWidget() {
64 return m_pObject;
65 }
66
67 void setEndOfLine(int yPosition);
68 void setLineColorCmd(const QColor &color);
69
70 protected:
71 void cleanupDestructionBox();
72
73 void moveDestructionBox();
74
75 ObjectWidget* m_pObject;
76 UMLScene* m_scene;
77
78 struct DestructionBox {
79 QGraphicsLineItem * line1{nullptr};
80 QGraphicsLineItem * line2{nullptr};
81 void setLineColorCmd(const QColor &color)
82 {
83 if (!line1)
84 return;
85 QPen pen = line1->pen();
86 pen.setColor(color);
87 line1->setPen(pen);
88 line2->setPen(pen);
89 }
90
91 void setLine1Points(QRect rect) {
92 line1->setLine(rect.x(), rect.y(),
93 rect.x() + rect.width(), rect.y() + rect.height());
94 }
95 void setLine2Points(QRect rect) {
96 line2->setLine(rect.x(), rect.y() + rect.height(),
97 rect.x() + rect.width(), rect.y());
98 }
99 } m_DestructionBox;
100
101 int m_nLengthY;
102
103 static int const m_nMouseDownEpsilonX;
104 void contextMenuEvent(QGraphicsSceneContextMenuEvent* event);
105 };
106
107 #endif
ObjectWidget
Displays an instance of a Concept.
Definition: objectwidget.h:33
SeqLineWidget
Widget class for graphical representation of sequence lines.
Definition: seqlinewidget.h:34
SeqLineWidget::onDestructionBox
bool onDestructionBox(const QPointF &p)
Definition: seqlinewidget.cpp:82
SeqLineWidget::cleanupDestructionBox
void cleanupDestructionBox()
Definition: seqlinewidget.cpp:125
SeqLineWidget::m_nLengthY
int m_nLengthY
the length of the line
Definition: seqlinewidget.h:101
SeqLineWidget::m_pObject
ObjectWidget * m_pObject
ObjectWidget associated with this sequence line.
Definition: seqlinewidget.h:75
SeqLineWidget::getObjectWidget
ObjectWidget * getObjectWidget()
Definition: seqlinewidget.h:63
SeqLineWidget::contextMenuEvent
void contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
Definition: seqlinewidget.cpp:211
SeqLineWidget::~SeqLineWidget
virtual ~SeqLineWidget()
Definition: seqlinewidget.cpp:49
SeqLineWidget::moveDestructionBox
void moveDestructionBox()
Definition: seqlinewidget.cpp:168
SeqLineWidget::m_DestructionBox
struct SeqLineWidget::DestructionBox m_DestructionBox
the destruction box
SeqLineWidget::getLineLength
int getLineLength()
Definition: seqlinewidget.h:54
SeqLineWidget::cleanup
void cleanup()
Definition: seqlinewidget.cpp:103
SeqLineWidget::setLineColorCmd
void setLineColorCmd(const QColor &color)
Definition: seqlinewidget.cpp:203
SeqLineWidget::SeqLineWidget
SeqLineWidget(UMLScene *scene, ObjectWidget *pObject)
Definition: seqlinewidget.cpp:33
SeqLineWidget::m_scene
UMLScene * m_scene
scene displayed on
Definition: seqlinewidget.h:76
SeqLineWidget::setupDestructionBox
void setupDestructionBox()
Definition: seqlinewidget.cpp:138
SeqLineWidget::onWidget
bool onWidget(const QPointF &p)
Definition: seqlinewidget.cpp:61
SeqLineWidget::setStartPoint
void setStartPoint(int startX, int startY)
Definition: seqlinewidget.cpp:114
SeqLineWidget::setEndOfLine
void setEndOfLine(int yPosition)
Definition: seqlinewidget.cpp:187
SeqLineWidget::m_nMouseDownEpsilonX
static int const m_nMouseDownEpsilonX
margin used for mouse clicks
Definition: seqlinewidget.h:103
UMLScene
Definition: umlscene.h:70
SeqLineWidget::DestructionBox
Definition: seqlinewidget.h:78
SeqLineWidget::DestructionBox::line1
QGraphicsLineItem * line1
Definition: seqlinewidget.h:79
SeqLineWidget::DestructionBox::setLine1Points
void setLine1Points(QRect rect)
Definition: seqlinewidget.h:91
SeqLineWidget::DestructionBox::line2
QGraphicsLineItem * line2
Definition: seqlinewidget.h:80
SeqLineWidget::DestructionBox::setLine2Points
void setLine2Points(QRect rect)
Definition: seqlinewidget.h:95
SeqLineWidget::DestructionBox::setLineColorCmd
void setLineColorCmd(const QColor &color)
Definition: seqlinewidget.h:81