umbrello 25.04.1
Umbrello UML Modeller is a Unified Modelling Language (UML) diagram program based on KDE Technology
|
Displays a line of text or an operation. More...
#include <floatingtextwidget.h>
Public Slots | |
virtual void | slotMenuSelection (QAction *action) |
void | setMessageText () |
![]() | |
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 () |
![]() | |
virtual void | slotMenuSelection (QAction *trigger) |
Static Public Member Functions | |
static bool | isTextValid (const QString &text) |
![]() | |
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) |
![]() | |
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) |
![]() | |
QVariant | itemChange (GraphicsItemChange change, const QVariant &value) |
![]() | |
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 | |
![]() | |
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 } |
![]() | |
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 } |
![]() | |
void | sigWidgetMoved (Uml::ID::Type id) |
![]() | |
static const QSizeF | DefaultMinimumSize |
static const QSizeF | DefaultMaximumSize |
static const int | defaultMargin = 5 |
static const int | selectionMarkerSize = 4 |
static const int | resizeMarkerLineCount = 3 |
![]() | |
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 |
![]() | |
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. | |
![]() | |
bool | m_calledFromItemChange {false} |
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.
|
explicit |
Constructs a FloatingTextWidget instance.
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.) |
|
virtual |
Destructor.
|
virtual |
Activate the FloatingTextWidget after the saved data has been loaded
ChangeLog | Pointer to the IDChangeLog. |
Reimplemented from UMLWidget.
Changes the text of linked widget.
newText | the new text |
|
protectedvirtual |
Overridden from UMLWidget. Modifies the value of the diffX and diffY variables used to move the widgets. The values are constrained using constrainPosition.
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.
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.
diffX | The difference between current X position and new X position. |
diffY | The difference between current Y position and new Y position. |
QString FloatingTextWidget::displayText | ( | ) | const |
Use to get the total text (prepended + main body + appended) currently displayed by the widget.
bool FloatingTextWidget::handleRename | ( | ) |
Handle the ListPopupMenu::mt_Rename case of the slotMenuSelection. Given an own method because it requires rather lengthy code.
bool FloatingTextWidget::isEmpty | ( | ) |
Return state if no pre, post and main text is empty
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.
text | The string to analyze. |
LinkWidget * FloatingTextWidget::link | ( | ) | const |
Returns the LinkWidget this floating text is related to.
|
virtual |
Loads the "floatingtext" XMI element.
Reimplemented from UMLWidget.
|
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.
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.
Override method from UMLWidget in order to additionally check widget parentage.
p | Point to be checked. |
Reimplemented from WidgetBase.
|
virtual |
Overrides default method
Reimplemented from UMLWidget.
QString FloatingTextWidget::postText | ( | ) | const |
Use to get the post-text which is appended to the main body of text to be displayed.
QString FloatingTextWidget::preText | ( | ) | const |
Use to get the pre-text which is prepended to the main body of text to be displayed.
|
virtual |
Reimplemented from UMLWidget::saveToXMI to save the widget data into XMI 'floatingtext' element.
Reimplemented from UMLWidget.
QString FloatingTextWidget::sequenceNumber | ( | ) | const |
Read property of QString m_SequenceNumber.
void FloatingTextWidget::setLink | ( | LinkWidget * | l | ) |
Set the LinkWidget that this FloatingTextWidget is related to.
l | The related LinkWidget. |
|
slot |
Sets the text for this label if it is acting as a sequence diagram message or a collaboration diagram message.
Set some text to be appended to the main body of text.
t | The text to append to main body which is displayed. |
Set some text to be prepended to the main body of text.
t | The text to prepend to main body which is displayed. |
Write property of QString m_SequenceNumber.
Set the main body of text to display.
t | The text to display. |
Method used by setText: its called by cmdsetTxt, Don't use it!
t | The text to display. |
void FloatingTextWidget::setTextRole | ( | Uml::TextRole::Enum | role | ) |
Sets the role type of this FloatingTextWidget.
role | The TextRole::Enum of this FloatingTextWidget. |
void FloatingTextWidget::showChangeTextDialog | ( | ) |
Displays a dialog box to change the text.
Shows an operation dialog box.
enableAutoIncrement | Enable auto increment checkbox |
|
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.
Called when a menu selection has been made.
action | The action that has been selected. |
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.
Uml::TextRole::Enum FloatingTextWidget::textRole | ( | ) | const |
Return the role of the text widget
|
private |
The association or message widget we may be linked to.
|
private |
The X direction the widget was moved when the constrain was applied. -1 means left, 1 means right.
|
private |
The Y direction the widget was moved when the constrain was applied. -1 means up, 1 means down.
|
private |
Ending text (such as bracket on changability notation for association Role)
|
private |
Prepended text (such as for scope of association Role or method)
|
private |
Contains sequence number for sequence or collaboration diagram message.
|
private |
The role the text widget will enact.
|
private |
The horizontal position the widget would have if its move wasn't constrained.
|
private |
The vertical position the widget would have if its move wasn't constrained.