umbrello: umbrello/umlwidgets/signalwidget.h Source File

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

signalwidget.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 SIGNALWIDGET_H
7#define SIGNALWIDGET_H
8
9#include "floatingtextwidget.h"
10#include "linkwidget.h"
11#include "umlwidget.h"
12#include "worktoolbar.h"
13
14#define SIGNAL_MARGIN 5
15#define SIGNAL_WIDTH 45
16#define SIGNAL_HEIGHT 15
17
22 class SignalWidget : public UMLWidget
23{
24 Q_OBJECT
25 Q_ENUMS(SignalType)
26public:
28 enum SignalType
29 {
30 Send = 0,
31 Accept,
32 Time
33 };
34
35 explicit SignalWidget(UMLScene * scene, SignalType signalType = Send, Uml::ID::Type id = Uml::ID::None);
36 virtual ~SignalWidget();
37
38 virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = nullptr);
39
40 void setX(qreal newX);
41 void setY(qreal newY);
42
43 virtual void setName(const QString &strName);
44
45 SignalType signalType() const;
46 QString signalTypeStr() const;
47 void setSignalType(SignalType signalType);
48
49 virtual bool showPropertiesDialog();
50
51 void mouseMoveEvent(QGraphicsSceneMouseEvent *me);
52
53 virtual bool loadFromXMI(QDomElement & qElement);
54 virtual void saveToXMI(QXmlStreamWriter& writer);
55
56public Q_SLOTS:
57 virtual void slotMenuSelection(QAction* action);
58
59protected:
60 QSizeF minimumSize() const;
61
65 int m_oldX;
66 int m_oldY;
67
68 // Only for the time event
73 FloatingTextWidget* m_pName;
74
75 SignalType m_signalType;
76
77protected Q_SLOTS:
78 void slotTextDestroyed();
79};
80
81#endif
FloatingTextWidget
Displays a line of text or an operation.
Definition floatingtextwidget.h:32
SignalWidget::~SignalWidget
virtual ~SignalWidget()
Definition signalwidget.cpp:58
SignalWidget::minimumSize
QSizeF minimumSize() const
Definition signalwidget.cpp:343
SignalWidget::loadFromXMI
virtual bool loadFromXMI(QDomElement &qElement)
Definition signalwidget.cpp:251
SignalWidget::setY
void setY(qreal newY)
Definition signalwidget.cpp:176
SignalWidget::setSignalType
void setSignalType(SignalType signalType)
Definition signalwidget.cpp:221
SignalWidget::slotTextDestroyed
void slotTextDestroyed()
Definition signalwidget.cpp:367
SignalWidget::paint
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=nullptr)
Definition signalwidget.cpp:65
SignalWidget::SignalType
SignalType
Enumeration that codes the different types of signal.
Definition signalwidget.h:29
SignalWidget::Time
@ Time
Definition signalwidget.h:32
SignalWidget::Send
@ Send
Definition signalwidget.h:30
SignalWidget::Accept
@ Accept
Definition signalwidget.h:31
SignalWidget::m_oldY
int m_oldY
Definition signalwidget.h:66
SignalWidget::mouseMoveEvent
void mouseMoveEvent(QGraphicsSceneMouseEvent *me)
Definition signalwidget.cpp:237
SignalWidget::setName
virtual void setName(const QString &strName)
Definition signalwidget.cpp:185
SignalWidget::saveToXMI
virtual void saveToXMI(QXmlStreamWriter &writer)
Definition signalwidget.cpp:301
SignalWidget::m_oldX
int m_oldX
Definition signalwidget.h:65
SignalWidget::SignalWidget
SignalWidget(UMLScene *scene, SignalType signalType=Send, Uml::ID::Type id=Uml::ID::None)
Definition signalwidget.cpp:39
SignalWidget::showPropertiesDialog
virtual bool showPropertiesDialog()
Definition signalwidget.cpp:229
SignalWidget::signalTypeStr
QString signalTypeStr() const
Definition signalwidget.cpp:213
SignalWidget::signalType
SignalType signalType() const
Definition signalwidget.cpp:205
SignalWidget::setX
void setX(qreal newX)
Definition signalwidget.cpp:167
SignalWidget::m_pName
FloatingTextWidget * m_pName
Definition signalwidget.h:73
SignalWidget::slotMenuSelection
virtual void slotMenuSelection(QAction *action)
Definition signalwidget.cpp:319
SignalWidget::m_signalType
SignalType m_signalType
Type of signal.
Definition signalwidget.h:75
UMLScene
Definition umlscene.h:65
UMLWidget::UMLWidget
UMLWidget(UMLScene *scene, WidgetType type=wt_UMLWidget, UMLObject *o=nullptr)
Definition umlwidget.cpp:86
floatingtextwidget.h
linkwidget.h
Uml::ID::None
const Type None
special value for uninitialized ID
Definition basictypes.h:373
Uml::ID::Type
std::string Type
Definition basictypes.h:371
umlwidget.h
worktoolbar.h