umbrello: FloatingTextWidget Class Reference

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

Public Slots | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
FloatingTextWidget Class Reference

Displays a line of text or an operation. More...

`#include <floatingtextwidget.h>`

Inheritance diagram for FloatingTextWidget:

## Public Slots
virtual void | slotMenuSelection (QAction *action)
void | setMessageText ()
Public Slots inherited from UMLWidget
virtual void | updateWidget ()
virtual void | slotMenuSelection (QAction *action)
virtual void | slotWidgetMoved (Uml::ID::Type id)
virtual void | slotFillColorChanged (Uml::ID::Type viewID)
virtual void | slotLineColorChanged (Uml::ID::Type viewID)
virtual void | slotTextColorChanged (Uml::ID::Type viewID)
virtual void | slotLineWidthChanged (Uml::ID::Type viewID)
void | slotSnapToGrid ()
Public Slots inherited from WidgetBase
virtual void | slotMenuSelection (QAction *trigger)

## Public Member Functions
| FloatingTextWidget (UMLScene *scene, Uml::TextRole::Enum role=Uml::TextRole::Floating, const QString &text=QString(), Uml::ID::Type id=Uml::ID::None)
virtual | ~FloatingTextWidget ()
QString | text () const
void | setText (const QString &t)
void | setTextcmd (const QString &t)
QString | preText () const
void | setPreText (const QString &t)
QString | postText () const
void | setPostText (const QString &t)
QString | displayText () const
bool | isEmpty ()
void | showChangeTextDialog ()
bool | showOperationDialog (bool enableAutoIncrement=true)
virtual bool | showPropertiesDialog ()
LinkWidget * | link () const
void | setLink (LinkWidget *l)
bool | activate (IDChangeLog *ChangeLog=nullptr)
Uml::TextRole::Enum | textRole () const
void | setTextRole (Uml::TextRole::Enum role)
bool | handleRename ()
void | changeName (const QString &newText)
void | setSequenceNumber (const QString &sequenceNumber)
QString | sequenceNumber () const
UMLWidget * | onWidget (const QPointF &p)
virtual void | paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=nullptr)
virtual void | saveToXMI (QXmlStreamWriter &writer)
virtual bool | loadFromXMI (QDomElement &qElement)
Public Member Functions inherited from UMLWidget
| UMLWidget (UMLScene *scene, WidgetType type=wt_UMLWidget, UMLObject *o=nullptr)
| UMLWidget (UMLScene *scene, WidgetType type=wt_UMLWidget, Uml::ID::Type id=Uml::ID::None)
virtual | ~UMLWidget ()
UMLWidget & | operator= (const UMLWidget &other)
bool | operator== (const UMLWidget &other) const
void | setMinimumSize (const QSizeF &size)
virtual QSizeF | maximumSize ()
void | setMaximumSize (const QSizeF &size)
virtual void | setUseFillColor (bool fc)
void | setUseFillColorCmd (bool fc)
virtual void | setTextColor (const QColor &color)
void | setTextColorCmd (const QColor &color)
virtual void | setLineColor (const QColor &color)
virtual void | setLineColorCmd (const QColor &color)
virtual void | setLineWidth (uint width)
void | setLineWidthCmd (uint width)
virtual void | setFillColor (const QColor &color)
void | setFillColorCmd (const QColor &color)
void | setSelectedFlag (bool _select)
virtual void | setSelected (bool _select)
void | setScene (UMLScene *scene)
void | setPenFromSettings (QPainter &p)
void | setPenFromSettings (QPainter *p)
virtual void | setFont (const QFont &font)
void | setFontCmd (const QFont &font)
bool | getStartMove () const
virtual qreal | getX () const
virtual qreal | getY () const
virtual QPointF | getPos () const
virtual void | setX (qreal x)
virtual void | setY (qreal y)
qreal | height () const
qreal | width () const
void | setSize (qreal width, qreal height)
void | setSize (const QSizeF &size)
virtual void | resizeWidget (qreal newW, qreal newH)
virtual void | notifyParentResize ()
bool | getIgnoreSnapToGrid () const
void | setIgnoreSnapToGrid (bool to)
virtual bool | isLocatedIn (const UMLWidget *other) const
void | moveByLocal (qreal dx, qreal dy)
virtual void | removeAssoc (AssociationWidget *pAssoc)
virtual void | addAssoc (AssociationWidget *pAssoc)
AssociationWidgetList & | associationWidgetList () const
bool | isInstance () const
void | setIsInstance (bool isInstance)
void | setInstanceName (const QString &instanceName)
QString | instanceName () const
Uml::ShowStereoType::Enum | showStereotype () const
virtual void | setShowStereotype (Uml::ShowStereoType::Enum flag)
QString | tags () const
virtual void | adjustAssocs (qreal dx, qreal dy)
virtual void | adjustUnselectedAssocs (qreal dx, qreal dy)
bool | isActivated () const
void | setActivated (bool active=true)
virtual void | cleanup ()
void | updateGeometry (bool withAssocs=true)
void | clipSize ()
void | forceUpdateFontMetrics (QPainter *painter)
void | forceUpdateFontMetrics (QFont &font, QPainter *painter)
QPointF | startMovePosition () const
void | setStartMovePosition (const QPointF &position)
QSizeF | startResizeSize () const
virtual QSizeF | calculateSize (bool withExtensions=true) const
void | resize ()
bool | fixedAspectRatio () const
void | setFixedAspectRatio (bool state)
bool | resizable () const
void | setResizable (bool state)
virtual void | setDefaultFontMetrics (QFont &font, UMLWidget::FontType fontType)
virtual void | setDefaultFontMetrics (QFont &font, UMLWidget::FontType fontType, QPainter &painter)
QFontMetrics & | getFontMetrics (UMLWidget::FontType fontType) const
void | setFontMetrics (UMLWidget::FontType fontType, QFontMetrics fm)
void | setupFontType (QFont &font, UMLWidget::FontType fontType)
Public Member Functions inherited from WidgetBase
| WidgetBase (UMLScene *scene, WidgetType type=wt_UMLWidget, Uml::ID::Type id=Uml::ID::None)
virtual | ~WidgetBase ()
UMLObject * | umlObject () const
virtual void | setUMLObject (UMLObject *obj)
Uml::ID::Type | id () const
void | setID (Uml::ID::Type id)
void | setLocalID (Uml::ID::Type id)
Uml::ID::Type | localID () const
virtual UMLWidget * | widgetWithID (Uml::ID::Type id)
WidgetType | baseType () const
void | setBaseType (const WidgetType &baseType)
QLatin1String | baseTypeStr () const
QString | baseTypeStrWithoutPrefix () const
UMLScene * | umlScene () const
UMLDoc * | umlDoc () const
QString | documentation () const
bool | hasDocumentation () const
virtual void | setDocumentation (const QString &doc)
QString | name () const
virtual void | setName (const QString &strName)
QColor | lineColor () const
uint | lineWidth () const
QColor | textColor () const
QColor | fillColor () const
bool | usesDiagramLineColor () const
void | setUsesDiagramLineColor (bool state)
bool | usesDiagramLineWidth () const
void | setUsesDiagramLineWidth (bool state)
bool | useFillColor () const
bool | usesDiagramTextColor () const
void | setUsesDiagramTextColor (bool state)
bool | usesDiagramFillColor () const
void | setUsesDiagramFillColor (bool state)
bool | usesDiagramUseFillColor () const
void | setUsesDiagramUseFillColor (bool state)
virtual QFont | font () const
bool | autoResize () const
void | setAutoResize (bool state)
bool | changesShape () const
void | setChangesShape (bool state)
WidgetBase & | operator= (const WidgetBase &other)
QRectF | rect () const
void | setRect (const QRectF &rect)
void | setRect (qreal x, qreal y, qreal width, qreal height)
virtual QRectF | boundingRect () const
bool | isActivityWidget () const
bool | isActorWidget () const
bool | isArtifactWidget () const
bool | isAssociationWidget () const
bool | isBoxWidget () const
bool | isCategoryWidget () const
bool | isClassWidget () const
bool | isCombinedFragmentWidget () const
bool | isComponentWidget () const
bool | isDatatypeWidget () const
bool | isEntityWidget () const
bool | isEnumWidget () const
bool | isFloatingDashLineWidget () const
bool | isForkJoinWidget () const
bool | isInterfaceWidget () const
bool | isMessageWidget () const
bool | isNodeWidget () const
bool | isNoteWidget () const
bool | isObjectNodeWidget () const
bool | isObjectWidget () const
bool | isPackageWidget () const
bool | isPinWidget () const
bool | isPortWidget () const
bool | isPreconditionWidget () const
bool | isRegionWidget () const
bool | isSignalWidget () const
bool | isStateWidget () const
bool | isTextWidget () const
bool | isUseCaseWidget () const
ActivityWidget * | asActivityWidget ()
ActorWidget * | asActorWidget ()
ArtifactWidget * | asArtifactWidget ()
AssociationWidget * | asAssociationWidget ()
BoxWidget * | asBoxWidget ()
CategoryWidget * | asCategoryWidget ()
ClassifierWidget * | asClassifierWidget ()
CombinedFragmentWidget * | asCombinedFragmentWidget ()
ComponentWidget * | asComponentWidget ()
DatatypeWidget * | asDatatypeWidget ()
EntityWidget * | asEntityWidget ()
EnumWidget * | asEnumWidget ()
FloatingDashLineWidget * | asFloatingDashLineWidget ()
ForkJoinWidget * | asForkJoinWidget ()
InterfaceWidget * | asInterfaceWidget ()
MessageWidget * | asMessageWidget ()
NodeWidget * | asNodeWidget ()
NoteWidget * | asNoteWidget ()
ObjectNodeWidget * | asObjectNodeWidget ()
ObjectWidget * | asObjectWidget ()
PackageWidget * | asPackageWidget ()
PinWidget * | asPinWidget ()
PinPortBase * | asPinPortBase ()
PortWidget * | asPortWidget ()
PreconditionWidget * | asPreconditionWidget ()
RegionWidget * | asRegionWidget ()
SignalWidget * | asSignalWidget ()
StateWidget * | asStateWidget ()
FloatingTextWidget * | asFloatingTextWidget ()
UseCaseWidget * | asUseCaseWidget ()
UMLWidget * | asUMLWidget ()
const ActivityWidget * | asActivityWidget () const
const ActorWidget * | asActorWidget () const
const ArtifactWidget * | asArtifactWidget () const
const AssociationWidget * | asAssociationWidget () const
const BoxWidget * | asBoxWidget () const
const CategoryWidget * | asCategoryWidget () const
const ClassifierWidget * | asClassifierWidget () const
const CombinedFragmentWidget * | asCombinedFragmentWidget () const
const ComponentWidget * | asComponentWidget () const
const DatatypeWidget * | asDatatypeWidget () const
const EntityWidget * | asEntityWidget () const
const EnumWidget * | asEnumWidget () const
const FloatingDashLineWidget * | asFloatingDashLineWidget () const
const ForkJoinWidget * | asForkJoinWidget () const
const InterfaceWidget * | asInterfaceWidget () const
const MessageWidget * | asMessageWidget () const
const NodeWidget * | asNodeWidget () const
const NoteWidget * | asNoteWidget () const
const ObjectNodeWidget * | asObjectNodeWidget () const
const ObjectWidget * | asObjectWidget () const
const PackageWidget * | asPackageWidget () const
const PinWidget * | asPinWidget () const
const PinPortBase * | asPinPortBase () const
const PortWidget * | asPortWidget () const
const PreconditionWidget * | asPreconditionWidget () const
const RegionWidget * | asRegionWidget () const
const SignalWidget * | asSignalWidget () const
const StateWidget * | asStateWidget () const
const FloatingTextWidget * | asFloatingTextWidget () const
const UseCaseWidget * | asUseCaseWidget () const
const UMLWidget * | asUMLWidget () const
Public Member Functions inherited from DiagramProxyWidget
| DiagramProxyWidget (UMLWidget *widget, qreal borderWidth=5)
virtual | ~DiagramProxyWidget ()
Uml::ID::Type | diagramLink () const
UMLScene * | linkedDiagram () const
bool | setDiagramLink (const Uml::ID::Type &id)
const QRectF & | clientRect () const
const QRectF & | sceneRect () const
void | setClientRect (const QRectF &rect)
bool | isProxyWidget () const
UMLWidget * | getProxiedWidget (const QPointF &p) const
QPointF | mapFromClient (const QPointF &p) const
QRectF | mapFromClient (const QRectF &r) const
QPointF | mapToClient (const QPointF &pos) const
void | paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=nullptr)
bool | showLinkedDiagram () const
void | setShowLinkedDiagram (bool showLinkedDiagram)
QRectF | iconRect () const
void | setIconRect (const QRectF &iconRect)

