umbrello: ToolBarStateMessages 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 | Protected Types | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
ToolBarStateMessages Class Reference

`#include <toolbarstatemessages.h>`

Inheritance diagram for ToolBarStateMessages:

## Public Slots
virtual void | slotWidgetRemoved (UMLWidget *widget)
Public Slots inherited from ToolBarState
virtual void | slotAssociationRemoved (AssociationWidget *association)
virtual void | slotWidgetRemoved (UMLWidget *widget)

## Public Member Functions
| ToolBarStateMessages (UMLScene *umlScene)
virtual | ~ToolBarStateMessages ()
virtual void | init ()
virtual void | cleanBeforeChange ()
virtual void | mouseMove (QGraphicsSceneMouseEvent *ome)
Public Member Functions inherited from ToolBarStatePool
virtual | ~ToolBarStatePool ()
void | setButton (const WorkToolBar::ToolBar_Buttons &button)
WorkToolBar::ToolBar_Buttons | getButton () const
Public Member Functions inherited from ToolBarState
virtual | ~ToolBarState ()
virtual void | mousePress (QGraphicsSceneMouseEvent *ome)
virtual void | mouseRelease (QGraphicsSceneMouseEvent *ome)
virtual void | mouseDoubleClick (QGraphicsSceneMouseEvent *ome)

## Protected Types
enum | MessageType { NormalMessage , CreationMessage , FoundMessage , LostMessage }

## Protected Member Functions
virtual void | setCurrentElement ()
virtual void | mouseReleaseWidget ()
virtual void | mouseReleaseEmpty ()
void | setFirstWidget (ObjectWidget *firstObject)
void | setSecondWidget (ObjectWidget *secondObject, MessageType messageType)
Uml::SequenceMessage::Enum | getMessageType ()
void | cleanMessage ()
Protected Member Functions inherited from ToolBarStatePool
| ToolBarStatePool (UMLScene *umlScene)
Protected Member Functions inherited from ToolBarState
| ToolBarState (UMLScene *umlScene)
virtual void | mousePressAssociation ()
virtual void | mousePressWidget ()
virtual void | mousePressEmpty ()
virtual void | mouseReleaseAssociation ()
virtual void | mouseDoubleClickAssociation ()
virtual void | mouseDoubleClickWidget ()
virtual void | mouseDoubleClickEmpty ()
virtual void | mouseMoveAssociation ()
virtual void | mouseMoveWidget ()
virtual void | mouseMoveEmpty ()
virtual void | changeTool ()
virtual UMLWidget * | currentWidget () const
virtual void | setCurrentWidget (UMLWidget *widget)
virtual AssociationWidget * | currentAssociation () const
virtual void | setCurrentAssociation (AssociationWidget *association)
void | setMouseEvent (QGraphicsSceneMouseEvent *ome, const QEvent::Type &type)
AssociationWidget * | associationAt (const QPointF &pos)
MessageWidget * | messageAt (const QPointF &pos)
FloatingDashLineWidget * | floatingLineAt (const QPointF &pos)

## Protected Attributes
ObjectWidget * | m_firstObject
QGraphicsLineItem * | m_messageLine
bool | m_isObjectWidgetLine
Protected Attributes inherited from ToolBarState
UMLScene * | m_pUMLScene
| The UMLScene.
QGraphicsSceneMouseEvent * | m_pMouseEvent
| The mouse event currently in use.

## Private Member Functions
void | setupMessageWidget (MessageWidget *msg, bool showOperationDialog=true)

## Private Attributes
qreal | xclick
qreal | yclick

## Additional Inherited Members
Signals inherited from ToolBarState
void | finished ()

## Detailed Description

Messages tool to create messages between objects in sequence diagrams. With messages tool, two objects are selected clicking with left button on them and a message of the needed type (depending on the message button selected) is created between the objects. When the first object is selected, a temporary visual message that follows the cursor movement is created until the second object is selected or the message cancelled.

A message can be cancelled using right button, which also returns to default tool, or with middle button, which only cancels the message without changing the tool being used.

The messages to create can be normal messages or creation messages. Normal messages are created clicking on the line of the two objects. Creation messages are created clicking in the line of the first object, and on the second object itself (not in its line).

Associations aren't taken into account, and are treated as empty spaces. Moreover, widgets other than objects aren't neither taken into account.

Todo

  refactor with common code in ToolBarStateAssociation?

  sequence message lines should be handled by object widgets. Right now, they aren't taken into account in testOnWidget and an explicit check is needed. However, if onWidget in object widgets is changed to also check for the line, a way to give them priority over other widgets in testOnWidget will be needed. For example, when creating a message clicking on an already created message, the message line must be got instead of the message, even if the message is smaller than the line.

## Member Enumeration Documentation

## ◆ MessageType

enum ToolBarStateMessages::MessageType
| protected

