umbrello: umbrello/umlwidgets/floatingtextwidget.h Source File

umbrello 2.32.1 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 * 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 FLOATINGTEXTWIDGET_H
12 #define FLOATINGTEXTWIDGET_H
13
14 #include "basictypes.h"
15 #include "umlwidget.h"
16
17 class LinkWidget;
18 class UMLScene;
19
36 class FloatingTextWidget : public UMLWidget
37 {
38 Q_OBJECT
39 public:
40 explicit FloatingTextWidget(UMLScene * scene, Uml::TextRole::Enum role = Uml::TextRole::Floating,
41 const QString& text = QString(), Uml::ID::Type id = Uml::ID::None);
42 virtual ~FloatingTextWidget();
43
44 QString text() const;
45 void setText(const QString &t);
46
47 void setTextcmd(const QString &t);
48
49 QString preText() const;
50 void setPreText(const QString &t);
51
52 QString postText() const;
53 void setPostText(const QString &t);
54
55 QString displayText() const;
56
57 bool isEmpty();
58
59 void showChangeTextDialog();
60 bool showOperationDialog(bool enableAutoIncrement = true);
61 virtual bool showPropertiesDialog();
62
63 LinkWidget* link() const;
64 void setLink(LinkWidget * l);
65
66 bool activate(IDChangeLog* ChangeLog = 0);
67
68 Uml::TextRole::Enum textRole() const;
69 void setTextRole(Uml::TextRole::Enum role);
70
71 bool handleRename();
72 void changeName(const QString& newText);
73
74 void setSequenceNumber(const QString &sequenceNumber);
75 QString sequenceNumber() const;
76
77 static bool isTextValid(const QString &text);
78
79 UMLWidget* onWidget(const QPointF& p);
80
81 virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
82
83 virtual void saveToXMI1(QDomDocument& qDoc, QDomElement& qElement);
84 virtual bool loadFromXMI1(QDomElement& qElement);
85
86 public Q_SLOTS:
87 virtual void slotMenuSelection(QAction* action);
88 void setMessageText();
89
90 protected:
91 QSizeF minimumSize() const;
92
93 virtual void moveWidgetBy(qreal diffX, qreal diffY);
94 virtual void constrainMovementForAllWidgets(qreal &diffX, qreal &diffY);
95
96 private:
97 QPointF constrainPosition(qreal diffX, qreal diffY);
98
100 LinkWidget * m_linkWidget;
101
103
105 QString m_preText;
107 QString m_postText;
109 Uml::TextRole::Enum m_textRole;
110
112
114 qreal m_unconstrainedPositionX;
115
117 qreal m_unconstrainedPositionY;
118
121 int m_movementDirectionX;
122
125 int m_movementDirectionY;
126
128 QString m_SequenceNumber;
129 };
130
131 #endif
ListPopupMenu::mt_Reset_Label_Positions
@ mt_Reset_Label_Positions
Definition: listpopupmenu.h:196
WidgetBase::wt_Association
@ wt_Association
Definition: widgetbase.h:132
Uml::ModelType::Enum
Enum
Definition: basictypes.h:41
Uml::CmdSetTxt
Definition: cmdsettxt.h:21
UMLWidget::height
qreal height() const
Definition: umlwidget.h:114
AssociationWidget
This class represents an association inside a diagram. Bugs and comments to umbrello-devel@kde....
Definition: associationwidget.h:52
WidgetBase::onWidget
virtual UMLWidget * onWidget(const QPointF &p)
Definition: widgetbase.cpp:875
FloatingTextWidget::postText
QString postText() const
Definition: floatingtextwidget.cpp:291
LinkWidget::setCustomOpText
virtual void setCustomOpText(const QString &opText)=0
x
int x
Definition: cxx11-lambda-functions-and-expressions.h:4
WidgetBase::textColor
QColor textColor() const
Definition: widgetbase.cpp:335
ListPopupMenu::mt_Properties
@ mt_Properties
Definition: listpopupmenu.h:182
LinkWidget::resetTextPositions
virtual void resetTextPositions()
Definition: linkwidget.cpp:70
UMLWidget::setFont
virtual void setFont(const QFont &font)
Definition: umlwidget.cpp:1955
LinkWidget::constrainTextPos
virtual void constrainTextPos(qreal &textX, qreal &textY, qreal textWidth, qreal textHeight, Uml::TextRole::Enum tr)=0
AssociationWidget::setMultiplicity
void setMultiplicity(const QString &text, Uml::RoleType::Enum role)
Definition: associationwidget.cpp:1065
Uml::TextRole::Seq_Message
@ Seq_Message
Definition: basictypes.h:183
FloatingTextWidget::preText
QString preText() const
Definition: floatingtextwidget.cpp:280
UMLObject::asUMLOperation
UMLOperation * asUMLOperation()
Definition: umlobject.cpp:1323
Uml::TextRole::ChangeA
@ ChangeA
Definition: basictypes.h:190
FloatingTextWidget::m_preText
QString m_preText
Prepended text (such as for scope of association Role or method)
Definition: floatingtextwidget.h:105
umlview.h
UMLWidget
The base class for graphical UML objects.
Definition: umlwidget.h:41
WidgetBase::isInterfaceWidget
bool isInterfaceWidget()
Definition: widgetbase.h:255
WidgetBase::name
QString name() const
Definition: widgetbase.cpp:309
Uml::TextRole::RoleAName
@ RoleAName
Definition: basictypes.h:188
FloatingTextWidget::constrainMovementForAllWidgets
virtual void constrainMovementForAllWidgets(qreal &diffX, qreal &diffY)
Definition: floatingtextwidget.cpp:578
FloatingTextWidget::m_unconstrainedPositionY
qreal m_unconstrainedPositionY
The vertical position the widget would have if its move wasn't constrained.
Definition: floatingtextwidget.h:117
UMLWidget::FT_NORMAL
@ FT_NORMAL
Definition: umlwidget.h:217
UMLScene::activeView
UMLView * activeView() const
Definition: umlscene.cpp:348
Uml::Changeability::Changeable
@ Changeable
Definition: basictypes.h:205
FloatingTextWidget::showChangeTextDialog
void showChangeTextDialog()
Definition: floatingtextwidget.cpp:207
ClassifierWidget::getDrawAsCircle
bool getDrawAsCircle() const
Definition: classifierwidget.cpp:1190
LinkWidget::setOperation
virtual void setOperation(UMLOperation *op)=0
FloatingTextWidget::setText
void setText(const QString &t)
Definition: floatingtextwidget.cpp:109
classifierwidget.h
FloatingTextWidget::showPropertiesDialog
virtual bool showPropertiesDialog()
Definition: floatingtextwidget.cpp:256
operation.h
DEBUG_REGISTER_DISABLED
#define DEBUG_REGISTER_DISABLED(src)
Definition: debug_utils.h:132
Uml::ID::None
const Type None
special value for uninitialized ID
Definition: basictypes.h:353
FloatingTextWidget::m_linkWidget
LinkWidget * m_linkWidget
The association or message widget we may be linked to.
Definition: floatingtextwidget.h:100
Uml::RoleType::A
@ A
Definition: basictypes.h:239
FloatingTextWidget::textRole
Uml::TextRole::Enum textRole() const
Definition: floatingtextwidget.cpp:344
FloatingTextWidget::activate
bool activate(IDChangeLog *ChangeLog=0)
Definition: floatingtextwidget.cpp:302
associationpropertiesdialog.h
FloatingTextWidget::moveWidgetBy
virtual void moveWidgetBy(qreal diffX, qreal diffY)
Definition: floatingtextwidget.cpp:518
UMLScene::showOpSig
bool showOpSig() const
Definition: umlscene.cpp:3649
object_factory.h
FloatingTextWidget::onWidget
UMLWidget * onWidget(const QPointF &p)
Definition: floatingtextwidget.cpp:594
FloatingTextWidget::displayText
QString displayText() const
Definition: floatingtextwidget.cpp:162
association.h
cmds.h
AssociationWidget::setName
void setName(const QString &strRole)
Definition: associationwidget.cpp:881
FloatingTextWidget::m_movementDirectionY
int m_movementDirectionY
Definition: floatingtextwidget.h:125
Uml::CmdHandleRename
Definition: cmdhandlerename.h:21
FloatingTextWidget::setSequenceNumber
void setSequenceNumber(const QString &sequenceNumber)
Definition: floatingtextwidget.cpp:442
Dialog_Utils::askName
bool askName(const QString &title, const QString &prompt, QString &name)
Definition: dialog_utils.cpp:96
Uml::ID::Type
std::string Type
Definition: basictypes.h:351
Object_Factory::createChildObject
UMLClassifierListItem * createChildObject(UMLClassifier *parent, UMLObject::ObjectType type, const QString &name)
Definition: object_factory.cpp:300
FloatingTextWidget::isEmpty
bool isEmpty()
Definition: floatingtextwidget.cpp:178
MessageWidget::setY
virtual void setY(qreal y)
Definition: messagewidget.cpp:157
Uml::TextRole::Coll_Message_Self
@ Coll_Message_Self
Definition: basictypes.h:186
model_utils.h
LinkWidget::lwOperationText
virtual QString lwOperationText()=0
FloatingTextWidget::loadFromXMI1
virtual bool loadFromXMI1(QDomElement &qElement)
Definition: floatingtextwidget.cpp:649
Uml::TextRole::Name
@ Name
Definition: basictypes.h:182
Uml::TextRole::RoleBName
@ RoleBName
Definition: basictypes.h:189
Uml::TextRole::Floating
@ Floating
Definition: basictypes.h:179
floatingtextwidget.h
FloatingTextWidget::m_SequenceNumber
QString m_SequenceNumber
Contains sequence number for sequence or collaboration diagram message.
Definition: floatingtextwidget.h:128
ListPopupMenu::mt_Operation
@ mt_Operation
Definition: listpopupmenu.h:112
UMLWidget::getFontMetrics
QFontMetrics & getFontMetrics(UMLWidget::FontType fontType) const
Definition: umlwidget.cpp:1936
WidgetBase::font
virtual QFont font() const
Definition: widgetbase.cpp:543
UMLWidget::showPropertiesDialog
virtual bool showPropertiesDialog()
Definition: umlwidget.cpp:1358
Uml::TextRole::Enum
Enum
Definition: basictypes.h:178
IDChangeLog
Definition: idchangelog.h:27
WidgetBase::wt_Pin
@ wt_Pin
Definition: widgetbase.h:138
Uml::TextRole::MultiA
@ MultiA
Definition: basictypes.h:180
UMLWidget::setX
virtual void setX(qreal x)
Definition: umlwidget.cpp:1685
Uml::TextRole::MultiB
@ MultiB
Definition: basictypes.h:181
FloatingTextWidget::handleRename
bool handleRename()
Definition: floatingtextwidget.cpp:353
WidgetBase::wt_Port
@ wt_Port
Definition: widgetbase.h:142
FloatingTextWidget::setMessageText
void setMessageText()
Definition: floatingtextwidget.cpp:783
umlwidget.h
LinkWidget::operationOwner
virtual UMLClassifier * operationOwner()
Definition: linkwidget.cpp:35
ListPopupMenu::mt_Select_Operation
@ mt_Select_Operation
Definition: listpopupmenu.h:181
ListPopupMenu::MenuType
MenuType
< This type hosts all possible menu entry types
Definition: listpopupmenu.h:44
i18n
#define i18n
Definition: main.cpp:39
Uml::TextRole::ChangeB
@ ChangeB
Definition: basictypes.h:191
messagewidget.h
Uml::TextRole::Seq_Message_Self
@ Seq_Message_Self
Definition: basictypes.h:184
ClassifierWidget
Common implementation for class widget and interface widget.
Definition: classifierwidget.h:33
basictypes.h
FloatingTextWidget::m_postText
QString m_postText
Ending text (such as bracket on changability notation for association Role)
Definition: floatingtextwidget.h:107
FloatingTextWidget
Displays a line of text or an operation.
Definition: floatingtextwidget.h:37
Uml::RoleType::B
@ B
Definition: basictypes.h:240
WidgetBase::m_scene
UMLScene * m_scene
Definition: widgetbase.h:316
FloatingTextWidget::m_textRole
Uml::TextRole::Enum m_textRole
The role the text widget will enact.
Definition: floatingtextwidget.h:109
Uml::TextRole::Coll_Message
@ Coll_Message
Definition: basictypes.h:185
ListPopupMenu::mt_Change_Font
@ mt_Change_Font
Definition: listpopupmenu.h:209
FloatingTextWidget::link
LinkWidget * link() const
Definition: floatingtextwidget.cpp:325
FloatingTextWidget::paint
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0)
Definition: floatingtextwidget.cpp:632
FloatingTextWidget::showOperationDialog
bool showOperationDialog(bool enableAutoIncrement=true)
Definition: floatingtextwidget.cpp:228
UMLApp::app
static UMLApp * app()
Definition: uml.cpp:269
UMLDoc::setModified
void setModified(bool modified=true)
Definition: umldoc.cpp:3127
WidgetBase
Common base class for UMLWidget and AssociationWidget.
Definition: widgetbase.h:105
LinkWidget
Interface to FloatingTextWidget for AssociationWidget and MessageWidget.
Definition: linkwidget.h:36
FloatingTextWidget::minimumSize
QSizeF minimumSize() const
Definition: floatingtextwidget.cpp:186
FloatingTextWidget::m_movementDirectionX
int m_movementDirectionX
Definition: floatingtextwidget.h:121
FloatingTextWidget::constrainPosition
QPointF constrainPosition(qreal diffX, qreal diffY)
Definition: floatingtextwidget.cpp:487
Uml
Definition: basictypes.cpp:37
LinkWidget::lwSetFont
virtual void lwSetFont(QFont font)=0
UMLWidget::setY
virtual void setY(qreal y)
Definition: umlwidget.cpp:1697
FloatingTextWidget::slotMenuSelection
virtual void slotMenuSelection(QAction *action)
Definition: floatingtextwidget.cpp:701
associationwidget.h
ListPopupMenu::mt_Delete
@ mt_Delete
Definition: listpopupmenu.h:186
SelectOperationDialog
A dialog to select an operation.
Definition: selectoperationdialog.h:33
LinkWidget::lwClassifier
virtual UMLClassifier * lwClassifier()=0
AssociationWidget::setChangeability
void setChangeability(Uml::Changeability::Enum value, Uml::RoleType::Enum role)
Definition: associationwidget.cpp:1132
FloatingTextWidget::setPostText
void setPostText(const QString &t)
Definition: floatingtextwidget.cpp:149
DEBUG
#define DEBUG(src)
Definition: debug_utils.h:129
LinkWidget::setText
virtual void setText(FloatingTextWidget *ft, const QString &newText)=0
classifier.h
uError
#define uError()
Definition: debug_utils.h:123
selectoperationdialog.h
UMLOperation
Definition: operation.h:25
Uml::TextRole::fromInt
Enum fromInt(int item)
Definition: basictypes.cpp:662
WidgetBase::wt_Interface
@ wt_Interface
Definition: widgetbase.h:117
uml.h
UMLWidget::setSize
void setSize(qreal width, qreal height)
Definition: umlwidget.cpp:1745
FloatingTextWidget::setTextRole
void setTextRole(Uml::TextRole::Enum role)
Definition: floatingtextwidget.cpp:335
LinkWidget::calculateNameTextSegment
virtual void calculateNameTextSegment()
Definition: linkwidget.cpp:87
UMLClassifier
Information for a non-graphical Concept/Class.
Definition: classifier.h:40
debug_utils.h
WidgetBase::WidgetType
WidgetType
Definition: widgetbase.h:111
UMLScene
Definition: umlscene.h:69
ListPopupMenu::typeFromAction
static MenuType typeFromAction(QAction *action)
Definition: listpopupmenu.cpp:407
DBG_SRC
#define DBG_SRC
Definition: import_utils.cpp:43
LinkWidget::showPropertiesDialog
virtual bool showPropertiesDialog()
Definition: linkwidget.cpp:78
UMLWidget::updateGeometry
void updateGeometry(bool withAssocs=true)
Definition: umlwidget.cpp:1781
Model_Utils::newText
QString newText(UMLObject::ObjectType type)
Definition: model_utils.cpp:620
ListPopupMenu::mt_Rename
@ mt_Rename
Definition: listpopupmenu.h:183
UMLWidget::saveToXMI1
virtual void saveToXMI1(QDomDocument &qDoc, QDomElement &qElement)
Definition: umlwidget.cpp:2045
listpopupmenu.h
UMLScene::removeWidget
void removeWidget(UMLWidget *o)
Definition: umlscene.cpp:1289
FloatingTextWidget::setTextcmd
void setTextcmd(const QString &t)
Definition: floatingtextwidget.cpp:199
FloatingTextWidget::setPreText
void setPreText(const QString &t)
Definition: floatingtextwidget.cpp:138
FloatingTextWidget::changeName
void changeName(const QString &newText)
Definition: floatingtextwidget.cpp:386
FloatingTextWidget::sequenceNumber
QString sequenceNumber() const
Definition: floatingtextwidget.cpp:450
UMLObject::ot_Operation
@ ot_Operation
Definition: umlobject.h:93
WidgetBase::setName
virtual void setName(const QString &strName)
Definition: widgetbase.cpp:322
dialog_utils.h
FloatingTextWidget::isTextValid
static bool isTextValid(const QString &text)
Definition: floatingtextwidget.cpp:462
linkwidget.h
UMLApp::executeCommand
void executeCommand(QUndoCommand *cmd)
Definition: uml.cpp:3416
FloatingTextWidget::text
QString text() const
Definition: floatingtextwidget.cpp:88
FloatingTextWidget::m_unconstrainedPositionX
qreal m_unconstrainedPositionX
The horizontal position the widget would have if its move wasn't constrained.
Definition: floatingtextwidget.h:114
UMLWidget::width
qreal width() const
Definition: umlwidget.h:121
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:59
WidgetBase::baseType
WidgetType baseType() const
Definition: widgetbase.cpp:115
UMLClassifierListItem
A base class for classifier list items (e.g. attributes)
Definition: classifierlistitem.h:30
MessageWidget
Displays a message.
Definition: messagewidget.h:41
FloatingTextWidget::setLink
void setLink(LinkWidget *l)
Definition: floatingtextwidget.cpp:315
UMLWidget::loadFromXMI1
virtual bool loadFromXMI1(QDomElement &qElement)
Definition: umlwidget.cpp:2067
WidgetBase::m_Text
QString m_Text
Definition: widgetbase.h:319
UMLWidget::slotMenuSelection
virtual void slotMenuSelection(QAction *action)
Definition: umlwidget.cpp:768
UMLApp::document
UMLDoc * document() const
Definition: uml.cpp:1055
umldoc.h
ListPopupMenu::mt_New_Operation
@ mt_New_Operation
Definition: listpopupmenu.h:139
FloatingTextWidget::~FloatingTextWidget
virtual ~FloatingTextWidget()
Definition: floatingtextwidget.cpp:78
AssociationWidget::setRoleName
void setRoleName(const QString &strRole, Uml::RoleType::Enum role)
Definition: associationwidget.cpp:958
LinkWidget::setMessageText
virtual void setMessageText(FloatingTextWidget *ft)=0
UMLWidget::activate
virtual bool activate(IDChangeLog *changeLog=0)
Definition: umlwidget.cpp:1192
FloatingTextWidget::saveToXMI1
virtual void saveToXMI1(QDomDocument &qDoc, QDomElement &qElement)
Definition: floatingtextwidget.cpp:676
UMLWidget::paint
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0)
Definition: umlwidget.cpp:1869