## Static Public Member Functions
static bool | isTextValid (const QString &text)
Static Public Member Functions inherited from WidgetBase
static QString | toString (WidgetType wt)
static QString | toI18nString (WidgetType wt)
static Icon_Utils::IconType | toIcon (WidgetType wt)
static bool | widgetHasUMLObject (WidgetBase::WidgetType type)

## Protected Member Functions
QSizeF | minimumSize () const
virtual void | moveWidgetBy (qreal diffX, qreal diffY)
virtual void | constrainMovementForAllWidgets (qreal &diffX, qreal &diffY)
Protected Member Functions inherited from UMLWidget
virtual void | contextMenuEvent (QGraphicsSceneContextMenuEvent *event)
virtual void | mouseDoubleClickEvent (QGraphicsSceneMouseEvent *event)
virtual void | mousePressEvent (QGraphicsSceneMouseEvent *event)
virtual void | mouseMoveEvent (QGraphicsSceneMouseEvent *event)
virtual void | mouseReleaseEvent (QGraphicsSceneMouseEvent *event)
virtual void | moveEvent (QGraphicsSceneMouseEvent *event)
virtual void | constrain (qreal &width, qreal &height)
virtual bool | isInResizeArea (QGraphicsSceneMouseEvent *me)
virtual QCursor | resizeCursor () const
void | selectSingle (QGraphicsSceneMouseEvent *me)
void | selectMultiple (QGraphicsSceneMouseEvent *me)
void | deselect (QGraphicsSceneMouseEvent *me)
void | setSelectionBounds ()
void | resize (QGraphicsSceneMouseEvent *me)
bool | wasSizeChanged ()
bool | wasPositionChanged ()
virtual void | toForeground ()
void | addConnectedWidget (UMLWidget *widget, Uml::AssociationType::Enum type=Uml::AssociationType::Association, AddWidgetOptions options=Default)
void | addConnectedUMLObject (UMLObject::ObjectType otype, Uml::AssociationType::Enum type)
void | addWidget (UMLWidget *widget, bool showProperties=true)
Protected Member Functions inherited from QGraphicsObjectWrapper
QVariant | itemChange (GraphicsItemChange change, const QVariant &value)
Protected Member Functions inherited from DiagramProxyWidget
DiagramProxyWidget & | operator= (const DiagramProxyWidget &other)
bool | activate (IDChangeLog *changeLog=nullptr)
bool | loadFromXMI (QDomElement &qElement)
void | saveToXMI (QXmlStreamWriter &writer)
void | setupEvent (QGraphicsSceneMouseEvent &e, const QGraphicsSceneMouseEvent *event, const QPointF &pos) const
void | setupEvent (QGraphicsSceneContextMenuEvent &e, const QGraphicsSceneContextMenuEvent *event, const QPointF &pos) const
void | slotMenuSelection (QAction *action)

