umbrello 2.39.0
Umbrello UML Modeller is a Unified Modelling Language (UML) diagram program based on KDE Technology
|
Common base class for UMLWidget and AssociationWidget. More...
#include <widgetbase.h>
Public Types | |
enum | WidgetType { wt_Min = 299 , wt_UMLWidget , 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 , wt_Port , wt_Instance , wt_Max } |
Public Slots | |
virtual void | slotMenuSelection (QAction *trigger) |
Static Public Member Functions | |
static QString | toString (WidgetType wt) |
static QString | toI18nString (WidgetType wt) |
static Icon_Utils::IconType | toIcon (WidgetType wt) |
static bool | widgetHasUMLObject (WidgetBase::WidgetType type) |
Protected Member Functions | |
virtual void | contextMenuEvent (QGraphicsSceneContextMenuEvent *event) |
![]() | |
QVariant | itemChange (GraphicsItemChange change, const QVariant &value) |
Protected Attributes | |
UMLScene * | m_scene |
QPointer< UMLObject > | m_umlObject |
QString | m_Doc |
Only used if m_umlObject is not set. | |
QString | m_Text |
QRectF | m_rect |
Widget size. In this rectangle, the x and y coordinates are always 0. | |
Uml::ID::Type | m_nId |
Uml::ID::Type | m_nLocalID |
QColor | m_textColor |
Color of the text of the widget. Is saved to XMI. | |
QColor | m_lineColor |
Color of the lines of the widget. Is saved to XMI. | |
QColor | m_fillColor |
color of the background of the widget | |
QBrush | m_brush |
QFont | m_font |
uint | m_lineWidth |
Width of the lines of the widget. Is saved to XMI. | |
bool | m_useFillColor |
flag indicates if the UMLWidget uses the Diagram FillColour | |
bool | m_usesDiagramFillColor |
bool | m_usesDiagramLineColor |
bool | m_usesDiagramLineWidth |
bool | m_usesDiagramTextColor |
bool | m_usesDiagramUseFillColor |
bool | m_autoResize |
bool | m_changesShape |
The widget changes its shape when the number of connections or their positions are changed. | |
![]() | |
bool | m_calledFromItemChange {false} |
Private Attributes | |
WidgetType | m_baseType |
Type of widget. | |
Common base class for UMLWidget and AssociationWidget.
|
explicit |
Creates a WidgetBase object.
scene | The view to be displayed on. |
type | The WidgetType to construct. This must be set to the appropriate value by the constructors of inheriting classes. |
id | The XMI ID to use. The value Uml::ID::None will trigger generation of a new ID. |
|
virtual |
Destructor.
|
virtual |
Activate the object after deserializing it from XMI
changeLog | optional pointer to IDChangeLog object |
Reimplemented in AssociationWidget, CombinedFragmentWidget, FloatingTextWidget, MessageWidget, ObjectWidget, PinPortBase, PreconditionWidget, and UMLWidget.
|
virtual |
ActivityWidget * WidgetBase::asActivityWidget | ( | ) |
const ActivityWidget * WidgetBase::asActivityWidget | ( | ) | const |
ActorWidget * WidgetBase::asActorWidget | ( | ) |
const ActorWidget * WidgetBase::asActorWidget | ( | ) | const |
ArtifactWidget * WidgetBase::asArtifactWidget | ( | ) |
const ArtifactWidget * WidgetBase::asArtifactWidget | ( | ) | const |
AssociationWidget * WidgetBase::asAssociationWidget | ( | ) |
const AssociationWidget * WidgetBase::asAssociationWidget | ( | ) | const |
BoxWidget * WidgetBase::asBoxWidget | ( | ) |
const BoxWidget * WidgetBase::asBoxWidget | ( | ) | const |
CategoryWidget * WidgetBase::asCategoryWidget | ( | ) |
const CategoryWidget * WidgetBase::asCategoryWidget | ( | ) | const |
ClassifierWidget * WidgetBase::asClassifierWidget | ( | ) |
const ClassifierWidget * WidgetBase::asClassifierWidget | ( | ) | const |
CombinedFragmentWidget * WidgetBase::asCombinedFragmentWidget | ( | ) |
const CombinedFragmentWidget * WidgetBase::asCombinedFragmentWidget | ( | ) | const |
ComponentWidget * WidgetBase::asComponentWidget | ( | ) |
const ComponentWidget * WidgetBase::asComponentWidget | ( | ) | const |
DatatypeWidget * WidgetBase::asDatatypeWidget | ( | ) |
const DatatypeWidget * WidgetBase::asDatatypeWidget | ( | ) | const |
EntityWidget * WidgetBase::asEntityWidget | ( | ) |
const EntityWidget * WidgetBase::asEntityWidget | ( | ) | const |
EnumWidget * WidgetBase::asEnumWidget | ( | ) |
const EnumWidget * WidgetBase::asEnumWidget | ( | ) | const |
FloatingDashLineWidget * WidgetBase::asFloatingDashLineWidget | ( | ) |
const FloatingDashLineWidget * WidgetBase::asFloatingDashLineWidget | ( | ) | const |
FloatingTextWidget * WidgetBase::asFloatingTextWidget | ( | ) |
const FloatingTextWidget * WidgetBase::asFloatingTextWidget | ( | ) | const |
ForkJoinWidget * WidgetBase::asForkJoinWidget | ( | ) |
const ForkJoinWidget * WidgetBase::asForkJoinWidget | ( | ) | const |
InterfaceWidget * WidgetBase::asInterfaceWidget | ( | ) |
const InterfaceWidget * WidgetBase::asInterfaceWidget | ( | ) | const |
MessageWidget * WidgetBase::asMessageWidget | ( | ) |
const MessageWidget * WidgetBase::asMessageWidget | ( | ) | const |
NodeWidget * WidgetBase::asNodeWidget | ( | ) |
const NodeWidget * WidgetBase::asNodeWidget | ( | ) | const |
NoteWidget * WidgetBase::asNoteWidget | ( | ) |
const NoteWidget * WidgetBase::asNoteWidget | ( | ) | const |
ObjectNodeWidget * WidgetBase::asObjectNodeWidget | ( | ) |
const ObjectNodeWidget * WidgetBase::asObjectNodeWidget | ( | ) | const |
ObjectWidget * WidgetBase::asObjectWidget | ( | ) |
const ObjectWidget * WidgetBase::asObjectWidget | ( | ) | const |
PackageWidget * WidgetBase::asPackageWidget | ( | ) |
const PackageWidget * WidgetBase::asPackageWidget | ( | ) | const |
PinPortBase * WidgetBase::asPinPortBase | ( | ) |
const PinPortBase * WidgetBase::asPinPortBase | ( | ) | const |
PinWidget * WidgetBase::asPinWidget | ( | ) |
const PinWidget * WidgetBase::asPinWidget | ( | ) | const |
PortWidget * WidgetBase::asPortWidget | ( | ) |
const PortWidget * WidgetBase::asPortWidget | ( | ) | const |
PreconditionWidget * WidgetBase::asPreconditionWidget | ( | ) |
const PreconditionWidget * WidgetBase::asPreconditionWidget | ( | ) | const |
RegionWidget * WidgetBase::asRegionWidget | ( | ) |
const RegionWidget * WidgetBase::asRegionWidget | ( | ) | const |
SignalWidget * WidgetBase::asSignalWidget | ( | ) |
const SignalWidget * WidgetBase::asSignalWidget | ( | ) | const |
StateWidget * WidgetBase::asStateWidget | ( | ) |
const StateWidget * WidgetBase::asStateWidget | ( | ) | const |
UMLWidget * WidgetBase::asUMLWidget | ( | ) |
const UMLWidget * WidgetBase::asUMLWidget | ( | ) | const |
UseCaseWidget * WidgetBase::asUseCaseWidget | ( | ) |
const UseCaseWidget * WidgetBase::asUseCaseWidget | ( | ) | const |
bool WidgetBase::autoResize | ( | ) | const |
Return state of auto resize property
WidgetBase::WidgetType WidgetBase::baseType | ( | ) | const |
Read property of m_baseType.
QLatin1String WidgetBase::baseTypeStr | ( | ) | const |
QString WidgetBase::baseTypeStrWithoutPrefix | ( | ) | const |
|
virtual |
Reimplemented in AssociationWidget, CombinedFragmentWidget, and PinPortBase.
bool WidgetBase::changesShape | ( | ) | const |
Return changes state property
|
protectedvirtual |
Reimplemented to show appropriate context menu.
Reimplemented in AssociationWidget, StateWidget, and UMLWidget.
QString WidgetBase::documentation | ( | ) | const |
Used by some child classes to get documentation.
QColor WidgetBase::fillColor | ( | ) | const |
Returns fill color
|
virtual |
bool WidgetBase::hasDocumentation | ( | ) | const |
Returns state of documentation for the widget.
Uml::ID::Type WidgetBase::id | ( | ) | const |
Read property of m_nId.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
QColor WidgetBase::lineColor | ( | ) | const |
Returns line color
uint WidgetBase::lineWidth | ( | ) | const |
Returns line width
|
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.
qElement | A QDomElement which contains xml info for this widget. |
Reimplemented in ActivityWidget, AssociationWidget, ClassifierWidget, CombinedFragmentWidget, DatatypeWidget, EntityWidget, EnumWidget, FloatingDashLineWidget, FloatingTextWidget, ForkJoinWidget, MessageWidget, NoteWidget, ObjectNodeWidget, ObjectWidget, PinPortBase, PreconditionWidget, RegionWidget, SignalWidget, StateWidget, and UMLWidget.
Uml::ID::Type WidgetBase::localID | ( | ) | const |
Returns the local ID for this object. This ID is used so that many objects of the same UMLObject instance can be on the same diagram.
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.)
|
virtual |
Test if point is inside the bounding rectangle of the widget. Inheriting classes may reimplement this to test possible child widgets.
p | Point to be checked. |
Reimplemented in AssociationWidget, ClassifierWidget, FloatingTextWidget, MessageWidget, and PinPortBase.
WidgetBase & WidgetBase::operator= | ( | const WidgetBase & | other | ) |
Assignment operator
|
virtual |
Draws the UMLWidget on the given paint device
painter | The painter for the drawing device |
option | Painting related options |
widget | Background widget on which to paint (optional) |
Reimplemented in ActivityWidget, ActorWidget, ArtifactWidget, BoxWidget, CategoryWidget, ClassifierWidget, CombinedFragmentWidget, ComponentWidget, DatatypeWidget, EntityWidget, EnumWidget, FloatingDashLineWidget, FloatingTextWidget, ForkJoinWidget, MessageWidget, NodeWidget, NoteWidget, ObjectNodeWidget, ObjectWidget, PackageWidget, PinPortBase, PreconditionWidget, RegionWidget, SignalWidget, StateWidget, UMLWidget, and UseCaseWidget.
QRectF WidgetBase::rect | ( | ) | const |
return drawing rectangle of widget in local coordinates
|
virtual |
|
virtual |
A virtual method to save the properties of this widget into a QXmlStreamWriter 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.
writer | The QXmlStreamWriter to write to. |
Reimplemented in ActivityWidget, ActorWidget, ArtifactWidget, AssociationWidget, BoxWidget, CategoryWidget, ClassifierWidget, CombinedFragmentWidget, ComponentWidget, DatatypeWidget, EntityWidget, EnumWidget, FloatingDashLineWidget, FloatingTextWidget, ForkJoinWidget, MessageWidget, NodeWidget, NoteWidget, ObjectNodeWidget, ObjectWidget, PackageWidget, PinPortBase, PreconditionWidget, RegionWidget, SignalWidget, StateWidget, UMLWidget, and UseCaseWidget.
void WidgetBase::setAutoResize | ( | bool | state | ) |
set auto resize state
state |
void WidgetBase::setBaseType | ( | const WidgetType & | baseType | ) |
Set property m_baseType. Used for types changing their types during runtime.
void WidgetBase::setChangesShape | ( | bool | state | ) |
set changes shape property
state |
|
virtual |
Used by some child classes to set documentation.
doc | The documentation to be set in the UMLObject (if m_umlObject is set.) |
Reimplemented in ClassifierWidget.
|
virtual |
|
virtual |
Set the font used to display text inside this widget.
Reimplemented in UMLWidget.
void WidgetBase::setID | ( | Uml::ID::Type | id | ) |
Write property of m_nId.
|
virtual |
Sets the line color
color | The new line color |
Reimplemented in AssociationWidget, and UMLWidget.
|
virtual |
Sets the line width
width | The new line width |
Reimplemented in AssociationWidget, and UMLWidget.
void WidgetBase::setLocalID | ( | Uml::ID::Type | id | ) |
Sets the local id of the object.
id | The local id of the object. |
|
virtual |
Sets the name in the corresponding UMLObject. Sets the local m_Text if m_umlObject is NULL.
strName | The name to be set. |
Reimplemented in AssociationWidget, PinPortBase, and SignalWidget.
void WidgetBase::setRect | ( | const QRectF & | rect | ) |
set widget rectangle in item coordinates
void WidgetBase::setRect | ( | qreal | x, |
qreal | y, | ||
qreal | width, | ||
qreal | height ) |
set widget rectangle in item coordinates
|
virtual |
Reimplemented from QGraphicsObjectWrapper.
Reimplemented in AssociationWidget, MessageWidget, ObjectWidget, and UMLWidget.
|
virtual |
Sets the text color
color | the new text color |
Reimplemented in AssociationWidget, and UMLWidget.
|
virtual |
Sets the UMLObject to represent.
obj | The object to represent. |
Reimplemented in AssociationWidget, and ClassifierWidget.
|
virtual |
void WidgetBase::setUsesDiagramFillColor | ( | bool | state | ) |
Set state if diagram fill color is used
state | The state to set |
void WidgetBase::setUsesDiagramLineColor | ( | bool | state | ) |
Set state of diagram line color is used
state | The state to set |
void WidgetBase::setUsesDiagramLineWidth | ( | bool | state | ) |
Set state of diagram line width is used
state | The state to set |
void WidgetBase::setUsesDiagramTextColor | ( | bool | state | ) |
Set state if diagram text color is used
state | The state to set |
void WidgetBase::setUsesDiagramUseFillColor | ( | bool | state | ) |
Set state of diagram use fill color is used
state | The state to set |
|
virtual |
A virtual method for the widget to display a property dialog box. Subclasses should reimplement this appropriately. In case the user cancels the dialog or there are some requirements not fulfilled the method returns false; true otherwise.
Reimplemented in ActivityWidget, AssociationWidget, BoxWidget, ClassifierWidget, FloatingTextWidget, ForkJoinWidget, MessageWidget, NoteWidget, ObjectNodeWidget, ObjectWidget, SignalWidget, StateWidget, and UMLWidget.
|
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.
Reimplemented in FloatingDashLineWidget.
QColor WidgetBase::textColor | ( | ) | const |
Returns text color
|
static |
Returns the given enum value as localized string.
wt | WidgetType of which a string representation is wanted |
|
static |
Returns the given enum value as icon type.
wt | WidgetType of which an icon type representation is wanted |
|
static |
Helper function for debug output. Returns the given enum value as string.
wt | WidgetType of which a string representation is wanted |
UMLDoc * WidgetBase::umlDoc | ( | ) | const |
This is shortcut method for UMLApp::app()->document().
UMLObject * WidgetBase::umlObject | ( | ) | const |
UMLScene * WidgetBase::umlScene | ( | ) | const |
Deliver a pointer to the connected UMLView (needed esp. by event handling of AssociationLine).
bool WidgetBase::useFillColor | ( | ) | const |
Return state of fill color usage
bool WidgetBase::usesDiagramFillColor | ( | ) | const |
Returns state of diagram fill color is used
bool WidgetBase::usesDiagramLineColor | ( | ) | const |
Returns state of diagram line color is used
bool WidgetBase::usesDiagramLineWidth | ( | ) | const |
Returns state of diagram line width is used
bool WidgetBase::usesDiagramTextColor | ( | ) | const |
Returns state if diagram text color is used
bool WidgetBase::usesDiagramUseFillColor | ( | ) | const |
Returns state of diagram use fill color is used
|
static |
Returns whether the widget type has an associated UMLObject
|
virtual |
Returns the widget with the given ID. The default implementation tests the following IDs:
id | The ID to test this widget against. |
Reimplemented in ClassifierWidget, and PinPortBase.
|
protected |
|
private |
Type of widget.
|
protected |
|
protected |
The widget changes its shape when the number of connections or their positions are changed.
|
protected |
Only used if m_umlObject is not set.
|
protected |
color of the background of the widget
|
protected |
|
protected |
Color of the lines of the widget. Is saved to XMI.
|
protected |
Width of the lines of the widget. Is saved to XMI.
|
protected |
|
protected |
This ID is only used when a widget could be added more than once to a diagram
|
protected |
Widget size. In this rectangle, the x and y coordinates are always 0.
|
protected |
|
protected |
|
protected |
Color of the text of the widget. Is saved to XMI.
|
protected |
|
protected |
flag indicates if the UMLWidget uses the Diagram FillColour
|
protected |
true by default, false if the colors have been explicitly set for this widget. These are saved to XMI.
|
protected |
|
protected |
|
protected |
|
protected |