umbrello: umbrello/umlwidgets/floatingtextwidget.h Source File

umbrello 2.32.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 * 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(QXmlStreamWriter& writer);
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
basictypes.h
FloatingTextWidget
Displays a line of text or an operation.
Definition: floatingtextwidget.h:37
FloatingTextWidget::setPostText
void setPostText(const QString &t)
Definition: floatingtextwidget.cpp:150
FloatingTextWidget::m_unconstrainedPositionX
qreal m_unconstrainedPositionX
The horizontal position the widget would have if its move wasn't constrained.
Definition: floatingtextwidget.h:114
FloatingTextWidget::m_SequenceNumber
QString m_SequenceNumber
Contains sequence number for sequence or collaboration diagram message.
Definition: floatingtextwidget.h:128
FloatingTextWidget::constrainMovementForAllWidgets
virtual void constrainMovementForAllWidgets(qreal &diffX, qreal &diffY)
Definition: floatingtextwidget.cpp:579
FloatingTextWidget::m_linkWidget
LinkWidget * m_linkWidget
The association or message widget we may be linked to.
Definition: floatingtextwidget.h:100
FloatingTextWidget::setPreText
void setPreText(const QString &t)
Definition: floatingtextwidget.cpp:139
FloatingTextWidget::showChangeTextDialog
void showChangeTextDialog()
Definition: floatingtextwidget.cpp:208
FloatingTextWidget::loadFromXMI1
virtual bool loadFromXMI1(QDomElement &qElement)
Definition: floatingtextwidget.cpp:650
FloatingTextWidget::~FloatingTextWidget
virtual ~FloatingTextWidget()
Definition: floatingtextwidget.cpp:79
FloatingTextWidget::showPropertiesDialog
virtual bool showPropertiesDialog()
Definition: floatingtextwidget.cpp:257
FloatingTextWidget::m_preText
QString m_preText
Prepended text (such as for scope of association Role or method)
Definition: floatingtextwidget.h:105
FloatingTextWidget::m_movementDirectionY
int m_movementDirectionY
Definition: floatingtextwidget.h:125
FloatingTextWidget::setLink
void setLink(LinkWidget *l)
Definition: floatingtextwidget.cpp:316
FloatingTextWidget::m_textRole
Uml::TextRole::Enum m_textRole
The role the text widget will enact.
Definition: floatingtextwidget.h:109
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:60
FloatingTextWidget::setText
void setText(const QString &t)
Definition: floatingtextwidget.cpp:110
FloatingTextWidget::isTextValid
static bool isTextValid(const QString &text)
Definition: floatingtextwidget.cpp:463
FloatingTextWidget::setTextcmd
void setTextcmd(const QString &t)
Definition: floatingtextwidget.cpp:200
FloatingTextWidget::activate
bool activate(IDChangeLog *ChangeLog=0)
Definition: floatingtextwidget.cpp:303
FloatingTextWidget::m_movementDirectionX
int m_movementDirectionX
Definition: floatingtextwidget.h:121
FloatingTextWidget::preText
QString preText() const
Definition: floatingtextwidget.cpp:281
FloatingTextWidget::setTextRole
void setTextRole(Uml::TextRole::Enum role)
Definition: floatingtextwidget.cpp:336
FloatingTextWidget::postText
QString postText() const
Definition: floatingtextwidget.cpp:292
FloatingTextWidget::minimumSize
QSizeF minimumSize() const
Definition: floatingtextwidget.cpp:187
FloatingTextWidget::changeName
void changeName(const QString &newText)
Definition: floatingtextwidget.cpp:387
FloatingTextWidget::showOperationDialog
bool showOperationDialog(bool enableAutoIncrement=true)
Definition: floatingtextwidget.cpp:229
FloatingTextWidget::moveWidgetBy
virtual void moveWidgetBy(qreal diffX, qreal diffY)
Definition: floatingtextwidget.cpp:519
FloatingTextWidget::setMessageText
void setMessageText()
Definition: floatingtextwidget.cpp:784
FloatingTextWidget::text
QString text() const
Definition: floatingtextwidget.cpp:89
FloatingTextWidget::onWidget
UMLWidget * onWidget(const QPointF &p)
Definition: floatingtextwidget.cpp:595
FloatingTextWidget::isEmpty
bool isEmpty()
Definition: floatingtextwidget.cpp:179
FloatingTextWidget::paint
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0)
Definition: floatingtextwidget.cpp:633
FloatingTextWidget::link
LinkWidget * link() const
Definition: floatingtextwidget.cpp:326
FloatingTextWidget::m_unconstrainedPositionY
qreal m_unconstrainedPositionY
The vertical position the widget would have if its move wasn't constrained.
Definition: floatingtextwidget.h:117
FloatingTextWidget::slotMenuSelection
virtual void slotMenuSelection(QAction *action)
Definition: floatingtextwidget.cpp:702
FloatingTextWidget::handleRename
bool handleRename()
Definition: floatingtextwidget.cpp:354
FloatingTextWidget::saveToXMI1
virtual void saveToXMI1(QXmlStreamWriter &writer)
Definition: floatingtextwidget.cpp:677
FloatingTextWidget::textRole
Uml::TextRole::Enum textRole() const
Definition: floatingtextwidget.cpp:345
FloatingTextWidget::displayText
QString displayText() const
Definition: floatingtextwidget.cpp:163
FloatingTextWidget::sequenceNumber
QString sequenceNumber() const
Definition: floatingtextwidget.cpp:451
FloatingTextWidget::m_postText
QString m_postText
Ending text (such as bracket on changability notation for association Role)
Definition: floatingtextwidget.h:107
FloatingTextWidget::setSequenceNumber
void setSequenceNumber(const QString &sequenceNumber)
Definition: floatingtextwidget.cpp:443
FloatingTextWidget::constrainPosition
QPointF constrainPosition(qreal diffX, qreal diffY)
Definition: floatingtextwidget.cpp:488
IDChangeLog
Definition: idchangelog.h:27
LinkWidget
Interface to FloatingTextWidget for AssociationWidget and MessageWidget.
Definition: linkwidget.h:37
UMLScene
Definition: umlscene.h:70
UMLWidget
The base class for graphical UML objects.
Definition: umlwidget.h:41
Model_Utils::newText
QString newText(UMLObject::ObjectType type)
Definition: model_utils.cpp:625
Uml::ID::None
const Type None
special value for uninitialized ID
Definition: basictypes.h:387
Uml::ID::Type
std::string Type
Definition: basictypes.h:385
Uml::TextRole::Enum
Enum
Definition: basictypes.h:190
Uml::TextRole::Floating
@ Floating
Definition: basictypes.h:191
umlwidget.h