## Private Member Functions
QPointF | constrainPosition (qreal diffX, qreal diffY)

## Private Attributes
LinkWidget * | m_linkWidget
| The association or message widget we may be linked to.
QString | m_preText
| Prepended text (such as for scope of association Role or method)
QString | m_postText
| Ending text (such as bracket on changability notation for association Role)
Uml::TextRole::Enum | m_textRole
| The role the text widget will enact.
qreal | m_unconstrainedPositionX
| The horizontal position the widget would have if its move wasn't constrained.
qreal | m_unconstrainedPositionY
| The vertical position the widget would have if its move wasn't constrained.
int | m_movementDirectionX
int | m_movementDirectionY
QString | m_SequenceNumber
| Contains sequence number for sequence or collaboration diagram message.

## Additional Inherited Members
Public Types inherited from UMLWidget
enum | FontType { FT_NORMAL = 0 , FT_BOLD = 1 , FT_ITALIC = 2 , FT_UNDERLINE = 3 , FT_BOLD_ITALIC = 4 , FT_BOLD_UNDERLINE = 5 , FT_ITALIC_UNDERLINE = 6 , FT_BOLD_ITALIC_UNDERLINE = 7 , FT_INVALID = 8 }
enum | AddWidgetOption { NoOption = 0 , SetupSize = 1 , SwitchDirection = 2 , ShowProperties = 4 , Default = SetupSize | ShowProperties }
Public Types inherited from WidgetBase
enum | WidgetType { wt_Min = 299 , wt_UMLWidget , wt_Actor , wt_UseCase , wt_Class , wt_Interface , wt_Datatype , wt_Enum , wt_Entity , wt_Package , wt_Object , wt_Note , wt_Box , wt_Message , wt_Text , wt_State , wt_Activity , wt_Component , wt_Artifact , wt_Node , wt_Association , wt_ForkJoin , wt_Precondition , wt_CombinedFragment , wt_FloatingDashLine , wt_Signal , wt_Pin , wt_ObjectNode , wt_Region , wt_Category , wt_Port , wt_Instance , wt_Max }
Signals inherited from UMLWidget
void | sigWidgetMoved (Uml::ID::Type id)
Static Public Attributes inherited from UMLWidget
static const QSizeF | DefaultMinimumSize
static const QSizeF | DefaultMaximumSize
static const int | defaultMargin = 5
static const int | selectionMarkerSize = 4
static const int | resizeMarkerLineCount = 3
Protected Attributes inherited from UMLWidget
QString | m_instanceName
| instance name (used if on a deployment diagram)
bool | m_isInstance
| holds whether this widget is a component instance (i.e. on a deployment diagram)
Uml::ShowStereoType::Enum | m_showStereotype
| if and how the stereotype should be displayed
bool | m_startMove
QPointF | m_startMovePostion
QSizeF | m_startResizeSize
int | m_nPosX
UMLDoc * | m_doc
| shortcut for UMLApp::app()->document()
bool | m_resizable
QFontMetrics * | m_pFontMetrics [FT_INVALID]
QSizeF | m_minimumSize
QSizeF | m_maximumSize
bool | m_activated
| true if the activate function has been called for this class instance
bool | m_ignoreSnapToGrid
bool | m_ignoreSnapComponentSizeToGrid
bool | m_fixedAspectRatio
QString | m_oldStatusBarMsg
| The text in the status bar when the cursor was pressed.
QPointF | m_pressOffset
QPointF | m_oldPos
| The X/Y position the widget had when the movement started.
qreal | m_oldW
| The width/height the widget had when the resize started.
qreal | m_oldH
bool | m_shiftPressed
| If shift or control button were pressed in mouse press event.
bool | m_inMoveArea
bool | m_inResizeArea
bool | m_moved
bool | m_resized
Protected Attributes inherited from WidgetBase
UMLScene * | m_scene
QPointer< UMLObject > | m_umlObject
QString | m_Doc
| Only used if m_umlObject is not set.
QString | m_Text
QRectF | m_rect
| Widget size. In this rectangle, the x and y coordinates are always 0.
Uml::ID::Type | m_nId
Uml::ID::Type | m_nLocalID
QColor | m_textColor
| Color of the text of the widget. Is saved to XMI.
QColor | m_lineColor
| Color of the lines of the widget. Is saved to XMI.
QColor | m_fillColor
| color of the background of the widget
QBrush | m_brush
QFont | m_font
uint | m_lineWidth
| Width of the lines of the widget. Is saved to XMI.
bool | m_useFillColor
| flag indicates if the UMLWidget uses the Diagram FillColour
bool | m_usesDiagramFillColor
bool | m_usesDiagramLineColor
bool | m_usesDiagramLineWidth
bool | m_usesDiagramTextColor
bool | m_usesDiagramUseFillColor
bool | m_autoResize
bool | m_changesShape
| The widget changes its shape when the number of connections or their positions are changed.
Protected Attributes inherited from QGraphicsObjectWrapper
bool | m_calledFromItemChange {false}

