umbrello  2.32.3
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  {
42  };
43 
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;
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(QDomDocument & qDoc, QDomElement & qElement);
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:
82 };
83 
84 #endif
Displays a note box.
Definition: notewidget.h:31
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0)
Definition: notewidget.cpp:67
virtual ~NoteWidget()
Definition: notewidget.cpp:60
Uml::ID::Type diagramLink() const
Definition: notewidget.cpp:160
NoteWidget(UMLScene *scene, NoteWidget::NoteType noteType=Normal, Uml::ID::Type id=Uml::ID::None)
Definition: notewidget.cpp:49
virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
Definition: notewidget.cpp:526
virtual bool showPropertiesDialog()
Definition: notewidget.cpp:280
virtual bool loadFromXMI1(QDomElement &qElement)
Definition: notewidget.cpp:249
static NoteType stringToNoteType(const QString &noteType)
Definition: notewidget.cpp:126
void setNoteType(NoteType noteType)
Definition: notewidget.cpp:141
virtual void saveToXMI1(QDomDocument &qDoc, QDomElement &qElement)
Definition: notewidget.cpp:266
void paintTextWordWrap(QPainter *painter)
Definition: notewidget.cpp:432
NoteType m_noteType
The type of note.
Definition: notewidget.h:81
Uml::ID::Type m_diagramLink
The diagram/scene this note links to.
Definition: notewidget.h:80
NoteType noteType() const
Definition: notewidget.cpp:118
void askForNoteType(UMLWidget *&targetWidget)
Definition: notewidget.cpp:221
void paintText(QPainter *painter)
Definition: notewidget.cpp:365
void slotMenuSelection(QAction *action)
Definition: notewidget.cpp:302
void setDiagramLink(Uml::ID::Type viewID)
Definition: notewidget.cpp:171
virtual QSizeF minimumSize() const
Definition: notewidget.cpp:320
static QPointer< NoteWidget > s_pCurrentNote
Definition: notewidget.h:68
NoteType
This enum type is used to specify the type of note.
Definition: notewidget.h:37
@ Normal
Definition: notewidget.h:38
@ PreCondition
Definition: notewidget.h:39
@ Transformation
Definition: notewidget.h:41
@ PostCondition
Definition: notewidget.h:40
virtual QSizeF calculateSize(bool withExtensions=true) const
Definition: notewidget.cpp:330
Definition: umlscene.h:69
The base class for graphical UML objects.
Definition: umlwidget.h:41
const Type None
special value for uninitialized ID
Definition: basictypes.h:353
std::string Type
Definition: basictypes.h:351