The type of the message to create.

Enumerator
NormalMessage |
CreationMessage |
FoundMessage |
LostMessage |

## Constructor & Destructor Documentation

## ◆ ToolBarStateMessages()

ToolBarStateMessages::ToolBarStateMessages | ( | UMLScene * | umlScene | ) |
| explicit

Creates a new ToolBarStateMessages.

Parameters

  umlScene | The UMLScene to use.

## ◆ ~ToolBarStateMessages()

ToolBarStateMessages::~ToolBarStateMessages | ( |  | ) |
| virtual

Destroys this ToolBarStateMessages.

## Member Function Documentation

## ◆ cleanBeforeChange()

void ToolBarStateMessages::cleanBeforeChange | ( |  | ) |
| virtual

Called when the current tool is changed to use another tool. Executes base method and cleans the message.

Reimplemented from ToolBarState.

## ◆ cleanMessage()

void ToolBarStateMessages::cleanMessage | ( |  | ) |
| protected

Cleans the first widget and the temporary message line, if any. Both are set to null, and the message line is also deleted.

## ◆ getMessageType()

Uml::SequenceMessage::Enum ToolBarStateMessages::getMessageType | ( |  | ) |
| protected

Returns the message type of this tool.

Returns
  The message type of this tool.

## ◆ init()

void ToolBarStateMessages::init | ( |  | ) |
| virtual

Goes back to the initial state.

Reimplemented from ToolBarState.

## ◆ mouseMove()

void ToolBarStateMessages::mouseMove | ( | QGraphicsSceneMouseEvent * | ome | ) |
| virtual

Called when a mouse event happened. It executes the base method and then updates the position of the message line, if any.

Reimplemented from ToolBarState.

## ◆ mouseReleaseEmpty()

void ToolBarStateMessages::mouseReleaseEmpty | ( |  | ) |
| protectedvirtual

Called when the release event happened on an empty space. Cleans the message. Empty spaces are not only actual empty spaces, but also associations.

Reimplemented from ToolBarState.

## ◆ mouseReleaseWidget()

void ToolBarStateMessages::mouseReleaseWidget | ( |  | ) |
| protectedvirtual

Called when the release event happened on a widget. If the button pressed isn't left button or the widget isn't an object widget, the message is cleaned. If the release event didn't happen on the line of an object and the first object wasn't selected, nothing is done. If the first object was already selected, a creation message is made. If the event happened on the line of an object, the first object or the second are set, depending on whether the first object was already set or not.

Reimplemented from ToolBarState.

## ◆ setCurrentElement()

void ToolBarStateMessages::setCurrentElement | ( |  | ) |
| protectedvirtual

Selects only widgets, but no associations. Overrides base class method. If the press event happened on the line of an object, the object is set as current widget. If the press event happened on a widget, the widget is set as current widget.

Reimplemented from ToolBarState.

## ◆ setFirstWidget()

void ToolBarStateMessages::setFirstWidget | ( | ObjectWidget * | firstObject | ) |
| protected

Sets the first object of the message using the specified object. The temporary visual message is created and mouse tracking enabled, so mouse events will be delivered.

Parameters

  firstObject | The first object of the message.

## ◆ setSecondWidget()

void ToolBarStateMessages::setSecondWidget | ( | ObjectWidget * | secondObject,
|  | MessageType | messageType )
| protected

Sets the second object of the message using the specified widget and creates the message. The association is created and added to the view. The dialog to select the operation of the message is shown.

Parameters

  secondObject | The second object of the message.
  messageType | The type of the message to create.

## ◆ setupMessageWidget()

void ToolBarStateMessages::setupMessageWidget | ( | MessageWidget * | msg,
|  | bool | showOperationDialog = true )
| private

## ◆ slotWidgetRemoved

void ToolBarStateMessages::slotWidgetRemoved | ( | UMLWidget * | widget | ) |
| virtualslot

A widget was removed from the UMLView. If the widget removed was the current widget, the current widget is set to 0. Also, if it was the first object, the message is cleaned.

## Member Data Documentation

## ◆ m_firstObject

ObjectWidget* ToolBarStateMessages::m_firstObject
| protected

The first object in the message.

## ◆ m_isObjectWidgetLine

bool ToolBarStateMessages::m_isObjectWidgetLine
| protected

If there is a current widget, it is true if the press event happened on the line of an object, or false if it happened on a normal UMLWidget.

## ◆ m_messageLine

QGraphicsLineItem* ToolBarStateMessages::m_messageLine
| protected

The message line shown while the first widget is selected and the second one wasn't selected yet.

## ◆ xclick

qreal ToolBarStateMessages::xclick
| private

x and y clicked for lost and found messages

## ◆ yclick

qreal ToolBarStateMessages::yclick
| private

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

- umbrello/toolbarstatemessages.h
- umbrello/toolbarstatemessages.cpp