## Detailed Description

Displays a line of text or an operation.

This is a multipurpose class. In its simplest form it will display a line of text. It can also be setup to be the text for an operation with regard to the MessageWidget on the sequence diagram. It is also used for the text required for an association.

The differences between all these different uses will be the popup menu that is associated with it.

Author
  Paul Hensgen phens.nosp@m.gen@.nosp@m.techi.nosp@m.e.co.nosp@m.m

See also
  UMLWidget Bugs and comments to umbre.nosp@m.llo-.nosp@m.devel.nosp@m.@kde.nosp@m..org or https://bugs.kde.org

## Constructor & Destructor Documentation

## ◆ FloatingTextWidget()

FloatingTextWidget::FloatingTextWidget | ( | UMLScene * | scene,
|  | Uml::TextRole::Enum | role = Uml::TextRole::Floating,
|  | const QString & | text = QString(),
|  | Uml::ID::Type | id = Uml::ID::None )
| explicit

Constructs a FloatingTextWidget instance.

Parameters

  scene | The parent of this FloatingTextWidget.
  role | The role this FloatingTextWidget will take up.
  text | The main text to display.
  id | The ID to assign (-1 will prompt a new ID.)

## ◆ ~FloatingTextWidget()

FloatingTextWidget::~FloatingTextWidget | ( |  | ) |
| virtual

