umbrello  2.32.0
Umbrello UML Modeller is a Unified Modelling Language (UML) diagram program based on KDE Technology
umllistviewitem.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-2021 *
8  * Umbrello UML Modeller Authors <umbrello-devel@kde.org> *
9  ***************************************************************************/
10 
11 #ifndef UMLLISTVIEWITEM_H
12 #define UMLLISTVIEWITEM_H
13 
14 #include "basictypes.h"
15 #include "icon_utils.h"
16 
17 #include <QDomDocument>
18 #include <QDomElement>
19 #include <QMap>
20 #include <QPointer>
21 #include <QTreeWidget>
22 #include <QXmlStreamWriter>
23 
24 // forward declarations
25 class UMLListView;
26 class UMLObject;
28 
29 typedef QTreeWidgetItemIterator UMLListViewItemIterator;
30 
40 class UMLListViewItem : public QTreeWidgetItem
41 {
42 public:
44  {
45  //the values in this enum are saved out to the file
46  //for file compatibility, only add new values to the end
47  lvt_Min = 799,
48  lvt_View = 800,
71  lvt_Diagrams, // currently unused
107  // enter new values above
109  lvt_Unknown = -1
110  };
111 
112  static QString toString(ListViewType type);
113 
114  UMLListViewItem(UMLListView * parent, const QString &name, ListViewType t, UMLObject* o = 0);
115  explicit UMLListViewItem(UMLListView * parent);
116  explicit UMLListViewItem(UMLListViewItem * parent);
117  UMLListViewItem(UMLListViewItem * parent, const QString &name, ListViewType t, UMLObject* o = 0);
118  UMLListViewItem(UMLListViewItem * parent, const QString &name, ListViewType t, Uml::ID::Type id);
120 
121  ListViewType type() const;
122 
123  void setID(Uml::ID::Type id);
124  Uml::ID::Type ID() const;
125 
126  void setUMLObject(UMLObject * obj);
127  UMLObject * umlObject() const;
128 
129  bool isOwnParent(Uml::ID::Type listViewItemID);
130 
131  void updateObject();
132  void updateFolder();
133 
134  void setText(int column, const QString &text);
135  void setText(const QString &text);
136  QString getSavedText() const;
137  void setVisible(bool state);
138 
139  QString toolTip();
140 
141  void setIcon(Icon_Utils::IconType iconType);
142 
144 
145  void deleteChildItem(UMLObject *child);
146 
147  //virtual int compare(UMLListViewItem *other, int col, bool ascending) const;
148 
150 
154 
155  UMLListViewItem* childItem(int i);
156 
157  void saveToXMI1(QXmlStreamWriter& writer);
158  bool loadFromXMI1(QDomElement& qElement);
159 
160  bool isOpen() { return isExpanded(); }
161  void setOpen(bool state);
162 
163 public slots:
164  void slotEditFinished(const QString &newText);
165 
166 protected:
167  void init();
168 
169  void cancelRenameWithMsg();
170 
177  typedef QMap<UMLObject*, UMLListViewItem*> ChildObjectMap;
178 
181  QPointer<UMLObject> m_object;
182  QString m_label;
184 
185 };
186 
187 QDebug operator<<(QDebug dbg, const UMLListViewItem& item);
188 
189 #endif
A base class for classifier list items (e.g. attributes)
Definition: classifierlistitem.h:30
Items used by UMLListView.
Definition: umllistviewitem.h:41
void updateFolder()
Definition: umllistviewitem.cpp:430
UMLListViewItem * deepCopy(UMLListViewItem *newParent)
Definition: umllistviewitem.cpp:827
ListViewType m_type
Definition: umllistviewitem.h:179
void setUMLObject(UMLObject *obj)
Definition: umllistviewitem.cpp:310
QString toolTip()
Definition: umllistviewitem.cpp:203
QString m_label
Definition: umllistviewitem.h:182
UMLListViewItem * findUMLObject(const UMLObject *o)
Definition: umllistviewitem.cpp:849
UMLObject * umlObject() const
Definition: umllistviewitem.cpp:320
QString getSavedText() const
Definition: umllistviewitem.cpp:472
void slotEditFinished(const QString &newText)
Definition: umllistviewitem.cpp:491
ChildObjectMap m_comap
Definition: umllistviewitem.h:183
bool loadFromXMI1(QDomElement &qElement)
Definition: umllistviewitem.cpp:943
void cancelRenameWithMsg()
Definition: umllistviewitem.cpp:719
static QString toString(ListViewType type)
Definition: umllistviewitem.cpp:973
bool isOpen()
Definition: umllistviewitem.h:160
void setText(int column, const QString &text)
Definition: umllistviewitem.cpp:463
Uml::ID::Type ID() const
Definition: umllistviewitem.cpp:279
Uml::ID::Type m_id
Definition: umllistviewitem.h:180
void saveToXMI1(QXmlStreamWriter &writer)
Definition: umllistviewitem.cpp:902
ListViewType
Definition: umllistviewitem.h:44
@ lvt_Logical_Folder
Definition: umllistviewitem.h:51
@ lvt_UseCase_Folder
Definition: umllistviewitem.h:52
@ lvt_Association
Definition: umllistviewitem.h:103
@ lvt_View
Definition: umllistviewitem.h:48
@ lvt_Deployment_View
Definition: umllistviewitem.h:75
@ lvt_Actor
Definition: umllistviewitem.h:59
@ lvt_State_Diagram
Definition: umllistviewitem.h:56
@ lvt_Node
Definition: umllistviewitem.h:76
@ lvt_Component_View
Definition: umllistviewitem.h:69
@ lvt_Properties_UserInterface
Definition: umllistviewitem.h:102
@ lvt_Collaboration_Diagram
Definition: umllistviewitem.h:54
@ lvt_Properties_Font
Definition: umllistviewitem.h:100
@ lvt_Deployment_Folder
Definition: umllistviewitem.h:74
@ lvt_Max
Definition: umllistviewitem.h:108
@ lvt_Operation
Definition: umllistviewitem.h:63
@ lvt_Entity
Definition: umllistviewitem.h:80
@ lvt_Class
Definition: umllistviewitem.h:61
@ lvt_EntityRelationship_Diagram
Definition: umllistviewitem.h:82
@ lvt_PrimaryKeyConstraint
Definition: umllistviewitem.h:89
@ lvt_Component
Definition: umllistviewitem.h:70
@ lvt_Properties_CodeImport
Definition: umllistviewitem.h:98
@ lvt_Deployment_Diagram
Definition: umllistviewitem.h:73
@ lvt_Diagrams
Definition: umllistviewitem.h:71
@ lvt_Enum
Definition: umllistviewitem.h:79
@ lvt_ForeignKeyConstraint
Definition: umllistviewitem.h:90
@ lvt_UseCase_View
Definition: umllistviewitem.h:50
@ lvt_Properties
Definition: umllistviewitem.h:94
@ lvt_Logical_View
Definition: umllistviewitem.h:49
@ lvt_Component_Folder
Definition: umllistviewitem.h:68
@ lvt_Datatype_Folder
Definition: umllistviewitem.h:78
@ lvt_Properties_AutoLayout
Definition: umllistviewitem.h:95
@ lvt_Properties_CodeGeneration
Definition: umllistviewitem.h:97
@ lvt_UseCase
Definition: umllistviewitem.h:60
@ lvt_Datatype
Definition: umllistviewitem.h:77
@ lvt_Object_Diagram
Definition: umllistviewitem.h:104
@ lvt_UniqueConstraint
Definition: umllistviewitem.h:88
@ lvt_EntityRelationship_Model
Definition: umllistviewitem.h:84
@ lvt_EnumLiteral
Definition: umllistviewitem.h:87
@ lvt_Instance
Definition: umllistviewitem.h:105
@ lvt_Interface
Definition: umllistviewitem.h:65
@ lvt_Activity_Diagram
Definition: umllistviewitem.h:57
@ lvt_EntityRelationship_Folder
Definition: umllistviewitem.h:83
@ lvt_InstanceAttribute
Definition: umllistviewitem.h:106
@ lvt_Properties_Class
Definition: umllistviewitem.h:96
@ lvt_Min
Definition: umllistviewitem.h:47
@ lvt_Attribute
Definition: umllistviewitem.h:62
@ lvt_Category
Definition: umllistviewitem.h:92
@ lvt_EntityAttribute
Definition: umllistviewitem.h:81
@ lvt_Unknown
Definition: umllistviewitem.h:109
@ lvt_Model
Definition: umllistviewitem.h:86
@ lvt_Template
Definition: umllistviewitem.h:64
@ lvt_Port
Definition: umllistviewitem.h:93
@ lvt_Component_Diagram
Definition: umllistviewitem.h:67
@ lvt_UseCase_Diagram
Definition: umllistviewitem.h:53
@ lvt_Properties_General
Definition: umllistviewitem.h:101
@ lvt_Subsystem
Definition: umllistviewitem.h:85
@ lvt_Artifact
Definition: umllistviewitem.h:72
@ lvt_CheckConstraint
Definition: umllistviewitem.h:91
@ lvt_Sequence_Diagram
Definition: umllistviewitem.h:58
@ lvt_Class_Diagram
Definition: umllistviewitem.h:55
@ lvt_Package
Definition: umllistviewitem.h:66
@ lvt_Properties_CodeViewer
Definition: umllistviewitem.h:99
QPointer< UMLObject > m_object
Definition: umllistviewitem.h:181
ListViewType type() const
Definition: umllistviewitem.cpp:234
UMLListViewItem(UMLListView *parent, const QString &name, ListViewType t, UMLObject *o=0)
Definition: umllistviewitem.cpp:60
void setID(Uml::ID::Type id)
Definition: umllistviewitem.cpp:293
void init()
Definition: umllistviewitem.cpp:192
UMLListViewItem * findChildObject(UMLObject *child)
Definition: umllistviewitem.cpp:867
QMap< UMLObject *, UMLListViewItem * > ChildObjectMap
Definition: umllistviewitem.h:177
void updateObject()
Definition: umllistviewitem.cpp:347
void setVisible(bool state)
Definition: umllistviewitem.cpp:269
void setIcon(Icon_Utils::IconType iconType)
Definition: umllistviewitem.cpp:480
void addChildItem(UMLObject *child, UMLListViewItem *childItem)
Definition: umllistviewitem.cpp:242
void setOpen(bool state)
Definition: umllistviewitem.cpp:446
UMLListViewItem * findItem(Uml::ID::Type id)
Definition: umllistviewitem.cpp:884
UMLListViewItem * childItem(int i)
Definition: umllistviewitem.cpp:968
~UMLListViewItem()
Definition: umllistviewitem.cpp:185
bool isOwnParent(Uml::ID::Type listViewItemID)
Definition: umllistviewitem.cpp:329
void deleteChildItem(UMLObject *child)
Definition: umllistviewitem.cpp:254
Displays the list view for the program.
Definition: umllistview.h:48
The base class for UML objects.
Definition: umlobject.h:75
IconType
Definition: icon_utils.h:47
QString newText(UMLObject::ObjectType type)
Definition: model_utils.cpp:625
std::string Type
Definition: basictypes.h:385
QDebug operator<<(QDebug dbg, const UMLListViewItem &item)
Definition: umllistviewitem.cpp:1088
QTreeWidgetItemIterator UMLListViewItemIterator
Definition: umllistviewitem.h:27