umbrello: umbrello/umllistviewitem.h Source File

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

- Main Page
- Related Pages
- Topics
- Namespaces
- Classes
- Files

- File List
- File Members

umllistviewitem.h
Go to the documentation of this file.
1/*
2 SPDX-License-Identifier: GPL-2.0-or-later
3 SPDX-FileCopyrightText: 2002-2022 Umbrello UML Modeller Authors <umbrello-devel@kde.org>
4*/
5
6#ifndef UMLLISTVIEWITEM_H
7#define UMLLISTVIEWITEM_H
8
9#include "basictypes.h"
10#include "icon_utils.h"
11
12#include <QDomDocument>
13#include <QDomElement>
14#include <QHash>
15#include <QPointer>
16#include <QTreeWidget>
17#include <QXmlStreamWriter>
18
19// forward declarations
20class UMLListView;
21class UMLObject;
22class UMLClassifierListItem;
23
24 typedef QTreeWidgetItemIterator UMLListViewItemIterator;
25
35 class UMLListViewItem : public QTreeWidgetItem
36{
37public:
38 enum ListViewType
39 {
40 //the values in this enum are saved out to the file
41 //for file compatibility, only add new values to the end
42 lvt_Min = 799,
43 lvt_View = 800,
44 lvt_Logical_View,
45 lvt_UseCase_View,
46 lvt_Logical_Folder,
47 lvt_UseCase_Folder,
48 lvt_UseCase_Diagram,
49 lvt_Collaboration_Diagram,
50 lvt_Class_Diagram,
51 lvt_State_Diagram,
52 lvt_Activity_Diagram,
53 lvt_Sequence_Diagram,
54 lvt_Actor,
55 lvt_UseCase,
56 lvt_Class,
57 lvt_Attribute,
58 lvt_Operation,
59 lvt_Template,
60 lvt_Interface,
61 lvt_Package,
62 lvt_Component_Diagram,
63 lvt_Component_Folder,
64 lvt_Component_View,
65 lvt_Component,
66 lvt_Diagrams, // currently unused
67 lvt_Artifact,
68 lvt_Deployment_Diagram,
69 lvt_Deployment_Folder,
70 lvt_Deployment_View,
71 lvt_Node,
72 lvt_Datatype,
73 lvt_Datatype_Folder,
74 lvt_Enum,
75 lvt_Entity,
76 lvt_EntityAttribute,
77 lvt_EntityRelationship_Diagram,
78 lvt_EntityRelationship_Folder,
79 lvt_EntityRelationship_Model,
80 lvt_Subsystem,
81 lvt_Model,
82 lvt_EnumLiteral,
83 lvt_UniqueConstraint,
84 lvt_PrimaryKeyConstraint,
85 lvt_ForeignKeyConstraint,
86 lvt_CheckConstraint,
87 lvt_Category,
88 lvt_Port,
89 lvt_Properties,
90 lvt_Properties_AutoLayout,
91 lvt_Properties_Class,
92 lvt_Properties_CodeGeneration,
93 lvt_Properties_CodeImport,
94 lvt_Properties_CodeViewer,
95 lvt_Properties_Font,
96 lvt_Properties_General,
97 lvt_Properties_UserInterface,
98 lvt_Association,
99 lvt_Object_Diagram,
100 lvt_Instance,
101 lvt_InstanceAttribute,
102 // enter new values above
103 lvt_Max,
104 lvt_Unknown = -1
105 };
106
107 static QString toString(ListViewType type);
108
109 UMLListViewItem(UMLListView * parent, const QString &name, ListViewType t, UMLObject* o = 0);
110 explicit UMLListViewItem(UMLListView * parent);
111 explicit UMLListViewItem(UMLListViewItem * parent);
112 UMLListViewItem(UMLListViewItem * parent, const QString &name, ListViewType t, UMLObject* o = 0);
113 UMLListViewItem(UMLListViewItem * parent, const QString &name, ListViewType t, Uml::ID::Type id);
114
115 ListViewType type() const;
116
117 void setID(Uml::ID::Type id);
118 Uml::ID::Type ID() const;
119
120 void setUMLObject(UMLObject * obj);
121 UMLObject * umlObject() const;
122
123 bool isOwnParent(Uml::ID::Type listViewItemID);
124
125 void updateObject();
126 void updateFolder();
127
128 void setText(int column, const QString &text);
129 void setText(const QString &text);
130 QString getSavedText() const;
131 void setVisible(bool state);
132
133 QString toolTip() const;
134
135 void setIcon(Icon_Utils::IconType iconType);
136
137 void addChildItem(UMLObject *child, UMLListViewItem *childItem);
138
139 void deleteChildItem(UMLObject *child);
140 static void deleteItem(UMLListViewItem *childItem);
141
142 //virtual int compare(UMLListViewItem *other, int col, bool ascending) const;
143
144 UMLListViewItem* deepCopy(UMLListViewItem *newParent);
145
146 UMLListViewItem* findUMLObject(const UMLObject *o);
147 UMLListViewItem* findChildObject(const UMLObject *child);
148 UMLListViewItem* findItem(Uml::ID::Type id);
149
150 UMLListViewItem* childItem(int i);
151
152 void saveToXMI(QXmlStreamWriter& writer);
153 bool loadFromXMI(QDomElement& qElement);
154
155 bool isOpen() const { return isExpanded(); }
156 void setOpen(bool state);
157
158public slots:
159 void slotEditFinished(const QString &newText);
160
161protected:
162 void init();
163
164 void cancelRenameWithMsg();
165
166 UMLListViewItem* findUMLObject_r(const UMLObject *o);
167
174 typedef QHash<const UMLObject*, UMLListViewItem*> ChildObjectMap;
175
176 ListViewType m_type;
177 Uml::ID::Type m_id;
178 QPointer<UMLObject> m_object;
179 QString m_label;
180 static ChildObjectMap *s_comap;
181
182};
183
184QDebug operator<<(QDebug dbg, const UMLListViewItem& item);
185
186#endif
basictypes.h
UMLClassifierListItem
A base class for classifier list items (e.g. attributes)
Definition classifierlistitem.h:25
UMLListViewItem
Items used by UMLListView.
Definition umllistviewitem.h:36
UMLListViewItem::updateFolder
void updateFolder()
Definition umllistviewitem.cpp:440
UMLListViewItem::deepCopy
UMLListViewItem * deepCopy(UMLListViewItem *newParent)
Definition umllistviewitem.cpp:839
UMLListViewItem::m_type
ListViewType m_type
Definition umllistviewitem.h:176
UMLListViewItem::setUMLObject
void setUMLObject(UMLObject *obj)
Definition umllistviewitem.cpp:319
UMLListViewItem::m_label
QString m_label
Definition umllistviewitem.h:179
UMLListViewItem::findUMLObject
UMLListViewItem * findUMLObject(const UMLObject *o)
Definition umllistviewitem.cpp:863
UMLListViewItem::s_comap
static ChildObjectMap * s_comap
Definition umllistviewitem.h:180
UMLListViewItem::umlObject
UMLObject * umlObject() const
Definition umllistviewitem.cpp:329
UMLListViewItem::getSavedText
QString getSavedText() const
Definition umllistviewitem.cpp:482
UMLListViewItem::slotEditFinished
void slotEditFinished(const QString &newText)
Definition umllistviewitem.cpp:501
UMLListViewItem::cancelRenameWithMsg
void cancelRenameWithMsg()
Definition umllistviewitem.cpp:730
UMLListViewItem::toString
static QString toString(ListViewType type)
Definition umllistviewitem.cpp:1013
UMLListViewItem::setText
void setText(int column, const QString &text)
Definition umllistviewitem.cpp:473
UMLListViewItem::ID
Uml::ID::Type ID() const
Definition umllistviewitem.cpp:288
UMLListViewItem::m_id
Uml::ID::Type m_id
Definition umllistviewitem.h:177
UMLListViewItem::toolTip
QString toolTip() const
Definition umllistviewitem.cpp:196
UMLListViewItem::ListViewType
ListViewType
Definition umllistviewitem.h:39
UMLListViewItem::lvt_Logical_Folder
@ lvt_Logical_Folder
Definition umllistviewitem.h:46
UMLListViewItem::lvt_UseCase_Folder
@ lvt_UseCase_Folder
Definition umllistviewitem.h:47
UMLListViewItem::lvt_Association
@ lvt_Association
Definition umllistviewitem.h:98
UMLListViewItem::lvt_View
@ lvt_View
Definition umllistviewitem.h:43
UMLListViewItem::lvt_Deployment_View
@ lvt_Deployment_View
Definition umllistviewitem.h:70
UMLListViewItem::lvt_Actor
@ lvt_Actor
Definition umllistviewitem.h:54
UMLListViewItem::lvt_State_Diagram
@ lvt_State_Diagram
Definition umllistviewitem.h:51
UMLListViewItem::lvt_Node
@ lvt_Node
Definition umllistviewitem.h:71
UMLListViewItem::lvt_Component_View
@ lvt_Component_View
Definition umllistviewitem.h:64
UMLListViewItem::lvt_Properties_UserInterface
@ lvt_Properties_UserInterface
Definition umllistviewitem.h:97
UMLListViewItem::lvt_Collaboration_Diagram
@ lvt_Collaboration_Diagram
Definition umllistviewitem.h:49
UMLListViewItem::lvt_Properties_Font
@ lvt_Properties_Font
Definition umllistviewitem.h:95
UMLListViewItem::lvt_Deployment_Folder
@ lvt_Deployment_Folder
Definition umllistviewitem.h:69
UMLListViewItem::lvt_Max
@ lvt_Max
Definition umllistviewitem.h:103
UMLListViewItem::lvt_Operation
@ lvt_Operation
Definition umllistviewitem.h:58
UMLListViewItem::lvt_Entity
@ lvt_Entity
Definition umllistviewitem.h:75
UMLListViewItem::lvt_Class
@ lvt_Class
Definition umllistviewitem.h:56
UMLListViewItem::lvt_EntityRelationship_Diagram
@ lvt_EntityRelationship_Diagram
Definition umllistviewitem.h:77
UMLListViewItem::lvt_PrimaryKeyConstraint
@ lvt_PrimaryKeyConstraint
Definition umllistviewitem.h:84
UMLListViewItem::lvt_Component
@ lvt_Component
Definition umllistviewitem.h:65
UMLListViewItem::lvt_Properties_CodeImport
@ lvt_Properties_CodeImport
Definition umllistviewitem.h:93
UMLListViewItem::lvt_Deployment_Diagram
@ lvt_Deployment_Diagram
Definition umllistviewitem.h:68
UMLListViewItem::lvt_Diagrams
@ lvt_Diagrams
Definition umllistviewitem.h:66
UMLListViewItem::lvt_Enum
@ lvt_Enum
Definition umllistviewitem.h:74
UMLListViewItem::lvt_ForeignKeyConstraint
@ lvt_ForeignKeyConstraint
Definition umllistviewitem.h:85
UMLListViewItem::lvt_UseCase_View
@ lvt_UseCase_View
Definition umllistviewitem.h:45
UMLListViewItem::lvt_Properties
@ lvt_Properties
Definition umllistviewitem.h:89
UMLListViewItem::lvt_Logical_View
@ lvt_Logical_View
Definition umllistviewitem.h:44
UMLListViewItem::lvt_Component_Folder
@ lvt_Component_Folder
Definition umllistviewitem.h:63
UMLListViewItem::lvt_Datatype_Folder
@ lvt_Datatype_Folder
Definition umllistviewitem.h:73
UMLListViewItem::lvt_Properties_AutoLayout
@ lvt_Properties_AutoLayout
Definition umllistviewitem.h:90
UMLListViewItem::lvt_Properties_CodeGeneration
@ lvt_Properties_CodeGeneration
Definition umllistviewitem.h:92
UMLListViewItem::lvt_UseCase
@ lvt_UseCase
Definition umllistviewitem.h:55
UMLListViewItem::lvt_Datatype
@ lvt_Datatype
Definition umllistviewitem.h:72
UMLListViewItem::lvt_Object_Diagram
@ lvt_Object_Diagram
Definition umllistviewitem.h:99
UMLListViewItem::lvt_UniqueConstraint
@ lvt_UniqueConstraint
Definition umllistviewitem.h:83
UMLListViewItem::lvt_EntityRelationship_Model
@ lvt_EntityRelationship_Model
Definition umllistviewitem.h:79
UMLListViewItem::lvt_EnumLiteral
@ lvt_EnumLiteral
Definition umllistviewitem.h:82
UMLListViewItem::lvt_Instance
@ lvt_Instance
Definition umllistviewitem.h:100
UMLListViewItem::lvt_Interface
@ lvt_Interface
Definition umllistviewitem.h:60
UMLListViewItem::lvt_Activity_Diagram
@ lvt_Activity_Diagram
Definition umllistviewitem.h:52
UMLListViewItem::lvt_EntityRelationship_Folder
@ lvt_EntityRelationship_Folder
Definition umllistviewitem.h:78
UMLListViewItem::lvt_InstanceAttribute
@ lvt_InstanceAttribute
Definition umllistviewitem.h:101
UMLListViewItem::lvt_Properties_Class
@ lvt_Properties_Class
Definition umllistviewitem.h:91
UMLListViewItem::lvt_Min
@ lvt_Min
Definition umllistviewitem.h:42
UMLListViewItem::lvt_Attribute
@ lvt_Attribute
Definition umllistviewitem.h:57
UMLListViewItem::lvt_Category
@ lvt_Category
Definition umllistviewitem.h:87
UMLListViewItem::lvt_EntityAttribute
@ lvt_EntityAttribute
Definition umllistviewitem.h:76
UMLListViewItem::lvt_Unknown
@ lvt_Unknown
Definition umllistviewitem.h:104
UMLListViewItem::lvt_Model
@ lvt_Model
Definition umllistviewitem.h:81
UMLListViewItem::lvt_Template
@ lvt_Template
Definition umllistviewitem.h:59
UMLListViewItem::lvt_Port
@ lvt_Port
Definition umllistviewitem.h:88
UMLListViewItem::lvt_Component_Diagram
@ lvt_Component_Diagram
Definition umllistviewitem.h:62
UMLListViewItem::lvt_UseCase_Diagram
@ lvt_UseCase_Diagram
Definition umllistviewitem.h:48
UMLListViewItem::lvt_Properties_General
@ lvt_Properties_General
Definition umllistviewitem.h:96
UMLListViewItem::lvt_Subsystem
@ lvt_Subsystem
Definition umllistviewitem.h:80
UMLListViewItem::lvt_Artifact
@ lvt_Artifact
Definition umllistviewitem.h:67
UMLListViewItem::lvt_CheckConstraint
@ lvt_CheckConstraint
Definition umllistviewitem.h:86
UMLListViewItem::lvt_Sequence_Diagram
@ lvt_Sequence_Diagram
Definition umllistviewitem.h:53
UMLListViewItem::lvt_Class_Diagram
@ lvt_Class_Diagram
Definition umllistviewitem.h:50
UMLListViewItem::lvt_Package
@ lvt_Package
Definition umllistviewitem.h:61
UMLListViewItem::lvt_Properties_CodeViewer
@ lvt_Properties_CodeViewer
Definition umllistviewitem.h:94
UMLListViewItem::m_object
QPointer< UMLObject > m_object
Definition umllistviewitem.h:178
UMLListViewItem::type
ListViewType type() const
Definition umllistviewitem.cpp:227
UMLListViewItem::UMLListViewItem
UMLListViewItem(UMLListView *parent, const QString &name, ListViewType t, UMLObject *o=0)
Definition umllistviewitem.cpp:58
UMLListViewItem::setID
void setID(Uml::ID::Type id)
Definition umllistviewitem.cpp:302
UMLListViewItem::saveToXMI
void saveToXMI(QXmlStreamWriter &writer)
Definition umllistviewitem.cpp:941
UMLListViewItem::init
void init()
Definition umllistviewitem.cpp:183
UMLListViewItem::findChildObject
UMLListViewItem * findChildObject(const UMLObject *child)
Definition umllistviewitem.cpp:906
UMLListViewItem::updateObject
void updateObject()
Definition umllistviewitem.cpp:357
UMLListViewItem::setVisible
void setVisible(bool state)
Definition umllistviewitem.cpp:278
UMLListViewItem::deleteItem
static void deleteItem(UMLListViewItem *childItem)
Definition umllistviewitem.cpp:268
UMLListViewItem::setIcon
void setIcon(Icon_Utils::IconType iconType)
Definition umllistviewitem.cpp:490
UMLListViewItem::addChildItem
void addChildItem(UMLObject *child, UMLListViewItem *childItem)
Definition umllistviewitem.cpp:237
UMLListViewItem::findUMLObject_r
UMLListViewItem * findUMLObject_r(const UMLObject *o)
Definition umllistviewitem.cpp:883
UMLListViewItem::ChildObjectMap
QHash< const UMLObject *, UMLListViewItem * > ChildObjectMap
Definition umllistviewitem.h:174
UMLListViewItem::setOpen
void setOpen(bool state)
Definition umllistviewitem.cpp:456
UMLListViewItem::loadFromXMI
bool loadFromXMI(QDomElement &qElement)
Definition umllistviewitem.cpp:983
UMLListViewItem::findItem
UMLListViewItem * findItem(Uml::ID::Type id)
Definition umllistviewitem.cpp:923
UMLListViewItem::isOpen
bool isOpen() const
Definition umllistviewitem.h:155
UMLListViewItem::childItem
UMLListViewItem * childItem(int i)
Definition umllistviewitem.cpp:1008
UMLListViewItem::isOwnParent
bool isOwnParent(Uml::ID::Type listViewItemID)
Definition umllistviewitem.cpp:338
UMLListViewItem::deleteChildItem
void deleteChildItem(UMLObject *child)
Definition umllistviewitem.cpp:249
UMLListView
Displays the list view for the program.
Definition umllistview.h:43
UMLObject
The base class for UML objects.
Definition umlobject.h:70
icon_utils.h
Icon_Utils::IconType
IconType
Definition icon_utils.h:25
Uml::ID::Type
std::string Type
Definition basictypes.h:371
operator<<
QDebug operator<<(QDebug dbg, const UMLListViewItem &item)
Definition umllistviewitem.cpp:1128
UMLListViewItemIterator
QTreeWidgetItemIterator UMLListViewItemIterator
Definition umllistviewitem.h:24