Destructor.

## Member Function Documentation

## ◆ activate()

bool FloatingTextWidget::activate | ( | IDChangeLog * | ChangeLog = nullptr | ) |
| virtual

Activate the FloatingTextWidget after the saved data has been loaded

Parameters

  ChangeLog | Pointer to the IDChangeLog.

Returns
  true for success

Reimplemented from UMLWidget.

## ◆ changeName()

void FloatingTextWidget::changeName | ( | const QString & | newText | ) |

Changes the text of linked widget.

Parameters

  newText | the new text

## ◆ constrainMovementForAllWidgets()

void FloatingTextWidget::constrainMovementForAllWidgets | ( | qreal & | diffX,
|  | qreal & | diffY )
| protectedvirtual

Overridden from UMLWidget. Modifies the value of the diffX and diffY variables used to move the widgets. The values are constrained using constrainPosition.

See also
  constrainPosition

Parameters

  diffX | The difference between current X position and new X position.
  diffY | The difference between current Y position and new Y position.

Reimplemented from UMLWidget.

## ◆ constrainPosition()

QPointF FloatingTextWidget::constrainPosition | ( | qreal | diffX,
|  | qreal | diffY )
| private

Returns a constrained position for the widget after applying the position difference. If no link widget exists, the position returned is the current widget position with the difference applied. If there's a link, the position to be returned is constrained using constrainTextPos method from the LinkWidget, if any.

