umbrello: umbrello/umlwidgets/notewidget.h Source File

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

notewidget.h
Go to the documentation of this file.
1/*
2 SPDX-License-Identifier: GPL-2.0-or-later
3 SPDX-FileCopyrightText: 2002-2021 Umbrello UML Modeller Authors <umbrello-devel@kde.org>
4*/
5
6#ifndef NOTEWIDGET_H
7#define NOTEWIDGET_H
8
9//app includes
10#include "umlwidget.h"
11
12// Qt forward declarations
13class QPainter;
14
25 class NoteWidget : public UMLWidget
26{
27 Q_OBJECT
28public:
29
31 enum NoteType
32 {
33 Normal,
34 PreCondition,
35 PostCondition,
36 Transformation
37 };
38
39 explicit NoteWidget(UMLScene * scene, NoteWidget::NoteType noteType = Normal,
40 Uml::ID::Type id = Uml::ID::None);
41 virtual ~NoteWidget();
42
43 virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = nullptr);
44
45 static NoteType stringToNoteType(const QString& noteType);
46
47 NoteType noteType() const;
48 void setNoteType(NoteType noteType);
49 void setNoteType(const QString& noteType);
50
51 Uml::ID::Type diagramLink() const;
52 void setDiagramLink(Uml::ID::Type viewID);
53 bool setDiagramLink(const QString &diagramName);
54
55 void askForNoteType(UMLWidget* &targetWidget);
56
57 virtual bool showPropertiesDialog();
58
59 virtual bool loadFromXMI(QDomElement & qElement);
60 virtual void saveToXMI(QXmlStreamWriter& writer);
61 virtual QSizeF minimumSize() const;
62
63 static QPointer<NoteWidget> s_pCurrentNote;
64
65public Q_SLOTS:
66 void slotMenuSelection(QAction* action);
67
68protected:
69 virtual QSizeF calculateSize(bool withExtensions = true) const;
70 void paintText(QPainter *painter);
71 void paintTextWordWrap(QPainter *painter);
72 virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
73
74private:
75 Uml::ID::Type m_diagramLink;
76 NoteType m_noteType;
77};
78
79#endif
NoteWidget::~NoteWidget
virtual ~NoteWidget()
Definition notewidget.cpp:52
NoteWidget::diagramLink
Uml::ID::Type diagramLink() const
Definition notewidget.cpp:155
NoteWidget::NoteWidget
NoteWidget(UMLScene *scene, NoteWidget::NoteType noteType=Normal, Uml::ID::Type id=Uml::ID::None)
Definition notewidget.cpp:41
NoteWidget::mouseDoubleClickEvent
virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
Definition notewidget.cpp:517
NoteWidget::showPropertiesDialog
virtual bool showPropertiesDialog()
Definition notewidget.cpp:271
NoteWidget::loadFromXMI
virtual bool loadFromXMI(QDomElement &qElement)
Definition notewidget.cpp:240
NoteWidget::stringToNoteType
static NoteType stringToNoteType(const QString &noteType)
Definition notewidget.cpp:121
NoteWidget::setNoteType
void setNoteType(NoteType noteType)
Definition notewidget.cpp:136
NoteWidget::paintTextWordWrap
void paintTextWordWrap(QPainter *painter)
Definition notewidget.cpp:423
NoteWidget::paint
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=nullptr)
Definition notewidget.cpp:59
NoteWidget::m_noteType
NoteType m_noteType
The type of note.
Definition notewidget.h:76
NoteWidget::m_diagramLink
Uml::ID::Type m_diagramLink
The diagram/scene this note links to.
Definition notewidget.h:75
NoteWidget::noteType
NoteType noteType() const
Definition notewidget.cpp:113
NoteWidget::askForNoteType
void askForNoteType(UMLWidget *&targetWidget)
Definition notewidget.cpp:217
NoteWidget::paintText
void paintText(QPainter *painter)
Definition notewidget.cpp:356
NoteWidget::slotMenuSelection
void slotMenuSelection(QAction *action)
Definition notewidget.cpp:293
NoteWidget::setDiagramLink
void setDiagramLink(Uml::ID::Type viewID)
Definition notewidget.cpp:166
NoteWidget::saveToXMI
virtual void saveToXMI(QXmlStreamWriter &writer)
Definition notewidget.cpp:257
NoteWidget::minimumSize
virtual QSizeF minimumSize() const
Definition notewidget.cpp:311
NoteWidget::s_pCurrentNote
static QPointer< NoteWidget > s_pCurrentNote
Definition notewidget.h:63
NoteWidget::NoteType
NoteType
This enum type is used to specify the type of note.
Definition notewidget.h:32
NoteWidget::Normal
@ Normal
Definition notewidget.h:33
NoteWidget::PreCondition
@ PreCondition
Definition notewidget.h:34
NoteWidget::Transformation
@ Transformation
Definition notewidget.h:36
NoteWidget::PostCondition
@ PostCondition
Definition notewidget.h:35
NoteWidget::calculateSize
virtual QSizeF calculateSize(bool withExtensions=true) const
Definition notewidget.cpp:321
UMLScene
Definition umlscene.h:65
UMLWidget
The base class for graphical UML objects.
Definition umlwidget.h:36
UMLWidget::UMLWidget
UMLWidget(UMLScene *scene, WidgetType type=wt_UMLWidget, UMLObject *o=nullptr)
Definition umlwidget.cpp:86
Uml::ID::None
const Type None
special value for uninitialized ID
Definition basictypes.h:373
Uml::ID::Type
std::string Type
Definition basictypes.h:371
umlwidget.h