umbrello: umbrello/umlwidgets/floatingtextwidget.h Source File

umbrello 25.04.0 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-2021 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
12class LinkWidget;
13class UMLScene;
14
31 class FloatingTextWidget : public UMLWidget
32{
33 Q_OBJECT
34public:
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 = nullptr);
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 = nullptr);
77
78 virtual void saveToXMI(QXmlStreamWriter& writer);
79 virtual bool loadFromXMI(QDomElement& qElement);
80
81public Q_SLOTS:
82 virtual void slotMenuSelection(QAction* action);
83 void setMessageText();
84
85protected:
86 QSizeF minimumSize() const;
87
88 virtual void moveWidgetBy(qreal diffX, qreal diffY);
89 virtual void constrainMovementForAllWidgets(qreal &diffX, qreal &diffY);
90
91private:
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::setPostText
void setPostText(const QString &t)
Definition floatingtextwidget.cpp:140
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:569
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:129
FloatingTextWidget::showChangeTextDialog
void showChangeTextDialog()
Definition floatingtextwidget.cpp:198
FloatingTextWidget::~FloatingTextWidget
virtual ~FloatingTextWidget()
Definition floatingtextwidget.cpp:69
FloatingTextWidget::showPropertiesDialog
virtual bool showPropertiesDialog()
Definition floatingtextwidget.cpp:247
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:306
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:50
FloatingTextWidget::setText
void setText(const QString &t)
Definition floatingtextwidget.cpp:100
FloatingTextWidget::isTextValid
static bool isTextValid(const QString &text)
Definition floatingtextwidget.cpp:453
FloatingTextWidget::loadFromXMI
virtual bool loadFromXMI(QDomElement &qElement)
Definition floatingtextwidget.cpp:640
FloatingTextWidget::paint
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=nullptr)
Definition floatingtextwidget.cpp:623
FloatingTextWidget::setTextcmd
void setTextcmd(const QString &t)
Definition floatingtextwidget.cpp:190
FloatingTextWidget::m_movementDirectionX
int m_movementDirectionX
Definition floatingtextwidget.h:116
FloatingTextWidget::preText
QString preText() const
Definition floatingtextwidget.cpp:271
FloatingTextWidget::setTextRole
void setTextRole(Uml::TextRole::Enum role)
Definition floatingtextwidget.cpp:326
FloatingTextWidget::postText
QString postText() const
Definition floatingtextwidget.cpp:282
FloatingTextWidget::minimumSize
QSizeF minimumSize() const
Definition floatingtextwidget.cpp:177
FloatingTextWidget::changeName
void changeName(const QString &newText)
Definition floatingtextwidget.cpp:377
FloatingTextWidget::showOperationDialog
bool showOperationDialog(bool enableAutoIncrement=true)
Definition floatingtextwidget.cpp:219
FloatingTextWidget::moveWidgetBy
virtual void moveWidgetBy(qreal diffX, qreal diffY)
Definition floatingtextwidget.cpp:509
FloatingTextWidget::setMessageText
void setMessageText()
Definition floatingtextwidget.cpp:769
FloatingTextWidget::text
QString text() const
Definition floatingtextwidget.cpp:79
FloatingTextWidget::saveToXMI
virtual void saveToXMI(QXmlStreamWriter &writer)
Definition floatingtextwidget.cpp:667
FloatingTextWidget::onWidget
UMLWidget * onWidget(const QPointF &p)
Definition floatingtextwidget.cpp:585
FloatingTextWidget::isEmpty
bool isEmpty()
Definition floatingtextwidget.cpp:169
FloatingTextWidget::link
LinkWidget * link() const
Definition floatingtextwidget.cpp:316
FloatingTextWidget::activate
bool activate(IDChangeLog *ChangeLog=nullptr)
Definition floatingtextwidget.cpp:293
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:692
FloatingTextWidget::handleRename
bool handleRename()
Definition floatingtextwidget.cpp:344
FloatingTextWidget::textRole
Uml::TextRole::Enum textRole() const
Definition floatingtextwidget.cpp:335
FloatingTextWidget::displayText
QString displayText() const
Definition floatingtextwidget.cpp:153
FloatingTextWidget::sequenceNumber
QString sequenceNumber() const
Definition floatingtextwidget.cpp:441
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:433
FloatingTextWidget::constrainPosition
QPointF constrainPosition(qreal diffX, qreal diffY)
Definition floatingtextwidget.cpp:478
IDChangeLog
Definition idchangelog.h:22
LinkWidget
Interface to FloatingTextWidget for AssociationWidget and MessageWidget.
Definition linkwidget.h:32
UMLScene
Definition umlscene.h:65
UMLWidget::UMLWidget
UMLWidget(UMLScene *scene, WidgetType type=wt_UMLWidget, UMLObject *o=nullptr)
Definition umlwidget.cpp:86
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