Parameters

  diffX | The difference between current X position and new X position.
  diffY | The difference between current Y position and new Y position.

Returns
  A QPointF with the constrained new position.

## ◆ displayText()

QString FloatingTextWidget::displayText | ( |  | ) | const

Use to get the total text (prepended + main body + appended) currently displayed by the widget.

Returns
  The text currently being displayed by the widget.

## ◆ handleRename()

bool FloatingTextWidget::handleRename | ( |  | ) |

Handle the ListPopupMenu::mt_Rename case of the slotMenuSelection. Given an own method because it requires rather lengthy code.

## ◆ isEmpty()

bool FloatingTextWidget::isEmpty | ( |  | ) |

Return state if no pre, post and main text is empty

Returns
  true if widget contains no text

## ◆ isTextValid()

bool FloatingTextWidget::isTextValid | ( | const QString & | text | ) |
| static

For a text to be valid it must be non-empty, i.e. have a length larger than zero, and have at least one non whitespace character.

Parameters

  text | The string to analyze.

Returns
  True if the given text is valid.

## ◆ link()

LinkWidget * FloatingTextWidget::link | ( |  | ) | const

Returns the LinkWidget this floating text is related to.

Returns
  The LinkWidget this floating text is related to.

## ◆ loadFromXMI()

bool FloatingTextWidget::loadFromXMI | ( | QDomElement & | qElement | ) |
| virtual

