umbrello/umbrello
umlwidget.cpp
Go to the documentation of this file.
151 // if(getBaseType() != wt_Text) // DON'T do this for floatingtext widgets, an infinite loop will result
167 // They will actually stop things functioning correctly so if you change these, be aware of that.
281 QList<QGraphicsItem*> items = scene()->items(rect, Qt::IntersectsItemShape, Qt::DescendingOrder);
342 UMLApp::app()->document()->writeToStatusBar(i18n("Hold shift or ctrl to move in X axis. Hold shift and control to move in Y axis. Right button click to cancel move."));
678 connect(m_scene, SIGNAL(sigFillColorChanged(Uml::ID::Type)), this, SLOT(slotFillColorChanged(Uml::ID::Type)));
679 connect(m_scene, SIGNAL(sigLineColorChanged(Uml::ID::Type)), this, SLOT(slotLineColorChanged(Uml::ID::Type)));
680 connect(m_scene, SIGNAL(sigTextColorChanged(Uml::ID::Type)), this, SLOT(slotTextColorChanged(Uml::ID::Type)));
681 connect(m_scene, SIGNAL(sigLineWidthChanged(Uml::ID::Type)), this, SLOT(slotLineWidthChanged(Uml::ID::Type)));
1190 // TODO the status message lies for at least MessageWidget which could only be resized vertical
1191 UMLApp::app()->document()->writeToStatusBar(i18n("Hold shift or ctrl to move in X axis. Hold shift and control to move in Y axis. Right button click to cancel resize."));
1208 DEBUG(DBG_SRC) << "event=" << me->scenePos() << "/ pos=" << pos() << " / newW=" << newW << " / newH=" << newH;
1353 disconnect(m_scene, SIGNAL(sigFillColorChanged(Uml::ID::Type)), this, SLOT(slotFillColorChanged(Uml::ID::Type)));
1354 disconnect(m_scene, SIGNAL(sigTextColorChanged(Uml::ID::Type)), this, SLOT(slotTextColorChanged(Uml::ID::Type)));
1355 disconnect(m_scene, SIGNAL(sigLineWidthChanged(Uml::ID::Type)), this, SLOT(slotLineWidthChanged(Uml::ID::Type)));
1358 connect(m_scene, SIGNAL(sigFillColorChanged(Uml::ID::Type)), this, SLOT(slotFillColorChanged(Uml::ID::Type)));
1359 connect(m_scene, SIGNAL(sigTextColorChanged(Uml::ID::Type)), this, SLOT(slotTextColorChanged(Uml::ID::Type)));
1360 connect(m_scene, SIGNAL(sigLineWidthChanged(Uml::ID::Type)), this, SLOT(slotLineWidthChanged(Uml::ID::Type)));
1565 void UMLWidget::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
void setScene(UMLScene *scene)
Clears the selection, resets the toolbar and deselects the widget.
Definition: umlwidget.cpp:1349
Definition: umlwidget.h:223
void selectMultiple(QGraphicsSceneMouseEvent *me)
Selects the widget and adds it to the list of selected widgets.
Definition: umlwidget.cpp:1317
static bool widgetHasUMLObject(WidgetBase::WidgetType type)
Returns whether the widget type has an associated UMLObject.
Definition: umlwidget.cpp:1412
virtual QCursor resizeCursor() const
Returns the cursor to be shown when resizing the widget.
Definition: umlwidget.cpp:1120
bool m_inMoveArea
If cursor was in move/resize area when left button was pressed (and no other widgets were selected)...
Definition: umlwidget.h:346
bool useFillColor() const
Returns whether to use the fill/background color.
Definition: umlscene.cpp:1203
Definition: widgetbase.h:64
virtual void slotTextColorChanged(Uml::ID::Type viewID)
Captures a text color change signal.
Definition: umlwidget.cpp:764
Definition: widgetbase.h:51
QPointF m_pressOffset
The X/Y offset from the position of the cursor when it was pressed to the upper left corner of the wi...
Definition: umlwidget.h:331
virtual void slotLineColorChanged(Uml::ID::Type viewID)
Captures a line color change signal.
Definition: umlwidget.cpp:779
int selectedCount(bool filterText=false) const
Return the amount of widgets selected.
Definition: umlscene.cpp:1831
void resizeSceneToItems()
Sets the size of the scene to just fit on all the items.
Definition: umlscene.cpp:3700
qreal snappedX(qreal x)
Returns the input coordinate with possible grid-snap applied.
Definition: umlscene.cpp:3605
UMLObject * umlObject() const
Returns the UMLObject set to represent.
Definition: widgetbase.cpp:113
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event)
Handles a mouse move event.
Definition: umlwidget.cpp:334
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0)
Draws the UMLWidget on the given paint device.
Definition: umlwidget.cpp:1565
Definition: widgetbase.h:48
void createAutoAttributeAssociations(UMLWidget *widget)
If the m_Type of the given widget is WidgetBase::wt_Class then iterate through the class' attributes ...
Definition: umlscene.cpp:2624
Definition: widgetbase.h:44
UMLDoc * umlDoc() const
This is shortcut method for UMLApp::app()->document().
Definition: widgetbase.cpp:103
virtual void constrain(qreal &width, qreal &height)
Apply possible constraints to the given candidate width and height.
Definition: umlwidget.cpp:617
bool wasSizeChanged()
Checks if the size of the widget changed respect to the size that it had when press event was fired...
Definition: umlwidget.cpp:1221
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
Handles a mouse release event.
Definition: umlwidget.cpp:498
virtual void showPropertiesDialog()
Show a properties dialog for a UMLWidget.
Definition: umlwidget.cpp:1047
void showDocumentation(UMLObject *object, bool overwrite=false)
Called when a widget wishes to display its documentation in the doc window.
Definition: docwindow.cpp:87
Uml::TextRole::Enum textRole() const
Return the role of the text widget.
Definition: floatingtextwidget.cpp:364
void setTextColorcmd(const QColor &color)
Overrides the method from WidgetBase.
Definition: umlwidget.cpp:822
virtual QSizeF minimumSize()
Compute the minimum possible width and height.
Definition: umlwidget.cpp:185
Definition: cmd_changeTextColor.h:21
This class contains all the ID translations done for each UMLObject pasted.
Definition: idchangelog.h:26
Definition: cmd_moveWidget.h:21
UMLScene * umlScene() const
Deliver a pointer to the connected UMLView (needed esp.
Definition: widgetbase.cpp:93
Definition: umlwidget.h:220
void setSelectionBounds()
Fills m_selectedWidgetsList and sets the selection bounds ((m_min/m_max)X/Y attributes).
Definition: umlwidget.cpp:1240
virtual void slotLineWidthChanged(Uml::ID::Type viewID)
Captures a linewidth change signal.
Definition: umlwidget.cpp:796
virtual void setSelected(bool _select)
Sets the state of whether the widget is selected.
Definition: umlwidget.cpp:1253
virtual QSizeF calculateSize()
calculate content related size of widget.
Definition: umlwidget.cpp:1161
void updateDocumentation(bool clear=false, bool startup=false)
Call when you wish move changes in the doc window back into the members documentation.
Definition: docwindow.cpp:205
virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
Reimplemented to show appropriate context menu.
Definition: widgetbase.cpp:651
QFontMetrics & getFontMetrics(UMLWidget::FontType fontType)
Returns the font metric used by this object for Text which uses bold/italic fonts.
Definition: umlwidget.cpp:1619
void moveByLocal(qreal dx, qreal dy)
Move the widget by an X and Y offset relative to the current position.
Definition: umlwidget.cpp:1089
bool m_ignoreSnapComponentSizeToGrid
Definition: umlwidget.h:314
virtual void saveToXMI(QDomDocument &qDoc, QDomElement &qElement)
A virtual method to save the properties of this widget into a QDomElement i.e xml.
Definition: widgetbase.cpp:467
UMLWidget(UMLScene *scene, WidgetType type=wt_UMLWidget, UMLObject *o=0)
Creates a UMLWidget object.
Definition: umlwidget.cpp:55
const Settings::OptionState & optionState() const
Returns the options being used.
Definition: umlscene.cpp:400
virtual bool loadFromXMI(QDomElement &qElement)
A virtual method to load the properties of this widget from a QDomElement into this widget...
Definition: widgetbase.cpp:507
Definition: umlwidget.h:226
bool isSelected() const
Returns the state of whether the widget is selected.
Definition: umlwidget.h:87
Definition: widgetbase.h:47
Definition: classpropdlg.h:34
void setLineColorcmd(const QColor &color)
Overrides the method from WidgetBase.
Definition: umlwidget.cpp:840
QListIterator< AssociationWidget * > AssociationWidgetListIt
Definition: associationwidgetlist.h:21
UMLDoc * document() const
Returns a pointer to the current document connected to the KMainWindow instance.
Definition: uml.cpp:872
QString name() const
Gets the name from the corresponding UMLObject if this widget has an underlying UMLObject; if it does...
Definition: widgetbase.cpp:197
Definition: widgetbase.h:59
bool wasPositionChanged()
Checks if the position of the widget changed respect to the position that it had when press event was...
Definition: umlwidget.cpp:1232
Definition: optionstate.h:141
virtual void slotMenuSelection(QAction *action)
This is usually called synchronously after menu.exec() and trigger's parent is always the ListPopupMe...
Definition: umlwidget.cpp:707
QPointF m_oldPos
The X/Y position the widget had when the movement started.
Definition: umlwidget.h:334
This class represents an association inside a diagram.
Definition: associationwidget.h:50
Definition: basictypes.h:155
Definition: cmd_changeLineColor.h:21
Definition: basictypes.h:79
bool isActivated() const
Returns true if the Activate method has been called for this instance.
Definition: umlwidget.cpp:957
bool snapComponentSizeToGrid() const
Return whether to use snap to grid for component size.
Definition: umlscene.cpp:3563
AssociationWidgetList selectedAssocs()
Returns a list with all the selected associations from the diagram.
Definition: umlscene.cpp:1875
bool m_activated
true if the activate function has been called for this class instance
Definition: umlwidget.h:308
void setSelected(UMLWidget *w, QGraphicsSceneMouseEvent *me)
Sets a widget to a selected state and adds it to a list of selected widgets.
Definition: umlscene.cpp:1262
virtual void updateWidget()
When a widget changes this slot captures that signal.
Definition: umlwidget.cpp:591
Definition: widgetbase.h:49
virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
Event handler for mouse double click events.
Definition: umlwidget.cpp:538
void forceUpdateFontMetrics(QPainter *painter)
Definition: umlwidget.cpp:1657
virtual void setTextColor(const QColor &color)
Overrides the method from WidgetBase.
Definition: umlwidget.cpp:831
virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
Event handler for context menu events.
Definition: umlwidget.cpp:225
Definition: widgetbase.h:46
virtual void setFillColor(const QColor &color)
Sets the background fill color.
Definition: umlwidget.cpp:868
void executeCommand(QUndoCommand *cmd)
Execute a command and pushit in the stack.
Definition: uml.cpp:3077
Definition: listpopupmenu.h:158
bool m_shiftPressed
If shift or control button were pressed in mouse press event.
Definition: umlwidget.h:340
UMLWidgetList selectedWidgetsExt(bool filterText=true)
Fills the List with all the selected widgets from the diagram The list can be filled with all the sel...
Definition: umlscene.cpp:1856
void selectSingle(QGraphicsSceneMouseEvent *me)
Selects the widget and clears the other selected widgets, if any.
Definition: umlwidget.cpp:1303
virtual bool activate(IDChangeLog *ChangeLog=0)
Activate the object after serializing it from a QDataStream.
Definition: umlwidget.cpp:890
void moveEntireAssoc(qreal x, qreal y)
Moves the entire association by the given offset.
Definition: associationwidget.cpp:3822
virtual void slotMenuSelection(QAction *trigger)
This is usually called synchronously after menu.exec() and trigger's parent is always the ListPopupMe...
Definition: widgetbase.cpp:724
UMLWidget * widgetAt(const QPointF &p)
Tests the given point against all widgets and returns the widget for which the point is within its bo...
Definition: umlscene.cpp:968
void setActivated(bool active=true)
Set the m_activated flag of a widget but does not perform the Activate method.
Definition: umlwidget.cpp:967
UMLWidgetList m_selectedWidgetsList
A list containing the selected widgets.
Definition: umlwidget.h:324
Definition: umlwidget.h:222
void setFontMetrics(UMLWidget::FontType fontType, QFontMetrics fm)
Set the font metric to use.
Definition: umlwidget.cpp:1630
Definition: widgetbase.h:56
virtual bool isInResizeArea(QGraphicsSceneMouseEvent *me)
Checks if the mouse is in resize area (right bottom corner), and sets the cursor depending on that...
Definition: umlwidget.cpp:1133
virtual void moveEvent(QGraphicsSceneMouseEvent *event)
Overrides the standard operation.
Definition: umlwidget.cpp:1703
QPointF startMovePosition() const
Return the start position of the move action.
Definition: umlwidget.cpp:558
Definition: cmd_resizeWidget.h:21
void setMaximumSize(const QSizeF &size)
This method is used to set the maximum size variable for this widget.
Definition: umlwidget.cpp:217
virtual void setDefaultFontMetrics(UMLWidget::FontType fontType)
Template Method, override this to set the default font metric.
Definition: umlwidget.cpp:1512
Definition: widgetbase.h:60
virtual bool loadFromXMI(QDomElement &qElement)
A virtual method to load the properties of this widget from a QDomElement into this widget...
Definition: umlwidget.cpp:1726
virtual void setLineWidth(uint width)
Overrides the method from WidgetBase.
Definition: umlwidget.cpp:857
QRectF rect() const
return drawing rectangle of widget in local coordinates
Definition: widgetbase.cpp:600
void setModified(bool modified=true)
Sets the modified flag for the document after a modifying action on the view connected to the documen...
Definition: umldoc.cpp:2607
virtual void slotFillColorChanged(Uml::ID::Type viewID)
Captures a color change signal.
Definition: umlwidget.cpp:744
Definition: umlwidget.h:228
virtual void cleanup()
Used to cleanup any other widget it may need to delete.
Definition: umlwidget.cpp:1391
bool getIgnoreSnapToGrid() const
Return the value of m_ignoreSnapToGrid.
Definition: umlwidget.cpp:1442
void slotClearAllSelected()
Captures a sigClearAllSelected signal sent by UMLView.
Definition: umlwidget.cpp:1293
Definition: umlwidget.h:221
virtual void setLineColor(const QColor &color)
Overrides the method from WidgetBase.
Definition: umlwidget.cpp:849
void createAutoConstraintAssociations(UMLWidget *widget)
Definition: umlscene.cpp:2755
UMLObject * findObjectById(Uml::ID::Type id)
Used to find a reference to a UMLObject by its ID.
Definition: umldoc.cpp:766
Uml::ID::Type m_nId
This ID is only used when the widget does not have a corresponding UMLObject (i.e.
Definition: widgetbase.h:165
void adjustUnselectedAssocs(qreal dx, qreal dy)
Adjusts all unselected associations with the given co-ordinates.
Definition: umlwidget.cpp:1030
virtual void saveToXMI(QDomDocument &qDoc, QDomElement &qElement)
A virtual method to save the properties of this widget into a QDomElement i.e xml.
Definition: umlwidget.cpp:1707
virtual void setFont(const QFont &font)
Set the font used to display text inside this widget.
Definition: widgetbase.cpp:443
void removeAssoc(AssociationWidget *pAssoc)
Removes an already created association from the list of associations that include this UMLWidget...
Definition: umlwidget.cpp:987
Definition: cmd_changeFillColor.h:24
Definition: umlwidget.h:225
Definition: widgetbase.h:50
UMLView * activeView() const
Returns the active view associated with this scene.
Definition: umlscene.cpp:193
Definition: listpopupmenu.h:198
QSizeF startResizeSize() const
Return the start size of the resize action.
Definition: umlwidget.cpp:567
virtual qreal onWidget(const QPointF &p)
Returns 0 if the given point is not in the boundaries of the widget, else returns a number which is p...
Definition: umlwidget.cpp:1071
void deselect(QGraphicsSceneMouseEvent *me)
Deselects the widget and removes it from the list of selected widgets.
Definition: umlwidget.cpp:1328
bool showStereotype() const
Returns the status of whether to show Stereotype.
Definition: umlwidget.cpp:1693
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event)
Handles a mouse press event.
Definition: umlwidget.cpp:416
virtual void setFont(const QFont &font)
Sets the font the widget is to use.
Definition: umlwidget.cpp:1641
virtual void moveWidgetBy(qreal diffX, qreal diffY)
Moves the widget to a new position using the difference between the current position and the new posi...
Definition: umlwidget.cpp:247
void addAssoc(AssociationWidget *pAssoc)
Adds an already created association to the list of associations that include this UMLWidget...
Definition: umlwidget.cpp:976
Definition: widgetbase.h:55
bool isSelected() const
Returns the state of whether the widget is selected.
Definition: associationwidget.cpp:3665
void setupFontType(QFont &font, UMLWidget::FontType fontType)
Definition: umlwidget.cpp:1518
void clipSize()
clip the size of this widget against the minimal and maximal limits.
Definition: umlwidget.cpp:1501
Definition: umlwidget.h:224
Definition: widgetbase.h:45
virtual void setShowStereotype(bool flag)
Set the status of whether to show Stereotype.
Definition: umlwidget.cpp:1681
void setRect(const QRectF &rect)
set widget rectangle in item coordinates
Definition: widgetbase.cpp:608
void createAutoAssociations(UMLWidget *widget)
Creates automatically any Associations that the given UMLWidget may have on any diagram.
Definition: umlscene.cpp:2441
virtual QSizeF maximumSize()
Compute the maximum possible width and height.
Definition: umlwidget.cpp:206
Definition: widgetbase.h:52
bool m_isInstance
holds whether this widget is a component instance (i.e. on a deployment diagram)
Definition: umlwidget.h:292
bool m_useFillColor
flag indicates if the UMLWidget uses the Diagram FillColour
Definition: widgetbase.h:173
virtual void adjustAssocs(qreal dx, qreal dy)
Adjusts associations with the given co-ordinates.
Definition: umlwidget.cpp:1000
QPointF getPastePoint()
Returns the offset point at which to place the paste from clipboard.
Definition: umlscene.cpp:3362
QString m_oldStatusBarMsg
The text in the status bar when the cursor was pressed.
Definition: umlwidget.h:327
static MenuType typeFromAction(QAction *action)
Convenience method to extract the ListPopupMenu type from an action.
Definition: listpopupmenu.cpp:1122
AssociationWidgetList m_Assocs
A list of AssociationWidgets between the UMLWidget and other UMLWidgets in the diagram.
Definition: umlwidget.h:289
Definition: widgetbase.h:61
virtual void constrainMovementForAllWidgets(qreal &diffX, qreal &diffY)
Modifies the value of the diffX and diffY variables used to move the widgets.
Definition: umlwidget.cpp:270
bool m_moved
If the widget was selected/moved/resized in the press and release cycle.
Definition: umlwidget.h:353
void widgetMoved(UMLWidget *widget, qreal x, qreal y)
Adjusts the ending point of the association that connects to Widget.
Definition: associationwidget.cpp:1863
void setFillColorcmd(const QColor &color)
Sets the background fill color.
Definition: umlwidget.cpp:878
void setMinimumSize(const QSizeF &size)
This method is used to set the minimum size variable for this widget.
Definition: umlwidget.cpp:196
void saveIdealTextPositions()
Auxiliary method for widgetMoved(): Saves all ideally computed floatingtext positions before doing an...
Definition: associationwidget.cpp:1849
virtual void slotWidgetMoved(Uml::ID::Type id)
Captures when another widget moves if this widget is linked to it.
Definition: umlwidget.cpp:735
bool hasDocumentation()
Returns state of documentation for the widget.
Definition: widgetbase.cpp:169
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:06:01 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:06:01 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.