|
| UMLWidget (UMLScene *scene, WidgetType type=wt_UMLWidget, UMLObject *o=0) |
|
| 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 |
|
virtual QSizeF | minimumSize () 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) |
|
virtual bool | activate (IDChangeLog *changeLog=0) |
|
void | setPenFromSettings (QPainter &p) |
|
void | setPenFromSettings (QPainter *p) |
|
virtual void | setFont (const QFont &font) |
|
void | setFontCmd (const QFont &font) |
|
bool | getStartMove () 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) |
|
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 |
|
bool | showStereotype () const |
|
virtual void | setShowStereotype (bool flag) |
|
virtual bool | showPropertiesDialog () |
|
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) |
|
virtual bool | loadFromXMI1 (QDomElement &qElement) |
|
virtual void | saveToXMI1 (QDomDocument &qDoc, QDomElement &qElement) |
|
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) |
|
virtual void | paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0) |
|
| 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 () |
|
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 () |
|
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 () |
|
void | setAutoResize (bool state) |
|
bool | changesShape () |
|
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 |
|
virtual UMLWidget * | onWidget (const QPointF &p) |
|
bool | isActivityWidget () |
|
bool | isActorWidget () |
|
bool | isArtifactWidget () |
|
bool | isAssociationWidget () |
|
bool | isBoxWidget () |
|
bool | isCategoryWidget () |
|
bool | isClassWidget () |
|
bool | isCombinedFragmentWidget () |
|
bool | isComponentWidget () |
|
bool | isDatatypeWidget () |
|
bool | isEntityWidget () |
|
bool | isEnumWidget () |
|
bool | isFloatingDashLineWidget () |
|
bool | isForkJoinWidget () |
|
bool | isInterfaceWidget () |
|
bool | isMessageWidget () |
|
bool | isNodeWidget () |
|
bool | isNoteWidget () |
|
bool | isObjectNodeWidget () |
|
bool | isObjectWidget () |
|
bool | isPackageWidget () |
|
bool | isPinWidget () |
|
bool | isPortWidget () |
|
bool | isPreconditionWidget () |
|
bool | isRegionWidget () |
|
bool | isSignalWidget () |
|
bool | isStateWidget () |
|
bool | isTextWidget () |
|
bool | isUseCaseWidget () |
|
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 () |
|
| 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 QRectF & | sceneRect () |
|
void | setClientRect (const QRectF &rect) |
|
bool | isProxyWidget () |
|
UMLWidget * | getProxiedWidget (const QPointF &p) |
|
QPointF | mapFromClient (const QPointF &p) |
|
QRectF | mapFromClient (const QRectF &r) |
|
QPointF | mapToClient (const QPointF &pos) |
|
void | paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0) |
|
bool | showLinkedDiagram () const |
|
void | setShowLinkedDiagram (bool showLinkedDiagram) |
|
QRectF | iconRect () const |
|
void | setIconRect (const QRectF &iconRect) |
|
|
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 | moveWidgetBy (qreal diffX, qreal diffY) |
|
virtual void | constrainMovementForAllWidgets (qreal &diffX, qreal &diffY) |
|
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=0) |
|
bool | loadFromXMI1 (QDomElement &qElement) |
|
void | saveToXMI1 (QDomDocument &qDoc, QDomElement &qElement) |
|
void | setupEvent (QGraphicsSceneMouseEvent &e, QGraphicsSceneMouseEvent *event, const QPointF &pos) |
|
void | setupEvent (QGraphicsSceneContextMenuEvent &e, QGraphicsSceneContextMenuEvent *event, const QPointF &pos) |
|
void | slotMenuSelection (QAction *action) |
|
The base class for graphical UML objects.
This is the base class for nearly all graphical widgets.
- Author
- Paul Hensgen phens.nosp@m.gen@.nosp@m.techi.nosp@m.e.co.nosp@m.m Bugs and comments to umbre.nosp@m.llo-.nosp@m.devel.nosp@m.@kde.nosp@m..org or https://bugs.kde.org
void UMLWidget::constrainMovementForAllWidgets |
( |
qreal & |
diffX, |
|
|
qreal & |
diffY |
|
) |
| |
|
protectedvirtual |
Modifies the value of the diffX and diffY variables used to move the widgets.
It can be overridden to constrain movement of all the selected widgets only in one axis even when the user isn't constraining the movement with shift or control buttons, for example. The difference with moveWidgetBy is that the diff positions used here are applied to all the selected widgets instead of only to m_widget, and that moveWidgetBy, in fact, moves the widget, and here simply the diff positions are modified.
Default behaviour is do nothing.
- See also
- moveWidgetBy
- Parameters
-
diffX | The difference between current X position and new X position. |
diffY | The difference between current Y position and new Y position. |
Reimplemented in MessageWidget, ObjectWidget, and FloatingTextWidget.
bool UMLWidget::loadFromXMI1 |
( |
QDomElement & |
qElement | ) |
|
|
virtual |
A virtual method to load the properties of this widget from a QDomElement into this widget.
Subclasses should reimplement this to load additional properties required, calling this base method to load the basic properties of the widget.
- Parameters
-
qElement | A QDomElement which contains xml info for this widget. |
- Todo:
- Add support to load older version.
Reimplemented from WidgetBase.
Reimplemented in MessageWidget, ClassifierWidget, FloatingTextWidget, ObjectWidget, StateWidget, CombinedFragmentWidget, ActivityWidget, ObjectNodeWidget, NoteWidget, SignalWidget, FloatingDashLineWidget, PinPortBase, PreconditionWidget, ForkJoinWidget, EnumWidget, DatatypeWidget, EntityWidget, and RegionWidget.
void UMLWidget::mouseMoveEvent |
( |
QGraphicsSceneMouseEvent * |
event | ) |
|
|
protectedvirtual |
Handles a mouse move event. It resizes or moves the widget, depending on where the cursor is pressed on the widget. Go on reading for more info about this.
If resizing, the widget is resized using UMLWidget::resizeWidget (where specific widget resize constraint can be applied), and then the associations are adjusted. The resizing can be constrained also to a specific axis using control and shift buttons. If on or another is pressed, it's constrained to X axis. If both are pressed, it's constrained to Y axis.
If not resizing, the widget is being moved. If the move is being started, the selection bounds are set (which includes updating the list of selected widgets). The difference between the previous position of the selection and the new one is got (taking in account the selection bounds so widgets don't go beyond the scene limits). Then, it's constrained to X or Y axis depending on shift and control buttons. A further constraint is made using constrainMovementForAllWidgets (for example, if the widget that receives the event can only be moved in Y axis, with this method the movement of all the widgets in the selection can be constrained to be moved only in Y axis). Then, all the selected widgets are moved using moveWidgetBy (where specific widget movement constraint can be applied) and, if a certain amount of time passed from the last move event, the associations are also updated (they're not updated always to be easy on the CPU). Finally, the scene is resized, and selection bounds updated.
- Parameters
-
event | The QGraphicsSceneMouseEvent event. |
Reimplemented from DiagramProxyWidget.
Reimplemented in ObjectWidget, SignalWidget, and StateWidget.
void UMLWidget::mousePressEvent |
( |
QGraphicsSceneMouseEvent * |
event | ) |
|
|
protectedvirtual |
Handles a mouse press event. It'll select the widget (or mark it to be deselected) and prepare it to be moved or resized. Go on reading for more info about this.
Widget values and message bar status are saved.
If shift or control buttons are pressed, we're in move area no matter where the button was pressed in the widget. Moreover, if the widget wasn't already selected, it's added to the selection. If already selected, it's marked to be deselected when releasing the button (provided it isn't moved). Also, if the widget is already selected with other widgets but shift nor control buttons are pressed, we're in move area. If finally we don't move the widget, it's selected and the other widgets deselected when releasing the left button.
If shift nor control buttons are pressed, we're facing a single selection. Depending on the position of the cursor, we're in move or in resize area. If the widget wasn't selected (both when there are no widgets selected, or when there're other widgets selected but not the one receiving the press event) it's selected and the others deselected, if any. If already selected, it's marked to be deselected when releasing the button (provided it wasn't moved or resized).
- Parameters
-
event | The QGraphicsSceneMouseEvent event. |
Reimplemented from DiagramProxyWidget.
Reimplemented in ObjectWidget, and StateWidget.
void UMLWidget::mouseReleaseEvent |
( |
QGraphicsSceneMouseEvent * |
event | ) |
|
|
protectedvirtual |
Handles a mouse release event. It selects or deselects the widget and cancels or confirms the move or resize. Go on reading for more info about this. No matter which tool is selected, Z position of widget is updated.
Middle button release resets the selection. Left button release, if it wasn't moved nor resized, selects the widget and deselect the others if it wasn't selected and there were other widgets selected. If the widget was marked to be deselected, deselects it. If it was moved or resized, the document is set to modified if position or size changed. Also, if moved, all the associations are adjusted because the timer could have prevented the adjustment in the last move event before the release. If mouse was pressed in resize area, cursor is set again to normal cursor Right button release if right button was pressed shows the pop up menu for the widget. If left button was pressed, it cancels the move or resize with a mouse move event at the same position than the cursor was when pressed. Another left button release is also sent.
- Parameters
-
event | The QGraphicsSceneMouseEvent event. |
Reimplemented from DiagramProxyWidget.
Reimplemented in StateWidget.
void UMLWidget::moveWidgetBy |
( |
qreal |
diffX, |
|
|
qreal |
diffY |
|
) |
| |
|
protectedvirtual |
Moves the widget to a new position using the difference between the current position and the new position. This method doesn't adjust associations. It only moves the widget.
It can be overridden to constrain movement only in one axis even when the user isn't constraining the movement with shift or control buttons, for example. The movement policy set here is applied whenever the widget is moved, being it moving it explicitly, or as a part of a selection but not receiving directly the mouse events.
Default behaviour is move the widget to the new position using the diffs.
- See also
- constrainMovementForAllWidgets
- Parameters
-
diffX | The difference between current X position and new X position. |
diffY | The difference between current Y position and new Y position. |
Reimplemented in MessageWidget, ObjectWidget, FloatingTextWidget, ActivityWidget, PinPortBase, and ComponentWidget.
void UMLWidget::saveToXMI1 |
( |
QDomDocument & |
qDoc, |
|
|
QDomElement & |
qElement |
|
) |
| |
|
virtual |
A virtual method to save the properties of this widget into a QDomElement i.e xml.
Subclasses should first create a new dedicated element as the child of qElement parameter passed. Then this base method should be called to save basic widget properties.
- Parameters
-
qDoc | A QDomDocument object representing the xml document. |
qElement | A QDomElement representing xml element data. |
Reimplemented from WidgetBase.
Reimplemented in MessageWidget, ClassifierWidget, FloatingTextWidget, StateWidget, ObjectWidget, CombinedFragmentWidget, ActivityWidget, ObjectNodeWidget, NoteWidget, SignalWidget, FloatingDashLineWidget, PinPortBase, UseCaseWidget, ActorWidget, ForkJoinWidget, PreconditionWidget, CategoryWidget, BoxWidget, ComponentWidget, EnumWidget, ArtifactWidget, DatatypeWidget, EntityWidget, PackageWidget, NodeWidget, and RegionWidget.