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

floatingtextwidget.h
Go to the documentation of this file.
1/*
2 SPDX-License-Identifier: GPL-2.0-or-later
3 SPDX-FileCopyrightText: 2002-2020 Umbrello UML Modeller Authors <umbrello-devel@kde.org>
4*/
5
6#ifndef FLOATINGTEXTWIDGET_H
7#define FLOATINGTEXTWIDGET_H
8
9#include "basictypes.h"
10#include "umlwidget.h"
11
12 class LinkWidget;
13 class UMLScene;
14
31 class FloatingTextWidget : public UMLWidget
32{
33 Q_OBJECT
34 public:
35 explicit FloatingTextWidget(UMLScene * scene, Uml::TextRole::Enum role = Uml::TextRole::Floating,
36 const QString& text = QString(), Uml::ID::Type id = Uml::ID::None);
37 virtual ~FloatingTextWidget();
38
39 QString text() const;
40 void setText(const QString &t);
41
42 void setTextcmd(const QString &t);
43
44 QString preText() const;
45 void setPreText(const QString &t);
46
47 QString postText() const;
48 void setPostText(const QString &t);
49
50 QString displayText() const;
51
52 bool isEmpty();
53
54 void showChangeTextDialog();
55 bool showOperationDialog(bool enableAutoIncrement = true);
56 virtual bool showPropertiesDialog();
57
58 LinkWidget* link() const;
59 void setLink(LinkWidget * l);
60
61 bool activate(IDChangeLog* ChangeLog = 0);
62
63 Uml::TextRole::Enum textRole() const;
64 void setTextRole(Uml::TextRole::Enum role);
65
66 bool handleRename();
67 void changeName(const QString& newText);
68
69 void setSequenceNumber(const QString &sequenceNumber);
70 QString sequenceNumber() const;
71
72 static bool isTextValid(const QString &text);
73
74 UMLWidget* onWidget(const QPointF& p);
75
76 virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
77
78 virtual void saveToXMI1(QXmlStreamWriter& writer);
79 virtual bool loadFromXMI1(QDomElement& qElement);
80
81 public Q_SLOTS:
82 virtual void slotMenuSelection(QAction* action);
83 void setMessageText();
84
85 protected:
86 QSizeF minimumSize() const;
87
88 virtual void moveWidgetBy(qreal diffX, qreal diffY);
89 virtual void constrainMovementForAllWidgets(qreal &diffX, qreal &diffY);
90
91 private:
92 QPointF constrainPosition(qreal diffX, qreal diffY);
93
95 LinkWidget * m_linkWidget;
96
98
100 QString m_preText;
102 QString m_postText;
104 Uml::TextRole::Enum m_textRole;
105
107
109 qreal m_unconstrainedPositionX;
110
112 qreal m_unconstrainedPositionY;
113
116 int m_movementDirectionX;
117
120 int m_movementDirectionY;
121
123 QString m_SequenceNumber;
124};
125
126#endif
basictypes.h
FloatingTextWidget
Displays a line of text or an operation.
Definition: floatingtextwidget.h:32
FloatingTextWidget::setPostText
void setPostText(const QString &t)
Definition: floatingtextwidget.cpp:145
FloatingTextWidget::m_unconstrainedPositionX
qreal m_unconstrainedPositionX
The horizontal position the widget would have if its move wasn't constrained.
Definition: floatingtextwidget.h:109
FloatingTextWidget::m_SequenceNumber
QString m_SequenceNumber
Contains sequence number for sequence or collaboration diagram message.
Definition: floatingtextwidget.h:123
FloatingTextWidget::constrainMovementForAllWidgets
virtual void constrainMovementForAllWidgets(qreal &diffX, qreal &diffY)
Definition: floatingtextwidget.cpp:574
FloatingTextWidget::m_linkWidget
LinkWidget * m_linkWidget
The association or message widget we may be linked to.
Definition: floatingtextwidget.h:95
FloatingTextWidget::setPreText
void setPreText(const QString &t)
Definition: floatingtextwidget.cpp:134
FloatingTextWidget::showChangeTextDialog
void showChangeTextDialog()
Definition: floatingtextwidget.cpp:203
FloatingTextWidget::loadFromXMI1
virtual bool loadFromXMI1(QDomElement &qElement)
Definition: floatingtextwidget.cpp:645
FloatingTextWidget::~FloatingTextWidget
virtual ~FloatingTextWidget()
Definition: floatingtextwidget.cpp:74
FloatingTextWidget::showPropertiesDialog
virtual bool showPropertiesDialog()
Definition: floatingtextwidget.cpp:252
FloatingTextWidget::m_preText
QString m_preText
Prepended text (such as for scope of association Role or method)
Definition: floatingtextwidget.h:100
FloatingTextWidget::m_movementDirectionY
int m_movementDirectionY
Definition: floatingtextwidget.h:120
FloatingTextWidget::setLink
void setLink(LinkWidget *l)
Definition: floatingtextwidget.cpp:311
FloatingTextWidget::m_textRole
Uml::TextRole::Enum m_textRole
The role the text widget will enact.
Definition: floatingtextwidget.h:104
FloatingTextWidget::FloatingTextWidget
FloatingTextWidget(UMLScene *scene, Uml::TextRole::Enum role=Uml::TextRole::Floating, const QString &text=QString(), Uml::ID::Type id=Uml::ID::None)
Definition: floatingtextwidget.cpp:55
FloatingTextWidget::setText
void setText(const QString &t)
Definition: floatingtextwidget.cpp:105
FloatingTextWidget::isTextValid
static bool isTextValid(const QString &text)
Definition: floatingtextwidget.cpp:458
FloatingTextWidget::setTextcmd
void setTextcmd(const QString &t)
Definition: floatingtextwidget.cpp:195
FloatingTextWidget::activate
bool activate(IDChangeLog *ChangeLog=0)
Definition: floatingtextwidget.cpp:298
FloatingTextWidget::m_movementDirectionX
int m_movementDirectionX
Definition: floatingtextwidget.h:116
FloatingTextWidget::preText
QString preText() const
Definition: floatingtextwidget.cpp:276
FloatingTextWidget::setTextRole
void setTextRole(Uml::TextRole::Enum role)
Definition: floatingtextwidget.cpp:331
FloatingTextWidget::postText
QString postText() const
Definition: floatingtextwidget.cpp:287
FloatingTextWidget::minimumSize
QSizeF minimumSize() const
Definition: floatingtextwidget.cpp:182
FloatingTextWidget::changeName
void changeName(const QString &newText)
Definition: floatingtextwidget.cpp:382
FloatingTextWidget::showOperationDialog
bool showOperationDialog(bool enableAutoIncrement=true)
Definition: floatingtextwidget.cpp:224
FloatingTextWidget::moveWidgetBy
virtual void moveWidgetBy(qreal diffX, qreal diffY)
Definition: floatingtextwidget.cpp:514
FloatingTextWidget::setMessageText
void setMessageText()
Definition: floatingtextwidget.cpp:779
FloatingTextWidget::text
QString text() const
Definition: floatingtextwidget.cpp:84
FloatingTextWidget::onWidget
UMLWidget * onWidget(const QPointF &p)
Definition: floatingtextwidget.cpp:590
FloatingTextWidget::isEmpty
bool isEmpty()
Definition: floatingtextwidget.cpp:174
FloatingTextWidget::paint
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0)
Definition: floatingtextwidget.cpp:628
FloatingTextWidget::link
LinkWidget * link() const
Definition: floatingtextwidget.cpp:321
FloatingTextWidget::m_unconstrainedPositionY
qreal m_unconstrainedPositionY
The vertical position the widget would have if its move wasn't constrained.
Definition: floatingtextwidget.h:112
FloatingTextWidget::slotMenuSelection
virtual void slotMenuSelection(QAction *action)
Definition: floatingtextwidget.cpp:697
FloatingTextWidget::handleRename
bool handleRename()
Definition: floatingtextwidget.cpp:349
FloatingTextWidget::saveToXMI1
virtual void saveToXMI1(QXmlStreamWriter &writer)
Definition: floatingtextwidget.cpp:672
FloatingTextWidget::textRole
Uml::TextRole::Enum textRole() const
Definition: floatingtextwidget.cpp:340
FloatingTextWidget::displayText
QString displayText() const
Definition: floatingtextwidget.cpp:158
FloatingTextWidget::sequenceNumber
QString sequenceNumber() const
Definition: floatingtextwidget.cpp:446
FloatingTextWidget::m_postText
QString m_postText
Ending text (such as bracket on changability notation for association Role)
Definition: floatingtextwidget.h:102
FloatingTextWidget::setSequenceNumber
void setSequenceNumber(const QString &sequenceNumber)
Definition: floatingtextwidget.cpp:438
FloatingTextWidget::constrainPosition
QPointF constrainPosition(qreal diffX, qreal diffY)
Definition: floatingtextwidget.cpp:483
IDChangeLog
Definition: idchangelog.h:22
LinkWidget
Interface to FloatingTextWidget for AssociationWidget and MessageWidget.
Definition: linkwidget.h:32
UMLScene
Definition: umlscene.h:65
UMLWidget
The base class for graphical UML objects.
Definition: umlwidget.h:36
Model_Utils::newText
QString newText(UMLObject::ObjectType type)
Definition: model_utils.cpp:620
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
Uml::TextRole::Enum
Enum
Definition: basictypes.h:176
Uml::TextRole::Floating
@ Floating
Definition: basictypes.h:177
umlwidget.h