umbrello/umbrello
#include <toolbarstate.h>
Public Slots | |
virtual void | slotAssociationRemoved (AssociationWidget *association) |
virtual void | slotWidgetRemoved (UMLWidget *widget) |
Public Member Functions | |
virtual | ~ToolBarState () |
virtual void | cleanBeforeChange () |
virtual void | init () |
virtual void | mouseDoubleClick (QGraphicsSceneMouseEvent *ome) |
virtual void | mouseMove (QGraphicsSceneMouseEvent *ome) |
virtual void | mousePress (QGraphicsSceneMouseEvent *ome) |
virtual void | mouseRelease (QGraphicsSceneMouseEvent *ome) |
Public Member Functions inherited from QObject | |
QObject (QObject *parent) | |
QObject (QObject *parent, const char *name) | |
virtual | ~QObject () |
bool | blockSignals (bool block) |
QObject * | child (const char *objName, const char *inheritsClass, bool recursiveSearch) const |
const QObjectList & | children () const |
const char * | className () const |
bool | connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const |
void | deleteLater () |
void | destroyed (QObject *obj) |
bool | disconnect (const QObject *receiver, const char *method) |
bool | disconnect (const char *signal, const QObject *receiver, const char *method) |
void | dumpObjectInfo () |
void | dumpObjectTree () |
QList< QByteArray > | dynamicPropertyNames () const |
virtual bool | event (QEvent *e) |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
T | findChild (const QString &name) const |
QList< T > | findChildren (const QRegExp ®Exp) const |
QList< T > | findChildren (const QString &name) const |
bool | inherits (const char *className) const |
void | insertChild (QObject *object) |
void | installEventFilter (QObject *filterObj) |
bool | isA (const char *className) const |
bool | isWidgetType () const |
void | killTimer (int id) |
virtual const QMetaObject * | metaObject () const |
void | moveToThread (QThread *targetThread) |
const char * | name () const |
const char * | name (const char *defaultName) const |
QString | objectName () const |
QObject * | parent () const |
QVariant | property (const char *name) const |
void | removeChild (QObject *object) |
void | removeEventFilter (QObject *obj) |
void | setName (const char *name) |
void | setObjectName (const QString &name) |
void | setParent (QObject *parent) |
bool | setProperty (const char *name, const QVariant &value) |
bool | signalsBlocked () const |
int | startTimer (int interval) |
QThread * | thread () const |
Protected Member Functions | |
ToolBarState (UMLScene *umlScene) | |
AssociationWidget * | associationAt (const QPointF &pos) |
virtual void | changeTool () |
virtual AssociationWidget * | currentAssociation () const |
virtual UMLWidget * | currentWidget () const |
FloatingDashLineWidget * | floatingLineAt (const QPointF &pos) |
MessageWidget * | messageAt (const QPointF &pos) |
virtual void | mouseDoubleClickAssociation () |
virtual void | mouseDoubleClickEmpty () |
virtual void | mouseDoubleClickWidget () |
virtual void | mouseMoveAssociation () |
virtual void | mouseMoveEmpty () |
virtual void | mouseMoveWidget () |
virtual void | mousePressAssociation () |
virtual void | mousePressEmpty () |
virtual void | mousePressWidget () |
virtual void | mouseReleaseAssociation () |
virtual void | mouseReleaseEmpty () |
virtual void | mouseReleaseWidget () |
virtual void | setCurrentAssociation (AssociationWidget *association) |
virtual void | setCurrentElement () |
virtual void | setCurrentWidget (UMLWidget *widget) |
void | setMouseEvent (QGraphicsSceneMouseEvent *ome, const QEvent::Type &type) |
Protected Member Functions inherited from QObject | |
bool | checkConnectArgs (const char *signal, const QObject *object, const char *method) |
virtual void | childEvent (QChildEvent *event) |
virtual void | connectNotify (const char *signal) |
virtual void | customEvent (QEvent *event) |
virtual void | disconnectNotify (const char *signal) |
int | receivers (const char *signal) const |
QObject * | sender () const |
int | senderSignalIndex () const |
virtual void | timerEvent (QTimerEvent *event) |
Protected Attributes | |
QGraphicsSceneMouseEvent * | m_pMouseEvent |
UMLScene * | m_pUMLScene |
Additional Inherited Members | |
Static Public Member Functions inherited from QObject | |
bool | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type) |
bool | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type) |
bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method) |
bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method) |
QString | tr (const char *sourceText, const char *disambiguation, int n) |
QString | trUtf8 (const char *sourceText, const char *disambiguation, int n) |
Static Protected Member Functions inherited from QObject | |
QByteArray | normalizeSignalSlot (const char *signalSlot) |
Properties inherited from QObject | |
objectName | |
Detailed Description
Base class for toolbar states.
All toolbar states inherit directly or indirectly from this class. Toolbar states represent tools that work with the diagram (for example, to create widgets, make associations...). All the mouse events received in the diagram are delivered to the toolbar state currently active. The events are handled in the tool and it executes the needed actions.
All the mouse event handlers can be overridden in subclasses. However, the behaviour of the main handlers shouldn't be modified (apart from extend it, that is, call the base implementation before any other actions in the derived method).
In order to handle the events, each main handler has three protected "sub-handlers" named like the main handler with the suffixes "Association", "Widget" and "Empty". The events received in the main handlers are delivered to the suitable handler, depending on if the event happened on an association, on a widget or on an empty space of the diagram. Those methods are the ones to override or extend to specify the behaviour of the toolbar state.
The mouse events received in main handlers are tweaked to use the inverse position. The modified event is saved in m_pMouseEvent. This is the event that must be used everywhere.
The association or widget that will receive the events is set in press event. How they are set can be tweaked in subclasses overriding setCurrentElement(). Once a press event happens, all the mouse events and the release event are sent to the same widget or association. Mouse events are delivered only when mouse tracking is enabled. It is enabled in press event, and disabled in release event. Also, it is disabled in the toolbar state initialization. Additionally, it can be enabled or disabled in other situations by subclasses if needed.
After handling a release event, the tool is changed if needed. Default implementation sets the default tool if the button released was the right button. Subclasses can override this behaviour if needed.
When a toolbar state is selected, method init is called to revert its state to the initial. Subclasses should extend that method as needed. Also, method cleanBeforeChange() is called before changing it to the new tool. Subclasses should extend that method as needed.
- Todo:
- Handle, for example, left press, right press, left release, right release and other similar strange combinations?
Definition at line 69 of file toolbarstate.h.
Constructor & Destructor Documentation
|
virtual |
|
protected |
Creates a new ToolBarState.
UMLScene is set as parent of this QObject, and name is left empty. Protected to avoid classes other than derived to create objects of this class.
- Parameters
-
umlScene The UMLScene to use.
Definition at line 256 of file toolbarstate.cpp.
Member Function Documentation
|
protected |
Returns the AssociationWidget at the specified position, or null if there is none.
If there are more than one association at this point, it returns the first found.
- Parameters
-
pos The position to get the association.
- Returns
- The AssociationWidget at the specified position, or null if there is none.
- Todo:
- Better handling for associations at the same point
Definition at line 527 of file toolbarstate.cpp.
|
protectedvirtual |
Changes the current tool to the default one if the right button was released.
It can be overridden in subclasses if needed.
Reimplemented in ToolBarStateArrow.
Definition at line 419 of file toolbarstate.cpp.
|
virtual |
Called when the current tool is changed to use another tool.
Subclasses can extend, but not override, this method as needed. Default implementation does nothing.
Reimplemented in ToolBarStateMessages, ToolBarStateAssociation, and ToolBarStateOneWidget.
Definition at line 59 of file toolbarstate.cpp.
|
protectedvirtual |
Returns the association currently in use.
- Returns
- The association currently in use.
Definition at line 455 of file toolbarstate.cpp.
|
protectedvirtual |
Returns the widget currently in use.
- Returns
- The widget currently in use.
Definition at line 431 of file toolbarstate.cpp.
|
protected |
Returns the FloatingDashLineWidget at the specified position, or null if there is none.
The floatingdashline is only returned if it is visible.
- Parameters
-
pos The position to get the floatingLine.
- Returns
- The MessageWidget at the specified position, or null if there is none.
Definition at line 544 of file toolbarstate.cpp.
|
virtual |
Goes back to the initial state.
Subclasses can extend, but not override, this method as needed.
Reimplemented in ToolBarStateMessages, ToolBarStateAssociation, and ToolBarStateArrow.
Definition at line 41 of file toolbarstate.cpp.
|
protected |
Returns the MessageWidget at the specified position, or null if there is none.
The message is only returned if it is visible. If there are more than one message at this point, it returns the first found.
- Parameters
-
pos The position to get the message.
- Returns
- The MessageWidget at the specified position, or null if there is none.
- Todo:
- Better handling for messages at the same point
Definition at line 509 of file toolbarstate.cpp.
|
virtual |
Handler for mouse double click events.
The current association or widget is set (if any), and events are delivered to the specific methods, depending on where the cursor was pressed. After delivering the events, the current association or widget is cleaned.
- Parameters
-
ome The received event.
Definition at line 143 of file toolbarstate.cpp.
|
protectedvirtual |
Called when the double click event happened on an association.
Default implementation does nothing.
Reimplemented in ToolBarStateArrow.
Definition at line 365 of file toolbarstate.cpp.
|
protectedvirtual |
Called when the double click event happened on an empty space.
Default implementation cleans the selection.
Definition at line 381 of file toolbarstate.cpp.
|
protectedvirtual |
Called when the double click event happened on a widget.
Default implementation does nothing.
Reimplemented in ToolBarStateArrow.
Definition at line 373 of file toolbarstate.cpp.
|
virtual |
Handler for mouse move events.
Events are delivered to the specific methods, depending on where the cursor was pressed. It uses the current widget or association set in press event, if any. Then, the scene is scrolled if needed (if the cursor is moved in any of the 30 pixels width area from left, top, right or bottom sides, and there is more diagram currently not being shown in that direction). This method is only called when mouse tracking is enabled and the mouse is moved.
- Parameters
-
ome The received event.
Reimplemented in ToolBarStateMessages, ToolBarStateAssociation, and ToolBarStateOneWidget.
Definition at line 180 of file toolbarstate.cpp.
|
protectedvirtual |
Called when the move event happened when an association is currently available.
Default implementation does nothing.
Reimplemented in ToolBarStateArrow.
Definition at line 393 of file toolbarstate.cpp.
|
protectedvirtual |
Called when the move event happened when no association nor widget are currently available.
Default implementation does nothing.
Reimplemented in ToolBarStateArrow.
Definition at line 411 of file toolbarstate.cpp.
|
protectedvirtual |
Called when the move event happened when a widget is currently available.
Default implementation does nothing.
Reimplemented in ToolBarStateArrow.
Definition at line 402 of file toolbarstate.cpp.
|
virtual |
Handler for mouse press events.
Mouse tracking is enabled, any pop up menu removed, the position of the cursor set and paste state disabled. Then, the current association or widget are set (if any), and events are delivered to the specific methods, depending on where the cursor was pressed.
- Parameters
-
ome The received event.
- See also
- setCurrentElement()
Definition at line 78 of file toolbarstate.cpp.
|
protectedvirtual |
Called when the press event happened on an association.
Default implementation does nothing.
Reimplemented in ToolBarStateArrow.
Definition at line 314 of file toolbarstate.cpp.
|
protectedvirtual |
Called when the press event happened on an empty space.
Default implementation cleans the selection.
Reimplemented in ToolBarStateArrow.
Definition at line 330 of file toolbarstate.cpp.
|
protectedvirtual |
Called when the press event happened on a widget.
Default implementation does nothing.
Reimplemented in ToolBarStateArrow.
Definition at line 322 of file toolbarstate.cpp.
|
virtual |
Handler for mouse release events.
Mouse tracking is disabled and the position of the cursor set. The events are delivered to the specific methods, depending on where the cursor was released, and the current association or widget cleaned. Finally, the current tool is changed if needed.
- Parameters
-
ome The received event.
Definition at line 110 of file toolbarstate.cpp.
|
protectedvirtual |
Called when the release event happened on an association.
Default implementation does nothing.
Reimplemented in ToolBarStateAssociation, and ToolBarStateArrow.
Definition at line 341 of file toolbarstate.cpp.
|
protectedvirtual |
Called when the release event happened on an empty space.
Default implementation does nothing.
Reimplemented in ToolBarStateMessages, ToolBarStateAssociation, ToolBarStateArrow, and ToolBarStateOneWidget.
Definition at line 357 of file toolbarstate.cpp.
|
protectedvirtual |
Called when the release event happened on a widget.
Default implementation does nothing.
Reimplemented in ToolBarStateMessages, ToolBarStateAssociation, ToolBarStateArrow, and ToolBarStateOneWidget.
Definition at line 349 of file toolbarstate.cpp.
|
protectedvirtual |
Sets the association currently in use.
This method is called in main press events handler just before calling the press event for associations handler. Default implementation is set the specified association, although this behaviour can be overridden in subclasses if needed.
- Parameters
-
association The association to be set.
Definition at line 469 of file toolbarstate.cpp.
|
protectedvirtual |
Sets the current association or widget.
It sets the current element when a press event happened. The element will be used until the next release event. Default implementation first checks for associations, then message widgets and then any other widgets. It can be overridden in subclasses if needed.
Reimplemented in ToolBarStateMessages, and ToolBarStateOneWidget.
Definition at line 272 of file toolbarstate.cpp.
|
protectedvirtual |
Sets the widget currently in use.
This method is called in main press events handler just before calling the press event for widgets handler. Default implementation is set the specified widget, although this behaviour can be overridden in subclasses if needed.
- Parameters
-
widget The widget to be set.
Reimplemented in ToolBarStateArrow.
Definition at line 445 of file toolbarstate.cpp.
|
protected |
Sets m_pMouseEvent as the equivalent of the received event after transforming it using the inverse world matrix in the UMLScene.
This method is called at the beginning of the main event handler methods.
- Parameters
-
ome The mouse event to transform. type The type of the event.
Definition at line 482 of file toolbarstate.cpp.
|
virtualslot |
An association was removed from the UMLScene.
If the association removed was the current association, the current association is set to 0. It can be extended in subclasses if needed.
Definition at line 228 of file toolbarstate.cpp.
|
virtualslot |
A widget was removed from the UMLScene.
If the widget removed was the current widget, the current widget is set to 0. It can be extended in subclasses if needed.
Definition at line 241 of file toolbarstate.cpp.
Member Data Documentation
|
protected |
The mouse event currently in use.
Definition at line 121 of file toolbarstate.h.
|
protected |
The UMLScene.
Definition at line 120 of file toolbarstate.h.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:40:29 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.