umbrello/umbrello
#include <widgetbase.h>
Public Types | |
enum | WidgetType { wt_UMLWidget = 300, 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 } |
Public Slots | |
virtual void | slotMenuSelection (QAction *trigger) |
Public Member Functions | |
WidgetBase (UMLScene *scene, WidgetType type=wt_UMLWidget) | |
virtual | ~WidgetBase () |
WidgetType | baseType () const |
QLatin1String | baseTypeStr () const |
virtual QRectF | boundingRect () const |
QString | documentation () const |
QColor | fillColor () const |
virtual QFont | font () const |
bool | hasDocumentation () |
Uml::ID::Type | id () const |
QColor | lineColor () const |
uint | lineWidth () const |
virtual bool | loadFromXMI (QDomElement &qElement) |
QString | name () const |
WidgetBase & | operator= (const WidgetBase &other) |
virtual void | paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0) |
QRectF | rect () const |
virtual void | saveToXMI (QDomDocument &qDoc, QDomElement &qElement) |
void | setDocumentation (const QString &doc) |
virtual void | setFillColor (const QColor &color) |
virtual void | setFont (const QFont &font) |
void | setID (Uml::ID::Type id) |
virtual void | setLineColor (const QColor &color) |
virtual void | setLineWidth (uint width) |
void | setName (const QString &strName) |
void | setRect (const QRectF &rect) |
void | setRect (qreal x, qreal y, qreal width, qreal height) |
virtual void | setTextColor (const QColor &color) |
virtual void | setUMLObject (UMLObject *obj) |
void | setUseFillColor (bool state) |
void | setUsesDiagramFillColor (bool state) |
void | setUsesDiagramLineColor (bool state) |
void | setUsesDiagramLineWidth (bool state) |
void | setUsesDiagramTextColor (bool state) |
void | setUsesDiagramUseFillColor (bool state) |
virtual void | showPropertiesDialog () |
QColor | textColor () const |
UMLDoc * | umlDoc () const |
UMLObject * | umlObject () const |
UMLScene * | umlScene () const |
bool | useFillColor () |
bool | usesDiagramFillColor () const |
bool | usesDiagramLineColor () const |
bool | usesDiagramLineWidth () const |
bool | usesDiagramTextColor () const |
bool | usesDiagramUseFillColor () const |
Static Public Member Functions | |
static QString | toString (WidgetType wt) |
Protected Member Functions | |
virtual void | contextMenuEvent (QGraphicsSceneContextMenuEvent *event) |
virtual void | setupContextMenuActions (ListPopupMenu &menu) |
Protected Attributes | |
WidgetType | m_baseType |
QBrush | m_brush |
QString | m_Doc |
QColor | m_fillColor |
QFont | m_font |
QColor | m_lineColor |
uint | m_lineWidth |
Uml::ID::Type | m_nId |
QRectF | m_rect |
UMLScene * | m_scene |
QString | m_Text |
QColor | m_textColor |
UMLObject * | m_umlObject |
bool | m_useFillColor |
bool | m_usesDiagramFillColor |
bool | m_usesDiagramLineColor |
bool | m_usesDiagramLineWidth |
bool | m_usesDiagramTextColor |
bool | m_usesDiagramUseFillColor |
Detailed Description
Common base class for UMLWidget and AssociationWidget.
Definition at line 35 of file widgetbase.h.
Member Enumeration Documentation
Definition at line 41 of file widgetbase.h.
Constructor & Destructor Documentation
|
explicit |
Creates a WidgetBase object.
- Parameters
-
scene The view to be displayed on.
Definition at line 33 of file widgetbase.cpp.
|
virtual |
Destructor.
Definition at line 69 of file widgetbase.cpp.
Member Function Documentation
WidgetBase::WidgetType WidgetBase::baseType | ( | ) | const |
Read property of m_baseType.
Definition at line 76 of file widgetbase.cpp.
QLatin1String WidgetBase::baseTypeStr | ( | ) | const |
- Returns
- The type used for rtti as string.
Definition at line 84 of file widgetbase.cpp.
|
virtual |
- Returns
- The bounding rectangle for this widget.
- See also
- setRect
Reimplemented in AssociationWidget.
Definition at line 629 of file widgetbase.cpp.
|
protectedvirtual |
Reimplemented to show appropriate context menu.
Reimplemented in UMLWidget, and AssociationWidget.
Definition at line 651 of file widgetbase.cpp.
QString WidgetBase::documentation | ( | ) | const |
Used by some child classes to get documentation.
- Returns
- The documentation from the UMLObject (if m_umlObject is set.)
Definition at line 157 of file widgetbase.cpp.
QColor WidgetBase::fillColor | ( | ) | const |
|
virtual |
Returns the font used for diaplaying any text.
- Returns
- the font
Reimplemented in AssociationWidget.
Definition at line 431 of file widgetbase.cpp.
bool WidgetBase::hasDocumentation | ( | ) |
Returns state of documentation for the widget.
- Returns
- false if documentation is empty
Definition at line 169 of file widgetbase.cpp.
Uml::ID::Type WidgetBase::id | ( | ) | const |
Read property of m_nId.
Definition at line 145 of file widgetbase.cpp.
QColor WidgetBase::lineColor | ( | ) | const |
uint WidgetBase::lineWidth | ( | ) | const |
|
virtual |
A virtual method to load the properties of this widget from a QDomElement into this widget.
Subclasses should reimplement this to load addtional 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 in UMLWidget, AssociationWidget, MessageWidget, ClassifierWidget, ObjectWidget, StateWidget, FloatingTextWidget, CombinedFragmentWidget, ActivityWidget, NoteWidget, ObjectNodeWidget, SignalWidget, FloatingDashLineWidget, PreconditionWidget, PinWidget, EnumWidget, DatatypeWidget, ForkJoinWidget, and RegionWidget.
Definition at line 507 of file widgetbase.cpp.
QString WidgetBase::name | ( | ) | const |
Gets the name from the corresponding UMLObject if this widget has an underlying UMLObject; if it does not, then it returns the local m_Text (notably the case for FloatingTextWidget.)
- Returns
- the currently set name
Definition at line 197 of file widgetbase.cpp.
WidgetBase & WidgetBase::operator= | ( | const WidgetBase & | other | ) |
Assignment operator.
Definition at line 574 of file widgetbase.cpp.
|
virtual |
Draws the UMLWidget on the given paint device.
- Parameters
-
p The painter for the drawing device offsetX x position to start the drawing. offsetY y position to start the drawing.
Reimplemented in UMLWidget, MessageWidget, ClassifierWidget, FloatingTextWidget, ActivityWidget, StateWidget, CombinedFragmentWidget, ObjectWidget, NoteWidget, UseCaseWidget, ActorWidget, ObjectNodeWidget, CategoryWidget, SignalWidget, FloatingDashLineWidget, PreconditionWidget, EnumWidget, PinWidget, ArtifactWidget, DatatypeWidget, EntityWidget, ForkJoinWidget, ComponentWidget, PackageWidget, NodeWidget, BoxWidget, and RegionWidget.
Definition at line 643 of file widgetbase.cpp.
QRectF WidgetBase::rect | ( | ) | const |
return drawing rectangle of widget in local coordinates
Definition at line 600 of file widgetbase.cpp.
|
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 in UMLWidget, AssociationWidget, MessageWidget, ClassifierWidget, StateWidget, ObjectWidget, FloatingTextWidget, ActivityWidget, CombinedFragmentWidget, NoteWidget, ObjectNodeWidget, SignalWidget, FloatingDashLineWidget, UseCaseWidget, ActorWidget, PreconditionWidget, CategoryWidget, PinWidget, EnumWidget, ArtifactWidget, DatatypeWidget, EntityWidget, ForkJoinWidget, ComponentWidget, PackageWidget, NodeWidget, BoxWidget, and RegionWidget.
Definition at line 467 of file widgetbase.cpp.
void WidgetBase::setDocumentation | ( | const QString & | doc | ) |
Used by some child classes to set documentation.
- Parameters
-
doc The documentation to be set in the UMLObject (if m_umlObject is set.)
Definition at line 182 of file widgetbase.cpp.
|
virtual |
Sets the fill color.
- Parameters
-
colour The new fill color
Reimplemented in UMLWidget.
Definition at line 275 of file widgetbase.cpp.
|
virtual |
Set the font used to display text inside this widget.
This method issues FontHasChanged notification after setting the new font.
- See also
- WidgetBase::attributeChange
Reimplemented in UMLWidget.
Definition at line 443 of file widgetbase.cpp.
void WidgetBase::setID | ( | Uml::ID::Type | id | ) |
Write property of m_nId.
Definition at line 131 of file widgetbase.cpp.
|
virtual |
Sets the line color.
- Parameters
-
color The new line color
Reimplemented in UMLWidget.
Definition at line 254 of file widgetbase.cpp.
|
virtual |
Sets the line width.
- Parameters
-
width The new line width
Reimplemented in UMLWidget.
Definition at line 296 of file widgetbase.cpp.
void WidgetBase::setName | ( | const QString & | strName | ) |
Sets the name in the corresponding UMLObject.
Sets the local m_Text if m_umlObject is NULL.
- Parameters
-
strName The name to be set.
Definition at line 210 of file widgetbase.cpp.
void WidgetBase::setRect | ( | const QRectF & | rect | ) |
set widget rectangle in item coordinates
Definition at line 608 of file widgetbase.cpp.
void WidgetBase::setRect | ( | qreal | x, |
qreal | y, | ||
qreal | width, | ||
qreal | height | ||
) |
set widget rectangle in item coordinates
Definition at line 620 of file widgetbase.cpp.
|
virtual |
Sets the text color.
- Parameters
-
color the new text color
Reimplemented in AssociationWidget, and UMLWidget.
Definition at line 233 of file widgetbase.cpp.
|
virtual |
Sets the UMLObject to represent.
- Parameters
-
o The object to represent.
Reimplemented in AssociationWidget.
Definition at line 123 of file widgetbase.cpp.
|
protectedvirtual |
Definition at line 687 of file widgetbase.cpp.
void WidgetBase::setUseFillColor | ( | bool | state | ) |
Set state if fill color is used.
- Parameters
-
state The state to set
Definition at line 317 of file widgetbase.cpp.
void WidgetBase::setUsesDiagramFillColor | ( | bool | state | ) |
Set state if diagram fill color is used.
- Parameters
-
state The state to set
Definition at line 382 of file widgetbase.cpp.
void WidgetBase::setUsesDiagramLineColor | ( | bool | state | ) |
Set state of diagram line color is used.
- Parameters
-
state The state to set
Definition at line 362 of file widgetbase.cpp.
void WidgetBase::setUsesDiagramLineWidth | ( | bool | state | ) |
Set state of diagram line width is used.
- Parameters
-
state The state to set
Definition at line 422 of file widgetbase.cpp.
void WidgetBase::setUsesDiagramTextColor | ( | bool | state | ) |
Set state if diagram text color is used.
- Parameters
-
state The state to set
Definition at line 338 of file widgetbase.cpp.
void WidgetBase::setUsesDiagramUseFillColor | ( | bool | state | ) |
Set state of diagram use fill color is used.
- Parameters
-
state The state to set
Definition at line 402 of file widgetbase.cpp.
|
virtual |
A virtual method for the widget to display a property dialog box.
Subclasses should reimplment this appropriately.
Reimplemented in UMLWidget, AssociationWidget, StateWidget, ActivityWidget, FloatingTextWidget, ObjectWidget, ObjectNodeWidget, and SignalWidget.
Definition at line 452 of file widgetbase.cpp.
|
virtualslot |
This is usually called synchronously after menu.exec() and trigger's parent is always the ListPopupMenu which can be used to get the type of action of trigger.
- Note
- Subclasses can reimplement to handle specific actions and leave the rest to WidgetBase::slotMenuSelection.
Reimplemented in FloatingDashLineWidget.
Definition at line 724 of file widgetbase.cpp.
QColor WidgetBase::textColor | ( | ) | const |
|
static |
Helper function for debug output.
Returns the given enum value as string.
- Parameters
-
wt WidgetType of which a string representation is wanted
- Returns
- the WidgetType as string
Definition at line 873 of file widgetbase.cpp.
UMLDoc * WidgetBase::umlDoc | ( | ) | const |
This is shortcut method for UMLApp::app()->document().
- Returns
- Pointer to the UMLDoc object.
Definition at line 103 of file widgetbase.cpp.
UMLObject * WidgetBase::umlObject | ( | ) | const |
Returns the UMLObject set to represent.
- Returns
- the UMLObject to represent.
Definition at line 113 of file widgetbase.cpp.
UMLScene * WidgetBase::umlScene | ( | ) | const |
Deliver a pointer to the connected UMLView (needed esp.
by event handling of AssociationLine).
Definition at line 93 of file widgetbase.cpp.
bool WidgetBase::useFillColor | ( | ) |
Return state of fill color usage.
- Returns
- True if fill color is used
Definition at line 307 of file widgetbase.cpp.
bool WidgetBase::usesDiagramFillColor | ( | ) | const |
Returns state of diagram fill color is used.
- Returns
- True means diagrams fill color is used
Definition at line 372 of file widgetbase.cpp.
bool WidgetBase::usesDiagramLineColor | ( | ) | const |
Returns state of diagram line color is used.
- Returns
- True means diagrams line color is used
Definition at line 352 of file widgetbase.cpp.
bool WidgetBase::usesDiagramLineWidth | ( | ) | const |
Returns state of diagram line width is used.
- Returns
- True means diagrams line width is used
Definition at line 412 of file widgetbase.cpp.
bool WidgetBase::usesDiagramTextColor | ( | ) | const |
Returns state if diagram text color is used.
- Returns
- True means diagram text color is used
Definition at line 328 of file widgetbase.cpp.
bool WidgetBase::usesDiagramUseFillColor | ( | ) | const |
Returns state of diagram use fill color is used.
- Returns
- True means diagrams fill color is used
Definition at line 392 of file widgetbase.cpp.
Member Data Documentation
|
protected |
Type of widget.
Definition at line 153 of file widgetbase.h.
|
protected |
Definition at line 170 of file widgetbase.h.
|
protected |
Only used if m_umlObject is not set.
Definition at line 156 of file widgetbase.h.
|
protected |
color of the background of the widget
Definition at line 169 of file widgetbase.h.
|
protected |
Definition at line 171 of file widgetbase.h.
|
protected |
Color of the lines of the widget. Is saved to XMI.
Definition at line 168 of file widgetbase.h.
|
protected |
Width of the lines of the widget. Is saved to XMI.
Definition at line 172 of file widgetbase.h.
|
protected |
This ID is only used when the widget does not have a corresponding UMLObject (i.e.
the m_umlObject pointer is NULL.) For UMLObjects, the ID from the UMLObject is used.
Definition at line 165 of file widgetbase.h.
|
protected |
widget size
Definition at line 158 of file widgetbase.h.
|
protected |
Definition at line 154 of file widgetbase.h.
|
protected |
Definition at line 157 of file widgetbase.h.
|
protected |
Color of the text of the widget. Is saved to XMI.
Definition at line 167 of file widgetbase.h.
|
protected |
Definition at line 155 of file widgetbase.h.
|
protected |
flag indicates if the UMLWidget uses the Diagram FillColour
Definition at line 173 of file widgetbase.h.
|
protected |
Definition at line 182 of file widgetbase.h.
|
protected |
Definition at line 181 of file widgetbase.h.
|
protected |
Definition at line 184 of file widgetbase.h.
|
protected |
true by default, false if the colors have been explicitly set for this widget.
These are saved to XMI.
Definition at line 180 of file widgetbase.h.
|
protected |
Definition at line 183 of file widgetbase.h.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:06:03 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.