umbrello 2.31.70-8160ef4c8
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 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 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 <QMap>
15#include <QPointer>
16#include <QTreeWidget>
17#include <QXmlStreamWriter>
18
19// forward declarations
20class UMLListView;
21class UMLObject;
23
24typedef QTreeWidgetItemIterator UMLListViewItemIterator;
25
35class UMLListViewItem : public QTreeWidgetItem
36{
37public:
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,
66 lvt_Diagrams, // currently unused
102 // enter new values above
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);
115
116 ListViewType type() const;
117
118 void setID(Uml::ID::Type id);
119 Uml::ID::Type ID() const;
120
121 void setUMLObject(UMLObject * obj);
122 UMLObject * umlObject() const;
123
124 bool isOwnParent(Uml::ID::Type listViewItemID);
125
126 void updateObject();
127 void updateFolder();
128
129 void setText(int column, const QString &text);
130 void setText(const QString &text);
131 QString getSavedText() const;
132 void setVisible(bool state);
133
134 QString toolTip() const;
135
136 void setIcon(Icon_Utils::IconType iconType);
137
139
140 void deleteChildItem(UMLObject *child);
141
142 //virtual int compare(UMLListViewItem *other, int col, bool ascending) const;
143
145
149
151
152 void saveToXMI1(QXmlStreamWriter& writer);
153 bool loadFromXMI1(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
172 typedef QMap<UMLObject*, UMLListViewItem*> ChildObjectMap;
173
176 QPointer<UMLObject> m_object;
177 QString m_label;
179
180};
181
182QDebug operator<<(QDebug dbg, const UMLListViewItem& item);
183
184#endif
A base class for classifier list items (e.g. attributes)
Definition: classifierlistitem.h:25
Items used by UMLListView.
Definition: umllistviewitem.h:36
void updateFolder()
Definition: umllistviewitem.cpp:425
UMLListViewItem * deepCopy(UMLListViewItem *newParent)
Definition: umllistviewitem.cpp:822
ListViewType m_type
Definition: umllistviewitem.h:174
void setUMLObject(UMLObject *obj)
Definition: umllistviewitem.cpp:305
QString m_label
Definition: umllistviewitem.h:177
UMLListViewItem * findUMLObject(const UMLObject *o)
Definition: umllistviewitem.cpp:844
UMLObject * umlObject() const
Definition: umllistviewitem.cpp:315
QString getSavedText() const
Definition: umllistviewitem.cpp:467
void slotEditFinished(const QString &newText)
Definition: umllistviewitem.cpp:486
ChildObjectMap m_comap
Definition: umllistviewitem.h:178
bool loadFromXMI1(QDomElement &qElement)
Definition: umllistviewitem.cpp:938
void cancelRenameWithMsg()
Definition: umllistviewitem.cpp:714
static QString toString(ListViewType type)
Definition: umllistviewitem.cpp:968
void setText(int column, const QString &text)
Definition: umllistviewitem.cpp:458
Uml::ID::Type ID() const
Definition: umllistviewitem.cpp:274
Uml::ID::Type m_id
Definition: umllistviewitem.h:175
void saveToXMI1(QXmlStreamWriter &writer)
Definition: umllistviewitem.cpp:897
QString toolTip() const
Definition: umllistviewitem.cpp:198
ListViewType
Definition: umllistviewitem.h:39
@ lvt_Logical_Folder
Definition: umllistviewitem.h:46
@ lvt_UseCase_Folder
Definition: umllistviewitem.h:47
@ lvt_Association
Definition: umllistviewitem.h:98
@ lvt_View
Definition: umllistviewitem.h:43
@ lvt_Deployment_View
Definition: umllistviewitem.h:70
@ lvt_Actor
Definition: umllistviewitem.h:54
@ lvt_State_Diagram
Definition: umllistviewitem.h:51
@ lvt_Node
Definition: umllistviewitem.h:71
@ lvt_Component_View
Definition: umllistviewitem.h:64
@ lvt_Properties_UserInterface
Definition: umllistviewitem.h:97
@ lvt_Collaboration_Diagram
Definition: umllistviewitem.h:49
@ lvt_Properties_Font
Definition: umllistviewitem.h:95
@ lvt_Deployment_Folder
Definition: umllistviewitem.h:69
@ lvt_Max
Definition: umllistviewitem.h:103
@ lvt_Operation
Definition: umllistviewitem.h:58
@ lvt_Entity
Definition: umllistviewitem.h:75
@ lvt_Class
Definition: umllistviewitem.h:56
@ lvt_EntityRelationship_Diagram
Definition: umllistviewitem.h:77
@ lvt_PrimaryKeyConstraint
Definition: umllistviewitem.h:84
@ lvt_Component
Definition: umllistviewitem.h:65
@ lvt_Properties_CodeImport
Definition: umllistviewitem.h:93
@ lvt_Deployment_Diagram
Definition: umllistviewitem.h:68
@ lvt_Diagrams
Definition: umllistviewitem.h:66
@ lvt_Enum
Definition: umllistviewitem.h:74
@ lvt_ForeignKeyConstraint
Definition: umllistviewitem.h:85
@ lvt_UseCase_View
Definition: umllistviewitem.h:45
@ lvt_Properties
Definition: umllistviewitem.h:89
@ lvt_Logical_View
Definition: umllistviewitem.h:44
@ lvt_Component_Folder
Definition: umllistviewitem.h:63
@ lvt_Datatype_Folder
Definition: umllistviewitem.h:73
@ lvt_Properties_AutoLayout
Definition: umllistviewitem.h:90
@ lvt_Properties_CodeGeneration
Definition: umllistviewitem.h:92
@ lvt_UseCase
Definition: umllistviewitem.h:55
@ lvt_Datatype
Definition: umllistviewitem.h:72
@ lvt_Object_Diagram
Definition: umllistviewitem.h:99
@ lvt_UniqueConstraint
Definition: umllistviewitem.h:83
@ lvt_EntityRelationship_Model
Definition: umllistviewitem.h:79
@ lvt_EnumLiteral
Definition: umllistviewitem.h:82
@ lvt_Instance
Definition: umllistviewitem.h:100
@ lvt_Interface
Definition: umllistviewitem.h:60
@ lvt_Activity_Diagram
Definition: umllistviewitem.h:52
@ lvt_EntityRelationship_Folder
Definition: umllistviewitem.h:78
@ lvt_InstanceAttribute
Definition: umllistviewitem.h:101
@ lvt_Properties_Class
Definition: umllistviewitem.h:91
@ lvt_Min
Definition: umllistviewitem.h:42
@ lvt_Attribute
Definition: umllistviewitem.h:57
@ lvt_Category
Definition: umllistviewitem.h:87
@ lvt_EntityAttribute
Definition: umllistviewitem.h:76
@ lvt_Unknown
Definition: umllistviewitem.h:104
@ lvt_Model
Definition: umllistviewitem.h:81
@ lvt_Template
Definition: umllistviewitem.h:59
@ lvt_Port
Definition: umllistviewitem.h:88
@ lvt_Component_Diagram
Definition: umllistviewitem.h:62
@ lvt_UseCase_Diagram
Definition: umllistviewitem.h:48
@ lvt_Properties_General
Definition: umllistviewitem.h:96
@ lvt_Subsystem
Definition: umllistviewitem.h:80
@ lvt_Artifact
Definition: umllistviewitem.h:67
@ lvt_CheckConstraint
Definition: umllistviewitem.h:86
@ lvt_Sequence_Diagram
Definition: umllistviewitem.h:53
@ lvt_Class_Diagram
Definition: umllistviewitem.h:50
@ lvt_Package
Definition: umllistviewitem.h:61
@ lvt_Properties_CodeViewer
Definition: umllistviewitem.h:94
QPointer< UMLObject > m_object
Definition: umllistviewitem.h:176
ListViewType type() const
Definition: umllistviewitem.cpp:229
UMLListViewItem(UMLListView *parent, const QString &name, ListViewType t, UMLObject *o=0)
Definition: umllistviewitem.cpp:55
void setID(Uml::ID::Type id)
Definition: umllistviewitem.cpp:288
void init()
Definition: umllistviewitem.cpp:187
UMLListViewItem * findChildObject(UMLObject *child)
Definition: umllistviewitem.cpp:862
QMap< UMLObject *, UMLListViewItem * > ChildObjectMap
Definition: umllistviewitem.h:172
void updateObject()
Definition: umllistviewitem.cpp:342
void setVisible(bool state)
Definition: umllistviewitem.cpp:264
void setIcon(Icon_Utils::IconType iconType)
Definition: umllistviewitem.cpp:475
void addChildItem(UMLObject *child, UMLListViewItem *childItem)
Definition: umllistviewitem.cpp:237
void setOpen(bool state)
Definition: umllistviewitem.cpp:441
UMLListViewItem * findItem(Uml::ID::Type id)
Definition: umllistviewitem.cpp:879
bool isOpen() const
Definition: umllistviewitem.h:155
UMLListViewItem * childItem(int i)
Definition: umllistviewitem.cpp:963
~UMLListViewItem()
Definition: umllistviewitem.cpp:180
bool isOwnParent(Uml::ID::Type listViewItemID)
Definition: umllistviewitem.cpp:324
void deleteChildItem(UMLObject *child)
Definition: umllistviewitem.cpp:249
Displays the list view for the program.
Definition: umllistview.h:43
The base class for UML objects.
Definition: umlobject.h:70
IconType
Definition: icon_utils.h:33
QString newText(UMLObject::ObjectType type)
Definition: model_utils.cpp:619
std::string Type
Definition: basictypes.h:371
QDebug operator<<(QDebug dbg, const UMLListViewItem &item)
Definition: umllistviewitem.cpp:1083
QTreeWidgetItemIterator UMLListViewItemIterator
Definition: umllistviewitem.h:22