umbrello  2.39.2
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
13 class QPainter;
14 
25 class NoteWidget : public UMLWidget
26 {
27  Q_OBJECT
28 public:
29 
31  enum NoteType
32  {
37  };
38 
41  virtual ~NoteWidget();
42 
43  virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
44 
45  static NoteType stringToNoteType(const QString& noteType);
46 
47  NoteType noteType() const;
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 
65 public Q_SLOTS:
66  void slotMenuSelection(QAction* action);
67 
68 protected:
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 
74 private:
77 };
78 
79 #endif
Displays a note box.
Definition: notewidget.h:26
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0)
Definition: notewidget.cpp:59
virtual ~NoteWidget()
Definition: notewidget.cpp:52
Uml::ID::Type diagramLink() const
Definition: notewidget.cpp:155
NoteWidget(UMLScene *scene, NoteWidget::NoteType noteType=Normal, Uml::ID::Type id=Uml::ID::None)
Definition: notewidget.cpp:41
virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
Definition: notewidget.cpp:517
virtual bool showPropertiesDialog()
Definition: notewidget.cpp:271
virtual bool loadFromXMI(QDomElement &qElement)
Definition: notewidget.cpp:240
static NoteType stringToNoteType(const QString &noteType)
Definition: notewidget.cpp:121
void setNoteType(NoteType noteType)
Definition: notewidget.cpp:136
void paintTextWordWrap(QPainter *painter)
Definition: notewidget.cpp:423
NoteType m_noteType
The type of note.
Definition: notewidget.h:76
Uml::ID::Type m_diagramLink
The diagram/scene this note links to.
Definition: notewidget.h:75
NoteType noteType() const
Definition: notewidget.cpp:113
void askForNoteType(UMLWidget *&targetWidget)
Definition: notewidget.cpp:217
void paintText(QPainter *painter)
Definition: notewidget.cpp:356
void slotMenuSelection(QAction *action)
Definition: notewidget.cpp:293
void setDiagramLink(Uml::ID::Type viewID)
Definition: notewidget.cpp:166
virtual void saveToXMI(QXmlStreamWriter &writer)
Definition: notewidget.cpp:257
virtual QSizeF minimumSize() const
Definition: notewidget.cpp:311
static QPointer< NoteWidget > s_pCurrentNote
Definition: notewidget.h:63
NoteType
This enum type is used to specify the type of note.
Definition: notewidget.h:32
@ Normal
Definition: notewidget.h:33
@ PreCondition
Definition: notewidget.h:34
@ Transformation
Definition: notewidget.h:36
@ PostCondition
Definition: notewidget.h:35
virtual QSizeF calculateSize(bool withExtensions=true) const
Definition: notewidget.cpp:321
Definition: umlscene.h:65
The base class for graphical UML objects.
Definition: umlwidget.h:36
const Type None
special value for uninitialized ID
Definition: basictypes.h:373
std::string Type
Definition: basictypes.h:371