umbrello: umbrello/umlwidgets/notewidget.h Source File

umbrello 2.32.1 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 * This program is free software; you can redistribute it and/or modify *
3 * it under the terms of the GNU General Public License as published by *
4 * the Free Software Foundation; either version 2 of the License, or *
5 * (at your option) any later version. *
6 * *
7 * copyright (C) 2002-2020 *
8 * Umbrello UML Modeller Authors <umbrello-devel@kde.org> *
9 ***************************************************************************/
10
11 #ifndef NOTEWIDGET_H
12 #define NOTEWIDGET_H
13
14 //app includes
15 #include "umlwidget.h"
16
17 // Qt forward declarations
18 class QPainter;
19
30 class NoteWidget : public UMLWidget
31 {
32 Q_OBJECT
33 public:
34
36 enum NoteType
37 {
38 Normal,
39 PreCondition,
40 PostCondition,
41 Transformation
42 };
43
44 explicit NoteWidget(UMLScene * scene, NoteWidget::NoteType noteType = Normal,
45 Uml::ID::Type id = Uml::ID::None);
46 virtual ~NoteWidget();
47
48 virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
49
50 static NoteType stringToNoteType(const QString& noteType);
51
52 NoteType noteType() const;
53 void setNoteType(NoteType noteType);
54 void setNoteType(const QString& noteType);
55
56 Uml::ID::Type diagramLink() const;
57 void setDiagramLink(Uml::ID::Type viewID);
58 bool setDiagramLink(const QString &diagramName);
59
60 void askForNoteType(UMLWidget* &targetWidget);
61
62 virtual bool showPropertiesDialog();
63
64 virtual bool loadFromXMI1(QDomElement & qElement);
65 virtual void saveToXMI1(QXmlStreamWriter& writer);
66 virtual QSizeF minimumSize() const;
67
68 static QPointer<NoteWidget> s_pCurrentNote;
69
70 public Q_SLOTS:
71 void slotMenuSelection(QAction* action);
72
73 protected:
74 virtual QSizeF calculateSize(bool withExtensions = true) const;
75 void paintText(QPainter *painter);
76 void paintTextWordWrap(QPainter *painter);
77 virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
78
79 private:
80 Uml::ID::Type m_diagramLink;
81 NoteType m_noteType;
82 };
83
84 #endif
NoteWidget
Displays a note box.
Definition: notewidget.h:31
NoteWidget::paint
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0)
Definition: notewidget.cpp:68
NoteWidget::~NoteWidget
virtual ~NoteWidget()
Definition: notewidget.cpp:61
NoteWidget::diagramLink
Uml::ID::Type diagramLink() const
Definition: notewidget.cpp:161
NoteWidget::NoteWidget
NoteWidget(UMLScene *scene, NoteWidget::NoteType noteType=Normal, Uml::ID::Type id=Uml::ID::None)
Definition: notewidget.cpp:50
NoteWidget::mouseDoubleClickEvent
virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
Definition: notewidget.cpp:527
NoteWidget::showPropertiesDialog
virtual bool showPropertiesDialog()
Definition: notewidget.cpp:281
NoteWidget::loadFromXMI1
virtual bool loadFromXMI1(QDomElement &qElement)
Definition: notewidget.cpp:250
NoteWidget::stringToNoteType
static NoteType stringToNoteType(const QString &noteType)
Definition: notewidget.cpp:127
NoteWidget::setNoteType
void setNoteType(NoteType noteType)
Definition: notewidget.cpp:142
NoteWidget::paintTextWordWrap
void paintTextWordWrap(QPainter *painter)
Definition: notewidget.cpp:433
NoteWidget::saveToXMI1
virtual void saveToXMI1(QXmlStreamWriter &writer)
Definition: notewidget.cpp:267
NoteWidget::m_noteType
NoteType m_noteType
The type of note.
Definition: notewidget.h:81
NoteWidget::m_diagramLink
Uml::ID::Type m_diagramLink
The diagram/scene this note links to.
Definition: notewidget.h:80
NoteWidget::noteType
NoteType noteType() const
Definition: notewidget.cpp:119
NoteWidget::askForNoteType
void askForNoteType(UMLWidget *&targetWidget)
Definition: notewidget.cpp:222
NoteWidget::paintText
void paintText(QPainter *painter)
Definition: notewidget.cpp:366
NoteWidget::slotMenuSelection
void slotMenuSelection(QAction *action)
Definition: notewidget.cpp:303
NoteWidget::setDiagramLink
void setDiagramLink(Uml::ID::Type viewID)
Definition: notewidget.cpp:172
NoteWidget::minimumSize
virtual QSizeF minimumSize() const
Definition: notewidget.cpp:321
NoteWidget::s_pCurrentNote
static QPointer< NoteWidget > s_pCurrentNote
Definition: notewidget.h:68
NoteWidget::NoteType
NoteType
This enum type is used to specify the type of note.
Definition: notewidget.h:37
NoteWidget::Normal
@ Normal
Definition: notewidget.h:38
NoteWidget::PreCondition
@ PreCondition
Definition: notewidget.h:39
NoteWidget::Transformation
@ Transformation
Definition: notewidget.h:41
NoteWidget::PostCondition
@ PostCondition
Definition: notewidget.h:40
NoteWidget::calculateSize
virtual QSizeF calculateSize(bool withExtensions=true) const
Definition: notewidget.cpp:331
UMLScene
Definition: umlscene.h:70
UMLWidget
The base class for graphical UML objects.
Definition: umlwidget.h:41
Uml::ID::None
const Type None
special value for uninitialized ID
Definition: basictypes.h:387
Uml::ID::Type
std::string Type
Definition: basictypes.h:385
umlwidget.h