Loads the "floatingtext" XMI element.

Reimplemented from UMLWidget.

## ◆ minimumSize()

QSizeF FloatingTextWidget::minimumSize | ( |  | ) | const
| protectedvirtual

Overrides method from UMLWidget.

Reimplemented from UMLWidget.

## ◆ moveWidgetBy()

void FloatingTextWidget::moveWidgetBy | ( | qreal | diffX,
|  | qreal | diffY )
| protectedvirtual

Overridden from UMLWidget. Moves the widget to a new position using the difference between the current position and the new position. If the floating text widget is part of a sequence message, and the message widget is selected, it does nothing: the message widget will update the text position when it's moved. In any other case, the floating text widget constrains its move using constrainPosition. When the position of the floating text is constrained, it's kept at that position until it can be moved to another valid position (m_unconstrainedPositionX/Y and m_movementDirectionX/Y are used for that). Moreover, if is part of a sequence message (and the message widget isn't selected), it updates the position of the message widget.

See also
  constrainPosition

Parameters

  diffX | The difference between current X position and new X position.
  diffY | The difference between current Y position and new Y position.

Reimplemented from UMLWidget.

## ◆ onWidget()

UMLWidget * FloatingTextWidget::onWidget | ( | const QPointF & | p | ) |
| virtual

Override method from UMLWidget in order to additionally check widget parentage.

Parameters

  p | Point to be checked.

Returns
  'this' if UMLWidget::onWidget(p) returns non 0; else NULL.

Reimplemented from WidgetBase.

## ◆ paint()

void FloatingTextWidget::paint | ( | QPainter * | painter,
|  | const QStyleOptionGraphicsItem * | option,
|  | QWidget * | widget = nullptr )
| virtual

Overrides default method

Reimplemented from UMLWidget.

## ◆ postText()

QString FloatingTextWidget::postText | ( |  | ) | const

Use to get the post-text which is appended to the main body of text to be displayed.

Returns
  The post-text currently displayed by the widget.

## ◆ preText()

QString FloatingTextWidget::preText | ( |  | ) | const

Use to get the pre-text which is prepended to the main body of text to be displayed.

Returns
  The pre-text currently displayed by the widget.

## ◆ saveToXMI()

void FloatingTextWidget::saveToXMI | ( | QXmlStreamWriter & | writer | ) |
| virtual

Reimplemented from UMLWidget::saveToXMI to save the widget data into XMI 'floatingtext' element.

Reimplemented from UMLWidget.

## ◆ sequenceNumber()

QString FloatingTextWidget::sequenceNumber | ( |  | ) | const

Read property of QString m_SequenceNumber.

## ◆ setLink()

void FloatingTextWidget::setLink | ( | LinkWidget * | l | ) |

Set the LinkWidget that this FloatingTextWidget is related to.

Parameters

  l | The related LinkWidget.

## ◆ setMessageText

void FloatingTextWidget::setMessageText | ( |  | ) |
| slot

Sets the text for this label if it is acting as a sequence diagram message or a collaboration diagram message.

## ◆ setPostText()

void FloatingTextWidget::setPostText | ( | const QString & | t | ) |

Set some text to be appended to the main body of text.

Parameters

  t | The text to append to main body which is displayed.

## ◆ setPreText()

void FloatingTextWidget::setPreText | ( | const QString & | t | ) |

Set some text to be prepended to the main body of text.

Parameters

  t | The text to prepend to main body which is displayed.

## ◆ setSequenceNumber()

void FloatingTextWidget::setSequenceNumber | ( | const QString & | sequenceNumber | ) |

Write property of QString m_SequenceNumber.

## ◆ setText()

void FloatingTextWidget::setText | ( | const QString & | t | ) |

Set the main body of text to display.

Parameters

  t | The text to display.

## ◆ setTextcmd()

void FloatingTextWidget::setTextcmd | ( | const QString & | t | ) |

Method used by setText: its called by cmdsetTxt, Don't use it!

Parameters

  t | The text to display.

## ◆ setTextRole()

void FloatingTextWidget::setTextRole | ( | Uml::TextRole::Enum | role | ) |

Sets the role type of this FloatingTextWidget.

Parameters

  role | The TextRole::Enum of this FloatingTextWidget.

## ◆ showChangeTextDialog()

void FloatingTextWidget::showChangeTextDialog | ( |  | ) |

Displays a dialog box to change the text.

## ◆ showOperationDialog()

bool FloatingTextWidget::showOperationDialog | ( | bool | enableAutoIncrement = true | ) |

Shows an operation dialog box.

Parameters

  enableAutoIncrement | Enable auto increment checkbox

## ◆ showPropertiesDialog()

bool FloatingTextWidget::showPropertiesDialog | ( |  | ) |
| virtual

Show the properties for a FloatingTextWidget. Depending on the role of the floating text widget, the options dialog for the floating text widget, the rename dialog for floating text or the options dialog for the link widget are shown.

Reimplemented from UMLWidget.

## ◆ slotMenuSelection

void FloatingTextWidget::slotMenuSelection | ( | QAction * | action | ) |
| virtualslot

Called when a menu selection has been made.

Parameters

  action | The action that has been selected.

## ◆ text()

QString FloatingTextWidget::text | ( |  | ) | const

Use to get the _main body_ of text (e.g. prepended and appended text is omitted) as currently displayed by the widget.

Returns
  The main text currently being displayed by the widget.

## ◆ textRole()

Uml::TextRole::Enum FloatingTextWidget::textRole | ( |  | ) | const

Return the role of the text widget

Returns
  The TextRole::Enum of this FloatingTextWidget.

## Member Data Documentation

## ◆ m_linkWidget

LinkWidget* FloatingTextWidget::m_linkWidget
| private

The association or message widget we may be linked to.

## ◆ m_movementDirectionX

int FloatingTextWidget::m_movementDirectionX
| private

The X direction the widget was moved when the constrain was applied. -1 means left, 1 means right.

## ◆ m_movementDirectionY

int FloatingTextWidget::m_movementDirectionY
| private

The Y direction the widget was moved when the constrain was applied. -1 means up, 1 means down.

## ◆ m_postText

QString FloatingTextWidget::m_postText
| private

Ending text (such as bracket on changability notation for association Role)

## ◆ m_preText

QString FloatingTextWidget::m_preText
| private

Prepended text (such as for scope of association Role or method)

## ◆ m_SequenceNumber

QString FloatingTextWidget::m_SequenceNumber
| private

Contains sequence number for sequence or collaboration diagram message.

## ◆ m_textRole

Uml::TextRole::Enum FloatingTextWidget::m_textRole
| private

The role the text widget will enact.

## ◆ m_unconstrainedPositionX

qreal FloatingTextWidget::m_unconstrainedPositionX
| private

The horizontal position the widget would have if its move wasn't constrained.

## ◆ m_unconstrainedPositionY

qreal FloatingTextWidget::m_unconstrainedPositionY
| private

The vertical position the widget would have if its move wasn't constrained.

The documentation for this class was generated from the following files:

- umbrello/umlwidgets/floatingtextwidget.h
- umbrello/umlwidgets/floatingtextwidget.cpp