umbrello 2.39.2 Umbrello UML Modeller is a Unified Modelling Language (UML) diagram program based on KDE Technology

- Main Page
- Related Pages
- Topics
- Namespaces
- Classes
- Files

- File List
- File Members

classifierwidget.h
Go to the documentation of this file.
1/*
2 SPDX-License-Identifier: GPL-2.0-or-later
3 SPDX-FileCopyrightText: 2004-2021 Umbrello UML Modeller Authors <umbrello-devel@kde.org>
4*/
5
6#ifndef CLASSIFIERWIDGET_H
7#define CLASSIFIERWIDGET_H
8
9#include "basictypes.h"
10#include "umlobject.h"
11#include "umlwidget.h"
12
13 class AssociationWidget;
14 class FloatingTextWidget;
15 class QPainter;
16 class UMLClassifier;
17
27 class ClassifierWidget : public UMLWidget
28{
29 Q_OBJECT
30 Q_ENUMS(VisualProperty)
31 public:
37 enum VisualProperty {
38 ShowStereotype = 0x1, // DEPRECATED - see umlwidgets/widgetbase.cpp
39 // WidgetBase::slotMenuSelection(QAction*)
40 // case ListPopupMenu::mt_{Show,Hide}_Stereotypes_Selection
41 ShowOperations = 0x2,
42 ShowPublicOnly = 0x4,
43 ShowVisibility = 0x8,
44 ShowPackage = 0x10,
45 ShowAttributes = 0x20,
46 DrawAsCircle = 0x40,
47 ShowOperationSignature = 0x60,
48 ShowAttributeSignature = 0x80,
49 DrawAsPackage = 0x100,
50 ShowDocumentation = 0x200,
51 };
52
53 Q_DECLARE_FLAGS(VisualProperties, VisualProperty)
54
55 ClassifierWidget(UMLScene * scene, UMLClassifier * umlc);
56 ClassifierWidget(UMLScene * scene, UMLInstance * umli);
57 ClassifierWidget(UMLScene * scene, UMLPackage * o);
58 virtual ~ClassifierWidget();
59
60 UMLClassifier *classifier() const;
61
62 void setShowStereotype(Uml::ShowStereoType::Enum flag);
63
64 VisualProperties visualProperties() const;
65 void setVisualProperties(VisualProperties properties);
66
67 bool visualProperty(VisualProperty property) const;
68 void setVisualProperty(VisualProperty property, bool enable = true);
69 void setVisualPropertyCmd(VisualProperty property, bool enable = true);
70 void toggleVisualProperty(VisualProperty property);
71
72 int displayedAttributes() const;
73 int displayedOperations() const;
74
75 Uml::SignatureType::Enum attributeSignature() const;
76 void setAttributeSignature(Uml::SignatureType::Enum sig);
77
78 Uml::SignatureType::Enum operationSignature() const;
79 void setOperationSignature(Uml::SignatureType::Enum sig);
80
81 void setShowAttSigs(bool _show);
82 void toggleShowAttSigs();
83
84 bool getDrawAsCircle() const;
85 void setDrawAsCircle(bool drawAsCircle);
86 void toggleDrawAsCircle();
87
88 void changeToClass();
89 void changeToInterface();
90 void changeToPackage();
91
92 AssociationWidget *classAssociationWidget() const;
93 void setClassAssociationWidget(AssociationWidget *assocwidget);
94
95 UMLWidget* onWidget(const QPointF& p);
96 UMLWidget* widgetWithID(Uml::ID::Type id);
97
98 virtual void setDocumentation(const QString& doc);
99
100 QSizeF calculateSize(bool withExtensions = true) const;
101
102 virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
103 virtual QPainterPath shape() const;
104
105 virtual void saveToXMI(QXmlStreamWriter& writer);
106 virtual bool loadFromXMI(QDomElement & qElement);
107
108 virtual bool showPropertiesDialog();
109 void setUMLObject(UMLObject *obj);
110
111 public Q_SLOTS:
112 virtual void slotMenuSelection(QAction* action);
113
114 private Q_SLOTS:
115 void slotShowAttributes(bool state);
116 void slotShowOperations(bool state);
117
118 protected:
119 virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
120
121 private:
122 void updateSignatureTypes();
123 QSize calculateTemplatesBoxSize() const;
124
125 QSizeF minimumSize() const;
126
127 void drawAsCircle(QPainter *p, const QStyleOptionGraphicsItem *option);
128 QSize calculateAsCircleSize() const;
129
130 void drawAsPackage(QPainter *painter, const QStyleOptionGraphicsItem *option);
131 QSize calculateAsPackageSize() const;
132
133 int displayedMembers(UMLObject::ObjectType ot) const;
134 void drawMembers(QPainter *painter, UMLObject::ObjectType ot, Uml::SignatureType::Enum sigType,
135 int x, int y, int textWidth, int fontHeight);
136
137 static const int CIRCLE_SIZE;
138 static const int SOCKET_INCREMENT;
139
140 VisualProperties m_visualProperties;
141 Uml::SignatureType::Enum m_attributeSignature;
142 Uml::SignatureType::Enum m_operationSignature;
143 AssociationWidget *m_pAssocWidget;
144 QPointer<FloatingTextWidget> m_pInterfaceName;
145
146};
147
148Q_DECLARE_OPERATORS_FOR_FLAGS(ClassifierWidget::VisualProperties)
149
150#endif
basictypes.h
AssociationWidget
This class represents an association inside a diagram. Bugs and comments to umbrello-devel@kde....
Definition associationwidget.h:47
ClassifierWidget
Common implementation for class widget and interface widget.
Definition classifierwidget.h:28
ClassifierWidget::displayedAttributes
int displayedAttributes() const
Definition classifierwidget.cpp:718
ClassifierWidget::slotShowOperations
void slotShowOperations(bool state)
Definition classifierwidget.cpp:1582
ClassifierWidget::setVisualPropertyCmd
void setVisualPropertyCmd(VisualProperty property, bool enable=true)
Definition classifierwidget.cpp:268
ClassifierWidget::m_pAssocWidget
AssociationWidget * m_pAssocWidget
related AssociationWidget in case this classifier acts as an association class
Definition classifierwidget.h:143
ClassifierWidget::showPropertiesDialog
virtual bool showPropertiesDialog()
Definition classifierwidget.cpp:1598
ClassifierWidget::widgetWithID
UMLWidget * widgetWithID(Uml::ID::Type id)
Definition classifierwidget.cpp:1221
ClassifierWidget::setDrawAsCircle
void setDrawAsCircle(bool drawAsCircle)
Definition classifierwidget.cpp:1242
ClassifierWidget::attributeSignature
Uml::SignatureType::Enum attributeSignature() const
Definition classifierwidget.cpp:401
ClassifierWidget::changeToPackage
void changeToPackage()
Definition classifierwidget.cpp:1335
ClassifierWidget::SOCKET_INCREMENT
static const int SOCKET_INCREMENT
augmentation of circle for socket (required interface)
Definition classifierwidget.h:138
ClassifierWidget::m_operationSignature
Uml::SignatureType::Enum m_operationSignature
Loaded/saved item.
Definition classifierwidget.h:142
ClassifierWidget::VisualProperty
VisualProperty
Definition classifierwidget.h:37
ClassifierWidget::ShowPackage
@ ShowPackage
Definition classifierwidget.h:44
ClassifierWidget::ShowDocumentation
@ ShowDocumentation
Definition classifierwidget.h:50
ClassifierWidget::ShowPublicOnly
@ ShowPublicOnly
Definition classifierwidget.h:42
ClassifierWidget::ShowOperations
@ ShowOperations
Definition classifierwidget.h:41
ClassifierWidget::ShowOperationSignature
@ ShowOperationSignature
only in setter
Definition classifierwidget.h:47
ClassifierWidget::ShowStereotype
@ ShowStereotype
Definition classifierwidget.h:38
ClassifierWidget::DrawAsCircle
@ DrawAsCircle
Definition classifierwidget.h:46
ClassifierWidget::ShowAttributeSignature
@ ShowAttributeSignature
only in setter
Definition classifierwidget.h:48
ClassifierWidget::DrawAsPackage
@ DrawAsPackage
Definition classifierwidget.h:49
ClassifierWidget::ShowAttributes
@ ShowAttributes
Definition classifierwidget.h:45
ClassifierWidget::ShowVisibility
@ ShowVisibility
Definition classifierwidget.h:43
ClassifierWidget::setUMLObject
void setUMLObject(UMLObject *obj)
Definition classifierwidget.cpp:1613
ClassifierWidget::setOperationSignature
void setOperationSignature(Uml::SignatureType::Enum sig)
Definition classifierwidget.cpp:433
ClassifierWidget::calculateSize
QSizeF calculateSize(bool withExtensions=true) const
Definition classifierwidget.cpp:519
ClassifierWidget::classAssociationWidget
AssociationWidget * classAssociationWidget() const
Definition classifierwidget.cpp:753
ClassifierWidget::visualProperty
bool visualProperty(VisualProperty property) const
Definition classifierwidget.cpp:222
ClassifierWidget::onWidget
UMLWidget * onWidget(const QPointF &p)
Definition classifierwidget.cpp:1207
ClassifierWidget::toggleVisualProperty
void toggleVisualProperty(VisualProperty property)
Definition classifierwidget.cpp:339
ClassifierWidget::visualProperties
VisualProperties visualProperties() const
Definition classifierwidget.cpp:195
ClassifierWidget::operationSignature
Uml::SignatureType::Enum operationSignature() const
Definition classifierwidget.cpp:423
ClassifierWidget::setVisualProperties
void setVisualProperties(VisualProperties properties)
Definition classifierwidget.cpp:204
ClassifierWidget::setShowStereotype
void setShowStereotype(Uml::ShowStereoType::Enum flag)
Definition classifierwidget.cpp:183
ClassifierWidget::drawMembers
void drawMembers(QPainter *painter, UMLObject::ObjectType ot, Uml::SignatureType::Enum sigType, int x, int y, int textWidth, int fontHeight)
Definition classifierwidget.cpp:1143
ClassifierWidget::getDrawAsCircle
bool getDrawAsCircle() const
Definition classifierwidget.cpp:1279
ClassifierWidget::m_visualProperties
VisualProperties m_visualProperties
Definition classifierwidget.h:140
ClassifierWidget::calculateAsCircleSize
QSize calculateAsCircleSize() const
Definition classifierwidget.cpp:1059
ClassifierWidget::drawAsCircle
void drawAsCircle(QPainter *p, const QStyleOptionGraphicsItem *option)
Definition classifierwidget.cpp:976
ClassifierWidget::m_pInterfaceName
QPointer< FloatingTextWidget > m_pInterfaceName
Separate widget for name in case of interface drawn as circle.
Definition classifierwidget.h:144
ClassifierWidget::calculateTemplatesBoxSize
QSize calculateTemplatesBoxSize() const
Definition classifierwidget.cpp:686
ClassifierWidget::setAttributeSignature
void setAttributeSignature(Uml::SignatureType::Enum sig)
Definition classifierwidget.cpp:412
ClassifierWidget::paint
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0)
Definition classifierwidget.cpp:763
ClassifierWidget::changeToInterface
void changeToInterface()
Definition classifierwidget.cpp:1319
ClassifierWidget::setClassAssociationWidget
void setClassAssociationWidget(AssociationWidget *assocwidget)
Definition classifierwidget.cpp:739
ClassifierWidget::~ClassifierWidget
virtual ~ClassifierWidget()
Definition classifierwidget.cpp:161
ClassifierWidget::loadFromXMI
virtual bool loadFromXMI(QDomElement &qElement)
Definition classifierwidget.cpp:1350
ClassifierWidget::mouseDoubleClickEvent
virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
Definition classifierwidget.cpp:1587
ClassifierWidget::calculateAsPackageSize
QSize calculateAsPackageSize() const
Definition classifierwidget.cpp:1106
ClassifierWidget::setDocumentation
virtual void setDocumentation(const QString &doc)
Definition classifierwidget.cpp:1230
ClassifierWidget::ClassifierWidget
ClassifierWidget(UMLScene *scene, UMLClassifier *umlc)
Definition classifierwidget.cpp:44
ClassifierWidget::classifier
UMLClassifier * classifier() const
Definition classifierwidget.cpp:175
ClassifierWidget::drawAsPackage
void drawAsPackage(QPainter *painter, const QStyleOptionGraphicsItem *option)
Definition classifierwidget.cpp:1066
ClassifierWidget::CIRCLE_SIZE
static const int CIRCLE_SIZE
size of circle when interface is rendered as such
Definition classifierwidget.h:137
ClassifierWidget::minimumSize
QSizeF minimumSize() const
Definition classifierwidget.cpp:510
ClassifierWidget::toggleDrawAsCircle
void toggleDrawAsCircle()
Definition classifierwidget.cpp:1288
ClassifierWidget::displayedMembers
int displayedMembers(UMLObject::ObjectType ot) const
Definition classifierwidget.cpp:491
ClassifierWidget::toggleShowAttSigs
void toggleShowAttSigs()
Definition classifierwidget.cpp:469
ClassifierWidget::slotMenuSelection
virtual void slotMenuSelection(QAction *action)
Definition classifierwidget.cpp:1468
ClassifierWidget::shape
virtual QPainterPath shape() const
Definition classifierwidget.cpp:953
ClassifierWidget::setShowAttSigs
void setShowAttSigs(bool _show)
Definition classifierwidget.cpp:447
ClassifierWidget::m_attributeSignature
Uml::SignatureType::Enum m_attributeSignature
Loaded/saved item.
Definition classifierwidget.h:141
ClassifierWidget::setVisualProperty
void setVisualProperty(VisualProperty property, bool enable=true)
Definition classifierwidget.cpp:252
ClassifierWidget::displayedOperations
int displayedOperations() const
Definition classifierwidget.cpp:728
ClassifierWidget::changeToClass
void changeToClass()
Definition classifierwidget.cpp:1301
ClassifierWidget::updateSignatureTypes
void updateSignatureTypes()
Definition classifierwidget.cpp:362
ClassifierWidget::slotShowAttributes
void slotShowAttributes(bool state)
Definition classifierwidget.cpp:1574
ClassifierWidget::saveToXMI
virtual void saveToXMI(QXmlStreamWriter &writer)
Definition classifierwidget.cpp:1422
FloatingTextWidget
Displays a line of text or an operation.
Definition floatingtextwidget.h:32
UMLClassifier
Information for a non-graphical Concept/Class.
Definition classifier.h:35
UMLInstance
Non-graphical Information for an Instance.
Definition instance.h:43
UMLObject
The base class for UML objects.
Definition umlobject.h:70
UMLObject::ObjectType
ObjectType
Definition umlobject.h:76
UMLPackage
Non-graphical information for a Package.
Definition package.h:28
UMLScene
Definition umlscene.h:65
UMLWidget
The base class for graphical UML objects.
Definition umlwidget.h:36
x
int x
Definition cxx11-lambda-functions-and-expressions.h:4
Uml::ID::Type
std::string Type
Definition basictypes.h:371
Uml::ShowStereoType::Enum
Enum
Definition basictypes.h:148
Uml::SignatureType::Enum
Enum
Definition basictypes.h:160
umlobject.h
umlwidget.h